New solderer model
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
package refinedstorage.block;
|
||||
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
@@ -21,10 +18,6 @@ import refinedstorage.tile.TileSolderer;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSolderer extends BlockNode {
|
||||
private static final AxisAlignedBB AABB_SOLDERER = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 14D / 16D, 1.0D);
|
||||
|
||||
private static final PropertyBool WORKING = PropertyBool.create("working");
|
||||
|
||||
public BlockSolderer() {
|
||||
super("solderer");
|
||||
}
|
||||
@@ -54,30 +47,6 @@ public class BlockSolderer extends BlockNode {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectivityState() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB_SOLDERER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return super.createBlockStateBuilder()
|
||||
.add(WORKING)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(WORKING, ((TileSolderer) world.getTileEntity(pos)).isWorking());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
@@ -90,6 +59,11 @@ public class BlockSolderer extends BlockNode {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlacementType getPlacementType() {
|
||||
return EnumPlacementType.HORIZONTAL;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class GuiSolderer extends GuiBase {
|
||||
|
||||
drawTexture(x, y, 0, 0, width, height);
|
||||
|
||||
if (solderer.isWorking()) {
|
||||
if (TileSolderer.WORKING.getValue()) {
|
||||
drawTexture(x + 83, y + 38 - 1, 212, 0, getProgressScaled(22), 15);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class GuiSolderer extends GuiBase {
|
||||
drawString(7, 7, t("gui.refinedstorage:solderer"));
|
||||
drawString(7, 77, t("container.inventory"));
|
||||
|
||||
if (inBounds(83, 38, 22, 15, mouseX, mouseY) && solderer.isWorking()) {
|
||||
if (inBounds(83, 38, 22, 15, mouseX, mouseY) && TileSolderer.WORKING.getValue()) {
|
||||
drawTooltip(mouseX, mouseY, getProgressScaled(100) + "%");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,13 @@ public class TileSolderer extends TileNode {
|
||||
}
|
||||
});
|
||||
|
||||
public static final TileDataParameter<Boolean> WORKING = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileSolderer>() {
|
||||
@Override
|
||||
public Boolean getValue(TileSolderer tile) {
|
||||
return tile.working;
|
||||
}
|
||||
});
|
||||
|
||||
private static final String NBT_WORKING = "Working";
|
||||
private static final String NBT_PROGRESS = "Progress";
|
||||
|
||||
@@ -72,11 +79,7 @@ public class TileSolderer extends TileNode {
|
||||
public TileSolderer() {
|
||||
dataManager.addWatchedParameter(DURATION);
|
||||
dataManager.addWatchedParameter(PROGRESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectivityState() {
|
||||
return true;
|
||||
dataManager.addWatchedParameter(WORKING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,8 +89,6 @@ public class TileSolderer extends TileNode {
|
||||
|
||||
@Override
|
||||
public void updateNode() {
|
||||
boolean wasWorking = working;
|
||||
|
||||
if (items.getStackInSlot(1) == null && items.getStackInSlot(2) == null && result.getStackInSlot(0) == null) {
|
||||
stop();
|
||||
} else {
|
||||
@@ -129,10 +130,6 @@ public class TileSolderer extends TileNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wasWorking != working) {
|
||||
updateBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,8 +138,6 @@ public class TileSolderer extends TileNode {
|
||||
|
||||
if (!state) {
|
||||
stop();
|
||||
|
||||
updateBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,26 +182,6 @@ public class TileSolderer extends TileNode {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
|
||||
super.writeUpdate(tag);
|
||||
|
||||
tag.setBoolean(NBT_WORKING, working);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readUpdate(NBTTagCompound tag) {
|
||||
working = tag.getBoolean(NBT_WORKING);
|
||||
|
||||
super.readUpdate(tag);
|
||||
}
|
||||
|
||||
public boolean isWorking() {
|
||||
return working;
|
||||
}
|
||||
|
||||
public ItemHandlerBasic getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user