This commit is contained in:
Raoul Van den Berge
2016-07-09 16:34:15 +02:00
parent e9af6647d9
commit 8fdcd98dbf
65 changed files with 50 additions and 71 deletions

View File

@@ -30,8 +30,4 @@ public class BlockCraftingMonitor extends BlockNode {
return true;
}
public boolean hasConnectivityState() {
return true;
}
}

View File

@@ -70,13 +70,4 @@ public class BlockGrid extends BlockNode {
public Item createItem() {
return new ItemBlockBase(this, true);
}
public boolean hasConnectivityState() {
return true;
}
@Override
public EnumPlacementType getPlacementType() {
return EnumPlacementType.ANY;
}
}

View File

@@ -47,6 +47,6 @@ public enum EnumStorageType implements IStringSerializable {
return type;
}
}
return TYPE_1K;
return TYPE_CREATIVE;
}
}

View File

@@ -1,6 +1,7 @@
package refinedstorage.item;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
@@ -64,6 +65,15 @@ public class ItemBlockStorage extends ItemBlockBase {
return stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.onUpdate(stack, world, entity, slot, selected);
if (!stack.hasTagCompound()) {
initNBT(stack);
}
}
@Override
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
super.onCreated(stack, world, player);

View File

@@ -2,6 +2,7 @@ package refinedstorage.item;
import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
@@ -39,14 +40,25 @@ public class ItemStorageDisk extends ItemBase {
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 6; ++i) {
list.add(i == TYPE_DEBUG ? createDebugDisk() : NBTStorage.createStackWithNBT(new ItemStack(item, 1, i)));
for (int i = 0; i < 5; ++i) {
list.add(NBTStorage.createStackWithNBT(new ItemStack(item, 1, i)));
}
}
private ItemStack createDebugDisk() {
ItemStack debugDisk = new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_DEBUG);
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.onUpdate(stack, world, entity, slot, selected);
if (!stack.hasTagCompound()) {
if (stack.getItemDamage() == 5) {
applyDebugDiskData(stack);
} else {
NBTStorage.createStackWithNBT(stack);
}
}
}
private void applyDebugDiskData(ItemStack stack) {
if (debugDiskTag == null) {
debugDiskTag = NBTStorage.createNBT();
@@ -76,9 +88,7 @@ public class ItemStorageDisk extends ItemBase {
storage.writeToNBT();
}
debugDisk.setTagCompound(debugDiskTag.copy());
return debugDisk;
stack.setTagCompound(debugDiskTag.copy());
}
@Override

View File

@@ -107,6 +107,10 @@ public class ClientProxy extends CommonProxy {
.build()
);
ModelLoader.setCustomStateMapper(RefinedStorageBlocks.GRID, (new StateMap.Builder())
.ignore(RefinedStorageBlocks.GRID.TYPE)
.build());
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CABLE), 0, new ModelResourceLocation("refinedstorage:cable", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.NORMAL.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.CRAFTING.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));

View File

@@ -86,10 +86,11 @@ public class CommonProxy {
registerBlock(RefinedStorageBlocks.PROCESSING_PATTERN_ENCODER);
registerBlock(RefinedStorageBlocks.DISK_DRIVE);
registerBlock(RefinedStorageBlocks.STORAGE);
registerBlock(RefinedStorageBlocks.EXTERNAL_STORAGE);
registerBlock(RefinedStorageBlocks.SOLDERER);
registerBlock(RefinedStorageBlocks.CABLE);
registerBlock(RefinedStorageBlocks.IMPORTER);
registerBlock(RefinedStorageBlocks.EXPORTER);
registerBlock(RefinedStorageBlocks.EXTERNAL_STORAGE);
registerBlock(RefinedStorageBlocks.CONSTRUCTOR);
registerBlock(RefinedStorageBlocks.DESTRUCTOR);
registerBlock(RefinedStorageBlocks.DETECTOR);
@@ -98,7 +99,6 @@ public class CommonProxy {
registerBlock(RefinedStorageBlocks.WIRELESS_TRANSMITTER);
registerBlock(RefinedStorageBlocks.MACHINE_CASING);
registerBlock(RefinedStorageBlocks.QUARTZ_ENRICHED_IRON);
registerBlock(RefinedStorageBlocks.CABLE);
registerItem(RefinedStorageItems.QUARTZ_ENRICHED_IRON);
registerItem(RefinedStorageItems.STORAGE_DISK);

View File

@@ -252,15 +252,17 @@ public class TileDiskDrive extends TileNode implements IStorageProvider, IStorag
ItemStack disk = disks.getStackInSlot(i);
if (disk != null) {
int capacity = EnumStorageType.getById(disk.getItemDamage()).getCapacity();
if (capacity == -1) {
return 0;
}
stored += NBTStorage.getStoredFromNBT(disk.getTagCompound());
storedMax += EnumStorageType.getById(disk.getItemDamage()).getCapacity();
}
}
if (storedMax == 0) {
return 0;
}
return (int) Math.floor((stored / storedMax) * 7f);
}

View File

@@ -335,6 +335,7 @@ public class TileGrid extends TileNode implements IGrid {
public void writeContainerData(ByteBuf buf) {
super.writeContainerData(buf);
buf.writeBoolean(isConnected());
buf.writeInt(sortingDirection);
buf.writeInt(sortingType);
buf.writeInt(searchBoxMode);
@@ -344,6 +345,7 @@ public class TileGrid extends TileNode implements IGrid {
public void readContainerData(ByteBuf buf) {
super.readContainerData(buf);
connected = buf.readBoolean();
sortingDirection = buf.readInt();
sortingType = buf.readInt();
searchBoxMode = buf.readInt();