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 static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
||||
public static final PropertyEnum<IronChestType> VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
||||
|
||||
public BlockIronChest()
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ public class BlockIronChest extends BlockContainer
|
|||
|
||||
@Override
|
||||
@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())
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ public class BlockIronChest extends BlockContainer
|
|||
@Override
|
||||
protected BlockState createBlockState()
|
||||
{
|
||||
return new BlockState(this, new IProperty[] { VARIANT_PROP });
|
||||
return new BlockState(this, new IProperty<?>[] { VARIANT_PROP });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
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 static BlockIronChest ironChestBlock;
|
||||
|
|
|
@ -21,14 +21,14 @@ import net.minecraft.util.BlockPos;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemChestChanger extends Item
|
||||
public class ItemChestChanger extends Item
|
||||
{
|
||||
private ChestChangerType type;
|
||||
|
||||
public ItemChestChanger(ChestChangerType type)
|
||||
{
|
||||
this.type = type;
|
||||
|
||||
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ironchest:" + type.name());
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
|
@ -40,13 +40,13 @@ public class ItemChestChanger extends Item
|
|||
if (world.isRemote)
|
||||
return false;
|
||||
if(this.type.canUpgrade(IronChestType.WOOD)){
|
||||
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){
|
||||
return false;
|
||||
}
|
||||
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){
|
||||
return false;
|
||||
}
|
||||
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||
|
|
|
@ -9,14 +9,13 @@ import net.minecraftforge.event.entity.living.LivingEvent;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class OcelotsSitOnChestsHandler {
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
||||
{
|
||||
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
|
||||
{
|
||||
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
||||
|
||||
for (EntityAITasks.EntityAITaskEntry task : tasks) {
|
||||
|
|
|
@ -316,7 +316,6 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
|||
{
|
||||
this.numUsingPlayers = 0;
|
||||
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));
|
||||
|
||||
for (EntityPlayer var4 : var2)
|
||||
|
@ -438,7 +437,7 @@ public class TileEntityIronChest extends TileEntityLockable implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
public Packet<?> getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setInteger("type", getType().ordinal());
|
||||
|
|
|
@ -13,17 +13,6 @@ package cpw.mods.ironchest.client;
|
|||
import java.util.Map;
|
||||
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.Builder;
|
||||
import com.google.common.primitives.SignedBytes;
|
||||
|
@ -32,8 +21,17 @@ import cpw.mods.ironchest.BlockIronChest;
|
|||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
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;
|
||||
|
||||
|
@ -44,14 +42,14 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
|||
}
|
||||
locations = builder.build();
|
||||
}
|
||||
|
||||
|
||||
private Random random;
|
||||
private RenderEntityItem itemRenderer;
|
||||
private ModelChest model;
|
||||
|
||||
private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F },
|
||||
{ 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F }, };
|
||||
|
||||
|
||||
public TileEntityIronChestRenderer()
|
||||
{
|
||||
model = new ModelChest();
|
||||
|
@ -79,14 +77,14 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
|||
}
|
||||
int facing = 3;
|
||||
IronChestType type = tile.getType();
|
||||
|
||||
|
||||
if (tile != null && tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock) {
|
||||
facing = tile.getFacing();
|
||||
type = tile.getType();
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
type = (IronChestType)state.getValue(BlockIronChest.VARIANT_PROP);
|
||||
}
|
||||
|
||||
|
||||
if (breakStage >= 0)
|
||||
{
|
||||
bindTexture(DESTROY_STAGES[breakStage]);
|
||||
|
@ -96,10 +94,10 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
|||
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
|
||||
GlStateManager.matrixMode(5888);
|
||||
} else
|
||||
bindTexture(locations.get(type));
|
||||
bindTexture(locations.get(type));
|
||||
GlStateManager.pushMatrix();
|
||||
if(type == IronChestType.CRYSTAL)
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GlStateManager.scale(1.0F, -1F, -1F);
|
||||
|
@ -132,10 +130,10 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
|||
GlStateManager.matrixMode(5888);
|
||||
}
|
||||
if(type == IronChestType.CRYSTAL)
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
if (type.isTransparent() && tile.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d) {
|
||||
random.setSeed(254L);
|
||||
float shiftX;
|
||||
|
@ -175,10 +173,9 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
|||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTick, int breakStage)
|
||||
|
||||
public void renderTileEntityAt(TileEntityIronChest 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