mirror of
https://github.com/demodude4u/Factorio-FBSR.git
synced 2024-11-24 08:12:21 +02:00
Factorio 1.1: Added linked belt
This commit is contained in:
parent
dd704fb963
commit
1e1de3cf12
@ -57,6 +57,7 @@ import com.demod.fbsr.entity.InserterRendering;
|
||||
import com.demod.fbsr.entity.LabRendering;
|
||||
import com.demod.fbsr.entity.LampRendering;
|
||||
import com.demod.fbsr.entity.LandMineRendering;
|
||||
import com.demod.fbsr.entity.LinkedBeltRendering;
|
||||
import com.demod.fbsr.entity.LinkedContainerRendering;
|
||||
import com.demod.fbsr.entity.LoaderRendering;
|
||||
import com.demod.fbsr.entity.LogisticContainerRendering;
|
||||
@ -188,6 +189,7 @@ public class EntityRendererFactory {
|
||||
byType.put("loader-1x1", new LoaderRendering());
|
||||
byType.put("locomotive", new RollingStockRendering());
|
||||
byType.put("logistic-container", new LogisticContainerRendering());
|
||||
byType.put("linked-belt", new LinkedBeltRendering());
|
||||
byType.put("linked-container", new LinkedContainerRendering());
|
||||
byType.put("mining-drill", new MiningDrillRendering());
|
||||
byType.put("offshore-pump", new OffshorePumpRendering());
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.demod.fbsr.entity;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.demod.factorio.DataTable;
|
||||
import com.demod.factorio.prototype.EntityPrototype;
|
||||
import com.demod.fbsr.BlueprintEntity;
|
||||
import com.demod.fbsr.Direction;
|
||||
import com.demod.fbsr.EntityRendererFactory;
|
||||
import com.demod.fbsr.RenderUtils;
|
||||
import com.demod.fbsr.Renderer;
|
||||
import com.demod.fbsr.Renderer.Layer;
|
||||
import com.demod.fbsr.Sprite;
|
||||
import com.demod.fbsr.WorldMap;
|
||||
import com.demod.fbsr.WorldMap.BeltBend;
|
||||
|
||||
public class LinkedBeltRendering extends EntityRendererFactory {
|
||||
@Override
|
||||
public void createRenderers(Consumer<Renderer> register, WorldMap map, DataTable dataTable, BlueprintEntity entity,
|
||||
EntityPrototype prototype) {
|
||||
boolean input = entity.json().getString("type").equals("input");
|
||||
Direction structDir = input ? entity.getDirection() : entity.getDirection().back();
|
||||
|
||||
Sprite beltSprite = TransportBeltRendering.getBeltSprite(prototype, entity.getDirection(), BeltBend.NONE);
|
||||
|
||||
Sprite sprite = RenderUtils.getSpriteFromAnimation(
|
||||
prototype.lua().get("structure").get(input ? "direction_in" : "direction_out").get("sheet"));
|
||||
sprite.source.x += sprite.source.width * (structDir.cardinal());
|
||||
|
||||
register.accept(RenderUtils.spriteRenderer(Layer.ENTITY, beltSprite, entity, prototype));
|
||||
register.accept(RenderUtils.spriteRenderer(Layer.ENTITY2, sprite, entity, prototype));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user