update to forge
This commit is contained in:
parent
beb5ebb2e1
commit
77d988937f
|
@ -17,7 +17,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the forge plugin - this adds all the magic for automatically obfuscating, deobfuscating etc
|
// 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
|
// This is a simple flatdir repository for "uploadArchives" when you don't have a remote repo to target
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -37,7 +37,7 @@ archivesBaseName = "ironchest"
|
||||||
|
|
||||||
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
|
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.8-7.10.99.1005-1.8"
|
version = "1.8-11.14.0.1239-1.8"
|
||||||
mappings = 'snapshot_20140930'
|
mappings = 'snapshot_20140930'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,28 +10,17 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
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.Minecraft;
|
||||||
import net.minecraft.client.renderer.entity.RenderItem;
|
|
||||||
import net.minecraft.init.Blocks;
|
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;
|
||||||
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.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
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;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:FML@[7.2,)")
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:FML@[7.2,)")
|
||||||
public class IronChest
|
public class IronChest
|
||||||
|
@ -69,7 +58,7 @@ public class IronChest
|
||||||
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest." + typ.name(), typ.name());
|
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest." + typ.name(), typ.name());
|
||||||
proxy.registerTileEntitySpecialRenderer(typ);
|
proxy.registerTileEntitySpecialRenderer(typ);
|
||||||
}
|
}
|
||||||
//OreDictionary.registerOre("chestWood", Blocks.chest);
|
OreDictionary.registerOre("chestWood", Blocks.chest);
|
||||||
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
||||||
ChestChangerType.generateRecipes();
|
ChestChangerType.generateRecipes();
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||||
|
|
|
@ -23,6 +23,7 @@ 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.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
|
||||||
public enum IronChestType implements IStringSerializable
|
public enum IronChestType implements IStringSerializable
|
||||||
{
|
{
|
||||||
|
@ -152,33 +153,13 @@ public enum IronChestType implements IStringSerializable
|
||||||
{
|
{
|
||||||
return Blocks.dirt;
|
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;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(ItemStack is, Object... parts)
|
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);
|
ShapedOreRecipe oreRecipe = new ShapedOreRecipe(is, parts);
|
||||||
//GameRegistry.addRecipe(is, parts);
|
GameRegistry.addRecipe(oreRecipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRowCount()
|
public int getRowCount()
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -17,6 +18,8 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityChest;
|
import net.minecraft.tileentity.TileEntityChest;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -35,11 +38,11 @@ public class ItemChestChanger extends Item
|
||||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
@Override
|
||||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side, float hitX, float hitY, float hitZ)
|
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (world.isRemote) return false;
|
if (world.isRemote) return false;
|
||||||
TileEntity te = world.getTileEntity(X, Y, Z);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
TileEntityIronChest newchest;
|
TileEntityIronChest newchest;
|
||||||
if (te != null && te instanceof TileEntityIronChest)
|
if (te != null && te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +70,7 @@ public class ItemChestChanger extends Item
|
||||||
ItemStack[] chestContents = ObfuscationReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0);
|
ItemStack[] chestContents = ObfuscationReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0);
|
||||||
System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length));
|
System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length));
|
||||||
BlockIronChest block = IronChest.ironChestBlock;
|
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.setFacing((byte) tec.getBlockMetadata());
|
||||||
newchest.sortTopStacks();
|
newchest.sortTopStacks();
|
||||||
for (int i = 0; i < Math.min(newSize, chestContents.length); i++)
|
for (int i = 0; i < Math.min(newSize, chestContents.length); i++)
|
||||||
|
@ -75,24 +78,24 @@ public class ItemChestChanger extends Item
|
||||||
chestContents[i] = null;
|
chestContents[i] = null;
|
||||||
}
|
}
|
||||||
// Clear the old block out
|
// 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
|
// Force the Chest TE to reset it's knowledge of neighbouring blocks
|
||||||
tec.updateContainingBlockInfo();
|
tec.updateContainingBlockInfo();
|
||||||
// Force the Chest TE to update any neighbours so they update next
|
// Force the Chest TE to update any neighbours so they update next
|
||||||
// tick
|
// tick
|
||||||
tec.checkForAdjacentChests();
|
tec.checkForAdjacentChests();
|
||||||
// And put in our block instead
|
// 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
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
world.setTileEntity(X, Y, Z, newchest);
|
world.setTileEntity(pos, newchest);
|
||||||
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal(), 3);
|
world.setBlockState(pos, IronChest.ironChestBlock.getStateFromMeta(newchest.getType().ordinal()), 3);
|
||||||
stack.stackSize = 0;
|
stack.stackSize = 0;
|
||||||
return true;
|
return true;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
public int getTargetChestOrdinal(int sourceOrdinal)
|
public int getTargetChestOrdinal(int sourceOrdinal)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,17 +23,9 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class RegistryHelper
|
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)
|
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, Object... itemCtorArgs)
|
||||||
{
|
{
|
||||||
block = GameRegistry.registerBlock(block, itemclass, name, 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();
|
Iterator iterator = block.getBlockState().getValidStates().iterator();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue