Add JEI to the dev environment, rename the items + blocks to match vanilla formats of no capital letters and to include underscores, and fix the crystal chest not rendering items in it.

This commit is contained in:
alexbegt 2016-11-18 10:26:10 -05:00
parent 9fe6c6912a
commit e6fb331bd9
47 changed files with 376 additions and 214 deletions

View File

@ -33,7 +33,7 @@ repositories {
} }
dependencies { dependencies {
//deobfCompile "mezz.jei:jei_1.10.2:3.7.6.232" deobfCompile "mezz.jei:jei_1.11:4.0.1.191"
} }
// This is our group. I'm cpw.mods // This is our group. I'm cpw.mods

View File

@ -47,7 +47,7 @@ public class BlockIronChest extends Block
public BlockIronChest() public BlockIronChest()
{ {
super(Material.IRON); super(Material.IRON);
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "BlockIronChest")); this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "iron_chest"));
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON)); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
@ -121,7 +121,7 @@ public class BlockIronChest extends Block
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
//public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) // public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list)
{ {
for (IronChestType type : IronChestType.VALUES) for (IronChestType type : IronChestType.VALUES)

View File

@ -22,15 +22,15 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public enum ChestChangerType public enum ChestChangerType
{ {
//@formatter:off //@formatter:off
IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "mmm", "msm", "mmm"), IRONGOLD(IRON, GOLD, "iron_gold_upgrade", "mmm", "msm", "mmm"),
GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "GGG", "msm", "GGG"), GOLDDIAMOND(GOLD, DIAMOND, "gold_diamond_upgrade", "GGG", "msm", "GGG"),
COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "mmm", "msm", "mmm"), COPPERSILVER(COPPER, SILVER, "copper_silver_upgrade", "mmm", "msm", "mmm"),
SILVERGOLD(SILVER, GOLD, "silverGoldUpgrade", "mGm", "GsG", "mGm"), SILVERGOLD(SILVER, GOLD, "silver_gold_upgrade", "mGm", "GsG", "mGm"),
COPPERIRON(COPPER, IRON, "copperIronUpgrade", "mGm", "GsG", "mGm"), COPPERIRON(COPPER, IRON, "copper_iron_upgrade", "mGm", "GsG", "mGm"),
DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamondCrystalUpgrade", "GGG", "GOG", "GGG"), DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamond_crystal_upgrade", "GGG", "GOG", "GGG"),
WOODIRON(WOOD, IRON, "woodIronUpgrade", "mmm", "msm", "mmm"), WOODIRON(WOOD, IRON, "wood_iron_upgrade", "mmm", "msm", "mmm"),
WOODCOPPER(WOOD, COPPER, "woodCopperUpgrade", "mmm", "msm", "mmm"), WOODCOPPER(WOOD, COPPER, "wood_copper_upgrade", "mmm", "msm", "mmm"),
DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamondObsidianUpgrade", "mmm", "mGm", "mmm"); DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamond_obsidian_upgrade", "mmm", "mGm", "mmm");
//@formatter:on //@formatter:on
public static final ChestChangerType[] VALUES = values(); public static final ChestChangerType[] VALUES = values();

View File

@ -10,6 +10,7 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import invtweaks.api.container.ChestContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -17,7 +18,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//@ChestContainer(isLargeChest = true) @ChestContainer(isLargeChest = true)
public class ContainerIronChest extends Container public class ContainerIronChest extends Container
{ {
private IronChestType type; private IronChestType type;
@ -123,9 +124,9 @@ public class ContainerIronChest extends Container
return this.player; return this.player;
} }
//@ChestContainer.RowSizeCallback @ChestContainer.RowSizeCallback
//public int getNumColumns() public int getNumColumns()
//{ {
// return this.type.rowLength; return this.type.rowLength;
//} }
} }

View File

@ -12,16 +12,24 @@ package cpw.mods.ironchest;
import java.util.Properties; import java.util.Properties;
import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
@Mod(modid = IronChest.MOD_ID, name = "Iron Chests", /*dependencies = "required-after:Forge@[12.17.0.1909,)",*/ acceptedMinecraftVersions = "[1.11, 1.12)") @Mod(modid = IronChest.MOD_ID, name = "Iron Chests", dependencies = "required-after:forge@[13.19.0.2142,);", acceptedMinecraftVersions = "[1.11, 1.12)")
public class IronChest public class IronChest
{ {
public static final String MOD_ID = "ironchest"; public static final String MOD_ID = "ironchest";
@ -67,4 +75,101 @@ public class IronChest
proxy.registerRenderInformation(); proxy.registerRenderInformation();
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler()); MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
} }
@Mod.EventHandler
public void onMissingMappings(FMLMissingMappingsEvent event)
{
for (MissingMapping mapping : event.get())
{
if (mapping.resourceLocation.getResourceDomain().equals(IronChest.MOD_ID))
{
@Nonnull
String path = mapping.resourceLocation.getResourcePath();
if (path.endsWith("blockironchest"))
{
path = path.replace("blockironchest", "iron_chest");
ResourceLocation newRes = new ResourceLocation(mapping.resourceLocation.getResourceDomain(), path);
Block block = ForgeRegistries.BLOCKS.getValue(newRes);
if (block != null)
{
if (mapping.type == GameRegistry.Type.BLOCK)
{
mapping.remap(block);
}
else
{
mapping.remap(Item.getItemFromBlock(block));
}
}
}
if (path.endsWith("irongoldupgrade"))
{
path = path.replace("irongoldupgrade", "iron_gold_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("golddiamondupgrade"))
{
path = path.replace("golddiamondupgrade", "gold_diamond_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("coppersilverupgrade"))
{
path = path.replace("coppersilverupgrade", "copper_silver_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("silvergoldupgrade"))
{
path = path.replace("silvergoldupgrade", "silver_gold_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("copperironupgrade"))
{
path = path.replace("copperironupgrade", "copper_iron_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("diamondcrystalupgrade"))
{
path = path.replace("diamondcrystalupgrade", "diamond_crystal_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("woodironupgrade"))
{
path = path.replace("woodironupgrade", "wood_iron_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("woodcopperupgrade"))
{
path = path.replace("woodcopperupgrade", "wood_copper_upgrade");
replaceUpgradeItem(path, mapping);
}
if (path.endsWith("diamondobsidianupgrade"))
{
path = path.replace("diamondobsidianupgrade", "diamond_obsidian_upgrade");
replaceUpgradeItem(path, mapping);
}
}
}
}
private static void replaceUpgradeItem(String path, MissingMapping mapping)
{
ResourceLocation newRes = new ResourceLocation(mapping.resourceLocation.getResourceDomain(), path);
Item item = ForgeRegistries.ITEMS.getValue(newRes);
if (item != null)
{
mapping.remap(item);
}
}
} }

View File

@ -1,7 +1,10 @@
package cpw.mods.ironchest; package cpw.mods.ironchest;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.ai.EntityAIOcelotSit; import net.minecraft.entity.ai.EntityAIOcelotSit;
import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -12,14 +15,32 @@ public class IronChestAIOcelotSit extends EntityAIOcelotSit
super(ocelotIn, speedIn); super(ocelotIn, speedIn);
} }
/**
* Return true to set given position as destination
*/
@Override @Override
protected boolean shouldMoveTo(World worldIn, BlockPos pos) protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{ {
if (worldIn.getBlockState(pos).getBlock() == IronChest.ironChestBlock) if (!worldIn.isAirBlock(pos.up()))
{ {
return true; return false;
} }
else
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
return super.shouldMoveTo(worldIn, pos); if (block == IronChest.ironChestBlock)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityIronChest && ((TileEntityIronChest) tileentity).numPlayersUsing < 1)
{
return true;
}
}
return super.shouldMoveTo(worldIn, pos);
}
} }
} }

View File

@ -28,14 +28,14 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
public enum IronChestType implements IStringSerializable public enum IronChestType implements IStringSerializable
{ {
//@formatter:off //@formatter:off
IRON(54, 9, true, "ironchest.png", Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, 184, 202, "mmmmPmmmm", "mGmG3GmGm"), IRON(54, 9, true, "iron_chest.png", Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, 184, 202, "mmmmPmmmm", "mGmG3GmGm"),
GOLD(81, 9, true, "goldchest.png", Collections.singleton("ingotGold"), TileEntityGoldChest.class, 184, 256, "mmmmPmmmm", "mGmG4GmGm"), GOLD(81, 9, true, "gold_chest.png", Collections.singleton("ingotGold"), TileEntityGoldChest.class, 184, 256, "mmmmPmmmm", "mGmG4GmGm"),
DIAMOND(108, 12, true, "diamondchest.png", Collections.singleton("gemDiamond"), TileEntityDiamondChest.class, 184, 256, "GGGmPmGGG", "GGGG4Gmmm"), DIAMOND(108, 12, true, "diamond_chest.png", Collections.singleton("gemDiamond"), TileEntityDiamondChest.class, 184, 256, "GGGmPmGGG", "GGGG4Gmmm"),
COPPER(45, 9, false, "copperchest.png", Collections.singleton("ingotCopper"), TileEntityCopperChest.class, 184, 184, "mmmmCmmmm"), COPPER(45, 9, false, "copper_chest.png", Collections.singleton("ingotCopper"), TileEntityCopperChest.class, 184, 184, "mmmmCmmmm"),
SILVER(72, 9, false, "silverchest.png", Collections.singleton("ingotSilver"), TileEntitySilverChest.class, 184, 238, "mmmm3mmmm", "mGmG0GmGm"), SILVER(72, 9, false, "silver_chest.png", Collections.singleton("ingotSilver"), TileEntitySilverChest.class, 184, 238, "mmmm3mmmm", "mGmG0GmGm"),
CRYSTAL(108, 12, true, "crystalchest.png", Collections.singleton("blockGlass"), TileEntityCrystalChest.class, 238, 256, "GGGGPGGGG"), CRYSTAL(108, 12, true, "crystal_chest.png", Collections.singleton("blockGlass"), TileEntityCrystalChest.class, 238, 256, "GGGGPGGGG"),
OBSIDIAN(108, 12, false, "obsidianchest.png", Collections.singleton("obsidian"), TileEntityObsidianChest.class, 238, 256, "mmmm2mmmm"), OBSIDIAN(108, 12, false, "obsidian_chest.png", Collections.singleton("obsidian"), TileEntityObsidianChest.class, 238, 256, "mmmm2mmmm"),
DIRTCHEST9000(1, 1, false, "dirtchest.png", Collections.singleton("dirt"), TileEntityDirtChest.class, 184, 184, "mmmmCmmmm"), DIRTCHEST9000(1, 1, false, "dirt_chest.png", Collections.singleton("dirt"), TileEntityDirtChest.class, 184, 184, "mmmmCmmmm"),
WOOD(0, 0, false, "", Collections.singleton("plankWood"), null, 0, 0); WOOD(0, 0, false, "", Collections.singleton("plankWood"), null, 0, 0);
//@formatter:on //@formatter:on

View File

@ -20,7 +20,7 @@ public class ItemIronChest extends ItemBlock
public ItemIronChest(Block block) public ItemIronChest(Block block)
{ {
super(block); super(block);
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "BlockIronChest")); this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "iron_chest"));
this.setMaxDamage(0); this.setMaxDamage(0);
this.setHasSubtypes(true); this.setHasSubtypes(true);

View File

@ -10,6 +10,9 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import java.util.Collections;
import java.util.Comparator;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -19,6 +22,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.ItemStackHelper; import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntityLockableLoot; import net.minecraft.tileentity.TileEntityLockableLoot;
@ -29,7 +33,7 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
public class TileEntityIronChest extends TileEntityLockableLoot implements ITickable//, IInventory public class TileEntityIronChest extends TileEntityLockableLoot implements ITickable
{ {
/** The current angle of the lid (between 0 and 1) */ /** The current angle of the lid (between 0 and 1) */
public float lidAngle; public float lidAngle;
@ -41,9 +45,9 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
private int ticksSinceSync = -1; private int ticksSinceSync = -1;
private int numPlayersUsing; public int numPlayersUsing;
//private ItemStack[] topStacks; private NonNullList<ItemStack> topStacks;
private EnumFacing facing; private EnumFacing facing;
@ -65,7 +69,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
super(); super();
this.chestType = type; this.chestType = type;
this.chestContents = NonNullList.<ItemStack> func_191197_a(type.size, ItemStack.field_190927_a); this.chestContents = NonNullList.<ItemStack> func_191197_a(type.size, ItemStack.field_190927_a);
//this.topStacks = new ItemStack[8]; this.topStacks = NonNullList.<ItemStack> func_191197_a(8, ItemStack.field_190927_a);
this.facing = EnumFacing.NORTH; this.facing = EnumFacing.NORTH;
} }
@ -132,107 +136,106 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
{ {
super.markDirty(); super.markDirty();
//this.sortTopStacks(); this.sortTopStacks();
} }
/*protected void sortTopStacks() protected void sortTopStacks()
{ {
if (!this.getType().isTransparent() || (this.worldObj != null && this.worldObj.isRemote)) if (!this.getType().isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
{ {
return; return;
} }
ItemStack[] tempCopy = new ItemStack[this.getSizeInventory()]; NonNullList<ItemStack> tempCopy = NonNullList.<ItemStack> func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);
boolean hasStuff = false; boolean hasStuff = false;
int compressedIdx = 0; int compressedIdx = 0;
mainLoop: mainLoop: for (int i = 0; i < this.getSizeInventory(); i++)
for (int i = 0; i < this.getSizeInventory(); i++)
{ {
if (this.chestContents[i] != null) if (this.chestContents.get(i) != ItemStack.field_190927_a)
{ {
for (int j = 0; j < compressedIdx; j++) for (int j = 0; j < compressedIdx; j++)
{ {
if (tempCopy[j].isItemEqual(this.chestContents[i])) if (tempCopy.get(j).isItemEqual(this.chestContents.get(i)))
{ {
tempCopy[j].func_190920_e(tempCopy[j].func_190916_E() + this.chestContents[i].func_190916_E()); tempCopy.get(j).func_190920_e(tempCopy.get(j).func_190916_E() + this.chestContents.get(i).func_190916_E());
continue mainLoop; continue mainLoop;
} }
} }
tempCopy[compressedIdx++] = this.chestContents[i].copy(); tempCopy.set(compressedIdx++, this.chestContents.get(i).copy());
hasStuff = true; hasStuff = true;
} }
} }
if (!hasStuff && this.hadStuff) if (!hasStuff && this.hadStuff)
{ {
this.hadStuff = false; this.hadStuff = false;
for (int i = 0; i < this.topStacks.length; i++) for (int i = 0; i < this.topStacks.size(); i++)
{ {
this.topStacks[i] = null; this.topStacks.set(i, ItemStack.field_190927_a);
} }
if (this.worldObj != null) if (this.worldObj != null)
{ {
IBlockState iblockstate = this.worldObj.getBlockState(this.pos); IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3); this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3);
} }
return; return;
} }
this.hadStuff = true; this.hadStuff = true;
Arrays.sort(tempCopy, new Comparator<ItemStack>() Collections.sort(tempCopy, new Comparator<ItemStack>() {
{
@Override @Override
public int compare(ItemStack o1, ItemStack o2) public int compare(ItemStack stack1, ItemStack stack2)
{ {
if (o1 == null) if (stack1 == null)
{ {
return 1; return 1;
} }
else if (o2 == null) else if (stack2 == null)
{ {
return -1; return -1;
} }
else else
{ {
return o2.func_190916_E() - o1.func_190916_E(); return stack2.func_190916_E() - stack1.func_190916_E();
} }
} }
}); });
int p = 0; int p = 0;
for (ItemStack element : tempCopy) for (int i = 0; i < tempCopy.size(); i++)
{ {
ItemStack element = tempCopy.get(i);
if (element != ItemStack.field_190927_a && element.func_190916_E() > 0) if (element != ItemStack.field_190927_a && element.func_190916_E() > 0)
{ {
this.topStacks[p++] = element; this.topStacks.set(p++, element);
if (p == this.topStacks.length) if (p == this.topStacks.size())
{ {
break; break;
} }
} }
} }
for (int i = p; i < this.topStacks.length; i++) for (int i = p; i < this.topStacks.size(); i++)
{ {
this.topStacks[i] = null; this.topStacks.set(i, ItemStack.field_190927_a);
} }
if (this.worldObj != null) if (this.worldObj != null)
{ {
IBlockState iblockstate = this.worldObj.getBlockState(this.pos); IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3); this.worldObj.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3);
} }
}*/ }
@Override @Override
public String getName() public String getName()
@ -270,7 +273,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
this.facing = EnumFacing.VALUES[compound.getByte("facing")]; this.facing = EnumFacing.VALUES[compound.getByte("facing")];
//this.sortTopStacks(); this.sortTopStacks();
} }
@Override @Override
@ -348,7 +351,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
{ {
this.inventoryTouched = false; this.inventoryTouched = false;
//this.sortTopStacks(); this.sortTopStacks();
} }
this.ticksSinceSync++; this.ticksSinceSync++;
@ -467,10 +470,10 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
} }
} }
//public ItemStack[] getTopItemStacks() public NonNullList<ItemStack> getTopItemStacks()
//{ {
// return this.topStacks; return this.topStacks;
//} }
@Override @Override
public SPacketUpdateTileEntity getUpdatePacket() public SPacketUpdateTileEntity getUpdatePacket()
@ -479,28 +482,28 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
compound.setByte("facing", (byte) this.facing.ordinal()); compound.setByte("facing", (byte) this.facing.ordinal());
/*ItemStack[] stacks = this.buildItemStackDataList(); NonNullList<ItemStack> stacks = this.buildItemStackDataList();
if (stacks != null) if (stacks != null)
{ {
NBTTagList itemList = new NBTTagList(); NBTTagList itemList = new NBTTagList();
for (int slot = 0; slot < stacks.length; slot++) for (int slot = 0; slot < stacks.size(); slot++)
{ {
if (stacks[slot] != null) if (stacks.get(slot) != ItemStack.field_190927_a)
{ {
NBTTagCompound item = new NBTTagCompound(); NBTTagCompound item = new NBTTagCompound();
item.setByte("Slot", (byte) slot); item.setByte("Slot", (byte) slot);
stacks[slot].writeToNBT(item); stacks.get(slot).writeToNBT(item);
itemList.appendTag(item); itemList.appendTag(item);
} }
} }
compound.setTag("stacks", itemList); compound.setTag("stacks", itemList);
}*/ }
return new SPacketUpdateTileEntity(this.pos, 0, compound); return new SPacketUpdateTileEntity(this.pos, 0, compound);
} }
@ -514,68 +517,69 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
this.facing = EnumFacing.VALUES[compound.getByte("facing")]; this.facing = EnumFacing.VALUES[compound.getByte("facing")];
/*NBTTagList itemList = compound.getTagList("stacks", Constants.NBT.TAG_COMPOUND); NBTTagList itemList = compound.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
ItemStack[] stacks = new ItemStack[this.topStacks.length]; ItemStack[] stacks = new ItemStack[this.topStacks.size()];
for (int item = 0; item < stacks.length; item++) for (int item = 0; item < stacks.length; item++)
{ {
NBTTagCompound itemStack = itemList.getCompoundTagAt(item); NBTTagCompound itemNBT = itemList.getCompoundTagAt(item);
int slot = itemStack.getByte("Slot") & 255; int slot = itemNBT.getByte("Slot") & 255;
if (slot >= 0 && slot < stacks.length) if (slot >= 0 && slot < stacks.length)
{ {
stacks[slot] = ItemStack.loadItemStackFromNBT(itemStack); stacks[slot] = new ItemStack(itemNBT);
} }
} }
if (this.getType().isTransparent() && stacks != null) if (this.getType().isTransparent() && stacks != null)
{ {
int pos = 0; int pos = 0;
for (int i = 0; i < this.topStacks.length; i++) for (int i = 0; i < this.topStacks.size(); i++)
{ {
if (stacks[pos] != null) if (stacks[pos] != null)
{ {
this.topStacks[i] = stacks[pos]; this.topStacks.set(i, stacks[pos]);
} }
else else
{ {
this.topStacks[i] = null; this.topStacks.set(i, ItemStack.field_190927_a);
} }
pos++; pos++;
} }
}*/ }
} }
} }
/*public ItemStack[] buildItemStackDataList() public NonNullList<ItemStack> buildItemStackDataList()
{ {
if (this.getType().isTransparent()) if (this.getType().isTransparent())
{ {
ItemStack[] sortList = new ItemStack[this.topStacks.length]; NonNullList<ItemStack> sortList = NonNullList.<ItemStack> func_191197_a(this.topStacks.size(), ItemStack.field_190927_a);
int pos = 0; int pos = 0;
for (ItemStack is : this.topStacks) for (int i = 0; i < this.topStacks.size(); i++)
{ {
ItemStack is = this.topStacks.get(i);
if (is != null) if (is != null)
{ {
sortList[pos++] = is; sortList.set(pos++, is);
} }
else else
{ {
sortList[pos++] = null; sortList.set(pos++, ItemStack.field_190927_a);
} }
} }
return sortList; return sortList;
} }
return null; return null;
}*/ }
@Override @Override
public boolean isItemValidForSlot(int index, ItemStack stack) public boolean isItemValidForSlot(int index, ItemStack stack)
@ -601,7 +605,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
@Override @Override
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{ {
this.fillWithLoot((EntityPlayer) null); this.fillWithLoot(playerIn);
return new ContainerIronChest(playerInventory, this, this.chestType, this.chestType.xSize, this.chestType.ySize); return new ContainerIronChest(playerInventory, this, this.chestType, this.chestType.xSize, this.chestType.ySize);
} }

View File

@ -50,7 +50,7 @@ public class ClientProxy extends CommonProxy
for (ChestChangerType type : ChestChangerType.VALUES) for (ChestChangerType type : ChestChangerType.VALUES)
{ {
//@formatter:off //@formatter:off
ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "ItemChestUpgrade"), "variant=" + type.itemName.toLowerCase())); ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "iron_chest_upgrades"), "variant=" + type.itemName.toLowerCase()));
//@formatter:on //@formatter:on
} }
} }

View File

@ -24,12 +24,12 @@ public class GUIChest extends GuiContainer
public enum ResourceList public enum ResourceList
{ {
//@formatter:off //@formatter:off
IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")), IRON(new ResourceLocation("ironchest", "textures/gui/iron_container.png")),
COPPER(new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")), COPPER(new ResourceLocation("ironchest", "textures/gui/copper_container.png")),
SILVER(new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")), SILVER(new ResourceLocation("ironchest", "textures/gui/silver_container.png")),
GOLD(new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")), GOLD(new ResourceLocation("ironchest", "textures/gui/gold_container.png")),
DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")), DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamond_container.png")),
DIRT(new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png")); DIRT(new ResourceLocation("ironchest", "textures/gui/dirt_container.png"));
//@formatter:on //@formatter:on
public final ResourceLocation location; public final ResourceLocation location;

View File

@ -12,17 +12,22 @@ package cpw.mods.ironchest.client;
import java.util.Random; import java.util.Random;
import com.google.common.primitives.SignedBytes;
import cpw.mods.ironchest.BlockIronChest; import cpw.mods.ironchest.BlockIronChest;
import cpw.mods.ironchest.IronChest; import cpw.mods.ironchest.IronChest;
import cpw.mods.ironchest.IronChestType; import cpw.mods.ironchest.IronChestType;
import cpw.mods.ironchest.TileEntityIronChest; import cpw.mods.ironchest.TileEntityIronChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChest; import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderEntityItem; import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileEntityIronChest> public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileEntityIronChest>
{ {
@ -141,7 +146,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F, 1F);
/*if (type.isTransparent() if (type.isTransparent()
&& tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d) && tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d)
{ {
this.random.setSeed(254L); this.random.setSeed(254L);
@ -151,23 +156,28 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
int shift = 0; int shift = 0;
float blockScale = 0.70F; float blockScale = 0.70F;
float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTick; float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTick;
if (tile.getTopItemStacks()[1] == null)
if (tile.getTopItemStacks().get(1) == ItemStack.field_190927_a)
{ {
shift = 8; shift = 8;
blockScale = 0.85F; blockScale = 0.85F;
} }
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.translate((float) x, (float) y, (float) z);
customitem.setWorld(this.getWorld()); customitem.setWorld(this.getWorld());
customitem.hoverStart = 0F; customitem.hoverStart = 0F;
for (ItemStack item : tile.getTopItemStacks())
NonNullList<ItemStack> stacks = tile.getTopItemStacks();
for (int i = 0; i < stacks.size(); i++)
{ {
ItemStack item = stacks.get(i);
if (shift > shifts.length) if (shift > shifts.length)
{ {
break; break;
} }
if (item == null) if (item == ItemStack.field_190927_a)
{ {
shift++; shift++;
continue; continue;
@ -181,22 +191,23 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
GlStateManager.rotate(timeD, 0F, 1F, 0F); GlStateManager.rotate(timeD, 0F, 1F, 0F);
GlStateManager.scale(blockScale, blockScale, blockScale); GlStateManager.scale(blockScale, blockScale, blockScale);
customitem.setEntityItemStack(item); customitem.setEntityItemStack(item);
if (this.itemRenderer == null) if (this.itemRenderer == null)
{ {
this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) { this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem())
{
@Override @Override
public int getModelCount(ItemStack stack) public int getModelCount(ItemStack stack)
{ {
return SignedBytes.saturatedCast(Math.min(stack.func_190916_E() / 32, 15) + 1); return SignedBytes.saturatedCast(Math.min(stack.func_190916_E() / 32, 15) + 1);
} }
@Override @Override
public boolean shouldBob() public boolean shouldBob()
{ {
return false; return false;
} }
@Override @Override
public boolean shouldSpreadItems() public boolean shouldSpreadItems()
{ {
@ -204,13 +215,13 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
} }
}; };
} }
this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTick); this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTick);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();
}*/ }
} }
} }

View File

@ -1,61 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"variant": {
"irongoldupgrade": {
"textures": {
"layer0": "ironchest:items/ironGoldUpgrade"
}
},
"coppersilverupgrade": {
"textures": {
"layer0": "ironchest:items/copperSilverUpgrade"
}
},
"diamondcrystalupgrade": {
"textures": {
"layer0": "ironchest:items/diamondCrystalUpgrade"
}
},
"diamondobsidianupgrade": {
"textures": {
"layer0": "ironchest:items/diamondObsidianUpgrade"
}
},
"golddiamondupgrade": {
"textures": {
"layer0": "ironchest:items/goldDiamondUpgrade"
}
},
"irongoldupgrade": {
"textures": {
"layer0": "ironchest:items/ironGoldUpgrade"
}
},
"silvergoldupgrade": {
"textures": {
"layer0": "ironchest:items/silverGoldUpgrade"
}
},
"woodcopperupgrade": {
"textures": {
"layer0": "ironchest:items/woodCopperUpgrade"
}
},
"woodironupgrade": {
"textures": {
"layer0": "ironchest:items/woodIronUpgrade"
}
},
"copperironupgrade": {
"textures": {
"layer0": "ironchest:items/copperIronUpgrade"
}
}
}
}
}

View File

@ -1,57 +1,57 @@
{ {
"forge_marker": 1, "forge_marker": 1,
"defaults": { "defaults": {
"model": "ironchest:chest", "model": "ironchest:iron_chest",
"transform": "forge:default-block" "transform": "forge:default-block"
}, },
"variants": { "variants": {
"variant": { "variant": {
"iron": { "iron": {
"textures": { "textures": {
"particle": "ironchest:blocks/ironbreak", "particle": "ironchest:blocks/iron_break",
"texture": "ironchest:model/ironchest" "texture": "ironchest:model/iron_chest"
} }
}, },
"gold": { "gold": {
"textures": { "textures": {
"particle": "ironchest:blocks/goldbreak", "particle": "ironchest:blocks/gold_break",
"texture": "ironchest:model/goldchest" "texture": "ironchest:model/gold_chest"
} }
}, },
"diamond": { "diamond": {
"textures": { "textures": {
"particle": "ironchest:blocks/diamondbreak", "particle": "ironchest:blocks/diamond_break",
"texture": "ironchest:model/diamondchest" "texture": "ironchest:model/diamond_chest"
} }
}, },
"copper": { "copper": {
"textures": { "textures": {
"particle": "ironchest:blocks/copperbreak", "particle": "ironchest:blocks/copper_break",
"texture": "ironchest:model/copperchest" "texture": "ironchest:model/copper_chest"
} }
}, },
"silver": { "silver": {
"textures": { "textures": {
"particle": "ironchest:blocks/silverbreak", "particle": "ironchest:blocks/silver_break",
"texture": "ironchest:model/silverchest" "texture": "ironchest:model/silver_chest"
} }
}, },
"crystal": { "crystal": {
"textures": { "textures": {
"particle": "ironchest:blocks/crystalbreak", "particle": "ironchest:blocks/crystal_break",
"texture": "ironchest:model/crystalchest" "texture": "ironchest:model/crystal_chest"
} }
}, },
"obsidian": { "obsidian": {
"textures": { "textures": {
"particle": "minecraft:blocks/obsidian", "particle": "minecraft:blocks/obsidian",
"texture": "ironchest:model/obsidianchest" "texture": "ironchest:model/obsidian_chest"
} }
}, },
"dirtchest9000": { "dirtchest9000": {
"textures": { "textures": {
"particle": "minecraft:blocks/dirt", "particle": "minecraft:blocks/dirt",
"texture": "ironchest:model/dirtchest" "texture": "ironchest:model/dirt_chest"
} }
}, },
"wood": { "wood": {

View File

@ -0,0 +1,56 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"variant": {
"copper_silver_upgrade": {
"textures": {
"layer0": "ironchest:items/copper_silver_upgrade"
}
},
"diamond_crystal_upgrade": {
"textures": {
"layer0": "ironchest:items/diamond_crystal_upgrade"
}
},
"diamond_obsidian_upgrade": {
"textures": {
"layer0": "ironchest:items/diamond_obsidian_upgrade"
}
},
"gold_diamond_upgrade": {
"textures": {
"layer0": "ironchest:items/gold_diamond_upgrade"
}
},
"iron_gold_upgrade": {
"textures": {
"layer0": "ironchest:items/iron_gold_upgrade"
}
},
"silver_gold_upgrade": {
"textures": {
"layer0": "ironchest:items/silver_gold_upgrade"
}
},
"wood_copper_upgrade": {
"textures": {
"layer0": "ironchest:items/wood_copper_upgrade"
}
},
"wood_iron_upgrade": {
"textures": {
"layer0": "ironchest:items/wood_iron_upgrade"
}
},
"copper_iron_upgrade": {
"textures": {
"layer0": "ironchest:items/copper_iron_upgrade"
}
}
}
}
}

View File

@ -0,0 +1,25 @@
tile.ironchest:IRON.name=Vas láda
tile.ironchest:GOLD.name=Arany láda
tile.ironchest:DIAMOND.name=Gyémánt láda
tile.ironchest:COPPER.name=Réz láda
tile.ironchest:SILVER.name=Ezüst láda
tile.ironchest:CRYSTAL.name=Kristály láda
tile.ironchest:OBSIDIAN.name=Obszidián láda
tile.ironchest:DIRTCHEST9000.name=DirtChest 9000!
item.ironchest:IRONGOLD.name=Vasról arany ládára bővítő
item.ironchest:GOLDDIAMOND.name=Aranyról gyémánt ládára bővítő
item.ironchest:COPPERSILVER.name=Rézről ezüst ládára bővítő
item.ironchest:SILVERGOLD.name=Ezüstről arany ládára bővítő
item.ironchest:COPPERIRON.name=Részről vas ládára bővítő
item.ironchest:DIAMONDCRYSTAL.name=Gyémántról kristály ládára bővítő
item.ironchest:WOODIRON.name=Normálról (fa) vas ládára bővítő
item.ironchest:WOODCOPPER.name=Normálról (fa) réz ládára bővítő
item.ironchest:DIAMONDOBSIDIAN.name=Gyémántról obszidián ládára bővítő
book.ironchest:dirtchest9000.title=Hogyan használd a DirtChest 9000-et!
book.ironchest:dirtchest9000.page1=Üdvözöl az új DirtChest 9000! Reméljük sok boldog évig élvezni fogod egy halom föld tárólásának eme vadiúj módját.
book.ironchest:dirtchest9000.page2=Használat: egyszerűen pakolj bele egy halom földet eme különlegesen érzékeny tárolóegységbe és élvezd a kényelmet, hogy egy halom föld mindig rendelkezésedre fog állni, bármikor nyitod is ki ezt a ládát.
book.ironchest:dirtchest9000.page3=Reméljük, hogy élvezted eme kézikönyv olvasgatását, és megfontolod más termékünk használatát is a jövöben. Üdvözlettel: A DirtChest 9000 kézikönyv írói.
book.ironchest:dirtchest9000.page4=Garancia: Ez a termék nem rendelkezik semmiféle garanciával. A belepakolt föld lehet, hogy nem is kerül tárolásra, elszivárog a környezetbe, vagy az is lehetséges hogy nem történik vele semmi.
book.ironchest:dirtchest9000.page5=A DirtChest 9000 környezetbarát termék. Kérjül fokozottan ügyelj erre a kézikönyv megsemmisitésekor, és semmiképpen se dobd lávába. Akkor ugyanis nagyon szomorúak leszünk.

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/block", "parent": "block/block",
"textures": { "textures": {
"texture": "ironchest:model/copperchest" "texture": "ironchest:model/copper_chest"
}, },
"elements": [ "elements": [
{ "from": [ 1, 0, 1 ], { "from": [ 1, 0, 1 ],

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View File

Before

Width:  |  Height:  |  Size: 466 B

After

Width:  |  Height:  |  Size: 466 B

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 526 B

View File

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 526 B

View File

Before

Width:  |  Height:  |  Size: 542 B

After

Width:  |  Height:  |  Size: 542 B

View File

Before

Width:  |  Height:  |  Size: 540 B

After

Width:  |  Height:  |  Size: 540 B

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB