Some rough model improvements (tiers not done)

This commit is contained in:
Ben Spiers committed 2016-04-29 00:36:29 +01:00
1 parent 55df74e240
commit 8e3d08dfd3
29 files changed
+369 -126

No files matched your search

@@ -21,7 +21,7 @@ public class RenderPersonalChest extends TileEntitySpecialRenderer<TileEntityPer
public void renderTileEntityAt(TileEntityPersonalChest tileEntity, double x, double y, double z, float partialTick, int destroyStage)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y + 1.0F, (float)z+1);
GL11.glTranslatef((float)x, (float)y + 1.0F, (float)z);
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PersonalChest.png"));
@@ -52,6 +52,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.EnumSkyBlock;
@@ -639,6 +640,13 @@ public abstract class BlockBasic extends Block//TODO? implements IBlockCTM, ICus
return BasicBlockType.get(world.getBlockState(pos)) != BasicBlockType.STRUCTURAL_GLASS;
}
@SideOnly(Side.CLIENT)
@Override
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}
public static boolean manageInventory(EntityPlayer player, TileEntityDynamicTank tileEntity)
{
ItemStack itemStack = player.getCurrentEquippedItem();
@@ -100,6 +100,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.Explosion;
@@ -174,7 +175,8 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
public static BlockMachine getBlockMachine(MachineBlock block)
{
return new BlockMachine() {
return new BlockMachine()
{
@Override
public MachineBlock getMachineBlock()
{
@@ -198,7 +200,7 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
@Override
public IBlockState getStateFromMeta(int meta)
{
MachineType type = MachineType.get(getMachineBlock(), meta&0xF);
MachineType type = MachineType.get(getMachineBlock(), meta & 0xF);
return getDefaultState().withProperty(getProperty(), type);
}
@@ -327,8 +329,7 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(height >= 65)
{
change = 1;
}
else if(height <= -65)
} else if(height <= -65)
{
change = 0;
}
@@ -338,10 +339,18 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
{
switch(side)
{
case 0: change = 2; break;
case 1: change = 5; break;
case 2: change = 3; break;
case 3: change = 4; break;
case 0:
change = 2;
break;
case 1:
change = 5;
break;
case 2:
change = 3;
break;
case 3:
change = 4;
break;
}
}
@@ -435,7 +444,7 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(client.enableAmbientLighting)
{
TileEntity tileEntity = world.getTileEntity(pos);
if(tileEntity instanceof IActiveState)
{
if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).lightUpdate())
@@ -574,11 +583,11 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
((IFactory)stack.getItem()).setRecipeType(recipe.ordinal(), stack);
list.add(stack);
}
break;
case FLUID_TANK:
ItemBlockMachine itemMachine = (ItemBlockMachine)item;
for(FluidTankTier tier : FluidTankTier.values())
{
ItemStack stack = new ItemStack(item, 1, type.meta);
@@ -590,15 +599,18 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
{
for(Fluid f : FluidRegistry.getRegisteredFluids().values())
{
try { //Prevent bad IDs
try
{ //Prevent bad IDs
ItemStack filled = new ItemStack(item, 1, type.meta);
itemMachine.setBaseTier(filled, BaseTier.ULTIMATE);
itemMachine.setFluidStack(new FluidStack(f, itemMachine.getCapacity(filled)), filled);
list.add(filled);
} catch(Exception e) {}
} catch(Exception e)
{
}
}
}
break;
default:
list.add(new ItemStack(item, 1, type.meta));
@@ -629,17 +641,17 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(entityplayer.isSneaking())
{
dismantleBlock(world, pos, false);
return true;
}
if(MekanismUtils.isBCWrench(tool))
{
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
}
int change = tileEntity.facing.rotateY().ordinal();
if(tileEntity instanceof TileEntityLogisticalSorter)
{
if(!((TileEntityLogisticalSorter)tileEntity).hasInventory())
@@ -647,7 +659,7 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
for(EnumFacing dir : EnumFacing.VALUES)
{
TileEntity tile = Coord4D.get(tileEntity).offset(dir).getTileEntity(world);
if(tile instanceof IInventory)
{
change = dir.getOpposite().ordinal();
@@ -656,14 +668,14 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
}
}
}
tileEntity.setFacing((short)change);
world.notifyNeighborsOfStateChange(pos, this);
}
else {
} else
{
SecurityUtils.displayNoAccess(entityplayer);
}
return true;
}
}
@@ -678,18 +690,18 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(!entityplayer.isSneaking() && !world.isSideSolid(pos.up(), EnumFacing.DOWN))
{
TileEntityPersonalChest chest = (TileEntityPersonalChest)tileEntity;
if(SecurityUtils.canAccess(entityplayer, tileEntity))
{
MekanismUtils.openPersonalChestGui((EntityPlayerMP)entityplayer, chest, null, true);
}
else {
} else
{
SecurityUtils.displayNoAccess(entityplayer);
}
return true;
}
break;
case FLUID_TANK:
if(!entityplayer.isSneaking())
@@ -703,18 +715,18 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
entityplayer.inventory.markDirty();
return true;
}
}
else {
} else
{
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos.getX(), pos.getY(), pos.getZ());
}
}
else {
} else
{
SecurityUtils.displayNoAccess(entityplayer);
}
return true;
}
break;
case LOGISTICAL_SORTER:
if(!entityplayer.isSneaking())
@@ -722,32 +734,32 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(SecurityUtils.canAccess(entityplayer, tileEntity))
{
LogisticalSorterGuiMessage.openServerGui(SorterGuiPacket.SERVER, 0, world, (EntityPlayerMP)entityplayer, Coord4D.get(tileEntity), -1);
}
else {
} else
{
SecurityUtils.displayNoAccess(entityplayer);
}
return true;
}
break;
case TELEPORTER:
case QUANTUM_ENTANGLOPORTER:
if(!entityplayer.isSneaking())
{
String owner = ((ISecurityTile)tileEntity).getSecurity().getOwner();
if(owner == null || entityplayer.getName().equals(owner))
{
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos.getX(), pos.getY(), pos.getZ());
}
else {
} else
{
SecurityUtils.displayNoAccess(entityplayer);
}
return true;
}
break;
default:
if(!entityplayer.isSneaking() && type.guiId != -1)
@@ -755,18 +767,18 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(SecurityUtils.canAccess(entityplayer, tileEntity))
{
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos.getX(), pos.getY(), pos.getZ());
}
else {
} else
{
SecurityUtils.displayNoAccess(entityplayer);
}
return true;
}
break;
}
}
return false;
}
@@ -793,7 +805,7 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
{
return false;
}
@Override
public Item getItemDropped(IBlockState state, Random random, int fortune)
{
@@ -806,6 +818,13 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
return 3;
}
@SideOnly(Side.CLIENT)
@Override
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, BlockPos pos)
{
@@ -3,10 +3,22 @@ package mekanism.common.block.states;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.block.BlockBasic;
import mekanism.common.tile.TileEntityBin;
import mekanism.common.tile.TileEntityBoilerCasing;
import mekanism.common.tile.TileEntityBoilerValve;
import mekanism.common.tile.TileEntityDynamicTank;
import mekanism.common.tile.TileEntityDynamicValve;
import mekanism.common.tile.TileEntityInductionCasing;
import mekanism.common.tile.TileEntityInductionCell;
import mekanism.common.tile.TileEntityInductionPort;
import mekanism.common.tile.TileEntityInductionProvider;
import mekanism.common.tile.TileEntityPressureDisperser;
import mekanism.common.tile.TileEntitySecurityDesk;
import mekanism.common.tile.TileEntityStructuralGlass;
import mekanism.common.tile.TileEntitySuperheatingElement;
import mekanism.common.tile.TileEntityThermalEvaporationBlock;
import mekanism.common.tile.TileEntityThermalEvaporationController;
import mekanism.common.tile.TileEntityThermalEvaporationValve;
import mekanism.common.util.LangUtils;
import net.minecraft.block.Block;
@@ -29,9 +41,9 @@ public class BlockStateBasic extends BlockStateFacing
{
public static final PropertyBool activeProperty = PropertyBool.create("active");
public BlockStateBasic(BlockBasic block, PropertyEnum typeProperty)
public BlockStateBasic(BlockBasic block, PropertyEnum<BasicBlockType> typeProperty)
{
super(block, typeProperty);
super(block, typeProperty, activeProperty);
}
public static enum BasicBlock
@@ -72,22 +84,22 @@ public class BlockStateBasic extends BlockStateFacing
COAL_BLOCK(BasicBlock.BASIC_BLOCK_1, 3, "CharcoalBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
REFINED_GLOWSTONE(BasicBlock.BASIC_BLOCK_1, 4, "RefinedGlowstone", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
STEEL_BLOCK(BasicBlock.BASIC_BLOCK_1, 5, "SteelBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
BIN(BasicBlock.BASIC_BLOCK_1, 6, "Bin", null, false, Plane.HORIZONTAL, false),
BIN(BasicBlock.BASIC_BLOCK_1, 6, "Bin", TileEntityBin.class, false, Plane.HORIZONTAL, true),
TELEPORTER_FRAME(BasicBlock.BASIC_BLOCK_1, 7, "TeleporterFrame", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
STEEL_CASING(BasicBlock.BASIC_BLOCK_1, 8, "SteelCasing", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
DYNAMIC_TANK(BasicBlock.BASIC_BLOCK_1, 9, "DynamicTank", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
STRUCTURAL_GLASS(BasicBlock.BASIC_BLOCK_1, 10, "StructuralGlass", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
DYNAMIC_VALVE(BasicBlock.BASIC_BLOCK_1, 11, "DynamicValve", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
DYNAMIC_TANK(BasicBlock.BASIC_BLOCK_1, 9, "DynamicTank", TileEntityDynamicTank.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
STRUCTURAL_GLASS(BasicBlock.BASIC_BLOCK_1, 10, "StructuralGlass", TileEntityStructuralGlass.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
DYNAMIC_VALVE(BasicBlock.BASIC_BLOCK_1, 11, "DynamicValve", TileEntityDynamicValve.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
COPPER_BLOCK(BasicBlock.BASIC_BLOCK_1, 12, "CopperBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
TIN_BLOCK(BasicBlock.BASIC_BLOCK_1, 13, "TinBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
SOLAR_EVAPORATION_CONTROLLER(BasicBlock.BASIC_BLOCK_1, 14, "SolarEvaporationController", null, false, Plane.HORIZONTAL, false),
SOLAR_EVAPORATION_VALVE(BasicBlock.BASIC_BLOCK_1, 15, "SolarEvaporationValve", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
SOLAR_EVAPORATION_BLOCK(BasicBlock.BASIC_BLOCK_2, 0, "SolarEvaporationBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_CASING(BasicBlock.BASIC_BLOCK_2, 1, "InductionCasing", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_PORT(BasicBlock.BASIC_BLOCK_2, 2, "InductionPort", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_CELL(BasicBlock.BASIC_BLOCK_2, 3, "InductionCell", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_PROVIDER(BasicBlock.BASIC_BLOCK_2, 4, "InductionProvider", null, false, Predicates.<EnumFacing>alwaysFalse(), false),
SUPERHEATING_ELEMENT(BasicBlock.BASIC_BLOCK_2, 5, "SuperheatingElement", null, true, Predicates.<EnumFacing>alwaysFalse(), false),
THERMAL_EVAPORATION_CONTROLLER(BasicBlock.BASIC_BLOCK_1, 14, "ThermalEvaporationController", TileEntityThermalEvaporationController.class, false, Plane.HORIZONTAL, false),
THERMAL_EVAPORATION_VALVE(BasicBlock.BASIC_BLOCK_1, 15, "ThermalEvaporationValve", TileEntityThermalEvaporationValve.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
THERMAL_EVAPORATION_BLOCK(BasicBlock.BASIC_BLOCK_2, 0, "ThermalEvaporationBlock", TileEntityThermalEvaporationBlock.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_CASING(BasicBlock.BASIC_BLOCK_2, 1, "InductionCasing", TileEntityInductionCasing.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_PORT(BasicBlock.BASIC_BLOCK_2, 2, "InductionPort", TileEntityInductionPort.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_CELL(BasicBlock.BASIC_BLOCK_2, 3, "InductionCell", TileEntityInductionCell.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
INDUCTION_PROVIDER(BasicBlock.BASIC_BLOCK_2, 4, "InductionProvider", TileEntityInductionProvider.class, false, Predicates.<EnumFacing>alwaysFalse(), false),
SUPERHEATING_ELEMENT(BasicBlock.BASIC_BLOCK_2, 5, "SuperheatingElement", TileEntitySuperheatingElement.class, true, Predicates.<EnumFacing>alwaysFalse(), false),
PRESSURE_DISPERSER(BasicBlock.BASIC_BLOCK_2, 6, "PressureDisperser",TileEntityPressureDisperser.class, true, Predicates.<EnumFacing>alwaysFalse(), false),
BOILER_CASING(BasicBlock.BASIC_BLOCK_2, 7, "BoilerCasing", TileEntityBoilerCasing.class, true, Predicates.<EnumFacing>alwaysFalse(), false),
BOILER_VALVE(BasicBlock.BASIC_BLOCK_2, 8, "BoilerValve", TileEntityBoilerValve.class, true, Predicates.<EnumFacing>alwaysFalse(), false),
@@ -218,11 +230,21 @@ public class BlockStateBasic extends BlockStateFacing
BlockBasic block = (BlockBasic)state.getBlock();
BasicBlockType type = state.getValue(block.getProperty());
StringBuilder builder = new StringBuilder();
if(type.hasActiveTexture())
{
builder.append(activeProperty.getName());
builder.append("=");
builder.append(state.getValue(activeProperty));
}
if(type.hasRotations())
{
EnumFacing facing = state.getValue(facingProperty);
if(type.canRotateTo(facing))
{
if(builder.length() > 0)
{
builder.append(",");
}
builder.append(facingProperty.getName());
builder.append("=");
builder.append(facing.getName());
@@ -232,15 +254,6 @@ public class BlockStateBasic extends BlockStateFacing
return new ModelResourceLocation("builtin/missing", "missing");
}
}
if(type.hasActiveTexture())
{
String active = state.getValue(activeProperty) ? "active" : "inactive";
if(builder.length() > 0)
{
builder.append(",");
}
builder.append(active);
}
if(builder.length() == 0)
{