Some cleanup, generics, whitespace, etc.
This commit is contained in:
parent
aad2b93dc4
commit
3b63013739
|
@ -44,7 +44,7 @@ import com.google.common.collect.Lists;
|
||||||
|
|
||||||
public class BlockIronChest extends BlockContainer
|
public class BlockIronChest extends BlockContainer
|
||||||
{
|
{
|
||||||
public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
public static final PropertyEnum<IronChestType> VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
||||||
|
|
||||||
public BlockIronChest()
|
public BlockIronChest()
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,7 @@ public class BlockIronChest extends BlockContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
|
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||||
{
|
{
|
||||||
for (IronChestType type : IronChestType.values())
|
for (IronChestType type : IronChestType.values())
|
||||||
{
|
{
|
||||||
|
@ -128,7 +128,7 @@ public class BlockIronChest extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
protected BlockState createBlockState()
|
protected BlockState createBlockState()
|
||||||
{
|
{
|
||||||
return new BlockState(this, new IProperty[] { VARIANT_PROP });
|
return new BlockState(this, new IProperty<?>[] { VARIANT_PROP });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,7 @@ 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;
|
||||||
|
|
||||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:FML@[7.2,)", acceptedMinecraftVersions="[1.8,1.8.8]")
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[11.14.4,]", acceptedMinecraftVersions="[1.8,1.8.8]")
|
||||||
public class IronChest
|
public class IronChest
|
||||||
{
|
{
|
||||||
public static BlockIronChest ironChestBlock;
|
public static BlockIronChest ironChestBlock;
|
||||||
|
|
|
@ -40,13 +40,13 @@ public class ItemChestChanger extends Item
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return false;
|
return false;
|
||||||
if(this.type.canUpgrade(IronChestType.WOOD)){
|
if(this.type.canUpgrade(IronChestType.WOOD)){
|
||||||
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){
|
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){
|
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class OcelotsSitOnChestsHandler {
|
||||||
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
|
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
|
||||||
{
|
{
|
||||||
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
List<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
||||||
|
|
||||||
for (EntityAITasks.EntityAITaskEntry task : tasks) {
|
for (EntityAITasks.EntityAITaskEntry task : tasks) {
|
||||||
|
|
|
@ -316,7 +316,6 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
{
|
{
|
||||||
this.numUsingPlayers = 0;
|
this.numUsingPlayers = 0;
|
||||||
float var1 = 5.0F;
|
float var1 = 5.0F;
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() - var1, pos.getY() - var1, pos.getZ() - var1, pos.getX() + 1 + var1, pos.getY() + 1 + var1, pos.getZ() + 1 + var1));
|
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() - var1, pos.getY() - var1, pos.getZ() - var1, pos.getX() + 1 + var1, pos.getY() + 1 + var1, pos.getZ() + 1 + var1));
|
||||||
|
|
||||||
for (EntityPlayer var4 : var2)
|
for (EntityPlayer var4 : var2)
|
||||||
|
@ -438,7 +437,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket()
|
public Packet<?> getDescriptionPacket()
|
||||||
{
|
{
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
nbt.setInteger("type", getType().ordinal());
|
nbt.setInteger("type", getType().ordinal());
|
||||||
|
|
|
@ -13,17 +13,6 @@ package cpw.mods.ironchest.client;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.model.ModelChest;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.entity.RenderEntityItem;
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableMap.Builder;
|
import com.google.common.collect.ImmutableMap.Builder;
|
||||||
import com.google.common.primitives.SignedBytes;
|
import com.google.common.primitives.SignedBytes;
|
||||||
|
@ -32,8 +21,17 @@ import cpw.mods.ironchest.BlockIronChest;
|
||||||
import cpw.mods.ironchest.IronChest;
|
import cpw.mods.ironchest.IronChest;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.model.ModelChest;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderEntityItem;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileEntityIronChest>
|
||||||
{
|
{
|
||||||
private static Map<IronChestType, ResourceLocation> locations;
|
private static Map<IronChestType, ResourceLocation> locations;
|
||||||
|
|
||||||
|
@ -96,10 +94,10 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
||||||
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
|
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
|
||||||
GlStateManager.matrixMode(5888);
|
GlStateManager.matrixMode(5888);
|
||||||
} else
|
} else
|
||||||
bindTexture(locations.get(type));
|
bindTexture(locations.get(type));
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
if(type == IronChestType.CRYSTAL)
|
if(type == IronChestType.CRYSTAL)
|
||||||
GlStateManager.disableCull();
|
GlStateManager.disableCull();
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||||
GlStateManager.scale(1.0F, -1F, -1F);
|
GlStateManager.scale(1.0F, -1F, -1F);
|
||||||
|
@ -132,7 +130,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
||||||
GlStateManager.matrixMode(5888);
|
GlStateManager.matrixMode(5888);
|
||||||
}
|
}
|
||||||
if(type == IronChestType.CRYSTAL)
|
if(type == IronChestType.CRYSTAL)
|
||||||
GlStateManager.enableCull();
|
GlStateManager.enableCull();
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
@ -176,9 +174,8 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void renderTileEntityAt(TileEntityIronChest tileentity, double x, double y, double z, float partialTick, int breakStage)
|
||||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTick, int breakStage)
|
|
||||||
{
|
{
|
||||||
render((TileEntityIronChest) tileentity, x, y, z, partialTick, breakStage);
|
render(tileentity, x, y, z, partialTick, breakStage);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue