update to forge

This commit is contained in:
Progwml6 2014-11-26 06:55:24 -05:00
parent beb5ebb2e1
commit 77d988937f
5 changed files with 22 additions and 57 deletions

View File

@ -17,7 +17,7 @@ buildscript {
}
// Apply the forge plugin - this adds all the magic for automatically obfuscating, deobfuscating etc
apply plugin: 'fml'
apply plugin: 'forge'
// This is a simple flatdir repository for "uploadArchives" when you don't have a remote repo to target
repositories {
@ -37,7 +37,7 @@ archivesBaseName = "ironchest"
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
minecraft {
version = "1.8-7.10.99.1005-1.8"
version = "1.8-11.14.0.1239-1.8"
mappings = 'snapshot_20140930'
}

View File

@ -10,28 +10,17 @@
******************************************************************************/
package cpw.mods.ironchest;
import java.util.HashMap;
import java.util.Map.Entry;
import cpw.mods.ironchest.client.ModelHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.RegistrySimple;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.oredict.OreDictionary;
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:FML@[7.2,)")
public class IronChest
@ -69,7 +58,7 @@ public class IronChest
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest." + typ.name(), typ.name());
proxy.registerTileEntitySpecialRenderer(typ);
}
//OreDictionary.registerOre("chestWood", Blocks.chest);
OreDictionary.registerOre("chestWood", Blocks.chest);
IronChestType.registerBlocksAndRecipes(ironChestBlock);
ChestChangerType.generateRecipes();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

View File

@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.util.IStringSerializable;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
public enum IronChestType implements IStringSerializable
{
@ -152,33 +153,13 @@ public enum IronChestType implements IStringSerializable
{
return Blocks.dirt;
}
else if (mat.equals("ingotIron"))//TODO get rid of this when forge is out
{
return Items.iron_ingot;
}
else if (mat.equals("ingotGold"))//TODO get rid of this when forge is out
{
return Items.gold_ingot;
}
else if (mat.equals("gemDiamond"))//TODO get rid of this when forge is out
{
return Items.diamond;
}
else if (mat.equals("blockGlass"))//TODO get rid of this when forge is out
{
return Blocks.glass;
}
else if(mat.equals("plankWood"))//TODO get rid of this when forge is out
{
return Blocks.planks;
}
return mat;
}
public static void addRecipe(ItemStack is, Object... parts)
{
//ShapedOreRecipe oreRecipe = new ShapedOreRecipe(is, parts);//TODO re-enable this as shaped instead use GameRegistry.addRecipe(oreRecipe);
//GameRegistry.addRecipe(is, parts);
ShapedOreRecipe oreRecipe = new ShapedOreRecipe(is, parts);
GameRegistry.addRecipe(oreRecipe);
}
public int getRowCount()

View File

@ -10,6 +10,7 @@
******************************************************************************/
package cpw.mods.ironchest;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -17,6 +18,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
@ -35,11 +38,11 @@ public class ItemChestChanger extends Item
this.setCreativeTab(CreativeTabs.tabMisc);
}
/*@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side, float hitX, float hitY, float hitZ)
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (world.isRemote) return false;
TileEntity te = world.getTileEntity(X, Y, Z);
TileEntity te = world.getTileEntity(pos);
TileEntityIronChest newchest;
if (te != null && te instanceof TileEntityIronChest)
{
@ -67,7 +70,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.dropContent(newSize, tec, world, tec.getPos());
newchest.setFacing((byte) tec.getBlockMetadata());
newchest.sortTopStacks();
for (int i = 0; i < Math.min(newSize, chestContents.length); i++)
@ -75,24 +78,24 @@ public class ItemChestChanger extends Item
chestContents[i] = null;
}
// Clear the old block out
world.setBlock(X, Y, Z, Blocks.air, 0, 3);
world.setBlockState(pos, Blocks.air.getDefaultState(), 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
tec.checkForAdjacentChests();
// And put in our block instead
world.setBlock(X, Y, Z, block, newchest.getType().ordinal(), 3);
world.setBlockState(pos, block.getStateFromMeta(newchest.getType().ordinal()), 3);
}
else
{
return false;
}
world.setTileEntity(X, Y, Z, newchest);
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal(), 3);
world.setTileEntity(pos, newchest);
world.setBlockState(pos, IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal()), 3);
stack.stackSize = 0;
return true;
}*/
}
public int getTargetChestOrdinal(int sourceOrdinal)
{

View File

@ -23,17 +23,9 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public class RegistryHelper
{
/**
* A temporary workaround whilst GameRegistry hasn't been fully updated to support 1.8
*/
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, Object... itemCtorArgs)
{
block = GameRegistry.registerBlock(block, itemclass, name, itemCtorArgs);
Item associatedItem = GameRegistry.findItem("ironchest", name);
Map itemBlockMap = (Map)ObfuscationReflectionHelper.getPrivateValue(Item.class, null, "BLOCK_TO_ITEM", "field_179220_a");
if (!itemBlockMap.containsKey(block)) itemBlockMap.put(block, associatedItem);
Iterator iterator = block.getBlockState().getValidStates().iterator();