Merge 5df94b322e into e9e50c855d
|
|
@ -0,0 +1,11 @@
|
|||
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files we want to always be normalized and converted to native line endings on checkout.
|
||||
*.md text
|
||||
*.info text
|
||||
*.txt text
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
|
|
@ -1,14 +1,28 @@
|
|||
build/
|
||||
.classpath
|
||||
.project
|
||||
.gradle/
|
||||
eclipse/
|
||||
gnore Gradle cache files & directories
|
||||
bin/
|
||||
build/
|
||||
|
||||
## Exclusive to IronChests
|
||||
repo/
|
||||
/run/
|
||||
run/
|
||||
|
||||
## Forge
|
||||
forge-*.txt
|
||||
|
||||
## Eclipse
|
||||
eclipse/
|
||||
.classpath
|
||||
.gradle/
|
||||
.project
|
||||
.settings/
|
||||
#IDEA files from Gradle
|
||||
.idea/
|
||||
|
||||
## Idea
|
||||
.idea
|
||||
/*.iml
|
||||
/*.ipr
|
||||
/*.iws
|
||||
|
||||
# Ignore OS cache files & directories
|
||||
*.DS_Store
|
||||
_MACOSX
|
||||
Thumbs.db
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
Copyright (c) 2012-14 cpw
|
||||
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are made available under the terms of the GNU Public License v3.0,
|
||||
which are available at http://www.gnu.org/licenses/gpl.html
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
gradle setupDecompWorkspace
|
||||
gradle eclipse
|
||||
|
|
@ -0,0 +1 @@
|
|||
gradle setupDecompWorkspace && gradle eclipse
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
gradlew setupDecompWorkspace
|
||||
gradlew eclipse
|
||||
|
|
@ -0,0 +1 @@
|
|||
bash gradlew setupDecompWorkspace && bash gradlew eclipse
|
||||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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 static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
|
|
@ -17,8 +7,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
|
@ -38,15 +26,15 @@ import net.minecraft.util.IIcon;
|
|||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockIronChest extends BlockContainer {
|
||||
|
||||
private Random random;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[][] icons;
|
||||
public static IIcon icon[] = new IIcon[IronChestType.values().length];
|
||||
|
||||
public BlockIronChest()
|
||||
{
|
||||
|
|
@ -54,17 +42,13 @@ public class BlockIronChest extends BlockContainer {
|
|||
setBlockName("IronChest");
|
||||
setHardness(3.0F);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
random = new Random();
|
||||
setCreativeTab(CreativeTabs.tabDecorations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden by {@link #createTileEntity(World, int)}
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World w, int i)
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return null;
|
||||
return IronChestType.makeEntity(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -86,21 +70,23 @@ public class BlockIronChest extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister r)
|
||||
{
|
||||
return IronChestType.makeEntity(metadata);
|
||||
for (IronChestType type : IronChestType.values())
|
||||
{
|
||||
if (type.isValidForCreativeMode())
|
||||
{
|
||||
icon[type.ordinal()] = r.registerIcon("ironchest:" + type.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int i, int j)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if (j < IronChestType.values().length)
|
||||
{
|
||||
IronChestType type = IronChestType.values()[j];
|
||||
return type.getIcon(i);
|
||||
}
|
||||
return null;
|
||||
return icon[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -112,22 +98,13 @@ public class BlockIronChest extends BlockContainer {
|
|||
items.add(stack);
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(i, j, k);
|
||||
|
||||
if (te == null || !(te instanceof TileEntityIronChest))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (world.isRemote)
|
||||
if (te == null || !(te instanceof TileEntityIronChest) || world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN) || world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -187,48 +164,48 @@ public class BlockIronChest extends BlockContainer {
|
|||
if (tileentitychest != null)
|
||||
{
|
||||
tileentitychest.removeAdornments();
|
||||
dropContent(0, tileentitychest, world, tileentitychest.xCoord, tileentitychest.yCoord, tileentitychest.zCoord);
|
||||
dropItems(0, tileentitychest, world, tileentitychest.xCoord, tileentitychest.yCoord, tileentitychest.zCoord);
|
||||
}
|
||||
super.breakBlock(world, i, j, k, i1, i2);
|
||||
}
|
||||
|
||||
public void dropContent(int newSize, IInventory chest, World world, int xCoord, int yCoord, int zCoord)
|
||||
public void dropItems(int newSize, IInventory chest, World world, int i, int j, int k)
|
||||
{
|
||||
for (int l = newSize; l < chest.getSizeInventory(); l++)
|
||||
for (int i1 = 0; i1 < chest.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = chest.getStackInSlot(l);
|
||||
if (itemstack == null)
|
||||
Random rand = new Random();
|
||||
ItemStack is = chest.getStackInSlot(i1);
|
||||
|
||||
if (is != null)
|
||||
{
|
||||
continue;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f = rand.nextFloat() * 0.8F + 0.1F; is.stackSize > 0; world.spawnEntityInWorld(entityitem))
|
||||
{
|
||||
int j1 = rand.nextInt(21) + 10;
|
||||
|
||||
if (j1 > is.stackSize)
|
||||
{
|
||||
j1 = is.stackSize;
|
||||
}
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
while (itemstack.stackSize > 0)
|
||||
|
||||
is.stackSize -= j1;
|
||||
entityitem = new EntityItem(world, (double)((float)i + f), (double)((float)j + f), (double)((float)k + f), new ItemStack(is.getItem(), j1, is.getItemDamage()));
|
||||
float f2 = 0.05F;
|
||||
entityitem.motionX = (double)((float)rand.nextGaussian() * f2);
|
||||
entityitem.motionY = (double)((float)rand.nextGaussian() * f2 + 0.2F);
|
||||
entityitem.motionZ = (double)((float)rand.nextGaussian() * f2);
|
||||
|
||||
if (is.hasTagCompound())
|
||||
{
|
||||
int i1 = random.nextInt(21) + 10;
|
||||
if (i1 > itemstack.stackSize)
|
||||
{
|
||||
i1 = itemstack.stackSize;
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)is.getTagCompound().copy());
|
||||
}
|
||||
itemstack.stackSize -= i1;
|
||||
EntityItem entityitem = new EntityItem(world, (float) xCoord + f, (float) yCoord + (newSize > 0 ? 1 : 0) + f1, (float) zCoord + f2,
|
||||
new ItemStack(itemstack.getItem(), i1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
|
@ -272,22 +249,10 @@ public class BlockIronChest extends BlockContainer {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
for (IronChestType typ: IronChestType.values())
|
||||
{
|
||||
typ.makeIcons(par1IconRegister);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN };
|
||||
@Override
|
||||
public ForgeDirection[] getValidRotations(World worldObj, int x, int y, int z)
|
||||
{
|
||||
return validRotationAxes;
|
||||
return new ForgeDirection[] { UP, DOWN };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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 static cpw.mods.ironchest.IronChestType.COPPER;
|
||||
|
|
@ -16,7 +10,6 @@ import static cpw.mods.ironchest.IronChestType.SILVER;
|
|||
import static cpw.mods.ironchest.IronChestType.WOOD;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public enum ChestChangerType {
|
||||
|
|
@ -56,7 +49,7 @@ public enum ChestChangerType {
|
|||
return this.target.ordinal();
|
||||
}
|
||||
|
||||
public ItemChestChanger buildItem(Configuration cfg)
|
||||
public ItemChestChanger buildItem()
|
||||
{
|
||||
item = new ItemChestChanger(this);
|
||||
GameRegistry.registerItem(item, itemName);
|
||||
|
|
@ -76,14 +69,6 @@ public enum ChestChangerType {
|
|||
}
|
||||
}
|
||||
|
||||
public static void buildItems(Configuration cfg)
|
||||
{
|
||||
for (ChestChangerType type : values())
|
||||
{
|
||||
type.buildItem(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void generateRecipes()
|
||||
{
|
||||
for (ChestChangerType item : values())
|
||||
|
|
|
|||
|
|
@ -1,55 +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 net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
public void registerRenderInformation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerTileEntitySpecialRenderer(IronChestType typ)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int X, int Y, int Z)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(X, Y, Z);
|
||||
if (te != null && te instanceof TileEntityIronChest)
|
||||
{
|
||||
TileEntityIronChest icte = (TileEntityIronChest) te;
|
||||
return new ContainerIronChest(player.inventory, icte, icte.getType(), 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public World getClientWorld()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* 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 invtweaks.api.container.ChestContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import invtweaks.api.container.ChestContainer;
|
||||
|
||||
@ChestContainer(isLargeChest = true)
|
||||
public class ContainerIronChest extends Container {
|
||||
|
|
@ -85,13 +75,13 @@ public class ContainerIronChest extends Container {
|
|||
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
||||
{
|
||||
if (type == IronChestType.DIRTCHEST9000) {
|
||||
addSlotToContainer(type.makeSlot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18));
|
||||
addSlotToContainer(new Slot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18));
|
||||
} else {
|
||||
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
|
||||
{
|
||||
for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++)
|
||||
{
|
||||
addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
|
||||
addSlotToContainer(new Slot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,8 +91,7 @@ public class ContainerIronChest extends Container {
|
|||
{
|
||||
for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++)
|
||||
{
|
||||
addSlotToContainer(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18
|
||||
- 10));
|
||||
addSlotToContainer(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18 - 10));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,88 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* 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 net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.ironchest.net.UniversalProxy;
|
||||
|
||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[10.10,);required-after:FML@[7.2,)")
|
||||
@Mod(modid = IronChest.modid, name = IronChest.name)
|
||||
public class IronChest {
|
||||
public static BlockIronChest ironChestBlock;
|
||||
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
@Instance("IronChest")
|
||||
public static final String modid = "IronChest", name = "Iron Chests", proxyPath = "cpw.mods.ironchest.net.UniversalProxy";
|
||||
|
||||
@Instance(modid)
|
||||
public static IronChest instance;
|
||||
public static boolean CACHE_RENDER = true;
|
||||
public static boolean OCELOTS_SITONCHESTS = true;
|
||||
|
||||
@SidedProxy(clientSide = proxyPath, serverSide = proxyPath)
|
||||
public static UniversalProxy proxy;
|
||||
|
||||
public static BlockIronChest ironChestBlock;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
public void preInit(FMLPreInitializationEvent e)
|
||||
{
|
||||
Version.init(event.getVersionProperties());
|
||||
event.getModMetadata().version = Version.fullVersionString();
|
||||
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
||||
try
|
||||
{
|
||||
cfg.load();
|
||||
ChestChangerType.buildItems(cfg);
|
||||
CACHE_RENDER = cfg.get(Configuration.CATEGORY_GENERAL, "cacheRenderingInformation", true).getBoolean(true);
|
||||
OCELOTS_SITONCHESTS = cfg.get(Configuration.CATEGORY_GENERAL, "ocelotsSitOnChests", true).getBoolean(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.ERROR, e, "IronChest has a problem loading its configuration");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (cfg.hasChanged())
|
||||
cfg.save();
|
||||
}
|
||||
Version.init(e.getVersionProperties());
|
||||
e.getModMetadata().version = Version.fullVersionString();
|
||||
|
||||
for (ChestChangerType type : ChestChangerType.values())
|
||||
type.buildItem();
|
||||
ironChestBlock = new BlockIronChest();
|
||||
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
||||
|
||||
PacketHandler.INSTANCE.ordinal();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void load(FMLInitializationEvent evt)
|
||||
public void init(FMLInitializationEvent e)
|
||||
{
|
||||
for (IronChestType typ : IronChestType.values())
|
||||
{
|
||||
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest."+typ.name(), typ.name());
|
||||
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, modid + "." + typ.name(), typ.name());
|
||||
proxy.registerTileEntitySpecialRenderer(typ);
|
||||
}
|
||||
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
||||
ChestChangerType.generateRecipes();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||
proxy.registerRenderInformation();
|
||||
// if (OCELOTS_SITONCHESTS)
|
||||
// {
|
||||
// MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||
// }
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void modsLoaded(FMLPostInitializationEvent evt)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIOcelotSit;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class IronChestAIOcelotSit extends EntityAIOcelotSit {
|
||||
public IronChestAIOcelotSit(EntityOcelot par1EntityOcelot, float par2)
|
||||
{
|
||||
super(par1EntityOcelot, par2);
|
||||
}
|
||||
|
||||
/* @Override
|
||||
protected boolean func_151486_a(World world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlock(x, y, z) == IronChest.ironChestBlock)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return super.func_151486_a(world, x, y, z);
|
||||
}
|
||||
*/}
|
||||
|
|
@ -1,41 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* 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.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum IronChestType {
|
||||
IRON(54, 9, true, "Iron Chest", "ironchest.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
|
||||
GOLD(81, 9, true, "Gold Chest", "goldchest.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
|
||||
DIAMOND(108, 12, true, "Diamond Chest", "diamondchest.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
||||
COPPER(45, 9, false, "Copper Chest", "copperchest.png", 3, Arrays.asList("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"),
|
||||
SILVER(72, 9, false, "Silver Chest", "silverchest.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
|
||||
CRYSTAL(108, 12, true, "Crystal Chest", "crystalchest.png", 5, Arrays.asList("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"),
|
||||
OBSIDIAN(108, 12, false, "Obsidian Chest", "obsidianchest.png", 6, Arrays.asList("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"),
|
||||
DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "dirtchest.png",7,Arrays.asList("dirt"), TileEntityDirtChest.class,Item.getItemFromBlock(Blocks.dirt),"mmmmCmmmm"),
|
||||
IRON(54, 9, true, "Iron Chest", "chest_iron.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
|
||||
GOLD(81, 9, true, "Gold Chest", "chest_gold.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
|
||||
DIAMOND(108, 12, true, "Diamond Chest", "chest_diamond.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
||||
COPPER(45, 9, false, "Copper Chest", "chest_copper.png", 3, Arrays.asList("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"),
|
||||
SILVER(72, 9, false, "Silver Chest", "chest_silver.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
|
||||
CRYSTAL(108, 12, true, "Crystal Chest", "chest_crystal.png", 5, Arrays.asList("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"),
|
||||
OBSIDIAN(108, 12, false, "Obsidian Chest", "chest_obsidian.png", 6, Arrays.asList("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"),
|
||||
DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "chest_dirt.png", 7, Arrays.asList("dirt"), TileEntityDirtChest.class, Item.getItemFromBlock(Blocks.dirt), "mmmmCmmmm"),
|
||||
WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
|
||||
int size;
|
||||
private int rowLength;
|
||||
|
|
@ -104,10 +89,6 @@ public enum IronChestType {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void registerTranslations()
|
||||
{
|
||||
}
|
||||
|
||||
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
||||
{
|
||||
ItemStack previous = new ItemStack(Blocks.chest);
|
||||
|
|
@ -219,42 +200,11 @@ public enum IronChestType {
|
|||
return this == OBSIDIAN;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void makeIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
if (isValidForCreativeMode())
|
||||
{
|
||||
icons = new IIcon[3];
|
||||
int i = 0;
|
||||
for (String s : sideNames)
|
||||
{
|
||||
icons[i++] = par1IconRegister.registerIcon(String.format("ironchest:%s_%s",name().toLowerCase(),s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side)
|
||||
{
|
||||
|
||||
return icons[sideMapping[side]];
|
||||
}
|
||||
|
||||
private static String[] sideNames = { "top", "front", "side" };
|
||||
private static int[] sideMapping = { 0, 0, 2, 1, 2, 2, 2 };
|
||||
|
||||
public Slot makeSlot(IInventory chestInventory, int index, int x, int y)
|
||||
{
|
||||
return new ValidatingSlot(chestInventory, index, x, y, this);
|
||||
}
|
||||
|
||||
public boolean acceptsStack(ItemStack itemstack)
|
||||
{
|
||||
return itemFilter == null || itemstack == null || itemstack.getItem() == itemFilter;
|
||||
}
|
||||
|
||||
public void adornItemDrop(ItemStack item)
|
||||
{
|
||||
if (this == DIRTCHEST9000)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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 net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
|
@ -24,7 +14,6 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemChestChanger extends Item {
|
||||
|
||||
private ChestChangerType type;
|
||||
|
||||
public ItemChestChanger(ChestChangerType type)
|
||||
|
|
@ -36,7 +25,6 @@ public class ItemChestChanger extends Item {
|
|||
setCreativeTab(CreativeTabs.tabMisc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
|
|
@ -76,7 +64,7 @@ public class ItemChestChanger extends Item {
|
|||
ItemStack[] chestContents = ObfuscationReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0);
|
||||
System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length));
|
||||
BlockIronChest block = IronChest.ironChestBlock;
|
||||
block.dropContent(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord);
|
||||
block.dropItems(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord);
|
||||
newchest.setFacing((byte) tec.getBlockMetadata());
|
||||
newchest.sortTopStacks();
|
||||
for (int i = 0; i < Math.min(newSize, chestContents.length); i++)
|
||||
|
|
@ -87,8 +75,7 @@ public class ItemChestChanger extends Item {
|
|||
world.setBlock(X, Y, Z, Blocks.air, 0, 3);
|
||||
// Force the Chest TE to reset it's knowledge of neighbouring blocks
|
||||
tec.updateContainingBlockInfo();
|
||||
// Force the Chest TE to update any neighbours so they update next
|
||||
// tick
|
||||
// Force the Chest TE to update any neighbours so they update next tick
|
||||
tec.checkForAdjacentChests();
|
||||
// And put in our block instead
|
||||
world.setBlock(X, Y, Z, block, newchest.getType().ordinal(), 3);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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 net.minecraft.block.Block;
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MappableItemStackWrapper {
|
||||
private ItemStack wrap;
|
||||
|
||||
public MappableItemStackWrapper(ItemStack toWrap)
|
||||
{
|
||||
wrap = toWrap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (!(obj instanceof MappableItemStackWrapper)) return false;
|
||||
MappableItemStackWrapper isw = (MappableItemStackWrapper) obj;
|
||||
if (wrap.getHasSubtypes())
|
||||
{
|
||||
return isw.wrap.isItemEqual(wrap);
|
||||
}
|
||||
else
|
||||
{
|
||||
return isw.wrap == wrap;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return System.identityHashCode(wrap);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.ai.EntityAIOcelotSit;
|
||||
import net.minecraft.entity.ai.EntityAITasks;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
public class OcelotsSitOnChestsHandler {
|
||||
@SubscribeEvent
|
||||
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
||||
{
|
||||
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
|
||||
{
|
||||
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++)
|
||||
{
|
||||
EntityAITasks.EntityAITaskEntry task = tasks.get(i);
|
||||
if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit))
|
||||
{
|
||||
task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,15 @@
|
|||
/*******************************************************************************
|
||||
* 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 io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
|
|
@ -28,7 +21,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
/**
|
||||
* Handles the packet wrangling for IronChest
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public enum PacketHandler {
|
||||
INSTANCE;
|
||||
|
|
@ -79,7 +71,7 @@ public enum PacketHandler {
|
|||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, IronChestMessage msg) throws Exception
|
||||
{
|
||||
World world = IronChest.proxy.getClientWorld();
|
||||
World world = FMLClientHandler.instance().getClient().theWorld;
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TileEntityIronChest)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,19 +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
|
||||
* 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;
|
||||
|
||||
public class TileEntityCopperChest extends TileEntityIronChest {
|
||||
public TileEntityCopperChest()
|
||||
{
|
||||
public TileEntityCopperChest() {
|
||||
super(IronChestType.COPPER);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +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
|
||||
* 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;
|
||||
|
||||
public class TileEntityCrystalChest extends TileEntityIronChest {
|
||||
public TileEntityCrystalChest()
|
||||
{
|
||||
public TileEntityCrystalChest() {
|
||||
super(IronChestType.CRYSTAL);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +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
|
||||
* 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;
|
||||
|
||||
public class TileEntityDiamondChest extends TileEntityIronChest {
|
||||
public TileEntityDiamondChest()
|
||||
{
|
||||
public TileEntityDiamondChest() {
|
||||
super(IronChestType.DIAMOND);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ public class TileEntityDirtChest extends TileEntityIronChest {
|
|||
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page5")));
|
||||
dirtChest9000GuideBook.setTagInfo("pages", pages);
|
||||
}
|
||||
|
||||
public TileEntityDirtChest() {
|
||||
super(IronChestType.DIRTCHEST9000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +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
|
||||
* 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;
|
||||
|
||||
public class TileEntityGoldChest extends TileEntityIronChest {
|
||||
|
||||
public TileEntityGoldChest()
|
||||
{
|
||||
public TileEntityGoldChest() {
|
||||
super(IronChestType.GOLD);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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.Arrays;
|
||||
|
|
@ -383,11 +373,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
|
||||
public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger)
|
||||
{
|
||||
if (numUsingPlayers > 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!itemChestChanger.getType().canUpgrade(this.getType()))
|
||||
if (numUsingPlayers > 0 || !itemChestChanger.getType().canUpgrade(this.getType()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
@ -395,7 +381,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
int newSize = newEntity.chestContents.length;
|
||||
System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length));
|
||||
BlockIronChest block = IronChest.ironChestBlock;
|
||||
block.dropContent(newSize, this, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
block.dropItems(newSize, this, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
newEntity.setFacing(facing);
|
||||
newEntity.sortTopStacks();
|
||||
newEntity.ticksSinceSync = -1;
|
||||
|
|
@ -498,11 +484,6 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
public void setMaxStackSize(int size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
|
|
@ -527,6 +508,5 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
|
||||
public void removeAdornments()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
public class TileEntityObsidianChest extends TileEntityIronChest {
|
||||
|
||||
public TileEntityObsidianChest()
|
||||
{
|
||||
public TileEntityObsidianChest() {
|
||||
super(IronChestType.OBSIDIAN);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +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
|
||||
* 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;
|
||||
|
||||
public class TileEntitySilverChest extends TileEntityIronChest {
|
||||
public TileEntitySilverChest()
|
||||
{
|
||||
public TileEntitySilverChest() {
|
||||
super(IronChestType.SILVER);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ValidatingSlot extends Slot {
|
||||
private IronChestType type;
|
||||
|
||||
public ValidatingSlot(IInventory par1iInventory, int par2, int par3, int par4, IronChestType type)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
return type.acceptsStack(par1ItemStack);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,9 @@
|
|||
/*******************************************************************************
|
||||
* 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;
|
||||
private static String major, minor, rev, build, mcversion;
|
||||
|
||||
static void init(Properties properties)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,55 +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.client.renderer.tileentity.TileEntityRendererChestHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.ironchest.CommonProxy;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void registerRenderInformation()
|
||||
{
|
||||
TileEntityRendererChestHelper.instance = new IronChestRenderHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTileEntitySpecialRenderer(IronChestType typ)
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(typ.clazz, new TileEntityIronChestRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getClientWorld()
|
||||
{
|
||||
return FMLClientHandler.instance().getClient().theWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileEntityIronChest)
|
||||
{
|
||||
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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.client.gui.inventory.GuiContainer;
|
||||
|
|
@ -23,15 +13,15 @@ import cpw.mods.ironchest.TileEntityIronChest;
|
|||
|
||||
public class GUIChest extends GuiContainer {
|
||||
public enum ResourceList {
|
||||
IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")),
|
||||
COPPER(new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")),
|
||||
SILVER(new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")),
|
||||
GOLD(new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")),
|
||||
DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")),
|
||||
DIRT(new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png"));
|
||||
IRON(new ResourceLocation("ironchest", "textures/gui/gui_chest_iron.png")),
|
||||
COPPER(new ResourceLocation("ironchest", "textures/gui/gui_chest_copper.png")),
|
||||
SILVER(new ResourceLocation("ironchest", "textures/gui/gui_chest_silver.png")),
|
||||
GOLD(new ResourceLocation("ironchest", "textures/gui/gui_chest_gold.png")),
|
||||
DIAMOND(new ResourceLocation("ironchest", "textures/gui/gui_chest_diamond.png")),
|
||||
DIRT(new ResourceLocation("ironchest", "textures/gui/gui_chest_dirt.png"));
|
||||
public final ResourceLocation location;
|
||||
private ResourceList(ResourceLocation loc) {
|
||||
this.location = loc;
|
||||
location = loc;
|
||||
}
|
||||
}
|
||||
public enum GUI {
|
||||
|
|
@ -89,8 +79,7 @@ public class GUIChest extends GuiContainer {
|
|||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// new "bind tex"
|
||||
this.mc.getTextureManager().bindTexture(type.guiResourceList.location);
|
||||
mc.getTextureManager().bindTexture(type.guiResourceList.location);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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 java.util.Map;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* 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 static org.lwjgl.opengl.GL11.glColor4f;
|
||||
|
|
@ -18,11 +8,11 @@ import static org.lwjgl.opengl.GL11.glPushMatrix;
|
|||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glScalef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||
import java.util.HashMap;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
|
@ -30,30 +20,24 @@ import net.minecraft.entity.item.EntityItem;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
import com.google.common.primitives.SignedBytes;
|
||||
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.MappableItemStackWrapper;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
|
||||
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||
@SuppressWarnings("unused")
|
||||
private static Map<MappableItemStackWrapper, Integer> renderList = new HashMap<MappableItemStackWrapper, Integer>();
|
||||
|
||||
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()));
|
||||
}
|
||||
for (IronChestType typ : IronChestType.values())
|
||||
builder.put(typ, new ResourceLocation("ironchest", "textures/models/" + typ.getModelTexture()));
|
||||
locations = builder.build();
|
||||
}
|
||||
|
||||
private Random random;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private RenderBlocks renderBlocks;
|
||||
|
||||
private RenderItem itemRenderer;
|
||||
|
||||
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 },
|
||||
|
|
@ -63,7 +47,6 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
|||
{
|
||||
model = new ModelChest();
|
||||
random = new Random();
|
||||
renderBlocks = new RenderBlocks();
|
||||
itemRenderer = new RenderItem() {
|
||||
@Override
|
||||
public byte getMiniBlockCount(ItemStack stack, byte original) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package cpw.mods.ironchest.net;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererChestHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.ironchest.ContainerIronChest;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
import cpw.mods.ironchest.client.GUIChest;
|
||||
import cpw.mods.ironchest.client.IronChestRenderHelper;
|
||||
import cpw.mods.ironchest.client.TileEntityIronChestRenderer;
|
||||
|
||||
public class UniversalProxy implements IGuiHandler {
|
||||
public void registerRenderInformation() {
|
||||
TileEntityRendererChestHelper.instance = new IronChestRenderHelper();
|
||||
}
|
||||
|
||||
public void registerTileEntitySpecialRenderer(IronChestType typ) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(typ.clazz, new TileEntityIronChestRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileEntityIronChest) {
|
||||
TileEntityIronChest chest = (TileEntityIronChest) te;
|
||||
return new ContainerIronChest(player.inventory, chest, chest.getType(), 0, 0);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileEntityIronChest)
|
||||
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 679 B |
|
Before Width: | Height: | Size: 661 B |
|
Before Width: | Height: | Size: 546 B |
|
After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 382 B |
|
After Width: | Height: | Size: 232 B |
|
Before Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 719 B |
|
Before Width: | Height: | Size: 572 B |
|
After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 784 B |
|
Before Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 572 B |
|
After Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 787 B |
|
Before Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 572 B |
|
After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 604 B |
|
After Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 370 B |
|
After Width: | Height: | Size: 429 B |
|
After Width: | Height: | Size: 357 B |
|
After Width: | Height: | Size: 407 B |
|
After Width: | Height: | Size: 379 B |
|
After Width: | Height: | Size: 397 B |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 237 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 237 B |
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 466 B After Width: | Height: | Size: 215 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 240 B |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 244 B |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 288 B |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 600 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 617 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 789 B |