Merge branch '6.0' of https://github.com/Anuken/Mindustry into object-config
# Conflicts: # core/src/mindustry/entities/traits/BuilderTrait.java # core/src/mindustry/entities/type/TileEntity.java # core/src/mindustry/game/EventType.java # core/src/mindustry/game/Schematics.java # core/src/mindustry/input/InputHandler.java # core/src/mindustry/io/TypeIO.java # core/src/mindustry/world/Block.java # core/src/mindustry/world/blocks/distribution/Sorter.java
This commit is contained in:
@@ -232,10 +232,14 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc{
|
|||||||
return proximity;
|
return proximity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tile configuration. Defaults to 0. Used for block rebuilding. */
|
/** Tile configuration. Defaults to null. Used for block rebuilding. */
|
||||||
@Override
|
public Object config(){
|
||||||
public int config(){
|
return null;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
/** Sets the config object and casts it. Does nothing by default. */
|
||||||
|
public void setConfig(Object config){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class BuildRequest{
|
|||||||
/** Whether this request comes with a config int. If yes, any blocks placed with this request will not call playerPlaced.*/
|
/** Whether this request comes with a config int. If yes, any blocks placed with this request will not call playerPlaced.*/
|
||||||
public boolean hasConfig;
|
public boolean hasConfig;
|
||||||
/** Config int. Not used unless hasConfig is true.*/
|
/** Config int. Not used unless hasConfig is true.*/
|
||||||
public int config;
|
public Object config;
|
||||||
/** Original position, only used in schematics.*/
|
/** Original position, only used in schematics.*/
|
||||||
public int originalX, originalY, originalWidth, originalHeight;
|
public int originalX, originalY, originalWidth, originalHeight;
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ public class BuildRequest{
|
|||||||
return y*tilesize + block.offset();
|
return y*tilesize + block.offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildRequest configure(int config){
|
public BuildRequest configure(Object config){
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.hasConfig = true;
|
this.hasConfig = true;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -116,10 +116,10 @@ public class Schematic implements Publishable, Comparable<Schematic>{
|
|||||||
public static class Stile{
|
public static class Stile{
|
||||||
public @NonNull Block block;
|
public @NonNull Block block;
|
||||||
public short x, y;
|
public short x, y;
|
||||||
public int config;
|
public Object config;
|
||||||
public byte rotation;
|
public byte rotation;
|
||||||
|
|
||||||
public Stile(Block block, int x, int y, int config, byte rotation){
|
public Stile(Block block, int x, int y, Object config, byte rotation){
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.x = (short)x;
|
this.x = (short)x;
|
||||||
this.y = (short)y;
|
this.y = (short)y;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.graphics.gl.*;
|
import arc.graphics.gl.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
|
import arc.util.io.*;
|
||||||
import arc.util.io.Streams.*;
|
import arc.util.io.Streams.*;
|
||||||
import arc.util.serialization.*;
|
import arc.util.serialization.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
@@ -20,6 +21,7 @@ import mindustry.game.EventType.*;
|
|||||||
import mindustry.game.Schematic.*;
|
import mindustry.game.Schematic.*;
|
||||||
import mindustry.input.*;
|
import mindustry.input.*;
|
||||||
import mindustry.input.Placement.*;
|
import mindustry.input.Placement.*;
|
||||||
|
import mindustry.io.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.blocks.production.*;
|
import mindustry.world.blocks.production.*;
|
||||||
@@ -35,7 +37,7 @@ public class Schematics implements Loadable{
|
|||||||
public static final String base64Header = "bXNjaAB";
|
public static final String base64Header = "bXNjaAB";
|
||||||
|
|
||||||
private static final byte[] header = {'m', 's', 'c', 'h'};
|
private static final byte[] header = {'m', 's', 'c', 'h'};
|
||||||
private static final byte version = 0;
|
private static final byte version = 1;
|
||||||
|
|
||||||
private static final int padding = 2;
|
private static final int padding = 2;
|
||||||
private static final int maxPreviewsMobile = 32;
|
private static final int maxPreviewsMobile = 32;
|
||||||
@@ -259,8 +261,8 @@ public class Schematics implements Loadable{
|
|||||||
|
|
||||||
tile.set(st.block, state.rules.defaultTeam);
|
tile.set(st.block, state.rules.defaultTeam);
|
||||||
tile.rotation(st.rotation);
|
tile.rotation(st.rotation);
|
||||||
if(st.block.posConfig){
|
if(st.config instanceof Point2){
|
||||||
tile.configureAny(Pos.get(tile.x - st.x + Pos.x(st.config), tile.y - st.y + Pos.y(st.config)));
|
tile.configureAny(Pos.get(tile.x - st.x + ((Point2)st.config).x, tile.y - st.y + ((Point2)st.config).y));
|
||||||
}else{
|
}else{
|
||||||
tile.configureAny(st.config);
|
tile.configureAny(st.config);
|
||||||
}
|
}
|
||||||
@@ -348,7 +350,7 @@ public class Schematics implements Loadable{
|
|||||||
&& (tile.entity.block().isVisible() || (tile.entity.block() instanceof CoreBlock && Core.settings.getBool("coreselect")))){
|
&& (tile.entity.block().isVisible() || (tile.entity.block() instanceof CoreBlock && Core.settings.getBool("coreselect")))){
|
||||||
Object config = tile.entity.config();
|
Object config = tile.entity.config();
|
||||||
if(config instanceof Point2){
|
if(config instanceof Point2){
|
||||||
config = Pos.get(Pos.x(config) + offsetX, Pos.y(config) + offsetY);
|
config = Pos.get(((Point2)config).x + offsetX, ((Point2)config).y + offsetY);
|
||||||
}
|
}
|
||||||
|
|
||||||
tiles.add(new Stile(tile.block(), tile.x + offsetX, tile.y + offsetY, config, tile.rotation()));
|
tiles.add(new Stile(tile.block(), tile.x + offsetX, tile.y + offsetY, config, tile.rotation()));
|
||||||
@@ -398,10 +400,7 @@ public class Schematics implements Loadable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ver;
|
int ver = input.read();
|
||||||
if((ver = input.read()) != version){
|
|
||||||
throw new IOException("Unknown version: " + ver);
|
|
||||||
}
|
|
||||||
|
|
||||||
try(DataInputStream stream = new DataInputStream(new InflaterInputStream(input))){
|
try(DataInputStream stream = new DataInputStream(new InflaterInputStream(input))){
|
||||||
short width = stream.readShort(), height = stream.readShort();
|
short width = stream.readShort(), height = stream.readShort();
|
||||||
@@ -424,7 +423,7 @@ public class Schematics implements Loadable{
|
|||||||
for(int i = 0; i < total; i++){
|
for(int i = 0; i < total; i++){
|
||||||
Block block = blocks.get(stream.readByte());
|
Block block = blocks.get(stream.readByte());
|
||||||
int position = stream.readInt();
|
int position = stream.readInt();
|
||||||
int config = stream.readInt();
|
Object config = ver == 0 ? stream.readInt() : TypeIO.readObject(Reads.get(stream));
|
||||||
byte rotation = stream.readByte();
|
byte rotation = stream.readByte();
|
||||||
if(block != Blocks.air){
|
if(block != Blocks.air){
|
||||||
tiles.add(new Stile(block, Pos.x(position), Pos.y(position), config, rotation));
|
tiles.add(new Stile(block, Pos.x(position), Pos.y(position), config, rotation));
|
||||||
@@ -468,7 +467,7 @@ public class Schematics implements Loadable{
|
|||||||
for(Stile tile : schematic.tiles){
|
for(Stile tile : schematic.tiles){
|
||||||
stream.writeByte(blocks.orderedItems().indexOf(tile.block));
|
stream.writeByte(blocks.orderedItems().indexOf(tile.block));
|
||||||
stream.writeInt(Pos.get(tile.x, tile.y));
|
stream.writeInt(Pos.get(tile.x, tile.y));
|
||||||
stream.writeInt(tile.config);
|
TypeIO.writeObject(Writes.get(stream), tile.config);
|
||||||
stream.writeByte(tile.rotation);
|
stream.writeByte(tile.rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,15 +159,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
|
||||||
public static void onTileTapped(Playerc player, Tile tile){
|
|
||||||
if(tile == null || player == null) return;
|
|
||||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
|
||||||
!netServer.admins.allowAction(player, ActionType.tapTile, tile, action -> {}))) throw new ValidateException(player, "Player cannot tap a tile.");
|
|
||||||
tile.block().tapped(tile, player);
|
|
||||||
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||||
public static void onTileConfig(Playerc player, Tile tile, @Nullable Object value){
|
public static void onTileConfig(Playerc player, Tile tile, @Nullable Object value){
|
||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
@@ -318,13 +309,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
|
|
||||||
if(req.config instanceof Point2){
|
if(req.config instanceof Point2){
|
||||||
int corigin = x ? req.originalWidth/2 : req.originalHeight/2;
|
int corigin = x ? req.originalWidth/2 : req.originalHeight/2;
|
||||||
int nvalue = -((x ? Pos.x(req.config) : Pos.y(req.config)) - corigin) + corigin;
|
int nvalue = -((x ? ((Point2)req.config).x : ((Point2)req.config).y) - corigin) + corigin;
|
||||||
if(x){
|
if(x){
|
||||||
req.originalX = -(req.originalX - corigin) + corigin;
|
req.originalX = -(req.originalX - corigin) + corigin;
|
||||||
req.config = Pos.get(nvalue, Pos.y(req.config));
|
req.config = Pos.get(nvalue, ((Point2)req.config).y);
|
||||||
}else{
|
}else{
|
||||||
req.originalY = -(req.originalY - corigin) + corigin;
|
req.originalY = -(req.originalY - corigin) + corigin;
|
||||||
req.config = Pos.get(Pos.x(req.config), nvalue);
|
req.config = Pos.get(((Point2)req.config).x, nvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,8 +450,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
for(BuildRequest req : requests){
|
for(BuildRequest req : requests){
|
||||||
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
|
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
|
||||||
BuildRequest copy = req.copy();
|
BuildRequest copy = req.copy();
|
||||||
if(copy.hasConfig && copy.block.posConfig){
|
if(copy.hasConfig && copy.config instanceof Point2){
|
||||||
copy.config = Pos.get(Pos.x(copy.config) + copy.x - copy.originalX, Pos.y(copy.config) + copy.y - copy.originalY);
|
copy.config = Pos.get(((Point2)copy.config).x + copy.x - copy.originalX, ((Point2)copy.config).x + copy.y - copy.originalY);
|
||||||
}
|
}
|
||||||
player.builder().addBuild(copy);
|
player.builder().addBuild(copy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
BuildRequest other = getRequest(request.x, request.y, request.block.size, null);
|
BuildRequest other = getRequest(request.x, request.y, request.block.size, null);
|
||||||
BuildRequest copy = request.copy();
|
BuildRequest copy = request.copy();
|
||||||
|
|
||||||
if(copy.hasConfig && copy.block.posConfig){
|
if(copy.hasConfig && copy.config instanceof Point2){
|
||||||
copy.config = Pos.get(Pos.x(copy.config) + copy.x - copy.originalX, Pos.y(copy.config) + copy.y - copy.originalY);
|
copy.config = Pos.get(((Point2)copy.config).x + copy.x - copy.originalX, ((Point2)copy.config).y + copy.y - copy.originalY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(other == null){
|
if(other == null){
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
stream.writeShort(block.y);
|
stream.writeShort(block.y);
|
||||||
stream.writeShort(block.rotation);
|
stream.writeShort(block.rotation);
|
||||||
stream.writeShort(block.block);
|
stream.writeShort(block.block);
|
||||||
stream.writeInt(block.config);
|
TypeIO.writeObject(Writes.get(stream), block.config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
TeamData data = team.data();
|
TeamData data = team.data();
|
||||||
int blocks = stream.readInt();
|
int blocks = stream.readInt();
|
||||||
for(int j = 0; j < blocks; j++){
|
for(int j = 0; j < blocks; j++){
|
||||||
data.brokenBlocks.addLast(new BrokenBlock(stream.readShort(), stream.readShort(), stream.readShort(), content.block(stream.readShort()).id, stream.readInt()));
|
data.brokenBlocks.addLast(new BrokenBlock(stream.readShort(), stream.readShort(), stream.readShort(), content.block(stream.readShort()).id, TypeIO.readObject(Reads.get(stream))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class TypeIO{
|
|||||||
write.s(request.block.id);
|
write.s(request.block.id);
|
||||||
write.b((byte)request.rotation);
|
write.b((byte)request.rotation);
|
||||||
write.b(request.hasConfig ? (byte)1 : 0);
|
write.b(request.hasConfig ? (byte)1 : 0);
|
||||||
write.i(request.config);
|
writeObject(write, request.config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ public class TypeIO{
|
|||||||
short block = read.s();
|
short block = read.s();
|
||||||
byte rotation = read.b();
|
byte rotation = read.b();
|
||||||
boolean hasConfig = read.b() == 1;
|
boolean hasConfig = read.b() == 1;
|
||||||
int config = read.i();
|
Object config = readObject(read);
|
||||||
currentRequest = new BuildRequest(Pos.x(position), Pos.y(position), rotation, content.block(block));
|
currentRequest = new BuildRequest(Pos.x(position), Pos.y(position), rotation, content.block(block));
|
||||||
if(hasConfig){
|
if(hasConfig){
|
||||||
currentRequest.configure(config);
|
currentRequest.configure(config);
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ public class Administration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ActionType{
|
public enum ActionType{
|
||||||
breakBlock, placeBlock, rotate, configure, withdrawItem, depositItem
|
breakBlock, placeBlock, rotate, configure, tapTile, withdrawItem, depositItem
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,9 +477,10 @@ public class Block extends BlockStorage{
|
|||||||
/** Called when arbitrary configuration is applied to a tile. */
|
/** Called when arbitrary configuration is applied to a tile. */
|
||||||
public void configured(Tile tile, @Nullable Playerc player, @Nullable Object value){
|
public void configured(Tile tile, @Nullable Playerc player, @Nullable Object value){
|
||||||
if(value == null){
|
if(value == null){
|
||||||
tapped(tile, player);
|
//TODO
|
||||||
|
//tapped(tile, player);
|
||||||
}else if(configurations.containsKey(value.getClass())){
|
}else if(configurations.containsKey(value.getClass())){
|
||||||
configurations.get(value.getClass()).configured(tile, player, value);
|
configurations.get(value.getClass()).configured(tile, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +930,7 @@ public class Block extends BlockStorage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface ConfigHandler<T>{
|
public interface ConfigHandler<T>{
|
||||||
void configured(Tile tile, Player player, T value);
|
void configured(Tile tile, T value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,17 +37,13 @@ public class ItemBridge extends Block{
|
|||||||
layer = Layer.power;
|
layer = Layer.power;
|
||||||
expanded = true;
|
expanded = true;
|
||||||
itemCapacity = 10;
|
itemCapacity = 10;
|
||||||
posConfig = true;
|
|
||||||
configurable = true;
|
configurable = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
entityType = ItemBridgeEntity::new;
|
entityType = ItemBridgeEntity::new;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
config(Integer.class, (tile, i) -> tile.<ItemBridgeEntity>ent().link = i);
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
|
||||||
tile.<ItemBridgeEntity>ent().link = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -371,7 +367,7 @@ public class ItemBridge extends Block{
|
|||||||
public float cycleSpeed = 1f;
|
public float cycleSpeed = 1f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int config(){
|
public Object config(){
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class MassDriver extends Block{
|
|||||||
super(name);
|
super(name);
|
||||||
update = true;
|
update = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
posConfig = true;
|
|
||||||
configurable = true;
|
configurable = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
layer = Layer.turret;
|
layer = Layer.turret;
|
||||||
@@ -46,7 +45,7 @@ public class MassDriver extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
tile.<MassDriverEntity>ent().link = value;
|
tile.<MassDriverEntity>ent().link = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public class Sorter extends Block{
|
|||||||
configurable = true;
|
configurable = true;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
entityType = SorterEntity::new;
|
entityType = SorterEntity::new;
|
||||||
config(Item.class, (tile, player, item) -> tile.<SorterEntity>ent().sortItem = item);
|
|
||||||
|
config(Item.class, (tile, item) -> tile.<SorterEntity>ent().sortItem = item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,8 +47,8 @@ public class Sorter extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
tile.<SorterEntity>ent().sortItem = content.item(value);
|
tile.<SorterEntity>ent().sortItem = (Item)value;
|
||||||
if(!headless){
|
if(!headless){
|
||||||
renderer.minimap.update(tile);
|
renderer.minimap.update(tile);
|
||||||
}
|
}
|
||||||
@@ -148,7 +149,7 @@ public class Sorter extends Block{
|
|||||||
@Nullable Item sortItem;
|
@Nullable Item sortItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item config(){
|
public Object config(){
|
||||||
return sortItem;
|
return sortItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class LightBlock extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
tile.<LightEntity>ent().color = value;
|
tile.<LightEntity>ent().color = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
Tilec entity = tile.entity;
|
Tilec entity = tile.entity;
|
||||||
Tile other = world.tile(value);
|
Tile other = world.tile(value);
|
||||||
boolean contains = entity.power().links.contains(value), valid = other != null && other.entity != null && other.entity.power() != null;
|
boolean contains = entity.power().links.contains(value), valid = other != null && other.entity != null && other.entity.power() != null;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class ItemSource extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
tile.<ItemSourceEntity>ent().outputItem = content.item(value);
|
tile.<ItemSourceEntity>ent().outputItem = content.item(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class LiquidSource extends Block{
|
|||||||
configurable = true;
|
configurable = true;
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
entityType = LiquidSourceEntity::new;
|
entityType = LiquidSourceEntity::new;
|
||||||
|
|
||||||
|
config();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,7 +87,7 @@ public class LiquidSource extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
tile.<LiquidSourceEntity>ent().source = value == -1 ? null : content.liquid(value);
|
tile.<LiquidSourceEntity>ent().source = value == -1 ? null : content.liquid(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,8 +95,8 @@ public class LiquidSource extends Block{
|
|||||||
public @Nullable Liquid source = null;
|
public @Nullable Liquid source = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int config(){
|
public Object config(){
|
||||||
return source == null ? -1 : source.id;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class Unloader extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
tile.entity.items().clear();
|
tile.entity.items().clear();
|
||||||
tile.<UnloaderEntity>ent().sortItem = content.item(value);
|
tile.<UnloaderEntity>ent().sortItem = content.item(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class CommandCenter extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Playerc player, int value){
|
public void configured(Tile tile, Playerc player, Object value){
|
||||||
UnitCommand command = UnitCommand.all[value];
|
UnitCommand command = UnitCommand.all[value];
|
||||||
((CommandCenter)tile.block()).effect.at(tile);
|
((CommandCenter)tile.block()).effect.at(tile);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user