Change solderer texure behaviour
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package refinedstorage.block;
|
||||
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -7,12 +10,16 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileDetector;
|
||||
import refinedstorage.tile.TileSolderer;
|
||||
|
||||
public class BlockSolderer extends BlockMachine {
|
||||
public static final PropertyBool WORKING = PropertyBool.create("working");
|
||||
|
||||
public BlockSolderer() {
|
||||
super("solderer");
|
||||
}
|
||||
@@ -30,4 +37,19 @@ public class BlockSolderer extends BlockMachine {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[]{
|
||||
DIRECTION,
|
||||
CONNECTED,
|
||||
WORKING
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(WORKING, ((TileSolderer) world.getTileEntity(pos)).isWorking());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
||||
public void receiveContainerData(ByteBuf buf) {
|
||||
super.receiveContainerData(buf);
|
||||
|
||||
working = buf.readBoolean();
|
||||
progress = buf.readInt();
|
||||
duration = buf.readInt();
|
||||
}
|
||||
@@ -131,11 +130,30 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
||||
public void sendContainerData(ByteBuf buf) {
|
||||
super.sendContainerData(buf);
|
||||
|
||||
buf.writeBoolean(working);
|
||||
buf.writeInt(progress);
|
||||
buf.writeInt(recipe != null ? recipe.getDuration() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf buf) {
|
||||
super.receiveData(buf);
|
||||
|
||||
boolean lastWorking = working;
|
||||
|
||||
working = buf.readBoolean();
|
||||
|
||||
if (working != lastWorking) {
|
||||
worldObj.notifyBlockUpdate(pos, worldObj.getBlockState(pos), worldObj.getBlockState(pos), 2 | 4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf buf) {
|
||||
super.sendData(buf);
|
||||
|
||||
buf.writeBoolean(working);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Container> getContainer() {
|
||||
return ContainerSolderer.class;
|
||||
@@ -145,18 +163,10 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
||||
return working;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int i) {
|
||||
return (int) ((float) progress / (float) duration * (float) i);
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getDroppedInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "orientable",
|
||||
"model": "cube_all",
|
||||
"textures": {
|
||||
"side": "refinedstorage:blocks/side",
|
||||
"top": "refinedstorage:blocks/side",
|
||||
"front": "refinedstorage:blocks/crafter"
|
||||
"all": "refinedstorage:blocks/crafter"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{
|
||||
"transform": "forge:default-block",
|
||||
"y": 0
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
@@ -23,22 +20,16 @@
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
},
|
||||
"up": {
|
||||
"x": 270
|
||||
},
|
||||
"down": {
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,29 +4,30 @@
|
||||
"model": "orientable",
|
||||
"textures": {
|
||||
"side": "refinedstorage:blocks/side",
|
||||
"top": "refinedstorage:blocks/side"
|
||||
"top": "refinedstorage:blocks/side",
|
||||
"front": "refinedstorage:blocks/solderer"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{
|
||||
"y": 0,
|
||||
"textures": {
|
||||
"front": "refinedstorage:blocks/solderer_disconnected"
|
||||
},
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"working": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"front": "refinedstorage:blocks/solderer_connected"
|
||||
"front": "refinedstorage:blocks/solderer_working"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
"textures": {
|
||||
"front": "refinedstorage:blocks/solderer_disconnected"
|
||||
}
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
|
||||
|
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 648 B |
|
Before Width: | Height: | Size: 653 B After Width: | Height: | Size: 653 B |
Reference in New Issue
Block a user