Added transporter beacon renderer
Fixed beacon usability findings
This commit is contained in:
parent
4ea5854430
commit
43bfb73186
8 changed files with 264 additions and 57 deletions
|
@ -142,6 +142,7 @@ import cr0s.warpdrive.render.RenderBlockShipScanner;
|
|||
import cr0s.warpdrive.render.RenderBlockForceField;
|
||||
import cr0s.warpdrive.render.RenderBlockOmnipanel;
|
||||
import cr0s.warpdrive.render.RenderBlockStandard;
|
||||
import cr0s.warpdrive.render.RenderBlockTransporterBeacon;
|
||||
import cr0s.warpdrive.render.RenderOverlayAir;
|
||||
import cr0s.warpdrive.render.RenderOverlayCamera;
|
||||
import cr0s.warpdrive.render.RenderOverlayLocation;
|
||||
|
@ -319,6 +320,9 @@ public class WarpDrive {
|
|||
|
||||
RenderBlockShipScanner.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(RenderBlockShipScanner.instance);
|
||||
|
||||
RenderBlockTransporterBeacon.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(RenderBlockTransporterBeacon.instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package cr0s.warpdrive.block.movement;
|
|||
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
import cr0s.warpdrive.block.BlockAbstractBase;
|
||||
import cr0s.warpdrive.block.BlockAbstractContainer;
|
||||
import cr0s.warpdrive.block.energy.TileEntityEnergyBank;
|
||||
import cr0s.warpdrive.data.EnumTransporterBeaconState;
|
||||
import cr0s.warpdrive.render.RenderBlockTransporterBeacon;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -41,31 +41,16 @@ public class BlockTransporterBeacon extends BlockAbstractContainer {
|
|||
@Override
|
||||
public void registerBlockIcons(final IIconRegister iconRegister) {
|
||||
iconBuffer = new IIcon[4];
|
||||
iconBuffer[0] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-item");
|
||||
iconBuffer[1] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-off");
|
||||
iconBuffer[2] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-deploying");
|
||||
iconBuffer[3] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-deployed");
|
||||
iconBuffer[EnumTransporterBeaconState.PACKED_INACTIVE .getMetadata()] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-packed_inactive");
|
||||
iconBuffer[EnumTransporterBeaconState.PACKED_ACTIVE .getMetadata()] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-packed_active");
|
||||
iconBuffer[EnumTransporterBeaconState.DEPLOYED_INACTIVE.getMetadata()] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-deployed_inactive");
|
||||
iconBuffer[EnumTransporterBeaconState.DEPLOYED_ACTIVE .getMetadata()] = iconRegister.registerIcon("warpdrive:movement/transporter_beacon-deployed_active");
|
||||
}
|
||||
|
||||
/* not used by torch rendering (type 2)
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(final IBlockAccess blockAccess, final int x, final int y, final int z, final int side) {
|
||||
final int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
if (side == 0 || side == 1) {
|
||||
return iconBuffer[0];
|
||||
}
|
||||
if (metadata >= 0 && metadata < 4) {
|
||||
return iconBuffer[metadata];
|
||||
}
|
||||
return iconBuffer[3];
|
||||
}
|
||||
/**/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int metadata) {
|
||||
return iconBuffer[3];
|
||||
return iconBuffer[metadata & 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +65,7 @@ public class BlockTransporterBeacon extends BlockAbstractContainer {
|
|||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 2;
|
||||
return RenderBlockTransporterBeacon.renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import cr0s.warpdrive.api.computer.ITransporterCore;
|
|||
import cr0s.warpdrive.block.ItemBlockAbstractBase;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnumTransporterBeaconState;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -13,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -22,7 +24,7 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
|
|||
public ItemBlockTransporterBeacon(final Block block) {
|
||||
super(block);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(100);
|
||||
setMaxDamage(100 * 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,8 +124,14 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
|
|||
}
|
||||
tagCompound.setInteger(TileEntityAbstractEnergy.ENERGY_TAG, energy);
|
||||
itemStack.setTagCompound(tagCompound);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static ItemStack updateDamage(final ItemStack itemStack, final int energy, final boolean isActive) {
|
||||
final int maxDamage = itemStack.getMaxDamage();
|
||||
itemStack.setItemDamage(maxDamage - maxDamage * energy / WarpDriveConfig.TRANSPORTER_BEACON_MAX_ENERGY_STORED);
|
||||
final int metadataEnergy = maxDamage - maxDamage * energy / WarpDriveConfig.TRANSPORTER_BEACON_MAX_ENERGY_STORED;
|
||||
final EnumTransporterBeaconState enumTransporterBeaconState = isActive ? EnumTransporterBeaconState.PACKED_ACTIVE : EnumTransporterBeaconState.PACKED_INACTIVE;
|
||||
itemStack.setItemDamage((metadataEnergy & ~0x7) + enumTransporterBeaconState.getMetadata());
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
@ -136,8 +144,7 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
|
|||
// Item overrides
|
||||
@Override
|
||||
public void onUpdate(final ItemStack itemStack, final World world, final Entity entity, final int indexSlot, final boolean isHeld) {
|
||||
if ( isHeld
|
||||
&& entity instanceof EntityPlayer ) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
final EntityPlayer entityPlayer = (EntityPlayer) entity;
|
||||
final ItemStack itemStackCheck = entityPlayer.inventory.getStackInSlot(indexSlot);
|
||||
if (itemStackCheck != itemStack) {
|
||||
|
@ -147,9 +154,15 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
|
|||
}
|
||||
|
||||
// consume energy
|
||||
final int energy = getEnergy(itemStack) - WarpDriveConfig.TRANSPORTER_BEACON_ENERGY_PER_TICK;
|
||||
final int energy = isHeld ? getEnergy(itemStack) - WarpDriveConfig.TRANSPORTER_BEACON_ENERGY_PER_TICK : -1;
|
||||
if (energy >= 0) {
|
||||
final ItemStack itemStackNew = setEnergy(itemStack, energy);
|
||||
ItemStack itemStackNew;
|
||||
itemStackNew = setEnergy(itemStack, energy);
|
||||
itemStackNew = updateDamage(itemStackNew, energy, true);
|
||||
((EntityPlayer) entity).inventory.setInventorySlotContents(indexSlot, itemStackNew);
|
||||
|
||||
} else if (itemStack.getItemDamage() != EnumTransporterBeaconState.PACKED_INACTIVE.getMetadata()) {
|
||||
final ItemStack itemStackNew = updateDamage(itemStack, energy, false);
|
||||
((EntityPlayer) entity).inventory.setInventorySlotContents(indexSlot, itemStackNew);
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +178,7 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
|
|||
}
|
||||
|
||||
// check if clicked block can be interacted with
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
// final Block block = world.getBlock(x, y, z);
|
||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof ITransporterCore)) {
|
||||
|
@ -177,22 +190,20 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
|
|||
|
||||
if (entityPlayer.isSneaking()) {// update transporter signature
|
||||
ItemStack itemStackNew = setTransporterName(itemStack, ((ITransporterCore) tileEntity).getStarMapName());
|
||||
itemStackNew = setTransporterSignature(itemStackNew, ((ITransporterCore) tileEntity).getUUID());
|
||||
// @TODO feedback to player
|
||||
setTransporterSignature(itemStackNew, ((ITransporterCore) tileEntity).getUUID());
|
||||
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D,
|
||||
block.stepSound.func_150496_b(),
|
||||
(block.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
block.stepSound.getPitch() * 0.8F);
|
||||
"mob.zombie.unfect",
|
||||
1.0F,
|
||||
world.rand.nextFloat() * 0.2F + 1.8F);
|
||||
|
||||
} else {// apply signature to transporter
|
||||
final UUID uuid = getTransporterSignature(itemStack);
|
||||
if (uuid != null) {
|
||||
((ITransporterCore) tileEntity).remoteLocation(new Object[] { uuid });
|
||||
// @TODO feedback to player
|
||||
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D,
|
||||
block.stepSound.func_150496_b(),
|
||||
(block.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
block.stepSound.getPitch() * 0.8F);
|
||||
"mob.zombie.infect",
|
||||
1.0F,
|
||||
world.rand.nextFloat() * 0.2F + 1.2F);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import cr0s.warpdrive.WarpDrive;
|
|||
import cr0s.warpdrive.api.computer.ITransporterBeacon;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnumTransporterBeaconState;
|
||||
import cr0s.warpdrive.data.StarMapRegistryItem;
|
||||
import cr0s.warpdrive.data.StarMapRegistryItem.EnumStarMapEntryType;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
|
@ -90,7 +91,11 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergy implem
|
|||
isActive = isActiveNew;
|
||||
|
||||
// report updated status
|
||||
final int metadataNew = 0; // @TODO block rendering !isDeployed || isLowPower ? 1 : !isConnected ? 0 : 2;
|
||||
final EnumTransporterBeaconState enumTransporterBeaconState = isDeployed
|
||||
? (isActive ? EnumTransporterBeaconState.DEPLOYED_ACTIVE : EnumTransporterBeaconState.DEPLOYED_INACTIVE)
|
||||
: (isActive ? EnumTransporterBeaconState.PACKED_ACTIVE : EnumTransporterBeaconState.PACKED_INACTIVE);
|
||||
final int metadataNew = enumTransporterBeaconState.getMetadata();
|
||||
|
||||
updateMetadata(metadataNew);
|
||||
}
|
||||
|
||||
|
@ -197,19 +202,13 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergy implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean energy_canInput(ForgeDirection from) {
|
||||
public boolean energy_canInput(final ForgeDirection from) {
|
||||
// only from bottom
|
||||
if (from != ForgeDirection.DOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// only when offline
|
||||
final int metadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
return (metadata == 0);
|
||||
return (from == ForgeDirection.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean energy_canOutput(ForgeDirection to) {
|
||||
public boolean energy_canOutput(final ForgeDirection to) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -226,8 +226,8 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
|||
1.0F, 1.0F, 1.0F,
|
||||
32);
|
||||
}
|
||||
if ( lockStrengthActual > 0.0F
|
||||
|| tickEnergizing > 0
|
||||
if ( lockStrengthActual > 0.01F
|
||||
|| (transporterState == EnumTransporterState.ENERGIZING && tickEnergizing > 0)
|
||||
|| tickCooldown > 0 ) {
|
||||
PacketHandler.sendTransporterEffectPacket(worldObj, globalPositionLocal, globalPositionRemote, lockStrengthActual,
|
||||
movingEntitiesLocal.values(), movingEntitiesRemote.values(),
|
||||
|
@ -656,11 +656,15 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
|||
final WorldServer worldBeacon = globalPositionBeacon.getWorldServerIfLoaded();
|
||||
if (worldBeacon == null) {
|
||||
globalPositionBeacon = null;
|
||||
isLockRequested = false;
|
||||
isEnergizeRequested = false;
|
||||
} else {
|
||||
final TileEntity tileEntity = worldBeacon.getTileEntity(globalPositionBeacon.x, globalPositionBeacon.y, globalPositionBeacon.z);
|
||||
if ( !(tileEntity instanceof ITransporterBeacon)
|
||||
|| !((ITransporterBeacon) tileEntity).isActive() ) {
|
||||
globalPositionBeacon = null;
|
||||
isLockRequested = false;
|
||||
isEnergizeRequested = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1431,9 +1435,13 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
|||
@Override
|
||||
public String[] transporterName(final Object[] arguments) {
|
||||
if (arguments.length == 1) {
|
||||
transporterName = arguments[0].toString();
|
||||
final String transporterNameNew = arguments[0].toString();
|
||||
if (transporterName.equals(transporterNameNew)) {
|
||||
transporterName = transporterNameNew;
|
||||
uuid = UUID.randomUUID();
|
||||
}
|
||||
}
|
||||
return new String[] { transporterName };
|
||||
return new String[] { transporterName, uuid == null ? null : uuid.toString() };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,10 +7,12 @@ import java.util.HashMap;
|
|||
|
||||
public enum EnumTransporterBeaconState implements IStringSerializable {
|
||||
|
||||
DISABLED (0, "disabled"), // disabled
|
||||
IDLE (1, "idle"), // enabling, waiting for lock
|
||||
ACQUIRING (2, "acquiring"), // acquiring lock
|
||||
ENERGIZING (3, "energizing"); // transferring entities
|
||||
// item form
|
||||
PACKED_INACTIVE (0, "packed_inactive"),
|
||||
PACKED_ACTIVE (1, "packed_active"),
|
||||
// block form
|
||||
DEPLOYED_INACTIVE (2, "deployed_inactive"),
|
||||
DEPLOYED_ACTIVE (3, "deployed_active");
|
||||
|
||||
private final int metadata;
|
||||
private final String unlocalizedName;
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
package cr0s.warpdrive.render;
|
||||
|
||||
import cr0s.warpdrive.block.movement.BlockTransporterBeacon;
|
||||
import cr0s.warpdrive.block.movement.TileEntityTransporterBeacon;
|
||||
import cr0s.warpdrive.data.EnumTransporterBeaconState;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderBlockTransporterBeacon implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int renderId = 0;
|
||||
public static RenderBlockTransporterBeacon instance = new RenderBlockTransporterBeacon();
|
||||
|
||||
private static final double CORE_RADIUS = 2.0D / 32.0D;
|
||||
private static final double CORE_Y_MIN_PACKED_INACTIVE = 0.0D / 32.0D;
|
||||
private static final double CORE_Y_MIN_PACKED_ACTIVE = 0.0D / 32.0D;
|
||||
private static final double CORE_Y_MIN_DEPLOYED_INACTIVE = 1.0D / 32.0D;
|
||||
private static final double CORE_Y_MIN_DEPLOYED_ACTIVE = 1.0D / 32.0D;
|
||||
private static final double CORE_Y_MAX_PACKED_INACTIVE = 11.0D / 32.0D;
|
||||
private static final double CORE_Y_MAX_PACKED_ACTIVE = 15.0D / 32.0D;
|
||||
private static final double CORE_Y_MAX_DEPLOYED_INACTIVE = 12.0D / 32.0D;
|
||||
private static final double CORE_Y_MAX_DEPLOYED_ACTIVE = 20.0D / 32.0D;
|
||||
private static final double BRANCH_HEIGHT = 24.0D / 32.0D;
|
||||
private static final double BRANCH_RADIUS = 16.0D / 32.0D;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
|
||||
if (!(block instanceof BlockTransporterBeacon)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final EnumTransporterBeaconState enumTransporterBeaconState = EnumTransporterBeaconState.get(metadata & 0x7);
|
||||
if (enumTransporterBeaconState == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IIcon icon = RenderBlocks.getInstance().getBlockIconFromSideAndMetadata(block, 0, enumTransporterBeaconState.getMetadata());
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// (block bounds aren't used in our render => no need to grab them here)
|
||||
|
||||
// disable lightning in item rendering, no need to set brightness
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
// (blending already by caller)
|
||||
// (color already set by caller?)
|
||||
// (transformation already done by caller)
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
renderTransporterBeacon(tessellator, 0.0D, 0.0D, 0.0D, enumTransporterBeaconState, icon);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(final IBlockAccess blockAccess, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
if (!(block instanceof BlockTransporterBeacon)) {
|
||||
return false;
|
||||
}
|
||||
final TileEntity tileEntity = blockAccess.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof TileEntityTransporterBeacon)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
final EnumTransporterBeaconState enumTransporterBeaconState = EnumTransporterBeaconState.get(metadata);
|
||||
if (enumTransporterBeaconState == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final IIcon icon = RenderBlocks.getInstance().getBlockIconFromSideAndMetadata(block, 0, metadata);
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
|
||||
renderTransporterBeacon(tessellator, x, y, z, enumTransporterBeaconState, icon);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderTransporterBeacon(final Tessellator tessellator,
|
||||
final double x, final double y, final double z,
|
||||
final EnumTransporterBeaconState enumTransporterBeaconState,
|
||||
final IIcon icon) {
|
||||
// texture coordinates
|
||||
final double uMin_side = icon.getInterpolatedU( 0.0D);
|
||||
final double vMin_side = icon.getInterpolatedV( 4.0D);
|
||||
final double uMax_side = icon.getInterpolatedU(16.0D);
|
||||
final double vMax_side = icon.getInterpolatedV(16.0D);
|
||||
final double uMin_top = icon.getInterpolatedU( 1.0D);
|
||||
final double vMin_top = icon.getInterpolatedV( 1.0D);
|
||||
final double uMax_top = icon.getInterpolatedU( 3.0D);
|
||||
final double vMax_top = icon.getInterpolatedV( 3.0D);
|
||||
final double uMin_bottom = icon.getInterpolatedU( 5.0D);
|
||||
final double vMin_bottom = icon.getInterpolatedV( 1.0D);
|
||||
final double uMax_bottom = icon.getInterpolatedU( 7.0D);
|
||||
final double vMax_bottom = icon.getInterpolatedV( 3.0D);
|
||||
|
||||
// vertex coordinates
|
||||
final double xCenter = x + 0.5D;
|
||||
final double zCenter = z + 0.5D;
|
||||
final double xMin_core = xCenter - CORE_RADIUS;
|
||||
final double xMax_core = xCenter + CORE_RADIUS;
|
||||
final double zMin_core = zCenter - CORE_RADIUS;
|
||||
final double zMax_core = zCenter + CORE_RADIUS;
|
||||
final double xMin_branch = xCenter - BRANCH_RADIUS;
|
||||
final double xMax_branch = xCenter + BRANCH_RADIUS;
|
||||
final double zMin_branch = zCenter - BRANCH_RADIUS;
|
||||
final double zMax_branch = zCenter + BRANCH_RADIUS;
|
||||
|
||||
final double yMin_branch = y + 0.0D;
|
||||
final double yMin_core;
|
||||
final double yMax_core;
|
||||
switch (enumTransporterBeaconState) {
|
||||
default:
|
||||
case PACKED_INACTIVE:
|
||||
yMin_core = y + CORE_Y_MIN_PACKED_INACTIVE;
|
||||
yMax_core = y + CORE_Y_MAX_PACKED_INACTIVE;
|
||||
break;
|
||||
|
||||
case PACKED_ACTIVE:
|
||||
yMin_core = y + CORE_Y_MIN_PACKED_ACTIVE;
|
||||
yMax_core = y + CORE_Y_MAX_PACKED_ACTIVE;
|
||||
break;
|
||||
|
||||
case DEPLOYED_INACTIVE:
|
||||
yMin_core = y + CORE_Y_MIN_DEPLOYED_INACTIVE;
|
||||
yMax_core = y + CORE_Y_MAX_DEPLOYED_INACTIVE;
|
||||
break;
|
||||
|
||||
case DEPLOYED_ACTIVE:
|
||||
yMin_core = y + CORE_Y_MIN_DEPLOYED_ACTIVE;
|
||||
yMax_core = y + CORE_Y_MAX_DEPLOYED_ACTIVE;
|
||||
break;
|
||||
}
|
||||
final double yMax_branch = y + BRANCH_HEIGHT;
|
||||
|
||||
// add top face
|
||||
tessellator.addVertexWithUV(xMin_core , yMax_core , zMin_core , uMin_top, vMin_top);
|
||||
tessellator.addVertexWithUV(xMin_core , yMax_core , zMax_core , uMin_top, vMax_top);
|
||||
tessellator.addVertexWithUV(xMax_core , yMax_core , zMax_core , uMax_top, vMax_top);
|
||||
tessellator.addVertexWithUV(xMax_core , yMax_core , zMin_core , uMax_top, vMin_top);
|
||||
|
||||
// add bottom face
|
||||
tessellator.addVertexWithUV(xMax_core , yMin_core , zMin_core , uMax_bottom, vMin_bottom);
|
||||
tessellator.addVertexWithUV(xMax_core , yMin_core , zMax_core , uMax_bottom, vMax_bottom);
|
||||
tessellator.addVertexWithUV(xMin_core , yMin_core , zMax_core , uMin_bottom, vMax_bottom);
|
||||
tessellator.addVertexWithUV(xMin_core , yMin_core , zMin_core , uMin_bottom, vMin_bottom);
|
||||
|
||||
// add side/branch faces
|
||||
tessellator.addVertexWithUV(xMin_core , yMax_branch, zMin_branch, uMin_side, vMin_side);
|
||||
tessellator.addVertexWithUV(xMin_core , yMin_branch, zMin_branch, uMin_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMin_core , yMin_branch, zMax_branch, uMax_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMin_core , yMax_branch, zMax_branch, uMax_side, vMin_side);
|
||||
|
||||
tessellator.addVertexWithUV(xMax_core , yMax_branch, zMax_branch, uMin_side, vMin_side);
|
||||
tessellator.addVertexWithUV(xMax_core , yMin_branch, zMax_branch, uMin_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMax_core , yMin_branch, zMin_branch, uMax_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMax_core , yMax_branch, zMin_branch, uMax_side, vMin_side);
|
||||
|
||||
tessellator.addVertexWithUV(xMin_branch, yMax_branch, zMax_core , uMin_side, vMin_side);
|
||||
tessellator.addVertexWithUV(xMin_branch, yMin_branch, zMax_core , uMin_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMax_branch, yMin_branch, zMax_core , uMax_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMax_branch, yMax_branch, zMax_core , uMax_side, vMin_side);
|
||||
|
||||
tessellator.addVertexWithUV(xMax_branch, yMax_branch, zMin_core , uMin_side, vMin_side);
|
||||
tessellator.addVertexWithUV(xMax_branch, yMin_branch, zMin_core , uMin_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMin_branch, yMin_branch, zMin_core , uMax_side, vMax_side);
|
||||
tessellator.addVertexWithUV(xMin_branch, yMax_branch, zMin_core , uMax_side, vMin_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(final int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderId;
|
||||
}
|
||||
}
|
|
@ -294,6 +294,7 @@ public class RenderCommons {
|
|||
return renderer.renderStandardBlock(blockDefault, x, y, z);
|
||||
}
|
||||
|
||||
// @FIXME: below method is unfinished, missing box and crossedSquares, also, it changes the OpenGL context
|
||||
public static void renderInventoryBlock(final Block block, final int metadata, final RenderBlocks renderer) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
|
|
Loading…
Reference in a new issue