diff --git a/CHANGELOG.md b/CHANGELOG.md index c8dd897b8..f1a4dc200 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ### 1.2 - Fixed resetting a stack of patterns yields 1 blank pattern (raoulvdberge) +### 1.1.3 +- Fixed some clients not starting up due to too many Disk Drive model permutations (raoulvdberge) + ### 1.1.2 - Added recipe transfer handler for Solderer (way2muchnoise) - It is now possible to start a crafting task even if the crafting preview says you can't (raoulvdberge) diff --git a/src/main/java/refinedstorage/block/BlockDiskDrive.java b/src/main/java/refinedstorage/block/BlockDiskDrive.java index b101d049b..6b00d9bc0 100755 --- a/src/main/java/refinedstorage/block/BlockDiskDrive.java +++ b/src/main/java/refinedstorage/block/BlockDiskDrive.java @@ -1,8 +1,5 @@ package refinedstorage.block; -import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -10,24 +7,12 @@ 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.RS; import refinedstorage.RSGui; import refinedstorage.tile.TileDiskDrive; public class BlockDiskDrive extends BlockNode { - private static final PropertyInteger STORED = PropertyInteger.create("stored", 0, 7); - - private static final PropertyBool FILLED_0 = PropertyBool.create("filled_0"); - private static final PropertyBool FILLED_1 = PropertyBool.create("filled_1"); - private static final PropertyBool FILLED_2 = PropertyBool.create("filled_2"); - private static final PropertyBool FILLED_3 = PropertyBool.create("filled_3"); - private static final PropertyBool FILLED_4 = PropertyBool.create("filled_4"); - private static final PropertyBool FILLED_5 = PropertyBool.create("filled_5"); - private static final PropertyBool FILLED_6 = PropertyBool.create("filled_6"); - private static final PropertyBool FILLED_7 = PropertyBool.create("filled_7"); - public BlockDiskDrive() { super("disk_drive"); } @@ -37,39 +22,6 @@ public class BlockDiskDrive extends BlockNode { return new TileDiskDrive(); } - @Override - public BlockStateContainer createBlockState() { - return createBlockStateBuilder() - .add(STORED) - .add(FILLED_0) - .add(FILLED_1) - .add(FILLED_2) - .add(FILLED_3) - .add(FILLED_4) - .add(FILLED_5) - .add(FILLED_6) - .add(FILLED_7) - .build(); - } - - @Override - public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { - TileDiskDrive diskDrive = (TileDiskDrive) world.getTileEntity(pos); - - state = super.getActualState(state, world, pos); - state = state.withProperty(STORED, Math.max(0, diskDrive.getStoredForDisplay())); - state = state.withProperty(FILLED_0, diskDrive.getFilled()[0]); - state = state.withProperty(FILLED_1, diskDrive.getFilled()[1]); - state = state.withProperty(FILLED_2, diskDrive.getFilled()[2]); - state = state.withProperty(FILLED_3, diskDrive.getFilled()[3]); - state = state.withProperty(FILLED_4, diskDrive.getFilled()[4]); - state = state.withProperty(FILLED_5, diskDrive.getFilled()[5]); - state = state.withProperty(FILLED_6, diskDrive.getFilled()[6]); - state = state.withProperty(FILLED_7, diskDrive.getFilled()[7]); - - return state; - } - @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { diff --git a/src/main/java/refinedstorage/tile/TileDiskDrive.java b/src/main/java/refinedstorage/tile/TileDiskDrive.java index 77dd45e20..082556e45 100755 --- a/src/main/java/refinedstorage/tile/TileDiskDrive.java +++ b/src/main/java/refinedstorage/tile/TileDiskDrive.java @@ -84,9 +84,7 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl private static final String NBT_PRIORITY = "Priority"; private static final String NBT_COMPARE = "Compare"; private static final String NBT_MODE = "Mode"; - private static final String NBT_STORED = "Stored"; private static final String NBT_TYPE = "Type"; - private static final String NBT_FILLED = "Filled_%d"; private ItemHandlerBasic disks = new ItemHandlerBasic(8, this, IItemValidator.STORAGE_DISK) { @Override @@ -94,7 +92,7 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl super.onContentsChanged(slot); if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { - RSUtils.constructFromDrive(getStackInSlot(slot), slot, itemStorages, fluidStorages, s -> new ItemStorage(s), s -> new FluidStorage(s)); + RSUtils.constructFromDrive(getStackInSlot(slot), slot, itemStorages, fluidStorages, ItemStorage::new, FluidStorage::new); if (network != null) { network.getItemStorage().rebuild(); @@ -132,9 +130,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl private int mode = IFilterable.WHITELIST; private int type = IType.ITEMS; - private int stored = 0; - private boolean[] filled = new boolean[8]; - public TileDiskDrive() { dataManager.addWatchedParameter(PRIORITY); dataManager.addWatchedParameter(COMPARE); @@ -142,19 +137,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl dataManager.addWatchedParameter(TYPE); } - @Override - public void update() { - if (!worldObj.isRemote) { - if (stored != getStoredForDisplay()) { - stored = getStoredForDisplay(); - - updateBlock(); - } - } - - super.update(); - } - @Override public int getEnergyUsage() { int usage = RS.INSTANCE.config.diskDriveUsage; @@ -263,34 +245,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl return tag; } - @Override - public NBTTagCompound writeUpdate(NBTTagCompound tag) { - super.writeUpdate(tag); - - tag.setInteger(NBT_STORED, stored); - - for (int i = 0; i < 8; ++i) { - tag.setBoolean(String.format(NBT_FILLED, i), disks.getStackInSlot(i) != null); - } - - return tag; - } - - @Override - public void readUpdate(NBTTagCompound tag) { - stored = tag.getInteger(NBT_STORED); - - for (int i = 0; i < 8; ++i) { - filled[i] = tag.getBoolean(String.format(NBT_FILLED, i)); - } - - super.readUpdate(tag); - } - - public boolean[] getFilled() { - return filled; - } - @Override public int getCompare() { return compare; @@ -315,36 +269,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl markDirty(); } - public int getStoredForDisplay() { - if (!worldObj.isRemote) { - float stored = 0; - float capacity = 0; - - for (int i = 0; i < disks.getSlots(); ++i) { - ItemStack disk = disks.getStackInSlot(i); - - if (disk != null) { - int diskCapacity = disk.getItem() == RSItems.STORAGE_DISK ? EnumItemStorageType.getById(disk.getItemDamage()).getCapacity() : EnumFluidStorageType.getById(disk.getItemDamage()).getCapacity(); - - if (diskCapacity == -1) { - return 0; - } - - stored += disk.getItem() == RSItems.STORAGE_DISK ? ItemStorageNBT.getStoredFromNBT(disk.getTagCompound()) : FluidStorageNBT.getStoredFromNBT(disk.getTagCompound()); - capacity += diskCapacity; - } - } - - if (capacity == 0) { - return 0; - } - - return (int) Math.floor((stored / capacity) * 7F); - } - - return stored; - } - @Override public String getGuiTitle() { return "block.refinedstorage:disk_drive.name"; diff --git a/src/main/resources/assets/refinedstorage/blockstates/disk_drive.json b/src/main/resources/assets/refinedstorage/blockstates/disk_drive.json index 28ed34516..2bfd5d06b 100755 --- a/src/main/resources/assets/refinedstorage/blockstates/disk_drive.json +++ b/src/main/resources/assets/refinedstorage/blockstates/disk_drive.json @@ -3,10 +3,10 @@ "defaults": { "model": "cube", "textures": { - "particle": "refinedstorage:blocks/disk_drive_0", + "particle": "refinedstorage:blocks/disk_drive", "down": "refinedstorage:blocks/disk_drive_bottom", "up": "refinedstorage:blocks/disk_drive_top", - "north": "refinedstorage:blocks/disk_drive_0", + "north": "refinedstorage:blocks/disk_drive", "east": "refinedstorage:blocks/disk_drive_side", "south": "refinedstorage:blocks/disk_drive_side", "west": "refinedstorage:blocks/disk_drive_side" @@ -18,96 +18,6 @@ "y": 0 } ], - "filled_0": { - "true": { - }, - "false": { - } - }, - "filled_1": { - "true": { - }, - "false": { - } - }, - "filled_2": { - "true": { - }, - "false": { - } - }, - "filled_3": { - "true": { - }, - "false": { - } - }, - "filled_4": { - "true": { - }, - "false": { - } - }, - "filled_5": { - "true": { - }, - "false": { - } - }, - "filled_6": { - "true": { - }, - "false": { - } - }, - "filled_7": { - "true": { - }, - "false": { - } - }, - "stored": { - "0": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "1": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "2": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "3": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "4": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "5": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "6": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - }, - "7": { - "textures": { - "north": "refinedstorage:blocks/disk_drive_0" - } - } - }, "direction": { "north": { "y": 0 diff --git a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_0.png b/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive.png similarity index 100% rename from src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_0.png rename to src/main/resources/assets/refinedstorage/textures/blocks/disk_drive.png diff --git a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_1.png b/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_1.png deleted file mode 100755 index b8234d75d..000000000 Binary files a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_1.png and /dev/null differ diff --git a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_2.png b/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_2.png deleted file mode 100755 index b8234d75d..000000000 Binary files a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_2.png and /dev/null differ diff --git a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_3.png b/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_3.png deleted file mode 100755 index b8234d75d..000000000 Binary files a/src/main/resources/assets/refinedstorage/textures/blocks/disk_drive_3.png and /dev/null differ