More changes for 1.3
This commit is contained in:
parent
49ebd84b8f
commit
958f8466d4
|
@ -14,4 +14,16 @@
|
|||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>common/ironchestversion.properties</name>
|
||||
<type>1</type>
|
||||
<locationURI>PROJECT_LOC/ironchestversion.properties</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>common/mcmod.info</name>
|
||||
<type>1</type>
|
||||
<locationURI>PROJECT_LOC/mcmod.info</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
|
|
@ -10,16 +10,30 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ChestItemRenderHelper;
|
||||
import net.minecraft.src.TileEntityRenderer;
|
||||
|
||||
public class IronChestRenderHelper extends ChestItemRenderHelper {
|
||||
private Map<Integer, TileEntityIronChest> itemRenders = Maps.newHashMap();
|
||||
|
||||
public IronChestRenderHelper() {
|
||||
for (IronChestType typ : IronChestType.values())
|
||||
{
|
||||
itemRenders.put(typ.ordinal(), (TileEntityIronChest) IronChest.ironChestBlock.createTileEntity(null, typ.ordinal()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderChest(Block block, int i, float f) {
|
||||
if (block==IronChest.ironChestBlock) {
|
||||
TileEntityRenderer.instance.renderTileEntityAt(block.createTileEntity(null,i), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
TileEntityRenderer.instance.renderTileEntityAt(itemRenders.get(i), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
} else {
|
||||
super.renderChest(block, i, f);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.util.Random;
|
|||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.Item;
|
||||
|
@ -40,6 +42,7 @@ import net.minecraft.src.TileEntitySpecialRenderer;
|
|||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.MappableItemStackWrapper;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
|
@ -70,6 +73,18 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
|||
renderBlocks = new RenderBlocks();
|
||||
}
|
||||
|
||||
private void overrideTexture(Object obj)
|
||||
{
|
||||
if (obj instanceof Item)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(((Item)obj).getTextureFile()));
|
||||
}
|
||||
else if (obj instanceof Block)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(((Block)obj).getTextureFile()));
|
||||
}
|
||||
}
|
||||
|
||||
public void render(TileEntityIronChest tile, double x, double y, double z, float partialTick) {
|
||||
if (tile == null) {
|
||||
return;
|
||||
|
@ -154,7 +169,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
|||
glPushMatrix();
|
||||
glTranslatef(shiftX, shiftY, shiftZ);
|
||||
glScalef(localScale, localScale, localScale);
|
||||
/* for (int miniBlocks = 0; miniBlocks < (item.stackSize / 32) + 1; miniBlocks++) {
|
||||
for (int miniBlocks = 0; miniBlocks < (item.stackSize / 32) + 1; miniBlocks++) {
|
||||
glPushMatrix();
|
||||
glRotatef(timeD, 0.0F, 1.0F, 0.0F);
|
||||
if (miniBlocks > 0) {
|
||||
|
@ -174,20 +189,20 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
|||
if (customRenderer != null) {
|
||||
customitem.item = item;
|
||||
bindTextureByName("/terrain.png");
|
||||
ForgeHooksClient.overrideTexture(item.getItem());
|
||||
overrideTexture(item.getItem());
|
||||
customRenderer.renderItem(IItemRenderer.ItemRenderType.ENTITY, item, renderBlocks, customitem);
|
||||
} else if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[item.itemID].getRenderType())) {
|
||||
bindTextureByName("/terrain.png");
|
||||
ForgeHooksClient.overrideTexture(Block.blocksList[item.itemID]);
|
||||
overrideTexture(Block.blocksList[item.itemID]);
|
||||
renderBlocks.renderBlockAsItem(Block.blocksList[item.itemID], item.getItemDamage(), 1.0F);
|
||||
} else {
|
||||
int i = item.getIconIndex();
|
||||
if (item.itemID >= Block.blocksList.length || Block.blocksList[item.itemID] == null) {
|
||||
bindTextureByName("/gui/items.png");
|
||||
ForgeHooksClient.overrideTexture(Item.itemsList[item.itemID]);
|
||||
overrideTexture(Item.itemsList[item.itemID]);
|
||||
} else {
|
||||
bindTextureByName("/terrain.png");
|
||||
ForgeHooksClient.overrideTexture(Block.blocksList[item.itemID]);
|
||||
overrideTexture(Block.blocksList[item.itemID]);
|
||||
}
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f5 = (float) ((i % 16) * 16 + 0) / 256F;
|
||||
|
@ -224,7 +239,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
|||
}
|
||||
glPopMatrix();
|
||||
}
|
||||
*/ glPopMatrix();
|
||||
glPopMatrix();
|
||||
}
|
||||
glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
glEnable(2896 /* GL_LIGHTING */);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class IronChest {
|
|||
|
||||
@Init
|
||||
public void load(FMLInitializationEvent evt) {
|
||||
GameRegistry.registerBlock(ironChestBlock);
|
||||
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class);
|
||||
for (IronChestType typ : IronChestType.values()) {
|
||||
GameRegistry.registerTileEntity(typ.clazz, typ.name());
|
||||
LanguageRegistry.instance().addStringLocalization(typ.name() + ".name", "en_US", typ.friendlyName);
|
||||
|
|
|
@ -32,6 +32,8 @@ public class ItemChestChanger extends Item {
|
|||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side) {
|
||||
if (world.isRemote)
|
||||
return false;
|
||||
TileEntity te=world.getBlockTileEntity(X,Y,Z);
|
||||
TileEntityIronChest newchest;
|
||||
if (te!=null && te instanceof TileEntityIronChest) {
|
||||
|
@ -76,6 +78,7 @@ public class ItemChestChanger extends Item {
|
|||
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal());
|
||||
world.notifyBlocksOfNeighborChange(X, Y, Z, world.getBlockId(X, Y, Z));
|
||||
world.markBlockNeedsUpdate(X, Y, Z);
|
||||
world.markBlocksDirty(X, Y, Z, X, Y, Z);
|
||||
stack.stackSize=0;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ package cpw.mods.ironchest;
|
|||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
@ -79,7 +81,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
}
|
||||
|
||||
protected void sortTopStacks() {
|
||||
if (!type.isTransparent() || IronChest.proxy.isRemote()) {
|
||||
if (!type.isTransparent() || (worldObj != null && worldObj.isRemote)) {
|
||||
return;
|
||||
}
|
||||
ItemStack[] tempCopy = new ItemStack[getSizeInventory()];
|
||||
|
@ -303,6 +305,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
}
|
||||
|
||||
public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger) {
|
||||
Mouse.setGrabbed(false);
|
||||
if (numUsingPlayers > 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -333,7 +336,8 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
@Override
|
||||
public Packet getAuxillaryInfoPacket() {
|
||||
return PacketHandler.getPacket(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue