Fix some formatter issues and update forge and mappings.

This commit is contained in:
Alexander 2016-04-21 14:29:22 -04:00
parent a4184e6961
commit d0b721e332
8 changed files with 46 additions and 22 deletions

View File

@ -35,8 +35,8 @@ archivesBaseName = "ironchest"
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
minecraft {
version = "1.9-12.16.0.1826-1.9"
mappings = "snapshot_20160324"
version = "1.9-12.16.0.1865-1.9"
mappings = "snapshot_20160419"
runDir = "run"
}

View File

@ -54,13 +54,13 @@ public class BlockIronChest extends BlockContainer
public BlockIronChest()
{
super(Material.iron);
super(Material.IRON);
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
this.setHardness(3.0F);
this.setUnlocalizedName("IronChest");
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setCreativeTab(CreativeTabs.DECORATIONS);
}
@Override
@ -88,8 +88,9 @@ public class BlockIronChest extends BlockContainer
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack heldItem,
EnumFacing direction, float hitX, float hitY, float hitZ)
//@formatter:off
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing direction, float hitX, float hitY, float hitZ)
//@formatter:on
{
TileEntity te = world.getTileEntity(pos);

View File

@ -24,6 +24,7 @@ import net.minecraftforge.fml.relauncher.Side;
public enum ChestChangerType
{
//@formatter:off
IRONGOLD(IRON, GOLD, "ironGoldUpgrade", "Iron to Gold Chest Upgrade", "mmm", "msm", "mmm"),
GOLDDIAMOND(GOLD, DIAMOND, "goldDiamondUpgrade", "Gold to Diamond Chest Upgrade", "GGG", "msm", "GGG"),
COPPERSILVER(COPPER, SILVER, "copperSilverUpgrade", "Copper to Silver Chest Upgrade", "mmm", "msm", "mmm"),
@ -33,6 +34,7 @@ public enum ChestChangerType
WOODIRON(WOOD, IRON, "woodIronUpgrade", "Normal chest to Iron Chest Upgrade", "mmm", "msm", "mmm"),
WOODCOPPER(WOOD, COPPER, "woodCopperUpgrade", "Normal chest to Copper Chest Upgrade", "mmm", "msm", "mmm"),
DIAMONDOBSIDIAN(DIAMOND, OBSIDIAN, "diamondObsidianUpgrade", "Diamond to Obsidian Chest Upgrade", "mmm", "mGm", "mmm");
//@formatter:on
private IronChestType source;
private IronChestType target;
@ -68,11 +70,15 @@ public enum ChestChangerType
public ItemChestChanger buildItem()
{
this.item = new ItemChestChanger(this);
GameRegistry.registerItem(this.item, this.itemName);
this.item.setRegistryName(this.itemName);
GameRegistry.register(this.item);
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
{
ModelHelper.registerItem(this.item, "ironchest:" + this.itemName);
}
return this.item;
}
@ -84,8 +90,9 @@ public enum ChestChangerType
{
Object targetMaterial = IronChestType.translateOreName(targetMat);
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
IronChestType.addRecipe(new ItemStack(this.item), this.recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', "blockGlass", 'O',
Blocks.obsidian);
//@formatter:off
IronChestType.addRecipe(new ItemStack(this.item), this.recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', "blockGlass", 'O', Blocks.OBSIDIAN);
//@formatter:on
}
}
}

View File

@ -25,6 +25,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public class IronChest
{
public static BlockIronChest ironChestBlock;
public static ItemIronChest ironChestItemBlock;
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
public static CommonProxy proxy;
@Instance("IronChest")
@ -44,7 +45,13 @@ public class IronChest
// Minecraft.getRenderItem() returns null before this stage
ChestChangerType.buildItems();
ironChestBlock = new BlockIronChest();
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
ironChestItemBlock = new ItemIronChest(ironChestBlock);
ironChestBlock.setRegistryName("BlockIronChest");
ironChestItemBlock.setRegistryName("BlockIronChest");
GameRegistry.register(ironChestBlock);
GameRegistry.register(ironChestItemBlock);
for (IronChestType typ : IronChestType.values())
{

View File

@ -26,6 +26,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
public enum IronChestType implements IStringSerializable
{
//@formatter:off
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"),
@ -33,8 +34,9 @@ public enum IronChestType implements IStringSerializable
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"),
DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "dirtchest.png", 7, Arrays.asList("dirt"), TileEntityDirtChest.class, Item.getItemFromBlock(Blocks.DIRT), "mmmmCmmmm"),
WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
//@formatter:on
int size;
private int rowLength;
public String friendlyName;
@ -133,6 +135,7 @@ public enum IronChestType implements IStringSerializable
for (String mat : type.matList)
{
mainMaterial = translateOreName(mat);
//@formatter:off
addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit,
'm', mainMaterial, 'P', previousTier, /* previous tier of chest */
'G', "blockGlass", 'C', "chestWood",
@ -140,8 +143,9 @@ public enum IronChestType implements IStringSerializable
'1', new ItemStack(blockResult, 1, 1), /* Gold Chest */
'2', new ItemStack(blockResult, 1, 2), /* Diamond Chest */
'3', new ItemStack(blockResult, 1, 3), /* Copper Chest */
'4', new ItemStack(blockResult, 1, 4) /* Silver Chest */
'4', new ItemStack(blockResult, 1, 4) /* Silver Chest */
);
//@formatter:on
}
}
}
@ -150,11 +154,11 @@ public enum IronChestType implements IStringSerializable
{
if (mat.equals("obsidian"))
{
return Blocks.obsidian;
return Blocks.OBSIDIAN;
}
else if (mat.equals("dirt"))
{
return Blocks.dirt;
return Blocks.DIRT;
}
return mat;
}

View File

@ -34,11 +34,13 @@ public class ItemChestChanger extends Item
this.setMaxStackSize(1);
this.setUnlocalizedName("ironchest:" + type.name());
this.setCreativeTab(CreativeTabs.tabMisc);
this.setCreativeTab(CreativeTabs.MISC);
}
@Override
//@formatter:off
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
//@formatter:on
{
if (worldIn.isRemote)
{

View File

@ -9,7 +9,7 @@ import net.minecraft.util.text.translation.I18n;
public class TileEntityDirtChest extends TileEntityIronChest
{
private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.written_book);
private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.WRITTEN_BOOK);
static
{

View File

@ -324,8 +324,9 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
this.numUsingPlayers = 0;
float var1 = 5.0F;
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.pos.getX() - var1, this.pos.getY() - var1,
this.pos.getZ() - var1, this.pos.getX() + 1 + var1, this.pos.getY() + 1 + var1, this.pos.getZ() + 1 + var1));
//@formatter:off
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.pos.getX() - var1, this.pos.getY() - var1, this.pos.getZ() - var1, this.pos.getX() + 1 + var1, this.pos.getY() + 1 + var1, this.pos.getZ() + 1 + var1));
//@formatter:on
for (EntityPlayer var4 : var2)
{
@ -353,8 +354,9 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
double d = this.pos.getX() + 0.5D;
double d1 = this.pos.getZ() + 0.5D;
this.worldObj.playSound((EntityPlayer) null, d, this.pos.getY() + 0.5D, d1, SoundEvents.block_chest_open, SoundCategory.BLOCKS, 0.5F,
this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
//@formatter:off
this.worldObj.playSound((EntityPlayer) null, d, this.pos.getY() + 0.5D, d1, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
//@formatter:on
}
if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
{
@ -376,8 +378,9 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
{
double d2 = this.pos.getX() + 0.5D;
double d3 = this.pos.getZ() + 0.5D;
this.worldObj.playSound((EntityPlayer) null, d2, this.pos.getY() + 0.5D, d3, SoundEvents.block_chest_close, SoundCategory.BLOCKS, 0.5F,
this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
//@formatter:off
this.worldObj.playSound((EntityPlayer) null, d2, this.pos.getY() + 0.5D, d3, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
//@formatter:on
}
if (this.lidAngle < 0.0F)
{