Update for 1.6

This commit is contained in:
Christian 2013-07-02 13:54:03 -04:00
parent bfb9726d7a
commit a286e5a069
49 changed files with 57 additions and 22 deletions

View File

@ -15,6 +15,11 @@
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
</natures> </natures>
<linkedResources> <linkedResources>
<link>
<name>common/assets</name>
<type>2</type>
<locationURI>PROJECT_LOC/resources/assets</locationURI>
</link>
<link> <link>
<name>common/mcmod.info</name> <name>common/mcmod.info</name>
<type>1</type> <type>1</type>

View File

@ -23,6 +23,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -152,7 +153,7 @@ public class BlockIronChest extends BlockContainer {
} }
@Override @Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemStack) public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack itemStack)
{ {
byte chestFacing = 0; byte chestFacing = 0;
int facing = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3; int facing = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;

View File

@ -18,6 +18,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.ForgeSubscribe;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PostInit;
@ -43,7 +44,7 @@ public class IronChest {
public static boolean OCELOTS_SITONCHESTS = true; public static boolean OCELOTS_SITONCHESTS = true;
private int blockId; private int blockId;
@PreInit @EventHandler
public void preInit(FMLPreInitializationEvent event) public void preInit(FMLPreInitializationEvent event)
{ {
Version.init(event.getVersionProperties()); Version.init(event.getVersionProperties());
@ -63,15 +64,16 @@ public class IronChest {
} }
finally finally
{ {
cfg.save(); if (cfg.hasChanged())
cfg.save();
} }
}
@Init
public void load(FMLInitializationEvent evt)
{
ironChestBlock = new BlockIronChest(blockId); ironChestBlock = new BlockIronChest(blockId);
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest"); GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
}
@EventHandler
public void load(FMLInitializationEvent evt)
{
for (IronChestType typ : IronChestType.values()) for (IronChestType typ : IronChestType.values())
{ {
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest."+typ.name(), typ.name()); GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest."+typ.name(), typ.name());
@ -93,7 +95,7 @@ public class IronChest {
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@PostInit @EventHandler
public void modsLoaded(FMLPostInitializationEvent evt) public void modsLoaded(FMLPostInitializationEvent evt)
{ {
} }

View File

@ -51,7 +51,7 @@ public enum IronChestType {
this.rowLength = rowLength; this.rowLength = rowLength;
this.tieredChest = tieredChest; this.tieredChest = tieredChest;
this.friendlyName = friendlyName; this.friendlyName = friendlyName;
this.modelTexture = "/mods/ironchest/textures/model/" + modelTexture; this.modelTexture = modelTexture;
this.textureRow = textureRow; this.textureRow = textureRow;
this.clazz = clazz; this.clazz = clazz;
this.recipes = recipes; this.recipes = recipes;

View File

@ -10,7 +10,10 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.client; package cpw.mods.ironchest.client;
import java.util.Map;
import net.minecraft.client.renderer.ChestItemRenderHelper; import net.minecraft.client.renderer.ChestItemRenderHelper;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -11,6 +11,7 @@
package cpw.mods.ironchest.client; package cpw.mods.ironchest.client;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -21,26 +22,38 @@ import cpw.mods.ironchest.IronChestType;
import cpw.mods.ironchest.TileEntityIronChest; import cpw.mods.ironchest.TileEntityIronChest;
public class GUIChest extends GuiContainer { 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"));
public final ResourceLocation location;
private ResourceList(ResourceLocation loc) {
this.location = loc;
}
}
public enum GUI { public enum GUI {
IRON(184, 202, "/mods/ironchest/textures/gui/ironcontainer.png", IronChestType.IRON), IRON(184, 202, ResourceList.IRON, IronChestType.IRON),
GOLD(184, 256, "/mods/ironchest/textures/gui/goldcontainer.png", IronChestType.GOLD), GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD),
DIAMOND(238, 256, "/mods/ironchest/textures/gui/diamondcontainer.png", IronChestType.DIAMOND), DIAMOND(238, 256, ResourceList.DIAMOND, IronChestType.DIAMOND),
COPPER(184, 184, "/mods/ironchest/textures/gui/coppercontainer.png", IronChestType.COPPER), COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER),
SILVER(184, 238, "/mods/ironchest/textures/gui/silvercontainer.png", IronChestType.SILVER), SILVER(184, 238, ResourceList.SILVER, IronChestType.SILVER),
CRYSTAL(238, 256, "/mods/ironchest/textures/gui/diamondcontainer.png", IronChestType.CRYSTAL), CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL),
OBSIDIAN(238, 256, "/mods/ironchest/textures/gui/diamondcontainer.png", IronChestType.OBSIDIAN); OBSIDIAN(238, 256, ResourceList.DIAMOND, IronChestType.OBSIDIAN);
private int xSize; private int xSize;
private int ySize; private int ySize;
private String guiTexture; private ResourceList guiResourceList;
private IronChestType mainType; private IronChestType mainType;
private GUI(int xSize, int ySize, String guiTexture, IronChestType mainType) private GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType)
{ {
this.xSize = xSize; this.xSize = xSize;
this.ySize = ySize; this.ySize = ySize;
this.guiTexture = guiTexture; this.guiResourceList = guiResourceList;
this.mainType = mainType; this.mainType = mainType;
} }
protected Container makeContainer(IInventory player, IInventory chest) protected Container makeContainer(IInventory player, IInventory chest)
@ -75,7 +88,7 @@ public class GUIChest extends GuiContainer {
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// new "bind tex" // new "bind tex"
mc.renderEngine.bindTexture(type.guiTexture); this.mc.func_110434_K().func_110577_a(type.guiResourceList.location);
int x = (width - xSize) / 2; int x = (width - xSize) / 2;
int y = (height - ySize) / 2; int y = (height - ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, xSize, ySize); drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

View File

@ -36,6 +36,7 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -46,6 +47,8 @@ import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
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.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
@ -57,6 +60,14 @@ import cpw.mods.ironchest.TileEntityIronChest;
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
private static Map<MappableItemStackWrapper, Integer> renderList = new HashMap<MappableItemStackWrapper, Integer>(); 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()));
}
locations = builder.build();
}
private Random random; private Random random;
private RenderBlocks renderBlocks; private RenderBlocks renderBlocks;
@ -104,7 +115,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
int typ = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); int typ = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
type = IronChestType.values()[typ]; type = IronChestType.values()[typ];
} }
bindTextureByName(type.getModelTexture()); func_110628_a(locations.get(type));
glPushMatrix(); glPushMatrix();
glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
glColor4f(1.0F, 1.0F, 1.0F, 1.0F); glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View File

Before

Width:  |  Height:  |  Size: 726 B

After

Width:  |  Height:  |  Size: 726 B

View File

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 572 B

View File

Before

Width:  |  Height:  |  Size: 726 B

After

Width:  |  Height:  |  Size: 726 B

View File

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 572 B

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB