Merge pull request #68 from LatvianModder/master
Cleanup and Rewrite of IronChests.
This commit is contained in:
commit
86594d371e
|
@ -4,22 +4,17 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
import cpw.mods.ironchest.client.IronChestTextureHandler;
|
|
||||||
import net.minecraft.block.BlockContainer;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -37,17 +32,16 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockIronChest extends BlockContainer
|
public class BlockIronChest extends Block
|
||||||
{
|
{
|
||||||
public static final PropertyEnum<IronChestType> VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
public static final PropertyEnum<IronChestType> VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
||||||
protected static final AxisAlignedBB IRON_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
|
protected static final AxisAlignedBB IRON_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
|
||||||
|
@ -55,6 +49,7 @@ public class BlockIronChest extends BlockContainer
|
||||||
public BlockIronChest()
|
public BlockIronChest()
|
||||||
{
|
{
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
|
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "BlockIronChest"));
|
||||||
|
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
|
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
|
||||||
|
|
||||||
|
@ -114,16 +109,22 @@ public class BlockIronChest extends BlockContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metadata)
|
public boolean hasTileEntity(IBlockState state)
|
||||||
{
|
{
|
||||||
return IronChestType.makeEntity(metadata);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(World world, IBlockState state)
|
||||||
|
{
|
||||||
|
return state.getValue(VARIANT_PROP).makeEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@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)
|
||||||
{
|
{
|
||||||
for (IronChestType type : IronChestType.values())
|
for (IronChestType type : IronChestType.VALUES)
|
||||||
{
|
{
|
||||||
if (type.isValidForCreativeMode())
|
if (type.isValidForCreativeMode())
|
||||||
{
|
{
|
||||||
|
@ -135,7 +136,7 @@ public class BlockIronChest extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta)
|
||||||
{
|
{
|
||||||
return this.getDefaultState().withProperty(VARIANT_PROP, IronChestType.values()[meta]);
|
return this.getDefaultState().withProperty(VARIANT_PROP, IronChestType.VALUES[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,17 +148,7 @@ public class BlockIronChest extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState()
|
||||||
{
|
{
|
||||||
return new BlockStateContainer(this, new IProperty<?>[] { VARIANT_PROP });
|
return new BlockStateContainer(this, VARIANT_PROP);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
|
||||||
{
|
|
||||||
ArrayList<ItemStack> items = Lists.newArrayList();
|
|
||||||
ItemStack stack = new ItemStack(this, 1, this.getMetaFromState(state));
|
|
||||||
IronChestType.values()[IronChestType.validateMeta(this.getMetaFromState(state))].adornItemDrop(stack);
|
|
||||||
items.add(stack);
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -170,30 +161,12 @@ public class BlockIronChest extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack)
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack)
|
||||||
{
|
{
|
||||||
byte chestFacing = 0;
|
|
||||||
int facing = MathHelper.floor_double((entityliving.rotationYaw * 4F) / 360F + 0.5D) & 3;
|
|
||||||
if (facing == 0)
|
|
||||||
{
|
|
||||||
chestFacing = 2;
|
|
||||||
}
|
|
||||||
if (facing == 1)
|
|
||||||
{
|
|
||||||
chestFacing = 5;
|
|
||||||
}
|
|
||||||
if (facing == 2)
|
|
||||||
{
|
|
||||||
chestFacing = 3;
|
|
||||||
}
|
|
||||||
if (facing == 3)
|
|
||||||
{
|
|
||||||
chestFacing = 4;
|
|
||||||
}
|
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
if (te != null && te instanceof TileEntityIronChest)
|
if (te != null && te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
TileEntityIronChest teic = (TileEntityIronChest) te;
|
TileEntityIronChest teic = (TileEntityIronChest) te;
|
||||||
teic.wasPlaced(entityliving, itemStack);
|
teic.wasPlaced(entityliving, itemStack);
|
||||||
teic.setFacing(chestFacing);
|
teic.setFacing(entityliving.getHorizontalFacing().getOpposite());
|
||||||
world.notifyBlockUpdate(pos, blockState, blockState, 3);
|
world.notifyBlockUpdate(pos, blockState, blockState, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +174,7 @@ public class BlockIronChest extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state)
|
public int damageDropped(IBlockState state)
|
||||||
{
|
{
|
||||||
return IronChestType.validateMeta(state.getValue(VARIANT_PROP).ordinal());
|
return state.getValue(VARIANT_PROP).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -268,22 +241,6 @@ public class BlockIronChest extends BlockContainer
|
||||||
return super.getExplosionResistance(world, pos, exploder, explosion);
|
return super.getExplosionResistance(world, pos, exploder, explosion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer)
|
|
||||||
{
|
|
||||||
IronChestTextureHandler.addHitEffects(worldObj, target.getBlockPos(), target.sideHit);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer)
|
|
||||||
{
|
|
||||||
IronChestTextureHandler.addDestroyEffects(world, pos, world.getBlockState(pos));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride(IBlockState state)
|
public boolean hasComparatorInputOverride(IBlockState state)
|
||||||
{
|
{
|
||||||
|
@ -328,4 +285,12 @@ public class BlockIronChest extends BlockContainer
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
|
||||||
|
{
|
||||||
|
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
||||||
|
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||||
|
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 cpw. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
|
* Copyright (c) 2012 cpw. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
|
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors: cpw - initial API and implementation
|
* Contributors: cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
@ -15,78 +15,58 @@ import static cpw.mods.ironchest.IronChestType.OBSIDIAN;
|
||||||
import static cpw.mods.ironchest.IronChestType.SILVER;
|
import static cpw.mods.ironchest.IronChestType.SILVER;
|
||||||
import static cpw.mods.ironchest.IronChestType.WOOD;
|
import static cpw.mods.ironchest.IronChestType.WOOD;
|
||||||
|
|
||||||
import cpw.mods.ironchest.client.ModelHelper;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
|
|
||||||
public enum ChestChangerType
|
public enum ChestChangerType
|
||||||
{
|
{
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "Iron to Gold Chest Upgrade", "mmm", "msm", "mmm"),
|
IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "mmm", "msm", "mmm"),
|
||||||
GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "Gold to Diamond Chest Upgrade", "GGG", "msm", "GGG"),
|
GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "GGG", "msm", "GGG"),
|
||||||
COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "Copper to Silver Chest Upgrade", "mmm", "msm", "mmm"),
|
COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "mmm", "msm", "mmm"),
|
||||||
SILVERGOLD(SILVER, GOLD, "silverGoldUpgrade", "Silver to Gold Chest Upgrade", "mGm", "GsG", "mGm"),
|
SILVERGOLD(SILVER, GOLD, "silverGoldUpgrade", "mGm", "GsG", "mGm"),
|
||||||
COPPERIRON(COPPER, IRON, "copperIronUpgrade", "Copper to Iron Chest Upgrade", "mGm", "GsG", "mGm"),
|
COPPERIRON(COPPER, IRON, "copperIronUpgrade", "mGm", "GsG", "mGm"),
|
||||||
DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamondCrystalUpgrade", "Diamond to Crystal Chest Upgrade", "GGG", "GOG", "GGG"),
|
DIAMONDCRYSTAL(DIAMOND, CRYSTAL, "diamondCrystalUpgrade", "GGG", "GOG", "GGG"),
|
||||||
WOODIRON(WOOD, IRON, "woodIronUpgrade", "Normal chest to Iron Chest Upgrade", "mmm", "msm", "mmm"),
|
WOODIRON(WOOD, IRON, "woodIronUpgrade", "mmm", "msm", "mmm"),
|
||||||
WOODCOPPER(WOOD, COPPER, "woodCopperUpgrade", "Normal chest to Copper Chest Upgrade", "mmm", "msm", "mmm"),
|
WOODCOPPER(WOOD, COPPER, "woodCopperUpgrade", "mmm", "msm", "mmm"),
|
||||||
DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamondObsidianUpgrade", "Diamond to Obsidian Chest Upgrade", "mmm", "mGm", "mmm");
|
DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamondObsidianUpgrade", "mmm", "mGm", "mmm");
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
private IronChestType source;
|
public static final ChestChangerType[] VALUES = values();
|
||||||
private IronChestType target;
|
|
||||||
public String itemName;
|
public final IronChestType source;
|
||||||
public String descriptiveName;
|
public final IronChestType target;
|
||||||
|
public final String itemName;
|
||||||
public ItemChestChanger item;
|
public ItemChestChanger item;
|
||||||
private String[] recipe;
|
private String[] recipe;
|
||||||
|
|
||||||
private ChestChangerType(IronChestType source, IronChestType target, String itemName, String descriptiveName, String... recipe)
|
ChestChangerType(IronChestType source, IronChestType target, String itemName, String... recipe)
|
||||||
{
|
{
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
this.descriptiveName = descriptiveName;
|
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IronChestType getSource()
|
|
||||||
{
|
|
||||||
return this.source;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canUpgrade(IronChestType from)
|
public boolean canUpgrade(IronChestType from)
|
||||||
{
|
{
|
||||||
return from == this.source;
|
return from == this.source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTarget()
|
|
||||||
{
|
|
||||||
return this.target.ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemChestChanger buildItem()
|
public ItemChestChanger buildItem()
|
||||||
{
|
{
|
||||||
this.item = new ItemChestChanger(this);
|
this.item = new ItemChestChanger(this);
|
||||||
this.item.setRegistryName(this.itemName);
|
this.item.setRegistryName(this.itemName);
|
||||||
|
|
||||||
GameRegistry.register(this.item);
|
GameRegistry.register(this.item);
|
||||||
|
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
|
||||||
{
|
|
||||||
ModelHelper.registerItem(this.item, "ironchest:" + this.itemName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.item;
|
return this.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipes()
|
public void addRecipes()
|
||||||
{
|
{
|
||||||
for (String sourceMat : this.source.getMatList())
|
for (String sourceMat : this.source.matList)
|
||||||
{
|
{
|
||||||
for (String targetMat : this.target.getMatList())
|
for (String targetMat : this.target.matList)
|
||||||
{
|
{
|
||||||
Object targetMaterial = IronChestType.translateOreName(targetMat);
|
Object targetMaterial = IronChestType.translateOreName(targetMat);
|
||||||
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
|
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
|
||||||
|
@ -99,7 +79,7 @@ public enum ChestChangerType
|
||||||
|
|
||||||
public static void buildItems()
|
public static void buildItems()
|
||||||
{
|
{
|
||||||
for (ChestChangerType type : values())
|
for (ChestChangerType type : VALUES)
|
||||||
{
|
{
|
||||||
type.buildItem();
|
type.buildItem();
|
||||||
}
|
}
|
||||||
|
@ -107,7 +87,7 @@ public enum ChestChangerType
|
||||||
|
|
||||||
public static void generateRecipes()
|
public static void generateRecipes()
|
||||||
{
|
{
|
||||||
for (ChestChangerType item : values())
|
for (ChestChangerType item : VALUES)
|
||||||
{
|
{
|
||||||
item.addRecipes();
|
item.addRecipes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -20,12 +20,6 @@ public class CommonProxy implements IGuiHandler
|
||||||
{
|
{
|
||||||
public void registerRenderInformation()
|
public void registerRenderInformation()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends TileEntityIronChest> void registerTileEntitySpecialRenderer(Class<T> typ)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,10 +42,4 @@ public class CommonProxy implements IGuiHandler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public World getClientWorld()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class ContainerIronChest extends Container
|
||||||
public ItemStack transferStackInSlot(EntityPlayer p, int i)
|
public ItemStack transferStackInSlot(EntityPlayer p, int i)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
Slot slot = (Slot) this.inventorySlots.get(i);
|
Slot slot = this.inventorySlots.get(i);
|
||||||
if (slot != null && slot.getHasStack())
|
if (slot != null && slot.getHasStack())
|
||||||
{
|
{
|
||||||
ItemStack itemstack1 = slot.getStack();
|
ItemStack itemstack1 = slot.getStack();
|
||||||
|
@ -93,9 +93,9 @@ public class ContainerIronChest extends Container
|
||||||
{
|
{
|
||||||
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
|
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
|
||||||
{
|
{
|
||||||
for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++)
|
for (int chestCol = 0; chestCol < type.rowLength; chestCol++)
|
||||||
{
|
{
|
||||||
this.addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
|
this.addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.rowLength, 12 + chestCol * 18, 8 + chestRow * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,6 @@ public class ContainerIronChest extends Container
|
||||||
@ChestContainer.RowSizeCallback
|
@ChestContainer.RowSizeCallback
|
||||||
public int getNumColumns()
|
public int getNumColumns()
|
||||||
{
|
{
|
||||||
return this.type.getRowLength();
|
return this.type.rowLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,66 +4,68 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import cpw.mods.ironchest.client.IronChestEventHandler;
|
import cpw.mods.ironchest.client.IronChestEventHandler;
|
||||||
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.FMLInitializationEvent;
|
|
||||||
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.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[12.16.0.1819,)", acceptedMinecraftVersions = "[1.9]")
|
@Mod(modid = IronChest.MOD_ID, name = "Iron Chests", dependencies = "required-after:Forge@[12.16.0.1819,)", acceptedMinecraftVersions = "[1.9]")
|
||||||
public class IronChest
|
public class IronChest
|
||||||
{
|
{
|
||||||
public static BlockIronChest ironChestBlock;
|
public static final String MOD_ID = "IronChest";
|
||||||
public static ItemIronChest ironChestItemBlock;
|
|
||||||
|
@Instance(IronChest.MOD_ID)
|
||||||
|
public static IronChest instance;
|
||||||
|
|
||||||
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
@Instance("IronChest")
|
|
||||||
public static IronChest instance;
|
public static BlockIronChest ironChestBlock;
|
||||||
|
public static ItemIronChest ironChestItemBlock;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event)
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
Version.init(event.getVersionProperties());
|
Properties properties = event.getVersionProperties();
|
||||||
event.getModMetadata().version = Version.fullVersionString();
|
|
||||||
}
|
if (properties != null)
|
||||||
|
{
|
||||||
|
String major = properties.getProperty("IronChest.build.major.number");
|
||||||
|
String minor = properties.getProperty("IronChest.build.minor.number");
|
||||||
|
String rev = properties.getProperty("IronChest.build.revision.number");
|
||||||
|
String build = properties.getProperty("IronChest.build.number");
|
||||||
|
// String mcversion = properties.getProperty("IronChest.build.mcversion");
|
||||||
|
event.getModMetadata().version = String.format("%s.%s.%s build %s", major, minor, rev, build);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void load(FMLInitializationEvent evt)
|
|
||||||
{
|
|
||||||
// Registration has been moved to init to account for the registration of inventory models
|
|
||||||
// Minecraft.getRenderItem() returns null before this stage
|
|
||||||
ChestChangerType.buildItems();
|
ChestChangerType.buildItems();
|
||||||
ironChestBlock = new BlockIronChest();
|
ironChestBlock = GameRegistry.register(new BlockIronChest());
|
||||||
ironChestItemBlock = new ItemIronChest(ironChestBlock);
|
ironChestItemBlock = GameRegistry.register(new ItemIronChest(ironChestBlock));
|
||||||
|
|
||||||
ironChestBlock.setRegistryName("BlockIronChest");
|
|
||||||
ironChestItemBlock.setRegistryName("BlockIronChest");
|
|
||||||
|
|
||||||
GameRegistry.register(ironChestBlock);
|
|
||||||
GameRegistry.register(ironChestItemBlock);
|
GameRegistry.register(ironChestItemBlock);
|
||||||
|
|
||||||
for (IronChestType typ : IronChestType.values())
|
for (IronChestType typ : IronChestType.VALUES)
|
||||||
{
|
{
|
||||||
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest." + typ.name(), typ.name());
|
GameRegistry.registerTileEntity(typ.clazz, "IronChest." + typ.name());
|
||||||
proxy.registerTileEntitySpecialRenderer(typ.clazz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
||||||
ChestChangerType.generateRecipes();
|
ChestChangerType.generateRecipes();
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||||
proxy.registerRenderInformation();
|
proxy.registerRenderInformation();
|
||||||
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
// FIXME: MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(IronChestEventHandler.INSTANCE);
|
MinecraftForge.EVENT_BUS.register(IronChestEventHandler.INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
@ -21,94 +21,77 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagByte;
|
import net.minecraft.nbt.NBTTagByte;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
|
||||||
public enum IronChestType implements IStringSerializable
|
public enum IronChestType implements IStringSerializable
|
||||||
{
|
{
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
IRON(54, 9, true, "Iron Chest", "ironchest.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
|
IRON(54, 9, true, "ironchest.png", Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
|
||||||
GOLD(81, 9, true, "Gold Chest", "goldchest.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
|
GOLD(81, 9, true, "goldchest.png", Collections.singleton("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
|
||||||
DIAMOND(108, 12, true, "Diamond Chest", "diamondchest.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
DIAMOND(108, 12, true, "diamondchest.png", Collections.singleton("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
||||||
COPPER(45, 9, false, "Copper Chest", "copperchest.png", 3, Arrays.asList("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"),
|
COPPER(45, 9, false, "copperchest.png", Collections.singleton("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"),
|
||||||
SILVER(72, 9, false, "Silver Chest", "silverchest.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
|
SILVER(72, 9, false, "silverchest.png", Collections.singleton("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
|
||||||
CRYSTAL(108, 12, true, "Crystal Chest", "crystalchest.png", 5, Arrays.asList("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"),
|
CRYSTAL(108, 12, true, "crystalchest.png", Collections.singleton("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"),
|
||||||
OBSIDIAN(108, 12, false, "Obsidian Chest", "obsidianchest.png", 6, Arrays.asList("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"),
|
OBSIDIAN(108, 12, false, "obsidianchest.png", Collections.singleton("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"),
|
||||||
DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "dirtchest.png", 7, Arrays.asList("dirt"), TileEntityDirtChest.class, Item.getItemFromBlock(Blocks.DIRT), "mmmmCmmmm"),
|
DIRTCHEST9000(1, 1, false, "dirtchest.png", Collections.singleton("dirt"), TileEntityDirtChest.class, "mmmmCmmmm"),
|
||||||
WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
|
WOOD(0, 0, false, "", Collections.singleton("plankWood"), null);
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
int size;
|
|
||||||
private int rowLength;
|
|
||||||
public String friendlyName;
|
|
||||||
private boolean tieredChest;
|
|
||||||
private String modelTexture;
|
|
||||||
private int textureRow;
|
|
||||||
public Class<? extends TileEntityIronChest> clazz;
|
|
||||||
private String[] recipes;
|
|
||||||
private ArrayList<String> matList;
|
|
||||||
private Item itemFilter;
|
|
||||||
|
|
||||||
IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String modelTexture, int textureRow, List<String> mats,
|
public static final IronChestType VALUES[] = values();
|
||||||
Class<? extends TileEntityIronChest> clazz, String... recipes)
|
|
||||||
{
|
|
||||||
this(size, rowLength, tieredChest, friendlyName, modelTexture, textureRow, mats, clazz, (Item) null, recipes);
|
|
||||||
}
|
|
||||||
|
|
||||||
IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String modelTexture, int textureRow, List<String> mats,
|
public final String name;
|
||||||
Class<? extends TileEntityIronChest> clazz, Item itemFilter, String... recipes)
|
public final int size;
|
||||||
|
public final int rowLength;
|
||||||
|
public final boolean tieredChest;
|
||||||
|
public final ResourceLocation modelTexture;
|
||||||
|
private String breakTexture;
|
||||||
|
public final Class<? extends TileEntityIronChest> clazz;
|
||||||
|
public final Collection<String> recipes;
|
||||||
|
public final Collection<String> matList;
|
||||||
|
|
||||||
|
IronChestType(int size, int rowLength, boolean tieredChest, String modelTexture, Collection<String> mats, Class<? extends TileEntityIronChest> clazz,
|
||||||
|
String... recipes)
|
||||||
{
|
{
|
||||||
|
this.name = this.name().toLowerCase();
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.rowLength = rowLength;
|
this.rowLength = rowLength;
|
||||||
this.tieredChest = tieredChest;
|
this.tieredChest = tieredChest;
|
||||||
this.friendlyName = friendlyName;
|
this.modelTexture = new ResourceLocation("ironchest", "textures/model/" + modelTexture);
|
||||||
this.modelTexture = modelTexture;
|
this.matList = Collections.unmodifiableCollection(mats);
|
||||||
this.textureRow = textureRow;
|
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
this.itemFilter = itemFilter;
|
this.recipes = Collections.unmodifiableCollection(Arrays.asList(recipes));
|
||||||
this.recipes = recipes;
|
}
|
||||||
this.matList = new ArrayList<String>();
|
|
||||||
this.matList.addAll(mats);
|
public String getBreakTexture()
|
||||||
|
{
|
||||||
|
if (this.breakTexture == null)
|
||||||
|
{
|
||||||
|
switch (this)
|
||||||
|
{
|
||||||
|
case DIRTCHEST9000:
|
||||||
|
{
|
||||||
|
this.breakTexture = "minecraft:blocks/dirt";
|
||||||
|
}
|
||||||
|
case OBSIDIAN:
|
||||||
|
{
|
||||||
|
this.breakTexture = "minecraft:blocks/obsidian";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
this.breakTexture = "ironchest:blocks/" + this.getName() + "break";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.breakTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name().toLowerCase();
|
return this.name;
|
||||||
}
|
|
||||||
|
|
||||||
public String getModelTexture()
|
|
||||||
{
|
|
||||||
return this.modelTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTextureRow()
|
|
||||||
{
|
|
||||||
return this.textureRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileEntityIronChest makeEntity(int metadata)
|
|
||||||
{
|
|
||||||
// Compatibility
|
|
||||||
int chesttype = validateMeta(metadata);
|
|
||||||
if (chesttype == metadata)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
TileEntityIronChest te = values()[chesttype].clazz.newInstance();
|
|
||||||
return te;
|
|
||||||
}
|
|
||||||
catch (InstantiationException e)
|
|
||||||
{
|
|
||||||
// unpossible
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e)
|
|
||||||
{
|
|
||||||
// unpossible
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
||||||
|
@ -136,15 +119,12 @@ public enum IronChestType implements IStringSerializable
|
||||||
{
|
{
|
||||||
mainMaterial = translateOreName(mat);
|
mainMaterial = translateOreName(mat);
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit,
|
addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit, 'm', mainMaterial, 'P', previousTier, /* previous tier of chest */
|
||||||
'm', mainMaterial, 'P', previousTier, /* previous tier of chest */
|
'G', "blockGlass", 'C', "chestWood", '0', new ItemStack(blockResult, 1, 0), /* Iron Chest */
|
||||||
'G', "blockGlass", 'C', "chestWood",
|
|
||||||
'0', new ItemStack(blockResult, 1, 0), /* Iron Chest */
|
|
||||||
'1', new ItemStack(blockResult, 1, 1), /* Gold Chest */
|
'1', new ItemStack(blockResult, 1, 1), /* Gold Chest */
|
||||||
'2', new ItemStack(blockResult, 1, 2), /* Diamond Chest */
|
'2', new ItemStack(blockResult, 1, 2), /* Diamond Chest */
|
||||||
'3', new ItemStack(blockResult, 1, 3), /* Copper Chest */
|
'3', new ItemStack(blockResult, 1, 3), /* Copper Chest */
|
||||||
'4', new ItemStack(blockResult, 1, 4) /* Silver Chest */
|
'4', new ItemStack(blockResult, 1, 4) /* Silver Chest */);
|
||||||
);
|
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,36 +154,14 @@ public enum IronChestType implements IStringSerializable
|
||||||
return this.size / this.rowLength;
|
return this.size / this.rowLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRowLength()
|
|
||||||
{
|
|
||||||
return this.rowLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTransparent()
|
public boolean isTransparent()
|
||||||
{
|
{
|
||||||
return this == CRYSTAL;
|
return this == CRYSTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getMatList()
|
|
||||||
{
|
|
||||||
return this.matList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int validateMeta(int i)
|
|
||||||
{
|
|
||||||
if (i < values().length && values()[i].size > 0)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidForCreativeMode()
|
public boolean isValidForCreativeMode()
|
||||||
{
|
{
|
||||||
return validateMeta(this.ordinal()) == this.ordinal();
|
return this != WOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExplosionResistant()
|
public boolean isExplosionResistant()
|
||||||
|
@ -216,9 +174,16 @@ public enum IronChestType implements IStringSerializable
|
||||||
return new ValidatingSlot(chestInventory, index, x, y, this);
|
return new ValidatingSlot(chestInventory, index, x, y, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Item DIRT_ITEM = Item.getItemFromBlock(Blocks.DIRT);
|
||||||
|
|
||||||
public boolean acceptsStack(ItemStack itemstack)
|
public boolean acceptsStack(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
return this.itemFilter == null || itemstack == null || itemstack.getItem() == this.itemFilter;
|
if (this == DIRTCHEST9000)
|
||||||
|
{
|
||||||
|
return itemstack == null || itemstack.getItem() == DIRT_ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adornItemDrop(ItemStack item)
|
public void adornItemDrop(ItemStack item)
|
||||||
|
@ -228,4 +193,29 @@ public enum IronChestType implements IStringSerializable
|
||||||
item.setTagInfo("dirtchest", new NBTTagByte((byte) 1));
|
item.setTagInfo("dirtchest", new NBTTagByte((byte) 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TileEntityIronChest makeEntity()
|
||||||
|
{
|
||||||
|
switch (this)
|
||||||
|
{
|
||||||
|
case IRON:
|
||||||
|
return new TileEntityIronChest();
|
||||||
|
case GOLD:
|
||||||
|
return new TileEntityGoldChest();
|
||||||
|
case DIAMOND:
|
||||||
|
return new TileEntityDiamondChest();
|
||||||
|
case COPPER:
|
||||||
|
return new TileEntityCopperChest();
|
||||||
|
case SILVER:
|
||||||
|
return new TileEntitySilverChest();
|
||||||
|
case CRYSTAL:
|
||||||
|
return new TileEntityCrystalChest();
|
||||||
|
case OBSIDIAN:
|
||||||
|
return new TileEntityObsidianChest();
|
||||||
|
case DIRTCHEST9000:
|
||||||
|
return new TileEntityDirtChest();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -26,12 +26,11 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemChestChanger extends Item
|
public class ItemChestChanger extends Item
|
||||||
{
|
{
|
||||||
private ChestChangerType type;
|
public final ChestChangerType type;
|
||||||
|
|
||||||
public ItemChestChanger(ChestChangerType type)
|
public ItemChestChanger(ChestChangerType type)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
this.setUnlocalizedName("ironchest:" + type.name());
|
this.setUnlocalizedName("ironchest:" + type.name());
|
||||||
this.setCreativeTab(CreativeTabs.MISC);
|
this.setCreativeTab(CreativeTabs.MISC);
|
||||||
|
@ -56,7 +55,7 @@ public class ItemChestChanger extends Item
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (worldIn.getBlockState(pos) != IronChest.ironChestBlock
|
if (worldIn.getBlockState(pos) != IronChest.ironChestBlock
|
||||||
.getStateFromMeta(IronChestType.valueOf(this.type.getSource().getName().toUpperCase()).ordinal()))
|
.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||||
{
|
{
|
||||||
return EnumActionResult.PASS;
|
return EnumActionResult.PASS;
|
||||||
}
|
}
|
||||||
|
@ -64,14 +63,14 @@ public class ItemChestChanger extends Item
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||||
ItemStack[] chestContents = new ItemStack[27];
|
ItemStack[] chestContents = new ItemStack[27];
|
||||||
int chestFacing = 0;
|
EnumFacing chestFacing = EnumFacing.DOWN;
|
||||||
if (te != null)
|
if (te != null)
|
||||||
{
|
{
|
||||||
if (te instanceof TileEntityIronChest)
|
if (te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
chestContents = ((TileEntityIronChest) te).chestContents;
|
chestContents = ((TileEntityIronChest) te).chestContents;
|
||||||
chestFacing = ((TileEntityIronChest) te).getFacing();
|
chestFacing = ((TileEntityIronChest) te).getFacing();
|
||||||
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
|
newchest = this.type.target.makeEntity();
|
||||||
if (newchest == null)
|
if (newchest == null)
|
||||||
{
|
{
|
||||||
return EnumActionResult.PASS;
|
return EnumActionResult.PASS;
|
||||||
|
@ -80,37 +79,23 @@ public class ItemChestChanger extends Item
|
||||||
else if (te instanceof TileEntityChest)
|
else if (te instanceof TileEntityChest)
|
||||||
{
|
{
|
||||||
IBlockState chestState = worldIn.getBlockState(pos);
|
IBlockState chestState = worldIn.getBlockState(pos);
|
||||||
EnumFacing orientation = chestState.getValue(BlockChest.FACING);
|
chestFacing = chestState.getValue(BlockChest.FACING);
|
||||||
if (orientation == EnumFacing.NORTH)
|
TileEntityChest chest = (TileEntityChest) te;
|
||||||
{
|
|
||||||
chestFacing = 2;
|
if (chest.numPlayersUsing > 0)
|
||||||
}
|
|
||||||
if (orientation == EnumFacing.EAST)
|
|
||||||
{
|
|
||||||
chestFacing = 5;
|
|
||||||
}
|
|
||||||
if (orientation == EnumFacing.SOUTH)
|
|
||||||
{
|
|
||||||
chestFacing = 3;
|
|
||||||
}
|
|
||||||
if (orientation == EnumFacing.WEST)
|
|
||||||
{
|
|
||||||
chestFacing = 4;
|
|
||||||
}
|
|
||||||
if (((TileEntityChest) te).numPlayersUsing > 0)
|
|
||||||
{
|
{
|
||||||
return EnumActionResult.PASS;
|
return EnumActionResult.PASS;
|
||||||
}
|
}
|
||||||
if (!this.getType().canUpgrade(IronChestType.WOOD))
|
if (!this.type.canUpgrade(IronChestType.WOOD))
|
||||||
{
|
{
|
||||||
return EnumActionResult.PASS;
|
return EnumActionResult.PASS;
|
||||||
}
|
}
|
||||||
chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
|
chestContents = new ItemStack[chest.getSizeInventory()];
|
||||||
for (int i = 0; i < chestContents.length; i++)
|
for (int i = 0; i < chestContents.length; i++)
|
||||||
{
|
{
|
||||||
chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
|
chestContents[i] = chest.getStackInSlot(i);
|
||||||
}
|
}
|
||||||
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
|
newchest = this.type.target.makeEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +108,7 @@ public class ItemChestChanger extends Item
|
||||||
worldIn.removeTileEntity(pos);
|
worldIn.removeTileEntity(pos);
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
|
|
||||||
IBlockState iblockstate = IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal());
|
IBlockState iblockstate = IronChest.ironChestBlock.getDefaultState().withProperty(BlockIronChest.VARIANT_PROP, type.target);
|
||||||
|
|
||||||
worldIn.setTileEntity(pos, newchest);
|
worldIn.setTileEntity(pos, newchest);
|
||||||
worldIn.setBlockState(pos, iblockstate, 3);
|
worldIn.setBlockState(pos, iblockstate, 3);
|
||||||
|
@ -134,20 +119,10 @@ public class ItemChestChanger extends Item
|
||||||
if (te2 instanceof TileEntityIronChest)
|
if (te2 instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
((TileEntityIronChest) te2).setContents(chestContents);
|
((TileEntityIronChest) te2).setContents(chestContents);
|
||||||
((TileEntityIronChest) te2).setFacing((byte) chestFacing);
|
((TileEntityIronChest) te2).setFacing(chestFacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.stackSize = playerIn.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
|
stack.stackSize = playerIn.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTargetChestOrdinal(int sourceOrdinal)
|
|
||||||
{
|
|
||||||
return this.type.getTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChestChangerType getType()
|
|
||||||
{
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,21 +4,23 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class ItemIronChest extends ItemBlock
|
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.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
this.setHasSubtypes(true);
|
this.setHasSubtypes(true);
|
||||||
|
@ -27,12 +29,12 @@ public class ItemIronChest extends ItemBlock
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(int meta)
|
public int getMetadata(int meta)
|
||||||
{
|
{
|
||||||
return IronChestType.validateMeta(meta);
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack itemstack)
|
public String getUnlocalizedName(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
return "tile.ironchest:" + IronChestType.values()[itemstack.getMetadata()].name();
|
return "tile.ironchest:" + IronChestType.VALUES[itemstack.getMetadata()].name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
public class OcelotsSitOnChestsHandler
|
public class OcelotsSitOnChestsHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -16,5 +16,4 @@ public class TileEntityCopperChest extends TileEntityIronChest
|
||||||
{
|
{
|
||||||
super(IronChestType.COPPER);
|
super(IronChestType.COPPER);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -16,4 +16,4 @@ public class TileEntityCrystalChest extends TileEntityIronChest
|
||||||
{
|
{
|
||||||
super(IronChestType.CRYSTAL);
|
super(IronChestType.CRYSTAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -16,4 +16,4 @@ public class TileEntityDiamondChest extends TileEntityIronChest
|
||||||
{
|
{
|
||||||
super(IronChestType.DIAMOND);
|
super(IronChestType.DIAMOND);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,4 +46,4 @@ public class TileEntityDirtChest extends TileEntityIronChest
|
||||||
this.chestContents[0] = null;
|
this.chestContents[0] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
@ -40,10 +40,9 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
public float prevLidAngle;
|
public float prevLidAngle;
|
||||||
public float lidAngle;
|
public float lidAngle;
|
||||||
private int numUsingPlayers;
|
private int numUsingPlayers;
|
||||||
private IronChestType type;
|
|
||||||
public ItemStack[] chestContents;
|
public ItemStack[] chestContents;
|
||||||
private ItemStack[] topStacks;
|
private ItemStack[] topStacks;
|
||||||
private byte facing;
|
private EnumFacing facing;
|
||||||
private boolean inventoryTouched;
|
private boolean inventoryTouched;
|
||||||
private boolean hadStuff;
|
private boolean hadStuff;
|
||||||
private String customName;
|
private String customName;
|
||||||
|
@ -56,19 +55,14 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
protected TileEntityIronChest(IronChestType type)
|
protected TileEntityIronChest(IronChestType type)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.type = type;
|
this.chestContents = new ItemStack[type.size];
|
||||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
|
||||||
this.topStacks = new ItemStack[8];
|
this.topStacks = new ItemStack[8];
|
||||||
}
|
this.facing = EnumFacing.NORTH;
|
||||||
|
|
||||||
public ItemStack[] getContents()
|
|
||||||
{
|
|
||||||
return this.chestContents;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContents(ItemStack[] contents)
|
public void setContents(ItemStack[] contents)
|
||||||
{
|
{
|
||||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
this.chestContents = new ItemStack[this.getType().size];
|
||||||
for (int i = 0; i < contents.length; i++)
|
for (int i = 0; i < contents.length; i++)
|
||||||
{
|
{
|
||||||
if (i < this.chestContents.length)
|
if (i < this.chestContents.length)
|
||||||
|
@ -82,17 +76,17 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory()
|
||||||
{
|
{
|
||||||
return this.type.size;
|
return this.chestContents.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFacing()
|
public EnumFacing getFacing()
|
||||||
{
|
{
|
||||||
return this.facing;
|
return this.facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IronChestType getType()
|
public IronChestType getType()
|
||||||
{
|
{
|
||||||
return this.type;
|
return this.hasWorldObj() ? this.worldObj.getBlockState(this.pos).getValue(BlockIronChest.VARIANT_PROP) : IronChestType.WOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,7 +105,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
|
|
||||||
protected void sortTopStacks()
|
protected void sortTopStacks()
|
||||||
{
|
{
|
||||||
if (!this.type.isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
|
if (!this.getType().isTransparent() || (this.worldObj != null && this.worldObj.isRemote))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +224,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.hasCustomName() ? this.customName : this.type.name();
|
return this.hasCustomName() ? this.customName : this.getType().name();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -266,7 +260,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.facing = nbttagcompound.getByte("facing");
|
this.facing = EnumFacing.VALUES[nbttagcompound.getByte("facing")];
|
||||||
this.sortTopStacks();
|
this.sortTopStacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +281,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
}
|
}
|
||||||
|
|
||||||
nbttagcompound.setTag("Items", nbttaglist);
|
nbttagcompound.setTag("Items", nbttaglist);
|
||||||
nbttagcompound.setByte("facing", this.facing);
|
nbttagcompound.setByte("facing", (byte) this.facing.ordinal());
|
||||||
|
|
||||||
if (this.hasCustomName())
|
if (this.hasCustomName())
|
||||||
{
|
{
|
||||||
|
@ -339,7 +333,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
|
|
||||||
if (this.worldObj != null && !this.worldObj.isRemote && this.ticksSinceSync < 0)
|
if (this.worldObj != null && !this.worldObj.isRemote && this.ticksSinceSync < 0)
|
||||||
{
|
{
|
||||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 3, ((this.numUsingPlayers << 3) & 0xF8) | (this.facing & 0x7));
|
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 3, ((this.numUsingPlayers << 3) & 0xF8) | (this.facing.ordinal() & 0x7));
|
||||||
}
|
}
|
||||||
if (!this.worldObj.isRemote && this.inventoryTouched)
|
if (!this.worldObj.isRemote && this.inventoryTouched)
|
||||||
{
|
{
|
||||||
|
@ -355,7 +349,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
double d = this.pos.getX() + 0.5D;
|
double d = this.pos.getX() + 0.5D;
|
||||||
double d1 = this.pos.getZ() + 0.5D;
|
double d1 = this.pos.getZ() + 0.5D;
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
this.worldObj.playSound((EntityPlayer) null, d, this.pos.getY() + 0.5D, d1, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
this.worldObj.playSound(null, d, this.pos.getY() + 0.5D, d1, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
}
|
}
|
||||||
if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
|
if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
|
||||||
|
@ -379,7 +373,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
double d2 = this.pos.getX() + 0.5D;
|
double d2 = this.pos.getX() + 0.5D;
|
||||||
double d3 = this.pos.getZ() + 0.5D;
|
double d3 = this.pos.getZ() + 0.5D;
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
this.worldObj.playSound((EntityPlayer) null, d2, this.pos.getY() + 0.5D, d3, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
this.worldObj.playSound(null, d2, this.pos.getY() + 0.5D, d3, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
}
|
}
|
||||||
if (this.lidAngle < 0.0F)
|
if (this.lidAngle < 0.0F)
|
||||||
|
@ -398,11 +392,11 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
}
|
}
|
||||||
else if (i == 2)
|
else if (i == 2)
|
||||||
{
|
{
|
||||||
this.facing = (byte) j;
|
this.facing = EnumFacing.VALUES[j];
|
||||||
}
|
}
|
||||||
else if (i == 3)
|
else if (i == 3)
|
||||||
{
|
{
|
||||||
this.facing = (byte) (j & 0x7);
|
this.facing = EnumFacing.VALUES[j & 0x7];
|
||||||
this.numUsingPlayers = (j & 0xF8) >> 3;
|
this.numUsingPlayers = (j & 0xF8) >> 3;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -430,7 +424,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numUsingPlayers);
|
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 1, this.numUsingPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFacing(byte facing2)
|
public void setFacing(EnumFacing facing2)
|
||||||
{
|
{
|
||||||
this.facing = facing2;
|
this.facing = facing2;
|
||||||
}
|
}
|
||||||
|
@ -440,26 +434,12 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
return this.topStacks;
|
return this.topStacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityIronChest updateFromMetadata(int l)
|
|
||||||
{
|
|
||||||
if (this.worldObj != null && this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
if (l != this.type.ordinal())
|
|
||||||
{
|
|
||||||
this.worldObj.setTileEntity(this.pos, IronChestType.makeEntity(l));
|
|
||||||
return (TileEntityIronChest) this.worldObj.getTileEntity(this.pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet<?> getDescriptionPacket()
|
public Packet<?> getDescriptionPacket()
|
||||||
{
|
{
|
||||||
|
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
nbt.setInteger("type", this.getType().ordinal());
|
nbt.setByte("facing", (byte) this.facing.ordinal());
|
||||||
nbt.setByte("facing", this.facing);
|
|
||||||
ItemStack[] stacks = this.buildItemStackDataList();
|
ItemStack[] stacks = this.buildItemStackDataList();
|
||||||
if (stacks != null)
|
if (stacks != null)
|
||||||
{
|
{
|
||||||
|
@ -486,8 +466,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
if (pkt.getTileEntityType() == 0)
|
if (pkt.getTileEntityType() == 0)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbt = pkt.getNbtCompound();
|
NBTTagCompound nbt = pkt.getNbtCompound();
|
||||||
this.type = IronChestType.values()[nbt.getInteger("type")];
|
this.facing = EnumFacing.VALUES[nbt.getByte("facing")];
|
||||||
this.facing = nbt.getByte("facing");
|
|
||||||
|
|
||||||
NBTTagList tagList = nbt.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
|
NBTTagList tagList = nbt.getTagList("stacks", Constants.NBT.TAG_COMPOUND);
|
||||||
ItemStack[] stacks = new ItemStack[this.topStacks.length];
|
ItemStack[] stacks = new ItemStack[this.topStacks.length];
|
||||||
|
@ -502,7 +481,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type.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.length; i++)
|
||||||
|
@ -523,7 +502,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
|
|
||||||
public ItemStack[] buildItemStackDataList()
|
public ItemStack[] buildItemStackDataList()
|
||||||
{
|
{
|
||||||
if (this.type.isTransparent())
|
if (this.getType().isTransparent())
|
||||||
{
|
{
|
||||||
ItemStack[] sortList = new ItemStack[this.topStacks.length];
|
ItemStack[] sortList = new ItemStack[this.topStacks.length];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -561,18 +540,13 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||||
{
|
{
|
||||||
return this.type.acceptsStack(itemstack);
|
return this.getType().acceptsStack(itemstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotateAround()
|
public void rotateAround()
|
||||||
{
|
{
|
||||||
this.facing++;
|
this.setFacing(this.facing.rotateY());
|
||||||
if (this.facing > EnumFacing.EAST.ordinal())
|
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 2, this.facing.ordinal());
|
||||||
{
|
|
||||||
this.facing = (byte) EnumFacing.NORTH.ordinal();
|
|
||||||
}
|
|
||||||
this.setFacing(this.facing);
|
|
||||||
this.worldObj.addBlockEvent(this.pos, IronChest.ironChestBlock, 2, this.facing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
|
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
|
||||||
|
@ -618,7 +592,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
@Override
|
@Override
|
||||||
public String getGuiID()
|
public String getGuiID()
|
||||||
{
|
{
|
||||||
return "IronChest:" + this.type.name();
|
return "IronChest:" + this.getType().name();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2012 cpw. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
|
|
||||||
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
|
|
||||||
*
|
|
||||||
* Contributors: cpw - initial API and implementation
|
|
||||||
******************************************************************************/
|
|
||||||
package cpw.mods.ironchest;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class Version
|
|
||||||
{
|
|
||||||
private static String major;
|
|
||||||
private static String minor;
|
|
||||||
private static String rev;
|
|
||||||
private static String build;
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static String mcversion;
|
|
||||||
|
|
||||||
static void init(Properties properties)
|
|
||||||
{
|
|
||||||
if (properties != null)
|
|
||||||
{
|
|
||||||
major = properties.getProperty("IronChest.build.major.number");
|
|
||||||
minor = properties.getProperty("IronChest.build.minor.number");
|
|
||||||
rev = properties.getProperty("IronChest.build.revision.number");
|
|
||||||
build = properties.getProperty("IronChest.build.number");
|
|
||||||
mcversion = properties.getProperty("IronChest.build.mcversion");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String fullVersionString()
|
|
||||||
{
|
|
||||||
return String.format("%s.%s.%s build %s", major, minor, rev, build);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,19 +4,17 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest.client;
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
|
import cpw.mods.ironchest.ChestChangerType;
|
||||||
import cpw.mods.ironchest.CommonProxy;
|
import cpw.mods.ironchest.CommonProxy;
|
||||||
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.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.ItemModelMesher;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -24,38 +22,34 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public class ClientProxy extends CommonProxy
|
public class ClientProxy extends CommonProxy
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void registerRenderInformation()
|
public void registerRenderInformation()
|
||||||
{
|
{
|
||||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getBlockModelShapes().registerBuiltInBlocks(IronChest.ironChestBlock);
|
Item chestItem = Item.getItemFromBlock(IronChest.ironChestBlock);
|
||||||
|
|
||||||
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
for (IronChestType type : IronChestType.values())
|
||||||
for (IronChestType chestType : IronChestType.values())
|
|
||||||
{
|
{
|
||||||
if (chestType != IronChestType.WOOD)
|
if (type != IronChestType.WOOD)
|
||||||
{
|
{
|
||||||
Item chestItem = Item.getItemFromBlock(IronChest.ironChestBlock);
|
ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(), new ModelResourceLocation(chestItem.getRegistryName(), "variant=" + type.getName()));
|
||||||
mesher.register(chestItem, chestType.ordinal(), new ModelResourceLocation("ironchest:chest_" + chestType.getName().toLowerCase(), "inventory"));
|
|
||||||
ModelBakery.registerItemVariants(chestItem, new ResourceLocation("ironchest:chest_" + chestType.getName().toLowerCase()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
for (ChestChangerType type : ChestChangerType.VALUES)
|
||||||
public <T extends TileEntityIronChest> void registerTileEntitySpecialRenderer(Class<T> type)
|
{
|
||||||
{
|
ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "ItemChestUpgrade"), "variant=" + type.itemName.toLowerCase()));
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(type, new TileEntityIronChestRenderer<T>(type));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public World getClientWorld()
|
|
||||||
{
|
|
||||||
return FMLClientHandler.instance().getClient().theWorld;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,18 +4,17 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest.client;
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.ironchest.ContainerIronChest;
|
import cpw.mods.ironchest.ContainerIronChest;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -24,15 +23,17 @@ public class GUIChest extends GuiContainer
|
||||||
{
|
{
|
||||||
public enum ResourceList
|
public enum ResourceList
|
||||||
{
|
{
|
||||||
IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")), COPPER(
|
//@formatter:off
|
||||||
new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")), SILVER(
|
IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")),
|
||||||
new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")), GOLD(
|
COPPER(new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")),
|
||||||
new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")), DIAMOND(
|
SILVER(new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")),
|
||||||
new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")), DIRT(
|
GOLD(new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")),
|
||||||
new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png"));
|
DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")),
|
||||||
|
DIRT(new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png"));
|
||||||
|
//@formatter:on
|
||||||
public final ResourceLocation location;
|
public final ResourceLocation location;
|
||||||
|
|
||||||
private ResourceList(ResourceLocation loc)
|
ResourceList(ResourceLocation loc)
|
||||||
{
|
{
|
||||||
this.location = loc;
|
this.location = loc;
|
||||||
}
|
}
|
||||||
|
@ -40,23 +41,28 @@ public class GUIChest extends GuiContainer
|
||||||
|
|
||||||
public enum GUI
|
public enum GUI
|
||||||
{
|
{
|
||||||
IRON(184, 202, ResourceList.IRON, IronChestType.IRON), GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD), DIAMOND(238, 256, ResourceList.DIAMOND,
|
//@formatter:off
|
||||||
IronChestType.DIAMOND), COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER), SILVER(184, 238, ResourceList.SILVER,
|
IRON(184, 202, ResourceList.IRON, IronChestType.IRON),
|
||||||
IronChestType.SILVER), CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL), OBSIDIAN(238, 256, ResourceList.DIAMOND,
|
GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD),
|
||||||
IronChestType.OBSIDIAN), DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000);
|
DIAMOND(238, 256, ResourceList.DIAMOND, IronChestType.DIAMOND),
|
||||||
|
COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER),
|
||||||
|
SILVER(184, 238, ResourceList.SILVER, IronChestType.SILVER),
|
||||||
|
CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL),
|
||||||
|
OBSIDIAN(238, 256, ResourceList.DIAMOND,IronChestType.OBSIDIAN),
|
||||||
|
DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000);
|
||||||
|
//@formatter:on
|
||||||
|
|
||||||
private int xSize;
|
private int xSize;
|
||||||
private int ySize;
|
private int ySize;
|
||||||
private ResourceList guiResourceList;
|
private ResourceList guiResourceList;
|
||||||
private IronChestType mainType;
|
private IronChestType mainType;
|
||||||
|
|
||||||
private GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType)
|
GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType)
|
||||||
{
|
{
|
||||||
this.xSize = xSize;
|
this.xSize = xSize;
|
||||||
this.ySize = ySize;
|
this.ySize = ySize;
|
||||||
this.guiResourceList = guiResourceList;
|
this.guiResourceList = guiResourceList;
|
||||||
this.mainType = mainType;
|
this.mainType = mainType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Container makeContainer(IInventory player, IInventory chest)
|
protected Container makeContainer(IInventory player, IInventory chest)
|
||||||
|
@ -70,11 +76,6 @@ public class GUIChest extends GuiContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRowLength()
|
|
||||||
{
|
|
||||||
return this.type.mainType.getRowLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
private GUI type;
|
private GUI type;
|
||||||
|
|
||||||
private GUIChest(GUI type, IInventory player, IInventory chest)
|
private GUIChest(GUI type, IInventory player, IInventory chest)
|
||||||
|
@ -89,7 +90,7 @@ public class GUIChest extends GuiContainer
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||||
{
|
{
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// new "bind tex"
|
// new "bind tex"
|
||||||
this.mc.getTextureManager().bindTexture(this.type.guiResourceList.location);
|
this.mc.getTextureManager().bindTexture(this.type.guiResourceList.location);
|
||||||
int x = (this.width - this.xSize) / 2;
|
int x = (this.width - this.xSize) / 2;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package cpw.mods.ironchest.client;
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class IronChestEventHandler
|
public class IronChestEventHandler
|
||||||
{
|
{
|
||||||
|
@ -17,12 +18,10 @@ public class IronChestEventHandler
|
||||||
{
|
{
|
||||||
if (event.getMap() == FMLClientHandler.instance().getClient().getTextureMapBlocks())
|
if (event.getMap() == FMLClientHandler.instance().getClient().getTextureMapBlocks())
|
||||||
{
|
{
|
||||||
event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/copperbreak"));
|
for (IronChestType t : IronChestType.VALUES)
|
||||||
event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/crystalbreak"));
|
{
|
||||||
event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/diamondbreak"));
|
event.getMap().registerSprite(new ResourceLocation(t.getBreakTexture()));
|
||||||
event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/goldbreak"));
|
}
|
||||||
event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/ironbreak"));
|
|
||||||
event.getMap().registerSprite(new ResourceLocation("ironchest:blocks/silverbreak"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
package cpw.mods.ironchest.client;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.ImmutableMap.Builder;
|
|
||||||
|
|
||||||
import cpw.mods.ironchest.IronChestType;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.particle.EntityDiggingFX;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelManager;
|
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class IronChestTextureHandler
|
|
||||||
{
|
|
||||||
private static Map<IronChestType, ResourceLocation> locations;
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
Builder<IronChestType, ResourceLocation> builder = ImmutableMap.<IronChestType, ResourceLocation> builder();
|
|
||||||
for (IronChestType typ : IronChestType.values())
|
|
||||||
{
|
|
||||||
if (typ != IronChestType.DIRTCHEST9000 && typ != IronChestType.OBSIDIAN)
|
|
||||||
builder.put(typ, new ResourceLocation("ironchest", "blocks/" + typ.getModelTexture().replace("chest", "break").replace(".png", "")));
|
|
||||||
else if (typ == IronChestType.DIRTCHEST9000)
|
|
||||||
builder.put(typ, new ResourceLocation("minecraft", "blocks/dirt"));
|
|
||||||
else if (typ == IronChestType.OBSIDIAN)
|
|
||||||
builder.put(typ, new ResourceLocation("minecraft", "blocks/obsidian"));
|
|
||||||
}
|
|
||||||
locations = builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addHitEffects(World world, BlockPos pos, EnumFacing side)
|
|
||||||
{
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
Block block = state.getBlock();
|
|
||||||
state = block.getActualState(state, world, pos);
|
|
||||||
Random rand = new Random();
|
|
||||||
IronChestType type = IronChestType.values()[IronChestType.validateMeta(block.getMetaFromState(state))];
|
|
||||||
ModelManager modelmanager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
|
|
||||||
|
|
||||||
if (block.getRenderType(state) != EnumBlockRenderType.INVISIBLE)
|
|
||||||
{
|
|
||||||
int i = pos.getX();
|
|
||||||
int j = pos.getY();
|
|
||||||
int k = pos.getZ();
|
|
||||||
float f = 0.1F;
|
|
||||||
AxisAlignedBB bb = block.getBoundingBox(state, world, pos);
|
|
||||||
|
|
||||||
double d0 = i + rand.nextDouble() * (bb.maxX - bb.minX - f * 2.0F) + f + bb.minX;
|
|
||||||
double d1 = j + rand.nextDouble() * (bb.maxY - bb.minY - f * 2.0F) + f + bb.minY;
|
|
||||||
double d2 = k + rand.nextDouble() * (bb.maxZ - bb.minZ - f * 2.0F) + f + bb.minZ;
|
|
||||||
|
|
||||||
if (side == EnumFacing.DOWN)
|
|
||||||
{
|
|
||||||
d1 = j + bb.minY - f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (side == EnumFacing.UP)
|
|
||||||
{
|
|
||||||
d1 = j + bb.maxY + f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (side == EnumFacing.NORTH)
|
|
||||||
{
|
|
||||||
d2 = k + bb.minZ - f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (side == EnumFacing.SOUTH)
|
|
||||||
{
|
|
||||||
d2 = k + bb.maxZ + f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (side == EnumFacing.WEST)
|
|
||||||
{
|
|
||||||
d0 = i + bb.minX - f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (side == EnumFacing.EAST)
|
|
||||||
{
|
|
||||||
d0 = i + bb.maxX + f;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityDiggingFX fx = ((EntityDiggingFX) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(),
|
|
||||||
d0, d1, d2, 0.0D, 0.0D, 0.0D, Block.getIdFromBlock(state.getBlock())));
|
|
||||||
|
|
||||||
fx.setBlockPos(pos);
|
|
||||||
fx.multiplyVelocity(0.2F);
|
|
||||||
fx.multipleParticleScaleBy(0.6F);
|
|
||||||
|
|
||||||
if (type != IronChestType.DIRTCHEST9000 && type != IronChestType.OBSIDIAN)
|
|
||||||
fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("ironchest:" + locations.get(type).getResourcePath()));
|
|
||||||
else if (type == IronChestType.DIRTCHEST9000)
|
|
||||||
fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath()));
|
|
||||||
else if (type == IronChestType.OBSIDIAN)
|
|
||||||
fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addDestroyEffects(World world, BlockPos pos, IBlockState state)
|
|
||||||
{
|
|
||||||
state = state.getBlock().getActualState(state, world, pos);
|
|
||||||
int i = 4;
|
|
||||||
IronChestType type = IronChestType.values()[IronChestType.validateMeta(state.getBlock().getMetaFromState(state))];
|
|
||||||
ModelManager modelmanager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
|
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j)
|
|
||||||
{
|
|
||||||
for (int k = 0; k < i; ++k)
|
|
||||||
{
|
|
||||||
for (int l = 0; l < i; ++l)
|
|
||||||
{
|
|
||||||
double d0 = pos.getX() + (j + 0.5D) / i;
|
|
||||||
double d1 = pos.getY() + (k + 0.5D) / i;
|
|
||||||
double d2 = pos.getZ() + (l + 0.5D) / i;
|
|
||||||
EntityDiggingFX fx = ((EntityDiggingFX) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(
|
|
||||||
EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D,
|
|
||||||
Block.getIdFromBlock(state.getBlock())));
|
|
||||||
fx.setBlockPos(pos);
|
|
||||||
if (type != IronChestType.DIRTCHEST9000 && type != IronChestType.OBSIDIAN)
|
|
||||||
fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("ironchest:" + locations.get(type).getResourcePath()));
|
|
||||||
else if (type == IronChestType.DIRTCHEST9000)
|
|
||||||
fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath()));
|
|
||||||
else if (type == IronChestType.OBSIDIAN)
|
|
||||||
fx.setParticleTexture(modelmanager.getTextureMap().getAtlasSprite("minecraft:" + locations.get(type).getResourcePath()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2012 cpw.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* cpw - initial API and implementation
|
|
||||||
******************************************************************************/
|
|
||||||
package cpw.mods.ironchest.client;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.ItemModelMesher;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class ModelHelper
|
|
||||||
{
|
|
||||||
public static void registerItem(Item item, int metadata, String itemName)
|
|
||||||
{
|
|
||||||
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
|
||||||
mesher.register(item, metadata, new ModelResourceLocation(itemName, "inventory"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerBlock(Block block, int metadata, String blockName)
|
|
||||||
{
|
|
||||||
registerItem(Item.getItemFromBlock(block), metadata, blockName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerBlock(Block block, String blockName)
|
|
||||||
{
|
|
||||||
registerBlock(block, 0, blockName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerItem(Item item, String itemName)
|
|
||||||
{
|
|
||||||
registerItem(item, 0, itemName);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,17 +4,14 @@
|
||||||
* are made available under the terms of the GNU Public License v3.0
|
* are made available under the terms of the GNU Public License v3.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*
|
* <p>
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - initial API and implementation
|
* cpw - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest.client;
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.ImmutableMap.Builder;
|
|
||||||
import com.google.common.primitives.SignedBytes;
|
import com.google.common.primitives.SignedBytes;
|
||||||
|
|
||||||
import cpw.mods.ironchest.BlockIronChest;
|
import cpw.mods.ironchest.BlockIronChest;
|
||||||
|
@ -29,67 +26,39 @@ 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.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends TileEntitySpecialRenderer<T>
|
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileEntityIronChest>
|
||||||
{
|
{
|
||||||
private static Map<IronChestType, ResourceLocation> locations;
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
Builder<IronChestType, ResourceLocation> builder = ImmutableMap.<IronChestType, ResourceLocation> builder();
|
|
||||||
for (IronChestType typ : IronChestType.values())
|
|
||||||
{
|
|
||||||
builder.put(typ, new ResourceLocation("ironchest", "textures/model/" + typ.getModelTexture()));
|
|
||||||
}
|
|
||||||
locations = builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Random random;
|
private Random random;
|
||||||
private RenderEntityItem itemRenderer;
|
private RenderEntityItem itemRenderer;
|
||||||
private ModelChest model;
|
private ModelChest model;
|
||||||
|
|
||||||
private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F },
|
private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F },
|
||||||
{ 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F }, };
|
{ 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F }, };
|
||||||
|
private static EntityItem customitem = new EntityItem(null);
|
||||||
|
private static float halfPI = (float) (Math.PI / 2D);
|
||||||
|
|
||||||
public TileEntityIronChestRenderer(Class<T> type)
|
public TileEntityIronChestRenderer()
|
||||||
{
|
{
|
||||||
this.model = new ModelChest();
|
this.model = new ModelChest();
|
||||||
this.random = new Random();
|
this.random = new Random();
|
||||||
this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) {
|
|
||||||
@Override
|
|
||||||
public int getModelCount(ItemStack stack)
|
|
||||||
{
|
|
||||||
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBob()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldSpreadItems()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(TileEntityIronChest tile, double x, double y, double z, float partialTick, int breakStage)
|
@Override
|
||||||
|
public void renderTileEntityAt(TileEntityIronChest tile, double x, double y, double z, float partialTick, int breakStage)
|
||||||
{
|
{
|
||||||
if (tile == null)
|
if (tile == null || tile.isInvalid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int facing = 3;
|
|
||||||
|
EnumFacing facing = EnumFacing.SOUTH;
|
||||||
IronChestType type = tile.getType();
|
IronChestType type = tile.getType();
|
||||||
|
|
||||||
if (tile != null && tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock)
|
if (tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock)
|
||||||
{
|
{
|
||||||
facing = tile.getFacing();
|
facing = tile.getFacing();
|
||||||
type = tile.getType();
|
|
||||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||||
type = state.getValue(BlockIronChest.VARIANT_PROP);
|
type = state.getValue(BlockIronChest.VARIANT_PROP);
|
||||||
}
|
}
|
||||||
|
@ -99,46 +68,59 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
|
||||||
this.bindTexture(DESTROY_STAGES[breakStage]);
|
this.bindTexture(DESTROY_STAGES[breakStage]);
|
||||||
GlStateManager.matrixMode(5890);
|
GlStateManager.matrixMode(5890);
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.scale(4.0F, 4.0F, 1.0F);
|
GlStateManager.scale(4F, 4F, 1F);
|
||||||
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
|
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
|
||||||
GlStateManager.matrixMode(5888);
|
GlStateManager.matrixMode(5888);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.bindTexture(locations.get(type));
|
this.bindTexture(type.modelTexture);
|
||||||
}
|
}
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
if (type == IronChestType.CRYSTAL)
|
if (type == IronChestType.CRYSTAL)
|
||||||
{
|
{
|
||||||
GlStateManager.disableCull();
|
GlStateManager.disableCull();
|
||||||
}
|
}
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||||
GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
GlStateManager.translate((float) x, (float) y + 1F, (float) z + 1F);
|
||||||
GlStateManager.scale(1.0F, -1F, -1F);
|
GlStateManager.scale(1F, -1F, -1F);
|
||||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||||
int k = 0;
|
|
||||||
if (facing == 2)
|
switch (facing)
|
||||||
{
|
{
|
||||||
k = 180;
|
case NORTH:
|
||||||
}
|
|
||||||
if (facing == 3)
|
|
||||||
{
|
{
|
||||||
k = 0;
|
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (facing == 4)
|
case SOUTH:
|
||||||
{
|
{
|
||||||
k = 90;
|
GlStateManager.rotate(0F, 0F, 1F, 0F);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (facing == 5)
|
case WEST:
|
||||||
{
|
{
|
||||||
k = -90;
|
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
GlStateManager.rotate(k, 0.0F, 1.0F, 0.0F);
|
case EAST:
|
||||||
|
{
|
||||||
|
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
|
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
|
||||||
float lidangle = tile.prevLidAngle + (tile.lidAngle - tile.prevLidAngle) * partialTick;
|
float lidangle = tile.prevLidAngle + (tile.lidAngle - tile.prevLidAngle) * partialTick;
|
||||||
lidangle = 1.0F - lidangle;
|
lidangle = 1F - lidangle;
|
||||||
lidangle = 1.0F - lidangle * lidangle * lidangle;
|
lidangle = 1F - lidangle * lidangle * lidangle;
|
||||||
this.model.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);
|
|
||||||
|
if (type.isTransparent())
|
||||||
|
{
|
||||||
|
GlStateManager.scale(1F, 0.99F, 1F);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.model.chestLid.rotateAngleX = -lidangle * halfPI;
|
||||||
// Render the chest itself
|
// Render the chest itself
|
||||||
this.model.renderAll();
|
this.model.renderAll();
|
||||||
if (breakStage >= 0)
|
if (breakStage >= 0)
|
||||||
|
@ -152,7 +134,7 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
|
||||||
GlStateManager.enableCull();
|
GlStateManager.enableCull();
|
||||||
}
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
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)
|
||||||
|
@ -163,7 +145,7 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
|
||||||
float shiftZ;
|
float shiftZ;
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
float blockScale = 0.70F;
|
float blockScale = 0.70F;
|
||||||
float timeD = (float) (360.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTick;
|
||||||
if (tile.getTopItemStacks()[1] == null)
|
if (tile.getTopItemStacks()[1] == null)
|
||||||
{
|
{
|
||||||
shift = 8;
|
shift = 8;
|
||||||
|
@ -171,8 +153,9 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
|
||||||
}
|
}
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float) x, (float) y, (float) z);
|
GlStateManager.translate((float) x, (float) y, (float) z);
|
||||||
EntityItem customitem = new EntityItem(this.getWorld());
|
|
||||||
customitem.hoverStart = 0f;
|
customitem.setWorld(this.getWorld());
|
||||||
|
customitem.hoverStart = 0F;
|
||||||
for (ItemStack item : tile.getTopItemStacks())
|
for (ItemStack item : tile.getTopItemStacks())
|
||||||
{
|
{
|
||||||
if (shift > shifts.length)
|
if (shift > shifts.length)
|
||||||
|
@ -190,19 +173,39 @@ public class TileEntityIronChestRenderer<T extends TileEntityIronChest> extends
|
||||||
shift++;
|
shift++;
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(shiftX, shiftY, shiftZ);
|
GlStateManager.translate(shiftX, shiftY, shiftZ);
|
||||||
GlStateManager.rotate(timeD, 0.0F, 1.0F, 0.0F);
|
GlStateManager.rotate(timeD, 0F, 1F, 0F);
|
||||||
GlStateManager.scale(blockScale, blockScale, blockScale);
|
GlStateManager.scale(blockScale, blockScale, blockScale);
|
||||||
customitem.setEntityItemStack(item);
|
customitem.setEntityItemStack(item);
|
||||||
this.itemRenderer.doRender(customitem, 0, 0, 0, 0, 0);
|
|
||||||
|
if (this.itemRenderer == null)
|
||||||
|
{
|
||||||
|
this.itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) {
|
||||||
|
@Override
|
||||||
|
public int getModelCount(ItemStack stack)
|
||||||
|
{
|
||||||
|
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldBob()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSpreadItems()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTick);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderTileEntityAt(TileEntityIronChest tileentity, double x, double y, double z, float partialTick, int breakStage)
|
|
||||||
{
|
|
||||||
this.render(tileentity, x, y, z, partialTick, breakStage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "ironchest:chest",
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"variant": {
|
||||||
|
"iron": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "ironchest:blocks/ironbreak",
|
||||||
|
"texture": "ironchest:model/ironchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gold": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "ironchest:blocks/goldbreak",
|
||||||
|
"texture": "ironchest:model/goldchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"diamond": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "ironchest:blocks/diamondbreak",
|
||||||
|
"texture": "ironchest:model/diamondchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"copper": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "ironchest:blocks/copperbreak",
|
||||||
|
"texture": "ironchest:model/copperchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"silver": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "ironchest:blocks/silverbreak",
|
||||||
|
"texture": "ironchest:model/silverchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crystal": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "ironchest:blocks/crystalbreak",
|
||||||
|
"texture": "ironchest:model/crystalchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"obsidian": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "minecraft:blocks/obsidian",
|
||||||
|
"texture": "ironchest:model/obsidianchest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dirtchest9000": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "minecraft:blocks/dirt",
|
||||||
|
"texture": "ironchest:model/dirtchest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
82
src/main/resources/assets/ironchest/models/item/chest_copper.json → src/main/resources/assets/ironchest/models/block/chest.json
Executable file → Normal file
82
src/main/resources/assets/ironchest/models/item/chest_copper.json → src/main/resources/assets/ironchest/models/block/chest.json
Executable file → Normal file
|
@ -1,41 +1,41 @@
|
||||||
{
|
{
|
||||||
"parent": "block/block",
|
"parent": "block/block",
|
||||||
"textures": {
|
"textures": {
|
||||||
"texture": "ironchest:model/copperchest"
|
"texture": "ironchest:model/copperchest"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{ "from": [ 1, 0, 1 ],
|
{ "from": [ 1, 0, 1 ],
|
||||||
"to": [ 15, 10, 15 ],
|
"to": [ 15, 10, 15 ],
|
||||||
"faces": {
|
"faces": {
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "from": [ 1, 9, 1 ],
|
{ "from": [ 1, 9, 1 ],
|
||||||
"to": [ 15, 14, 15 ],
|
"to": [ 15, 14, 15 ],
|
||||||
"faces": {
|
"faces": {
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "from": [ 7, 7, 0 ],
|
{ "from": [ 7, 7, 0 ],
|
||||||
"to": [ 9, 11, 1 ],
|
"to": [ 9, 11, 1 ],
|
||||||
"faces": {
|
"faces": {
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/crystalchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/diamondchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/dirtchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/goldchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/ironchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/obsidianchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"texture": "ironchest:model/silverchest"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{ "from": [ 1, 0, 1 ],
|
|
||||||
"to": [ 15, 10, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 1, 9, 1 ],
|
|
||||||
"to": [ 15, 14, 15 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "from": [ 7, 7, 0 ],
|
|
||||||
"to": [ 9, 11, 1 ],
|
|
||||||
"faces": {
|
|
||||||
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
|
|
||||||
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
|
|
||||||
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
|
|
||||||
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
|
|
||||||
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
|
|
||||||
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/copperIronUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/copperSilverUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/diamondCrystalUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/diamondObsidianUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/goldDiamondUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/ironGoldUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/silverGoldUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/woodCopperUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "ironchest:items/woodIronUpgrade"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson": {
|
|
||||||
"rotation": [ -90, 0, 0 ],
|
|
||||||
"translation": [ 0, 1, -3 ],
|
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
|
||||||
},
|
|
||||||
"firstperson": {
|
|
||||||
"rotation": [ 0, -135, 25 ],
|
|
||||||
"translation": [ 0, 4, 2 ],
|
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue