Added omnipanel rendering

Refactored baked models
This commit is contained in:
Unknown 2019-04-11 12:02:40 +02:00 committed by unknown
parent 5681a099c0
commit 36175f33a7
12 changed files with 1157 additions and 822 deletions

View file

@ -1,11 +1,11 @@
package cr0s.warpdrive.api;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
public interface IMyBakedModel extends IBakedModel {
void setResourceLocation(final ResourceLocation resourceLocation);
void setModelResourceLocation(final ModelResourceLocation modelResourceLocation);
void setOriginalBakedModel(final IBakedModel bakedModel);
}

View file

@ -1,22 +1,43 @@
package cr0s.warpdrive.block;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.EnumTier;
import cr0s.warpdrive.event.ModelBakeEventHandler;
import cr0s.warpdrive.render.BakedModelOmnipanel;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockPane;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.MutableBlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.common.property.Properties;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -29,12 +50,12 @@ public abstract class BlockAbstractOmnipanel extends BlockAbstractBase {
protected static AxisAlignedBB AABB_XP_YN = new AxisAlignedBB(CENTER_MIN, 0.0F, CENTER_MIN, 1.0F, CENTER_MAX, CENTER_MAX);
protected static AxisAlignedBB AABB_XN_YP = new AxisAlignedBB(0.0F, CENTER_MIN, CENTER_MIN, CENTER_MAX, 1.0F, CENTER_MAX);
protected static AxisAlignedBB AABB_XP_YP = new AxisAlignedBB(CENTER_MIN, CENTER_MIN, CENTER_MIN, 1.0F, 1.0F, CENTER_MAX);
protected static AxisAlignedBB AABB_ZN_YN = new AxisAlignedBB(CENTER_MIN, 0.0F, 0.0F, CENTER_MAX, CENTER_MAX, CENTER_MAX);
protected static AxisAlignedBB AABB_ZP_YN = new AxisAlignedBB(CENTER_MIN, 0.0F, CENTER_MIN, CENTER_MAX, CENTER_MAX, 1.0F);
protected static AxisAlignedBB AABB_ZN_YP = new AxisAlignedBB(CENTER_MIN, CENTER_MIN, 0.0F, CENTER_MAX, 1.0F, CENTER_MAX);
protected static AxisAlignedBB AABB_ZP_YP = new AxisAlignedBB(CENTER_MIN, CENTER_MIN, CENTER_MIN, CENTER_MAX, 1.0F, 1.0F);
protected static AxisAlignedBB AABB_XN_ZN = new AxisAlignedBB(0.0F, CENTER_MIN, 0.0F, CENTER_MAX, CENTER_MAX, CENTER_MAX);
protected static AxisAlignedBB AABB_XP_ZN = new AxisAlignedBB(CENTER_MIN, CENTER_MIN, 0.0F, 1.0F, CENTER_MAX, CENTER_MAX);
protected static AxisAlignedBB AABB_XN_ZP = new AxisAlignedBB(0.0F, CENTER_MIN, CENTER_MIN, CENTER_MAX, CENTER_MAX, 1.0F);
@ -47,21 +68,178 @@ public abstract class BlockAbstractOmnipanel extends BlockAbstractBase {
protected static AxisAlignedBB AABB_XN = new AxisAlignedBB(0.0F, CENTER_MIN, CENTER_MIN, CENTER_MAX, CENTER_MAX, CENTER_MAX);
protected static AxisAlignedBB AABB_XP = new AxisAlignedBB(CENTER_MIN, CENTER_MIN, CENTER_MIN, 1.0F, CENTER_MAX, CENTER_MAX);
public static final IUnlistedProperty<Boolean> CAN_CONNECT_Y_NEG = Properties.toUnlisted(PropertyBool.create("canConnectY_neg"));
public static final IUnlistedProperty<Boolean> CAN_CONNECT_Y_POS = Properties.toUnlisted(PropertyBool.create("canConnectY_pos"));
public static final IUnlistedProperty<Boolean> CAN_CONNECT_Z_NEG = Properties.toUnlisted(PropertyBool.create("canConnectZ_neg"));
public static final IUnlistedProperty<Boolean> CAN_CONNECT_Z_POS = Properties.toUnlisted(PropertyBool.create("canConnectZ_pos"));
public static final IUnlistedProperty<Boolean> CAN_CONNECT_X_NEG = Properties.toUnlisted(PropertyBool.create("canConnectX_neg"));
public static final IUnlistedProperty<Boolean> CAN_CONNECT_X_POS = Properties.toUnlisted(PropertyBool.create("canConnectX_pos"));
public static final IUnlistedProperty<Boolean> HAS_XN_YN = Properties.toUnlisted(PropertyBool.create("hasXnYn"));
public static final IUnlistedProperty<Boolean> HAS_XP_YN = Properties.toUnlisted(PropertyBool.create("hasXpYn"));
public static final IUnlistedProperty<Boolean> HAS_XN_YP = Properties.toUnlisted(PropertyBool.create("hasXnYp"));
public static final IUnlistedProperty<Boolean> HAS_XP_YP = Properties.toUnlisted(PropertyBool.create("hasXpYp"));
public static final IUnlistedProperty<Boolean> HAS_XN_ZN = Properties.toUnlisted(PropertyBool.create("hasXnZn"));
public static final IUnlistedProperty<Boolean> HAS_XP_ZN = Properties.toUnlisted(PropertyBool.create("hasXpZn"));
public static final IUnlistedProperty<Boolean> HAS_XN_ZP = Properties.toUnlisted(PropertyBool.create("hasXnZp"));
public static final IUnlistedProperty<Boolean> HAS_XP_ZP = Properties.toUnlisted(PropertyBool.create("hasXpZp"));
public static final IUnlistedProperty<Boolean> HAS_ZN_YN = Properties.toUnlisted(PropertyBool.create("hasZnYn"));
public static final IUnlistedProperty<Boolean> HAS_ZP_YN = Properties.toUnlisted(PropertyBool.create("hasZpYn"));
public static final IUnlistedProperty<Boolean> HAS_ZN_YP = Properties.toUnlisted(PropertyBool.create("hasZnYp"));
public static final IUnlistedProperty<Boolean> HAS_ZP_YP = Properties.toUnlisted(PropertyBool.create("hasZpYp"));
public BlockAbstractOmnipanel(final String registryName, final EnumTier enumTier, final Material material) {
super(registryName, enumTier, material);
}
@Nonnull
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this,
new IProperty[] { BlockColored.COLOR },
new IUnlistedProperty[] { CAN_CONNECT_Y_NEG, CAN_CONNECT_Y_POS, CAN_CONNECT_Z_NEG, CAN_CONNECT_Z_POS, CAN_CONNECT_X_NEG, CAN_CONNECT_X_POS,
HAS_XN_YN, HAS_XP_YN, HAS_XN_YP, HAS_XP_YP, HAS_XN_ZN, HAS_XP_ZN, HAS_XN_ZP, HAS_XP_ZP, HAS_ZN_YN, HAS_ZP_YN, HAS_ZN_YP, HAS_ZP_YP });
}
@SuppressWarnings("deprecation")
@Nonnull
@Override
public IBlockState getStateFromMeta(final int metadata) {
return this.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.byMetadata(metadata));
}
@Override
public int getMetaFromState(final IBlockState blockState) {
return blockState.getValue(BlockColored.COLOR).getMetadata();
}
@Nonnull
@Override
public IBlockState getExtendedState(@Nonnull final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) {
if (!(blockState instanceof IExtendedBlockState)) {
WarpDrive.logger.error(String.format("%s Invalid call to getExtendedState() with invalid state %s %s",
this, blockState, Commons.format(blockAccess, blockPos)));
return blockState;
}
final MutableBlockPos mutableBlockPos = new MutableBlockPos(blockPos);
// get direct connections
final int maskConnectY_neg = getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() - 1, blockPos.getZ() ), EnumFacing.DOWN);
final int maskConnectY_pos = getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() + 1, blockPos.getZ() ), EnumFacing.UP);
final int maskConnectZ_neg = getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() , blockPos.getZ() - 1), EnumFacing.NORTH);
final int maskConnectZ_pos = getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() , blockPos.getZ() + 1), EnumFacing.SOUTH);
final int maskConnectX_neg = getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() - 1, blockPos.getY() , blockPos.getZ() ), EnumFacing.WEST);
final int maskConnectX_pos = getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() + 1, blockPos.getY() , blockPos.getZ() ), EnumFacing.EAST);
final boolean canConnectY_neg = maskConnectY_neg > 0;
final boolean canConnectY_pos = maskConnectY_pos > 0;
final boolean canConnectZ_neg = maskConnectZ_neg > 0;
final boolean canConnectZ_pos = maskConnectZ_pos > 0;
final boolean canConnectX_neg = maskConnectX_neg > 0;
final boolean canConnectX_pos = maskConnectX_pos > 0;
final boolean canConnectNone = !canConnectY_neg && !canConnectY_pos && !canConnectZ_neg && !canConnectZ_pos && !canConnectX_neg && !canConnectX_pos;
// get diagonal connections
final boolean canConnectXn_Y_neg = (maskConnectX_neg > 1 && maskConnectY_neg > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() - 1, blockPos.getY() - 1, blockPos.getZ() ), EnumFacing.DOWN ) > 0;
final boolean canConnectXn_Y_pos = (maskConnectX_neg > 1 && maskConnectY_pos > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() - 1, blockPos.getY() + 1, blockPos.getZ() ), EnumFacing.UP ) > 0;
final boolean canConnectXn_Z_neg = (maskConnectX_neg > 1 && maskConnectZ_neg > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() - 1, blockPos.getY() , blockPos.getZ() - 1), EnumFacing.NORTH) > 0;
final boolean canConnectXn_Z_pos = (maskConnectX_neg > 1 && maskConnectZ_pos > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() - 1, blockPos.getY() , blockPos.getZ() + 1), EnumFacing.SOUTH) > 0;
final boolean canConnectZn_Y_neg = (maskConnectZ_neg > 1 && maskConnectY_neg > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() - 1, blockPos.getZ() - 1), EnumFacing.DOWN ) > 0;
final boolean canConnectZn_Y_pos = (maskConnectZ_neg > 1 && maskConnectY_pos > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() + 1, blockPos.getZ() - 1), EnumFacing.UP ) > 0;
final boolean canConnectXp_Y_neg = (maskConnectX_pos > 1 && maskConnectY_neg > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() + 1, blockPos.getY() - 1, blockPos.getZ() ), EnumFacing.DOWN ) > 0;
final boolean canConnectXp_Y_pos = (maskConnectX_pos > 1 && maskConnectY_pos > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() + 1, blockPos.getY() + 1, blockPos.getZ() ), EnumFacing.UP ) > 0;
final boolean canConnectXp_Z_neg = (maskConnectX_pos > 1 && maskConnectZ_neg > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() + 1, blockPos.getY() , blockPos.getZ() - 1), EnumFacing.NORTH) > 0;
final boolean canConnectXp_Z_pos = (maskConnectX_pos > 1 && maskConnectZ_pos > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() + 1, blockPos.getY() , blockPos.getZ() + 1), EnumFacing.SOUTH) > 0;
final boolean canConnectZp_Y_neg = (maskConnectZ_pos > 1 && maskConnectY_neg > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() - 1, blockPos.getZ() + 1), EnumFacing.DOWN ) > 0;
final boolean canConnectZp_Y_pos = (maskConnectZ_pos > 1 && maskConnectY_pos > 1) || getConnectionMask(blockAccess, mutableBlockPos.setPos(blockPos.getX() , blockPos.getY() + 1, blockPos.getZ() + 1), EnumFacing.UP ) > 0;
// get panels
final boolean hasXnYn = canConnectNone || (canConnectX_neg && canConnectY_neg && canConnectXn_Y_neg);
final boolean hasXpYn = canConnectNone || (canConnectX_pos && canConnectY_neg && canConnectXp_Y_neg);
final boolean hasXnYp = canConnectNone || (canConnectX_neg && canConnectY_pos && canConnectXn_Y_pos);
final boolean hasXpYp = canConnectNone || (canConnectX_pos && canConnectY_pos && canConnectXp_Y_pos);
final boolean hasXnZn = canConnectNone || (canConnectX_neg && canConnectZ_neg && canConnectXn_Z_neg);
final boolean hasXpZn = canConnectNone || (canConnectX_pos && canConnectZ_neg && canConnectXp_Z_neg);
final boolean hasXnZp = canConnectNone || (canConnectX_neg && canConnectZ_pos && canConnectXn_Z_pos);
final boolean hasXpZp = canConnectNone || (canConnectX_pos && canConnectZ_pos && canConnectXp_Z_pos);
final boolean hasZnYn = canConnectNone || (canConnectZ_neg && canConnectY_neg && canConnectZn_Y_neg);
final boolean hasZpYn = canConnectNone || (canConnectZ_pos && canConnectY_neg && canConnectZp_Y_neg);
final boolean hasZnYp = canConnectNone || (canConnectZ_neg && canConnectY_pos && canConnectZn_Y_pos);
final boolean hasZpYp = canConnectNone || (canConnectZ_pos && canConnectY_pos && canConnectZp_Y_pos);
// build extended state
return ((IExtendedBlockState) blockState)
.withProperty(CAN_CONNECT_Y_NEG, canConnectY_neg)
.withProperty(CAN_CONNECT_Y_POS, canConnectY_pos)
.withProperty(CAN_CONNECT_Z_NEG, canConnectZ_neg)
.withProperty(CAN_CONNECT_Z_POS, canConnectZ_pos)
.withProperty(CAN_CONNECT_X_NEG, canConnectX_neg)
.withProperty(CAN_CONNECT_X_POS, canConnectX_pos)
.withProperty(HAS_XN_YN, hasXnYn)
.withProperty(HAS_XP_YN, hasXpYn)
.withProperty(HAS_XN_YP, hasXnYp)
.withProperty(HAS_XP_YP, hasXpYp)
.withProperty(HAS_XN_ZN, hasXnZn)
.withProperty(HAS_XP_ZN, hasXpZn)
.withProperty(HAS_XN_ZP, hasXnZp)
.withProperty(HAS_XP_ZP, hasXpZp)
.withProperty(HAS_ZN_YN, hasZnYn)
.withProperty(HAS_ZP_YN, hasZpYn)
.withProperty(HAS_ZN_YP, hasZnYp)
.withProperty(HAS_ZP_YP, hasZpYp);
}
@Nullable
@Override
public ItemBlock createItemBlock() {
return new ItemBlockAbstractBase(this, true, false);
}
@Override
public int damageDropped(final IBlockState blockState) {
return getMetaFromState(blockState);
return blockState.getValue(BlockColored.COLOR).getMetadata();
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final CreativeTabs creativeTab, final NonNullList<ItemStack> list) {
for (final EnumDyeColor enumDyeColor : EnumDyeColor.values()) {
list.add(new ItemStack(this, 1, enumDyeColor.getMetadata()));
}
}
@SideOnly(Side.CLIENT)
@Override
public void modelInitialisation() {
super.modelInitialisation();
// register (smart) baked model
final ResourceLocation registryName = getRegistryName();
assert registryName != null;
for (final EnumDyeColor enumDyeColor : BlockColored.COLOR.getAllowedValues()) {
final String variant = String.format("%s=%s",
BlockColored.COLOR.getName(), enumDyeColor.getName());
ModelBakeEventHandler.registerBakedModel(new ModelResourceLocation(registryName, variant), BakedModelOmnipanel.class);
}
}
@SuppressWarnings("deprecation")
@Nonnull
@Override
public MapColor getMapColor(final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) {
return MapColor.getBlockColor(blockState.getValue(BlockColored.COLOR));
}
@SuppressWarnings("deprecation")
@Override
public boolean isBlockNormalCube(final IBlockState blockState) {
// not supposed to be called, upstream should use isNormalCube(IBlockState, IBlockAccess, BlockPos) instead
// practically, Forge still use it in WorldEntitySpawner.isValidEmptySpawnBlock() calling BlockStateContainer$StateImplementation.isBlockNormalCube()
// practically, Forge still use it in WorldEntitySpawner.isValidEmptySpawnBlock(), Block.getAmbientOcclusionLightValue(), BlockRedstoneWire.getAttachPosition()
// calling BlockStateContainer$StateImplementation.isBlockNormalCube()
return false;
}
@ -82,6 +260,13 @@ public abstract class BlockAbstractOmnipanel extends BlockAbstractBase {
return false;
}
@Nonnull
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@Override

View file

@ -8,15 +8,20 @@ import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.block.BlockColored;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockAirShield extends BlockAbstractOmnipanel {
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockAirShield extends BlockAbstractOmnipanel implements IBlockColor {
public BlockAirShield(final String registryName, final EnumTier enumTier) {
super(registryName, enumTier, Material.CLOTH);
@ -24,46 +29,46 @@ public class BlockAirShield extends BlockAbstractOmnipanel {
setTranslationKey("warpdrive.breathing.air_shield");
}
/* @TODO rendering
@SideOnly(Side.CLIENT)
@Override
public int getRenderColor(final int metadata) {
switch (metadata) {
case 0:
return 0xFFFFFF; // white
case 1:
return 0xFF5A02; // orange
case 2:
return 0xF269FF; // magenta
case 3:
return 0x80AAFF; // light blue
case 4:
return 0xFFEE3C; // yellow
case 5:
return 0x90E801; // lime green
case 6:
return 0xFB0680; // pink
case 7:
return 0x2C2C2C; // gray
case 8:
return 0x686868; // light gray
case 9:
default:
return 0x0FD7FF; // SciFi cyan
case 10:
return 0x5D1072; // purple
case 11:
return 0x4351CC; // blue
case 12:
return 0x99572E; // brown
case 13:
return 0x75993C; // green
case 14:
return 0xCC4d41; // red
case 15:
return 0x080808; // black
public int colorMultiplier(@Nonnull final IBlockState blockState, @Nullable final IBlockAccess blockAccess, @Nullable final BlockPos blockPos, final int tintIndex) {
switch (blockState.getValue(BlockColored.COLOR)) {
case WHITE:
return 0xFFFFFF;
case ORANGE:
return 0xFF5A02;
case MAGENTA:
return 0xF269FF;
case LIGHT_BLUE:
return 0x80AAFF;
case YELLOW:
return 0xFFEE3C;
case LIME:
return 0x90E801;
case PINK:
return 0xFB0680;
case SILVER: // gray
return 0x2C2C2C;
case GRAY: // light gray
return 0x686868;
case CYAN:
default: // SciFi cyan
return 0x0FD7FF;
case PURPLE:
return 0x5D1072;
case BLUE:
return 0x4351CC;
case BROWN:
return 0x99572E;
case GREEN:
return 0x75993C;
case RED:
return 0xCC4d41;
case BLACK:
return 0x080808;
}
// return MapColor.getBlockColor(blockState.getValue(BlockColored.COLOR)).colorValue;
}
/**/
@SuppressWarnings("deprecation")
@Override
@ -77,7 +82,6 @@ public class BlockAirShield extends BlockAbstractOmnipanel {
return false;
}
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(final IBlockState blockState, final @Nonnull World world, final @Nonnull BlockPos blockPos,
final @Nonnull AxisAlignedBB entityBox, final @Nonnull List<AxisAlignedBB> collidingBoxes,

View file

@ -13,23 +13,14 @@ import cr0s.warpdrive.data.Vector3;
import net.minecraft.block.BlockColored;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.EnumPushReaction;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockHullOmnipanel extends BlockAbstractOmnipanel implements IDamageReceiver {
public BlockHullOmnipanel(final String registryName, final EnumTier enumTier) {
@ -59,44 +50,6 @@ public class BlockHullOmnipanel extends BlockAbstractOmnipanel implements IDamag
return EnumPushReaction.BLOCK;
}
@Override
public int damageDropped(final IBlockState blockState) {
return blockState.getValue(BlockColored.COLOR).getMetadata();
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final CreativeTabs creativeTab, final NonNullList<ItemStack> list) {
for (final EnumDyeColor enumDyeColor : EnumDyeColor.values()) {
list.add(new ItemStack(this, 1, enumDyeColor.getMetadata()));
}
}
@SuppressWarnings("deprecation")
@Nonnull
@Override
public MapColor getMapColor(final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) {
return MapColor.getBlockColor(blockState.getValue(BlockColored.COLOR));
}
@SuppressWarnings("deprecation")
@Nonnull
@Override
public IBlockState getStateFromMeta(final int metadata) {
return this.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.byMetadata(metadata));
}
@Override
public int getMetaFromState(final IBlockState blockState) {
return blockState.getValue(BlockColored.COLOR).getMetadata();
}
@Nonnull
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BlockColored.COLOR);
}
@Override
public float getBlockHardness(final IBlockState blockState, final World world, final BlockPos blockPos,
final DamageSource damageSource, final int damageParameter, final Vector3 damageDirection, final int damageLevel) {

View file

@ -12,7 +12,9 @@ import cr0s.warpdrive.render.*;
import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -43,6 +45,11 @@ public class ClientProxy extends CommonProxy {
MinecraftForge.EVENT_BUS.register(new ClientHandler());
MinecraftForge.EVENT_BUS.register(new TooltipHandler());
// color handlers
// final Item itemAirShield = Item.getItemFromBlock(blockAirShield);
// Minecraft.getMinecraft().getItemColors().registerItemColorHandler((IItemColor) itemAirShield, itemAirShield);
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((IBlockColor) WarpDrive.blockAirShield, WarpDrive.blockAirShield);
// generic rendering
// MinecraftForge.EVENT_BUS.register(new WarpDriveKeyBindings());
MinecraftForge.EVENT_BUS.register(new RenderOverlayAir());
@ -62,9 +69,6 @@ public class ClientProxy extends CommonProxy {
RenderBlockForceField.renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(RenderBlockForceField.instance);
RenderBlockOmnipanel.renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(RenderBlockOmnipanel.instance);
RenderBlockShipScanner.renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(RenderBlockShipScanner.instance);

View file

@ -30,24 +30,23 @@ public class ModelBakeEventHandler {
@SubscribeEvent
public void onModelBake(final ModelBakeEvent event) {
for (final Entry<ModelResourceLocation, Class<? extends IMyBakedModel>> entry : modelResourceLocationToBakedModel.entrySet()) {
final Object object = event.getModelRegistry().getObject(entry.getKey());
if (object == null) {
final IBakedModel bakedModelExisting = event.getModelRegistry().getObject(entry.getKey());
if (bakedModelExisting == null) {
WarpDrive.logger.warn(String.format("Unable to update baked model for missing %s",
entry.getKey()));
continue;
}
final IBakedModel bakedModelExisting = (IBakedModel) object;
final IMyBakedModel bakedModelNew;
// add a custom baked model wrapping around automatically registered models (from JSON)
try {
bakedModelNew = entry.getValue().newInstance();
bakedModelNew.setResourceLocation(entry.getKey());
bakedModelNew.setModelResourceLocation(entry.getKey());
bakedModelNew.setOriginalBakedModel(bakedModelExisting);
} catch (final Exception exception) {
exception.printStackTrace();
WarpDrive.logger.error(String.format("Failed to instantiate bake model calls for %s, using class %s",
WarpDrive.logger.error(String.format("Failed to update baked model through %s of %s",
entry.getKey(), entry.getValue()));
continue;
}

View file

@ -0,0 +1,232 @@
package cr0s.warpdrive.render;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IMyBakedModel;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import org.lwjgl.util.vector.Vector3f;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.tuple.Pair;
public abstract class BakedModelAbstractBase implements IMyBakedModel {
protected ModelResourceLocation modelResourceLocation;
protected IBakedModel bakedModelOriginal;
protected TextureAtlasSprite spriteParticle;
protected TextureAtlasSprite spriteBlock;
protected int tintIndex = -1;
protected VertexFormat format;
public BakedModelAbstractBase() {
super();
}
@Override
public void setModelResourceLocation(final ModelResourceLocation modelResourceLocation) {
this.modelResourceLocation = modelResourceLocation;
}
@Override
public void setOriginalBakedModel(final IBakedModel bakedModel) {
this.bakedModelOriginal = bakedModel;
spriteParticle = bakedModel.getParticleTexture();
try {
for (final EnumFacing enumFacing : EnumFacing.VALUES) {
final List<BakedQuad> bakedQuads = bakedModel.getQuads(null, enumFacing, 0);
if (!bakedQuads.isEmpty()) {
final BakedQuad bakedQuad = bakedQuads.get(0);
format = bakedQuad.getFormat();
spriteBlock = bakedQuad.getSprite();
if (bakedQuad.hasTintIndex()) {
tintIndex = bakedQuad.getTintIndex();
}
break;
}
}
} catch (final Exception exception) {
exception.printStackTrace();
WarpDrive.logger.error(String.format("Exception trying to retrieve format for %s original baked model %s, defaulting to forge",
modelResourceLocation, bakedModelOriginal));
format = DefaultVertexFormats.ITEM;
}
}
protected void putVertex(final UnpackedBakedQuad.Builder builder,
final float x, final float y, final float z,
final float red, final float green, final float blue, final float alpha,
final float u, final float v,
@Nullable final Vector3f normal) {
for (int index = 0; index < format.getElementCount(); index++) {
switch (format.getElement(index).getUsage()) {
case POSITION:
builder.put(index, x, y, z, 1.0F);
break;
case NORMAL:
if (normal != null) {
builder.put(index, normal.x, normal.y, normal.z);
} else {
WarpDrive.logger.warn(String.format("Missing normal vector, it's required in format %s",
format));
builder.put(index);
}
break;
case COLOR:
builder.put(index, red, green, blue, alpha);
break;
case UV:
builder.put(index, u, v, 0.0F, 1.0F);
break;
// case MATRIX:
// case BLEND_WEIGHT:
case PADDING:
builder.put(index);
break;
// case GENERIC:
default:
WarpDrive.logger.warn(String.format("Unsupported format element #%d %s in %s",
index, format.getElement(index), format));
builder.put(index);
break;
}
}
}
protected void addBakedQuad(final List<BakedQuad> quads, final TextureAtlasSprite sprite,
final float red, final float green, final float blue, final float alpha,
final float x1, final float y1, final float z1, final float u1, final float v1,
final float x2, final float y2, final float z2, final float u2, final float v2,
final float x3, final float y3, final float z3, final float u3, final float v3,
final float x4, final float y4, final float z4, final float u4, final float v4) {
final Vector3f vectorNormal;
if (format.hasNormal()) {
final Vector3f vectorTemp1 = new Vector3f(x3 - x2, y3 - y2, z3 - z2);
final Vector3f vectorTemp2 = new Vector3f(x1 - x2, y1 - y2, z1 - z2);
vectorNormal = Vector3f.cross(vectorTemp1, vectorTemp2, vectorTemp1);
vectorNormal.normalise(vectorNormal);
} else {
vectorNormal = null;
}
final UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
builder.setTexture(sprite);
putVertex(builder, x1, y1, z1, red, green, blue, alpha, u1, v1, vectorNormal);
putVertex(builder, x2, y2, z2, red, green, blue, alpha, u2, v2, vectorNormal);
putVertex(builder, x3, y3, z3, red, green, blue, alpha, u3, v3, vectorNormal);
putVertex(builder, x4, y4, z4, red, green, blue, alpha, u4, v4, vectorNormal);
quads.add(builder.build());
}
protected void addBakedQuad(final List<BakedQuad> quads, final TextureAtlasSprite sprite, final int color,
final float x1, final float y1, final float z1, final float u1, final float v1,
final float x2, final float y2, final float z2, final float u2, final float v2,
final float x3, final float y3, final float z3, final float u3, final float v3,
final float x4, final float y4, final float z4, final float u4, final float v4) {
final float[] rgba = { (color >> 16 & 0xFF) / 255.0F,
(color >> 8 & 0xFF) / 255.0F,
(color & 0xFF) / 255.0F,
(color >> 24 & 0xFF) / 255.0F };
if (rgba[3] == 0.0F) {
rgba[3] = 1.0F;
}
addBakedQuad(quads, sprite,
rgba[0], rgba[1], rgba[2], rgba[3],
x1, y1, z1, u1, v1,
x2, y2, z2, u2, v2,
x3, y3, z3, u3, v3,
x4, y4, z4, u4, v4);
}
@Override
public boolean isAmbientOcclusion() {
return bakedModelOriginal.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
return bakedModelOriginal.isGui3d();
}
@Override
public boolean isBuiltInRenderer() {
return bakedModelOriginal.isBuiltInRenderer();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture() {
// Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("warpdrive:someTexture")
return spriteParticle;
}
/*
@Nonnull
@Override
public ItemCameraTransforms getItemCameraTransforms() {
// ItemCameraTransforms.DEFAULT
return bakedModelOriginal.getItemCameraTransforms();
}
/**/
@Nonnull
@Override
public ItemOverrideList getOverrides() {
// return bakedModelOriginal.getOverrides();
return itemOverrideList;
}
protected IBlockState blockStateDefault;
protected ItemOverrideList itemOverrideList = new ItemOverrideList(ImmutableList.of()) {
@Nonnull
@Override
public IBakedModel handleItemState(@Nonnull final IBakedModel model, @Nonnull final ItemStack itemStack,
final World world, final EntityLivingBase entity) {
final Block block = ((ItemBlock) itemStack.getItem()).getBlock();
final IBlockState blockState = block.getStateFromMeta(itemStack.getMetadata());
final IBakedModel bakedModelNew = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(blockState);
blockStateDefault = blockState;
return bakedModelNew;
}
};
@Nonnull
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(@Nonnull final ItemCameraTransforms.TransformType cameraTransformType) {
if (bakedModelOriginal == null) {
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(this, cameraTransformType);
}
final Matrix4f matrix4f = ((IBakedModel) bakedModelOriginal).handlePerspective(cameraTransformType).getRight();
return Pair.of(this, matrix4f);
}
}

View file

@ -1,14 +1,11 @@
package cr0s.warpdrive.render;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IMyBakedModel;
import cr0s.warpdrive.config.Dictionary;
import cr0s.warpdrive.data.BlockProperties;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import java.util.List;
@ -17,36 +14,22 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.property.IExtendedBlockState;
public class BakedModelCamouflage implements IBakedModel, IMyBakedModel {
private ResourceLocation resourceLocation;
private IBakedModel bakedModelOriginal;
public class BakedModelCamouflage extends BakedModelAbstractBase {
public BakedModelCamouflage() {
}
@Override
public void setResourceLocation(final ResourceLocation resourceLocation) {
this.resourceLocation = resourceLocation;
}
@Override
public void setOriginalBakedModel(final IBakedModel bakedModel) {
this.bakedModelOriginal = bakedModel;
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState blockState, @Nullable EnumFacing facing, long rand) {
public List<BakedQuad> getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing enumFacing, final long rand) {
assert modelResourceLocation != null;
assert bakedModelOriginal != null;
if (blockState instanceof IExtendedBlockState) {
final IExtendedBlockState extendedBlockState = (IExtendedBlockState) blockState;
final IBlockState blockStateReference = extendedBlockState.getValue(BlockProperties.CAMOUFLAGE);
@ -55,8 +38,8 @@ public class BakedModelCamouflage implements IBakedModel, IMyBakedModel {
// Retrieve the IBakedModel of the copied block and return it.
final BlockModelShapes blockModelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
final IBakedModel bakedModelResult = blockModelShapes.getModelForState(blockStateReference);
return bakedModelResult.getQuads(blockStateReference, facing, rand);
} catch(Exception exception) {
return bakedModelResult.getQuads(blockStateReference, enumFacing, rand);
} catch(final Exception exception) {
exception.printStackTrace();
WarpDrive.logger.error(String.format("Failed to render camouflage for block state %s, updating dictionary with %s = NOCAMOUFLAGE dictionary to prevent further errors",
blockStateReference,
@ -65,7 +48,7 @@ public class BakedModelCamouflage implements IBakedModel, IMyBakedModel {
}
}
}
return bakedModelOriginal.getQuads(blockState, facing, rand);
return bakedModelOriginal.getQuads(blockState, enumFacing, rand);
}
@Override
@ -82,34 +65,4 @@ public class BakedModelCamouflage implements IBakedModel, IMyBakedModel {
public boolean isBuiltInRenderer() {
return bakedModelOriginal.isBuiltInRenderer();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture() {
// Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("warpdrive:someTexture")
return bakedModelOriginal.getParticleTexture();
}
@Nonnull
@Override
public ItemCameraTransforms getItemCameraTransforms() {
// ItemCameraTransforms.DEFAULT
return bakedModelOriginal.getItemCameraTransforms();
}
@Nonnull
@Override
public ItemOverrideList getOverrides() {
return bakedModelOriginal.getOverrides();
}
@Nonnull
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(@Nonnull final ItemCameraTransforms.TransformType cameraTransformType) {
if (bakedModelOriginal == null) {
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(this, cameraTransformType);
}
final Matrix4f matrix4f = ((IBakedModel) bakedModelOriginal).handlePerspective(cameraTransformType).getRight();
return Pair.of(this, matrix4f);
}
}

View file

@ -1,8 +1,6 @@
package cr0s.warpdrive.render;
import com.google.common.collect.ImmutableList;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IMyBakedModel;
import cr0s.warpdrive.block.energy.BlockCapacitor;
import cr0s.warpdrive.data.EnumDisabledInputOutput;
@ -10,29 +8,18 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
public class BakedModelCapacitor implements IBakedModel, IMyBakedModel {
public class BakedModelCapacitor extends BakedModelAbstractBase {
private ResourceLocation resourceLocation;
private IBakedModel bakedModelOriginal;
private IExtendedBlockState extendedBlockStateDefault;
private long timeLastError = -1L;
@ -40,24 +27,14 @@ public class BakedModelCapacitor implements IBakedModel, IMyBakedModel {
public BakedModelCapacitor() {
}
@Override
public void setResourceLocation(final ResourceLocation resourceLocation) {
this.resourceLocation = resourceLocation;
}
@Override
public void setOriginalBakedModel(final IBakedModel bakedModel) {
this.bakedModelOriginal = bakedModel;
}
public IBakedModel getOriginalBakedModel() {
return bakedModelOriginal;
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing facing, final long rand) {
assert resourceLocation != null;
public List<BakedQuad> getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing enumFacing, final long rand) {
assert modelResourceLocation != null;
assert bakedModelOriginal != null;
final IExtendedBlockState extendedBlockState;
@ -79,16 +56,16 @@ public class BakedModelCapacitor implements IBakedModel, IMyBakedModel {
extendedBlockState = null;
}
if (extendedBlockState != null) {
final EnumDisabledInputOutput enumDisabledInputOutput = getEnumDisabledInputOutput(extendedBlockState, facing);
final EnumDisabledInputOutput enumDisabledInputOutput = getEnumDisabledInputOutput(extendedBlockState, enumFacing);
if (enumDisabledInputOutput == null) {
final long time = System.currentTimeMillis();
if (time - timeLastError > 5000L) {
timeLastError = time;
new RuntimeException("Invalid extended property").printStackTrace();
WarpDrive.logger.error(String.format("%s Invalid extended property for %s facing %s\n%s",
this, extendedBlockState, facing, formatDetails()));
WarpDrive.logger.error(String.format("%s Invalid extended property for %s enumFacing %s\n%s",
this, extendedBlockState, enumFacing, formatDetails()));
}
return getDefaultQuads(facing, rand);
return getDefaultQuads(enumFacing, rand);
}
final IBlockState blockStateToRender = extendedBlockState.getClean().withProperty(BlockCapacitor.CONFIG, enumDisabledInputOutput);
@ -96,9 +73,9 @@ public class BakedModelCapacitor implements IBakedModel, IMyBakedModel {
final BlockModelShapes blockModelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
final IBakedModel bakedModelWrapped = blockModelShapes.getModelForState(blockStateToRender);
final IBakedModel bakedModelToRender = ((BakedModelCapacitor) bakedModelWrapped).getOriginalBakedModel();
return bakedModelToRender.getQuads(blockStateToRender, facing, rand);
return bakedModelToRender.getQuads(blockStateToRender, enumFacing, rand);
}
return getDefaultQuads(facing, rand);
return getDefaultQuads(enumFacing, rand);
}
public EnumDisabledInputOutput getEnumDisabledInputOutput(final IExtendedBlockState extendedBlockState, @Nullable final EnumFacing facing) {
@ -122,58 +99,9 @@ public class BakedModelCapacitor implements IBakedModel, IMyBakedModel {
.getModelForState(blockState).getQuads(blockState, side, rand);
}
@Override
public boolean isAmbientOcclusion() {
return bakedModelOriginal.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
return bakedModelOriginal.isGui3d();
}
@Override
public boolean isBuiltInRenderer() {
return bakedModelOriginal.isBuiltInRenderer();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture() {
// Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("warpdrive:someTexture")
return bakedModelOriginal.getParticleTexture();
}
@Nonnull
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return bakedModelOriginal.getItemCameraTransforms();
}
@Nonnull
@Override
public ItemOverrideList getOverrides() {
return itemOverrideList;
}
private final ItemOverrideList itemOverrideList = new ItemOverrideList(ImmutableList.of()) {
@Nonnull
@Override
public IBakedModel handleItemState(@Nonnull final IBakedModel model, @Nonnull final ItemStack itemStack,
final World world, final EntityLivingBase entity) {
final Block block = ((ItemBlock) itemStack.getItem()).getBlock();
final IBlockState blockState = block.getStateFromMeta(itemStack.getMetadata());
final IBakedModel bakedModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(blockState);
if (bakedModel instanceof BakedModelCapacitor) {
return ((BakedModelCapacitor) bakedModel).bakedModelOriginal;
}
return bakedModel;
}
};
private String formatDetails() {
return String.format("resourceLocation %s\nbakedModelOriginal %s\nextendedBlockStateDefault %s]",
resourceLocation,
return String.format("modelResourceLocation %s\nbakedModelOriginal %s\nextendedBlockStateDefault %s]",
modelResourceLocation,
bakedModelOriginal,
extendedBlockStateDefault);
}

View file

@ -0,0 +1,657 @@
package cr0s.warpdrive.render;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.block.BlockAbstractOmnipanel;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
public class BakedModelOmnipanel extends BakedModelAbstractBase {
protected IExtendedBlockState extendedBlockStateDefault;
public BakedModelOmnipanel() {
super();
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing enumFacing, final long rand) {
assert modelResourceLocation != null;
assert bakedModelOriginal != null;
final IExtendedBlockState extendedBlockState;
if (blockState == null) {// (probably an item form)
if (!(blockStateDefault instanceof IExtendedBlockState)) {
WarpDrive.logger.error(String.format("Invalid default blockstate %s for model %s",
blockStateDefault, modelResourceLocation));
return bakedModelOriginal.getQuads(null, enumFacing, rand);
}
if (extendedBlockStateDefault == null) {
extendedBlockStateDefault = ((IExtendedBlockState) blockStateDefault)
.withProperty(BlockAbstractOmnipanel.CAN_CONNECT_Y_NEG, false)
.withProperty(BlockAbstractOmnipanel.CAN_CONNECT_Y_POS, false)
.withProperty(BlockAbstractOmnipanel.CAN_CONNECT_Z_NEG, false)
.withProperty(BlockAbstractOmnipanel.CAN_CONNECT_Z_POS, false)
.withProperty(BlockAbstractOmnipanel.CAN_CONNECT_X_NEG, false)
.withProperty(BlockAbstractOmnipanel.CAN_CONNECT_X_POS, false)
.withProperty(BlockAbstractOmnipanel.HAS_XN_YN, true)
.withProperty(BlockAbstractOmnipanel.HAS_XP_YN, true)
.withProperty(BlockAbstractOmnipanel.HAS_XN_YP, true)
.withProperty(BlockAbstractOmnipanel.HAS_XP_YP, true)
.withProperty(BlockAbstractOmnipanel.HAS_XN_ZN, true)
.withProperty(BlockAbstractOmnipanel.HAS_XP_ZN, true)
.withProperty(BlockAbstractOmnipanel.HAS_XN_ZP, true)
.withProperty(BlockAbstractOmnipanel.HAS_XP_ZP, true)
.withProperty(BlockAbstractOmnipanel.HAS_ZN_YN, true)
.withProperty(BlockAbstractOmnipanel.HAS_ZP_YN, true)
.withProperty(BlockAbstractOmnipanel.HAS_ZN_YP, true)
.withProperty(BlockAbstractOmnipanel.HAS_ZP_YP, true);
}
extendedBlockState = extendedBlockStateDefault;
} else if (!(blockState instanceof IExtendedBlockState)) {
WarpDrive.logger.error(String.format("Invalid non-extended blockstate %s for model %s",
blockStateDefault, modelResourceLocation));
return bakedModelOriginal.getQuads(null, enumFacing, rand);
} else {
extendedBlockState = (IExtendedBlockState) blockState;
}
// get color
final int color = Minecraft.getMinecraft().getBlockColors().colorMultiplier(blockState == null ? blockStateDefault : blockState, null, null, tintIndex);
// pre-compute coordinates
final float dX_min = 0.0F;
final float dX_max = 1.0F;
final float dY_min = 0.0F;
final float dY_max = 1.0F;
final float dZ_min = 0.0F;
final float dZ_max = 1.0F;
final float dX_neg = BlockAbstractOmnipanel.CENTER_MIN;
final float dX_pos = BlockAbstractOmnipanel.CENTER_MAX;
final float dY_neg = BlockAbstractOmnipanel.CENTER_MIN;
final float dY_pos = BlockAbstractOmnipanel.CENTER_MAX;
final float dZ_neg = BlockAbstractOmnipanel.CENTER_MIN;
final float dZ_pos = BlockAbstractOmnipanel.CENTER_MAX;
final float dU_min = spriteBlock.getMinU();
final float dU_neg = spriteBlock.getInterpolatedU(7.0F);
final float dU_pos = spriteBlock.getInterpolatedU(9.0F);
final float dU_max = spriteBlock.getMaxU();
final float dV_min = spriteBlock.getMinV();
final float dV_neg = spriteBlock.getInterpolatedV(7.0F);
final float dV_pos = spriteBlock.getInterpolatedV(9.0F);
final float dV_max = spriteBlock.getMaxV();
// get direct connections
final boolean canConnectY_neg = extendedBlockState.getValue(BlockAbstractOmnipanel.CAN_CONNECT_Y_NEG);
final boolean canConnectY_pos = extendedBlockState.getValue(BlockAbstractOmnipanel.CAN_CONNECT_Y_POS);
final boolean canConnectZ_neg = extendedBlockState.getValue(BlockAbstractOmnipanel.CAN_CONNECT_Z_NEG);
final boolean canConnectZ_pos = extendedBlockState.getValue(BlockAbstractOmnipanel.CAN_CONNECT_Z_POS);
final boolean canConnectX_neg = extendedBlockState.getValue(BlockAbstractOmnipanel.CAN_CONNECT_X_NEG);
final boolean canConnectX_pos = extendedBlockState.getValue(BlockAbstractOmnipanel.CAN_CONNECT_X_POS);
final boolean canConnectNone = !canConnectY_neg && !canConnectY_pos && !canConnectZ_neg && !canConnectZ_pos && !canConnectX_neg && !canConnectX_pos;
// get panels
final boolean hasXnYn = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XN_YN);
final boolean hasXpYn = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XP_YN);
final boolean hasXnYp = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XN_YP);
final boolean hasXpYp = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XP_YP);
final boolean hasXnZn = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XN_ZN);
final boolean hasXpZn = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XP_ZN);
final boolean hasXnZp = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XN_ZP);
final boolean hasXpZp = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_XP_ZP);
final boolean hasZnYn = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_ZN_YN);
final boolean hasZpYn = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_ZP_YN);
final boolean hasZnYp = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_ZN_YP);
final boolean hasZpYp = extendedBlockState.getValue(BlockAbstractOmnipanel.HAS_ZP_YP);
final List<BakedQuad> quads = new ArrayList<>();
{// z plane
if (hasXnYn) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_min, dZ_neg, dU_neg, dV_max,
dX_min, dY_min, dZ_neg, dU_min, dV_max,
dX_min, dY_neg, dZ_neg, dU_min, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_neg, dZ_pos, dU_min, dV_pos,
dX_min, dY_min, dZ_pos, dU_min, dV_max,
dX_neg, dY_min, dZ_pos, dU_neg, dV_max,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos);
} else {
if (canConnectX_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg,
dX_min, dY_neg, dZ_pos, dU_min, dV_neg,
dX_min, dY_neg, dZ_neg, dU_min, dV_pos);
}
if (canConnectY_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_min, dZ_neg, dU_neg, dV_max,
dX_neg, dY_min, dZ_pos, dU_pos, dV_max,
dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos);
}
}
if (hasXpYn) {
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_neg, dZ_neg, dU_max, dV_pos,
dX_max, dY_min, dZ_neg, dU_max, dV_max,
dX_pos, dY_min, dZ_neg, dU_pos, dV_max,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_pos, dY_min, dZ_pos, dU_pos, dV_max,
dX_max, dY_min, dZ_pos, dU_max, dV_max,
dX_max, dY_neg, dZ_pos, dU_max, dV_pos);
} else {
if (canConnectX_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_neg, dZ_neg, dU_max, dV_pos,
dX_max, dY_neg, dZ_pos, dU_max, dV_neg,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
}
if (canConnectY_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_pos, dY_min, dZ_pos, dU_pos, dV_max,
dX_pos, dY_min, dZ_neg, dU_neg, dV_max,
dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
if (hasXnYp) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_max, dZ_neg, dU_neg, dV_min,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_min, dY_pos, dZ_neg, dU_min, dV_neg,
dX_min, dY_max, dZ_neg, dU_min, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_max, dZ_pos, dU_min, dV_min,
dX_min, dY_pos, dZ_pos, dU_min, dV_neg,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg,
dX_neg, dY_max, dZ_pos, dU_neg, dV_min);
} else {
if (canConnectX_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos,
dX_min, dY_pos, dZ_neg, dU_min, dV_pos,
dX_min, dY_pos, dZ_pos, dU_min, dV_neg);
}
if (canConnectY_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_neg, dY_max, dZ_pos, dU_pos, dV_min,
dX_neg, dY_max, dZ_neg, dU_neg, dV_min,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
}
}
if (hasXpYp) {
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_max, dZ_neg, dU_max, dV_min,
dX_max, dY_pos, dZ_neg, dU_max, dV_neg,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg,
dX_pos, dY_max, dZ_neg, dU_pos, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_max, dZ_pos, dU_pos, dV_min,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_max, dY_pos, dZ_pos, dU_max, dV_neg,
dX_max, dY_max, dZ_pos, dU_max, dV_min);
} else {
if (canConnectX_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_max, dY_pos, dZ_pos, dU_max, dV_neg,
dX_max, dY_pos, dZ_neg, dU_max, dV_pos);
}
if (canConnectY_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_pos, dY_max, dZ_neg, dU_neg, dV_min,
dX_pos, dY_max, dZ_pos, dU_pos, dV_min,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
}
}
}
{// x plane
if (hasZnYn) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_min, dU_min, dV_pos,
dX_neg, dY_min, dZ_min, dU_min, dV_max,
dX_neg, dY_min, dZ_neg, dU_neg, dV_max,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_pos, dY_min, dZ_neg, dU_neg, dV_max,
dX_pos, dY_min, dZ_min, dU_min, dV_max,
dX_pos, dY_neg, dZ_min, dU_min, dV_pos);
} else {
if (canConnectZ_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_min, dU_neg, dV_max,
dX_pos, dY_neg, dZ_min, dU_pos, dV_max,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
if (canConnectY_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos,
dX_pos, dY_min, dZ_neg, dU_pos, dV_max,
dX_neg, dY_min, dZ_neg, dU_neg, dV_max,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
if (hasZpYn) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_neg, dY_min, dZ_pos, dU_pos, dV_max,
dX_neg, dY_min, dZ_max, dU_max, dV_max,
dX_neg, dY_neg, dZ_max, dU_max, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_max, dU_max, dV_pos,
dX_pos, dY_min, dZ_max, dU_max, dV_max,
dX_pos, dY_min, dZ_pos, dU_pos, dV_max,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
} else {
if (canConnectZ_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_neg, dZ_max, dU_pos, dV_min,
dX_neg, dY_neg, dZ_max, dU_neg, dV_min);
}
if (canConnectY_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos,
dX_neg, dY_min, dZ_pos, dU_neg, dV_max,
dX_pos, dY_min, dZ_pos, dU_pos, dV_max,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
}
}
if (hasZnYp) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_max, dZ_min, dU_min, dV_min,
dX_neg, dY_pos, dZ_min, dU_min, dV_neg,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_neg, dY_max, dZ_neg, dU_neg, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_max, dZ_neg, dU_neg, dV_min,
dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_pos, dY_pos, dZ_min, dU_min, dV_neg,
dX_pos, dY_max, dZ_min, dU_min, dV_min);
} else {
if (canConnectZ_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_min, dU_pos, dV_max,
dX_neg, dY_pos, dZ_min, dU_neg, dV_max,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos);
}
if (canConnectY_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_neg, dY_max, dZ_neg, dU_neg, dV_min,
dX_pos, dY_max, dZ_neg, dU_pos, dV_min,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg);
}
}
if (hasZpYp) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_max, dZ_pos, dU_pos, dV_min,
dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_neg, dY_pos, dZ_max, dU_max, dV_neg,
dX_neg, dY_max, dZ_max, dU_max, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_max, dZ_max, dU_max, dV_min,
dX_pos, dY_pos, dZ_max, dU_max, dV_neg,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_max, dZ_pos, dU_pos, dV_min);
} else {
if (canConnectZ_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_max, dU_neg, dV_min,
dX_pos, dY_pos, dZ_max, dU_pos, dV_min,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
}
if (canConnectY_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_max, dZ_pos, dU_pos, dV_min,
dX_neg, dY_max, dZ_pos, dU_neg, dV_min,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
}
}
}
{// z plane
if (hasXnZn) {
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_neg, dZ_neg, dU_min, dV_pos,
dX_min, dY_neg, dZ_min, dU_min, dV_max,
dX_neg, dY_neg, dZ_min, dU_neg, dV_max,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_pos, dZ_min, dU_neg, dV_max,
dX_min, dY_pos, dZ_min, dU_min, dV_max,
dX_min, dY_pos, dZ_neg, dU_min, dV_pos);
} else {
if (canConnectX_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_neg, dZ_neg, dU_min, dV_pos,
dX_min, dY_pos, dZ_neg, dU_min, dV_neg,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
if (canConnectZ_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_neg, dY_pos, dZ_min, dU_min, dV_neg,
dX_neg, dY_neg, dZ_min, dU_min, dV_pos,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
if (hasXpZn) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos,
dX_pos, dY_neg, dZ_min, dU_pos, dV_max,
dX_max, dY_neg, dZ_min, dU_max, dV_max,
dX_max, dY_neg, dZ_neg, dU_max, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_pos, dZ_neg, dU_max, dV_pos,
dX_max, dY_pos, dZ_min, dU_max, dV_max,
dX_pos, dY_pos, dZ_min, dU_pos, dV_max,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos);
} else {
if (canConnectX_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg,
dX_max, dY_pos, dZ_neg, dU_max, dV_neg,
dX_max, dY_neg, dZ_neg, dU_max, dV_pos);
}
if (canConnectZ_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_pos, dY_neg, dZ_min, dU_min, dV_pos,
dX_pos, dY_pos, dZ_min, dU_min, dV_neg,
dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg);
}
}
if (hasXnZp) {
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_neg, dZ_max, dU_min, dV_min,
dX_min, dY_neg, dZ_pos, dU_min, dV_neg,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg,
dX_neg, dY_neg, dZ_max, dU_neg, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_max, dU_neg, dV_min,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg,
dX_min, dY_pos, dZ_pos, dU_min, dV_neg,
dX_min, dY_pos, dZ_max, dU_min, dV_min);
} else {
if (canConnectX_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_pos, dZ_pos, dU_min, dV_neg,
dX_min, dY_neg, dZ_pos, dU_min, dV_pos,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
}
if (canConnectZ_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_neg, dY_neg, dZ_max, dU_max, dV_pos,
dX_neg, dY_pos, dZ_max, dU_max, dV_neg,
dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg);
}
}
if (hasXpZp) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_max, dU_pos, dV_min,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg,
dX_max, dY_neg, dZ_pos, dU_max, dV_neg,
dX_max, dY_neg, dZ_max, dU_max, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_pos, dZ_max, dU_max, dV_min,
dX_max, dY_pos, dZ_pos, dU_max, dV_neg,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_pos, dZ_max, dU_pos, dV_min);
} else {
if (canConnectX_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_neg, dZ_pos, dU_max, dV_pos,
dX_max, dY_pos, dZ_pos, dU_max, dV_neg,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
}
if (canConnectZ_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_pos, dZ_max, dU_max, dV_neg,
dX_pos, dY_neg, dZ_max, dU_max, dV_pos,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
}
}
}
if (canConnectNone) {
// x min
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_max, dZ_neg, dU_neg, dV_min,
dX_min, dY_min, dZ_neg, dU_neg, dV_max,
dX_min, dY_min, dZ_pos, dU_pos, dV_max,
dX_min, dY_max, dZ_pos, dU_pos, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_pos, dZ_max, dU_max, dV_neg,
dX_min, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_min, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_min, dY_neg, dZ_max, dU_max, dV_pos);
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_min, dY_pos, dZ_min, dU_min, dV_neg,
dX_min, dY_neg, dZ_min, dU_min, dV_pos,
dX_min, dY_neg, dZ_neg, dU_neg, dV_pos);
// x max
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_max, dZ_pos, dU_pos, dV_min,
dX_max, dY_min, dZ_pos, dU_pos, dV_max,
dX_max, dY_min, dZ_neg, dU_neg, dV_max,
dX_max, dY_max, dZ_neg, dU_neg, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_neg, dZ_max, dU_max, dV_pos,
dX_max, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_max, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_max, dY_pos, dZ_max, dU_max, dV_neg);
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_max, dY_neg, dZ_min, dU_min, dV_pos,
dX_max, dY_pos, dZ_min, dU_min, dV_neg,
dX_max, dY_pos, dZ_neg, dU_neg, dV_neg);
// z min
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_max, dZ_min, dU_pos, dV_min,
dX_pos, dY_min, dZ_min, dU_pos, dV_max,
dX_neg, dY_min, dZ_min, dU_neg, dV_max,
dX_neg, dY_max, dZ_min, dU_neg, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_min, dU_neg, dV_neg,
dX_neg, dY_neg, dZ_min, dU_neg, dV_pos,
dX_min, dY_neg, dZ_min, dU_min, dV_pos,
dX_min, dY_pos, dZ_min, dU_min, dV_neg);
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_pos, dZ_min, dU_max, dV_neg,
dX_max, dY_neg, dZ_min, dU_max, dV_pos,
dX_pos, dY_neg, dZ_min, dU_pos, dV_pos,
dX_pos, dY_pos, dZ_min, dU_pos, dV_neg);
// z max
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_max, dZ_max, dU_neg, dV_min,
dX_neg, dY_min, dZ_max, dU_neg, dV_max,
dX_pos, dY_min, dZ_max, dU_pos, dV_max,
dX_pos, dY_max, dZ_max, dU_pos, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_pos, dZ_max, dU_min, dV_neg,
dX_min, dY_neg, dZ_max, dU_min, dV_pos,
dX_neg, dY_neg, dZ_max, dU_neg, dV_pos,
dX_neg, dY_pos, dZ_max, dU_neg, dV_neg);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_max, dU_pos, dV_neg,
dX_pos, dY_neg, dZ_max, dU_pos, dV_pos,
dX_max, dY_neg, dZ_max, dU_max, dV_pos,
dX_max, dY_pos, dZ_max, dU_max, dV_neg);
// y min
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_min, dZ_max, dU_neg, dV_min,
dX_neg, dY_min, dZ_min, dU_neg, dV_max,
dX_pos, dY_min, dZ_min, dU_pos, dV_max,
dX_pos, dY_min, dZ_max, dU_pos, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_min, dY_min, dZ_pos, dU_min, dV_neg,
dX_min, dY_min, dZ_neg, dU_min, dV_pos,
dX_neg, dY_min, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_min, dZ_pos, dU_neg, dV_neg);
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_min, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_min, dZ_neg, dU_pos, dV_pos,
dX_max, dY_min, dZ_neg, dU_max, dV_pos,
dX_max, dY_min, dZ_pos, dU_max, dV_neg);
// y max
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_max, dZ_max, dU_pos, dV_min,
dX_pos, dY_max, dZ_min, dU_pos, dV_max,
dX_neg, dY_max, dZ_min, dU_neg, dV_max,
dX_neg, dY_max, dZ_max, dU_neg, dV_min);
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_max, dZ_pos, dU_neg, dV_neg,
dX_neg, dY_max, dZ_neg, dU_neg, dV_pos,
dX_min, dY_max, dZ_neg, dU_min, dV_pos,
dX_min, dY_max, dZ_pos, dU_min, dV_neg);
addBakedQuad(quads, spriteBlock, color,
dX_max, dY_max, dZ_pos, dU_max, dV_neg,
dX_max, dY_max, dZ_neg, dU_max, dV_pos,
dX_pos, dY_max, dZ_neg, dU_pos, dV_pos,
dX_pos, dY_max, dZ_pos, dU_pos, dV_neg);
} else {
// center cube
if (!canConnectY_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_pos, dY_neg, dZ_neg, dU_neg, dV_neg,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg,
dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos);
}
if (!canConnectY_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_pos, dZ_pos, dU_pos, dV_pos,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos);
}
if (!canConnectZ_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg,
dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
}
if (!canConnectZ_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos);
}
if (!canConnectX_neg) {
addBakedQuad(quads, spriteBlock, color,
dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos,
dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg,
dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_neg, dY_pos, dZ_neg, dU_pos, dV_pos);
}
if (!canConnectX_pos) {
addBakedQuad(quads, spriteBlock, color,
dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos,
dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg,
dX_pos, dY_neg, dZ_pos, dU_neg, dV_neg,
dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
return quads;
}
@Override
public boolean isAmbientOcclusion() {
return false;
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
}

View file

@ -110,15 +110,14 @@ public enum MyCustomModelLoader implements ICustomModelLoader {
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing side, final long rand) {
final List<BakedQuad> bakedQuadsIn = bakedModel.getQuads(blockState, side, rand);
public List<BakedQuad> getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing enumFacing, final long rand) {
final List<BakedQuad> bakedQuadsIn = bakedModel.getQuads(blockState, enumFacing, rand);
final IExtendedBlockState exState = (IExtendedBlockState) blockState;
EnumForceFieldShape enumForceFieldShape = exState != null ? exState.getValue(BlockForceFieldProjector.SHAPE) : EnumForceFieldShape.NONE;
if (enumForceFieldShape == null) {
new RuntimeException("Invalid shape").printStackTrace();
WarpDrive.logger.error(String.format("Invalid shape for %s side %s",
blockState, side));
WarpDrive.logger.error(String.format("Invalid shape for %s facing %s",
blockState, enumFacing));
enumForceFieldShape = EnumForceFieldShape.NONE;
}
final TextureAtlasSprite spriteShape = spriteShapes.get(enumForceFieldShape);

View file

@ -1,579 +0,0 @@
package cr0s.warpdrive.render;
public class RenderBlockOmnipanel {
}
/* @TODO MC1.10 ISBRH
import cr0s.warpdrive.block.BlockAbstractOmnipanel;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
public class RenderBlockOmnipanel implements ISimpleBlockRenderingHandler {
public static int renderId = 0;
public static RenderBlockOmnipanel instance = new RenderBlockOmnipanel();
@Override
public void renderInventoryBlock(final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
// not supposed to happen
}
@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) {
final Tessellator tessellator = Tessellator.instance;
// get brightness factors
final int brightnessForRender = getBrightnessForRender(partialTick);
final int brightnessHigh = brightnessForRender >> 16 & 65535;
final int brightnessLow = Math.max(240, brightnessForRender & 65535);
// apply coloring
final int colorMultiplier = block.colorMultiplier(blockAccess, x, y, z);
final float fRed = (float) (colorMultiplier >> 16 & 255) / 255.0F;
final float fGreen = (float) (colorMultiplier >> 8 & 255) / 255.0F;
final float fBlue = (float) (colorMultiplier & 255) / 255.0F;
tessellator.setColorOpaque_F(fRed, fGreen, fBlue);
// get icon
final int metadata = blockAccess.getBlockMetadata(x, y, z);
final IIcon icon = block.getIcon(0, metadata);
// pre-compute coordinates
final double dX_min = (double) x;
final double dX_max = x + 1;
final double dY_min = y + 0.0D;
final double dY_max = y + 1.0D;
final double dZ_min = (double) z;
final double dZ_max = z + 1;
final double dX_neg = x + BlockAbstractOmnipanel.CENTER_MIN;
final double dX_pos = x + BlockAbstractOmnipanel.CENTER_MAX;
final double dY_neg = y + BlockAbstractOmnipanel.CENTER_MIN;
final double dY_pos = y + BlockAbstractOmnipanel.CENTER_MAX;
final double dZ_neg = z + BlockAbstractOmnipanel.CENTER_MIN;
final double dZ_pos = z + BlockAbstractOmnipanel.CENTER_MAX;
final double dU_min = icon.getMinU();
final double dU_neg = icon.getInterpolatedU(7.0D);
final double dU_pos = icon.getInterpolatedU(9.0D);
final double dU_max = icon.getMaxU();
final double dV_min = icon.getMinV();
final double dV_neg = icon.getInterpolatedV(7.0D);
final double dV_pos = icon.getInterpolatedV(9.0D);
final double dV_max = icon.getMaxV();
// get direct connections
final BlockAbstractOmnipanel blockAbstractOmnipanel = (BlockAbstractOmnipanel) block;
final int maskConnectY_neg = blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y - 1, z, EnumFacing.DOWN);
final int maskConnectY_pos = blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y + 1, z, EnumFacing.UP);
final int maskConnectZ_neg = blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y, z - 1, EnumFacing.NORTH);
final int maskConnectZ_pos = blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y, z + 1, EnumFacing.SOUTH);
final int maskConnectX_neg = blockAbstractOmnipanel.getConnectionMask(blockAccess, x - 1, y, z, EnumFacing.WEST);
final int maskConnectX_pos = blockAbstractOmnipanel.getConnectionMask(blockAccess, x + 1, y, z, EnumFacing.EAST);
final boolean canConnectY_neg = maskConnectY_neg > 0;
final boolean canConnectY_pos = maskConnectY_pos > 0;
final boolean canConnectZ_neg = maskConnectZ_neg > 0;
final boolean canConnectZ_pos = maskConnectZ_pos > 0;
final boolean canConnectX_neg = maskConnectX_neg > 0;
final boolean canConnectX_pos = maskConnectX_pos > 0;
final boolean canConnectNone = !canConnectY_neg && !canConnectY_pos && !canConnectZ_neg && !canConnectZ_pos && !canConnectX_neg && !canConnectX_pos;
// get diagonal connections
final boolean canConnectXn_Y_neg = (maskConnectX_neg > 1 && maskConnectY_neg > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x - 1, y - 1, z, EnumFacing.DOWN ) > 0;
final boolean canConnectXn_Y_pos = (maskConnectX_neg > 1 && maskConnectY_pos > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x - 1, y + 1, z, EnumFacing.UP ) > 0;
final boolean canConnectXn_Z_neg = (maskConnectX_neg > 1 && maskConnectZ_neg > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x - 1, y, z - 1, EnumFacing.NORTH) > 0;
final boolean canConnectXn_Z_pos = (maskConnectX_neg > 1 && maskConnectZ_pos > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x - 1, y, z + 1, EnumFacing.SOUTH) > 0;
final boolean canConnectZn_Y_neg = (maskConnectZ_neg > 1 && maskConnectY_neg > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y - 1, z - 1, EnumFacing.DOWN ) > 0;
final boolean canConnectZn_Y_pos = (maskConnectZ_neg > 1 && maskConnectY_pos > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y + 1, z - 1, EnumFacing.UP ) > 0;
final boolean canConnectXp_Y_neg = (maskConnectX_pos > 1 && maskConnectY_neg > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x + 1, y - 1, z, EnumFacing.DOWN ) > 0;
final boolean canConnectXp_Y_pos = (maskConnectX_pos > 1 && maskConnectY_pos > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x + 1, y + 1, z, EnumFacing.UP ) > 0;
final boolean canConnectXp_Z_neg = (maskConnectX_pos > 1 && maskConnectZ_neg > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x + 1, y, z - 1, EnumFacing.NORTH) > 0;
final boolean canConnectXp_Z_pos = (maskConnectX_pos > 1 && maskConnectZ_pos > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x + 1, y, z + 1, EnumFacing.SOUTH) > 0;
final boolean canConnectZp_Y_neg = (maskConnectZ_pos > 1 && maskConnectY_neg > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y - 1, z + 1, EnumFacing.DOWN ) > 0;
final boolean canConnectZp_Y_pos = (maskConnectZ_pos > 1 && maskConnectY_pos > 1) || blockAbstractOmnipanel.getConnectionMask(blockAccess, x, y + 1, z + 1, EnumFacing.UP ) > 0;
// get panels
final boolean hasXnYn = canConnectNone || (canConnectX_neg && canConnectY_neg && canConnectXn_Y_neg);
final boolean hasXpYn = canConnectNone || (canConnectX_pos && canConnectY_neg && canConnectXp_Y_neg);
final boolean hasXnYp = canConnectNone || (canConnectX_neg && canConnectY_pos && canConnectXn_Y_pos);
final boolean hasXpYp = canConnectNone || (canConnectX_pos && canConnectY_pos && canConnectXp_Y_pos);
final boolean hasXnZn = canConnectNone || (canConnectX_neg && canConnectZ_neg && canConnectXn_Z_neg);
final boolean hasXpZn = canConnectNone || (canConnectX_pos && canConnectZ_neg && canConnectXp_Z_neg);
final boolean hasXnZp = canConnectNone || (canConnectX_neg && canConnectZ_pos && canConnectXn_Z_pos);
final boolean hasXpZp = canConnectNone || (canConnectX_pos && canConnectZ_pos && canConnectXp_Z_pos);
final boolean hasZnYn = canConnectNone || (canConnectZ_neg && canConnectY_neg && canConnectZn_Y_neg);
final boolean hasZpYn = canConnectNone || (canConnectZ_pos && canConnectY_neg && canConnectZp_Y_neg);
final boolean hasZnYp = canConnectNone || (canConnectZ_neg && canConnectY_pos && canConnectZn_Y_pos);
final boolean hasZpYp = canConnectNone || (canConnectZ_pos && canConnectY_pos && canConnectZp_Y_pos);
// @TODO MC1.10+ rendering
// template:
// vertexBuffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
// vertexBuffer.pos(xMinEnd , yMax, 0.0D).tex(uMax, vMax).color(fRed, fGreen, fBlue, alpha).lightmap(brightnessHigh, brightnessLow).endVertex();
{// z plane
if (hasXnYn) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_min, dY_min, dZ_neg, dU_min, dV_max);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_neg, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_pos, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_min, dZ_pos, dU_min, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_pos, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos);
} else {
if (canConnectX_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_neg, dU_min, dV_pos);
}
if (canConnectY_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos);
}
}
if (hasXpYn) {
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_neg, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_min, dZ_neg, dU_max, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_neg, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_max, dY_min, dZ_pos, dU_max, dV_max);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_pos, dU_max, dV_pos);
} else {
if (canConnectX_pos) {
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_neg, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
}
if (canConnectY_neg) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
if (hasXnYp) {
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_neg, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_max, dZ_neg, dU_min, dV_min);
tessellator.addVertexWithUV(dX_min, dY_max, dZ_pos, dU_min, dV_min);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_pos, dU_neg, dV_min);
} else {
if (canConnectX_neg) {
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_neg, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_pos, dU_min, dV_neg);
}
if (canConnectY_pos) {
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
}
}
if (hasXpYp) {
tessellator.addVertexWithUV(dX_max, dY_max, dZ_neg, dU_max, dV_min);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_neg, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_neg, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_max, dZ_pos, dU_max, dV_min);
} else {
if (canConnectX_pos) {
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_neg, dU_max, dV_pos);
}
if (canConnectY_pos) {
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
}
}
}
{// x plane
if (hasZnYn) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_min, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_min, dU_min, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_min, dU_min, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_min, dU_min, dV_pos);
} else {
if (canConnectZ_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
if (canConnectY_neg) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_neg, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
if (hasZpYn) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_max, dU_max, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_max, dU_max, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
} else {
if (canConnectZ_pos) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_max, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_max, dU_neg, dV_min);
}
if (canConnectY_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_pos, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
}
}
if (hasZnYp) {
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_min, dU_min, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_min, dU_min, dV_min);
} else {
if (canConnectZ_neg) {
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos);
}
if (canConnectY_pos) {
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_neg, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg);
}
}
if (hasZpYp) {
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_max, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_max, dU_max, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_max, dU_max, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_max, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_pos, dU_pos, dV_min);
} else {
if (canConnectZ_pos) {
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_max, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_max, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
}
if (canConnectY_pos) {
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_pos, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
}
}
}
{// z plane
if (hasXnZn) {
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_neg, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_min, dU_min, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_min, dU_min, dV_max);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_neg, dU_min, dV_pos);
} else {
if (canConnectX_neg) {
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_neg, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_neg, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
if (canConnectZ_neg) {
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_min, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
if (hasXpZn) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_min, dU_max, dV_max);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_neg, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_neg, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_min, dU_max, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos);
} else {
if (canConnectX_pos) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_neg, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_neg, dU_max, dV_pos);
}
if (canConnectZ_neg) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_min, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg);
}
}
if (hasXnZp) {
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_max, dU_min, dV_min);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_max, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_max, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_max, dU_min, dV_min);
} else {
if (canConnectX_neg) {
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_pos, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
}
if (canConnectZ_pos) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_max, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg);
}
}
if (hasXpZp) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_max, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_max, dU_max, dV_min);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_max, dU_max, dV_min);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_max, dU_pos, dV_min);
} else {
if (canConnectX_pos) {
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_pos, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
}
if (canConnectZ_pos) {
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_max, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
}
}
}
if (canConnectNone) {
// x min
tessellator.addVertexWithUV(dX_min, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_min, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_min, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_min, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_max, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_min, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_neg, dU_neg, dV_pos);
// x max
tessellator.addVertexWithUV(dX_max, dY_max, dZ_pos, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_max, dY_min, dZ_pos, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_max, dY_min, dZ_neg, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_max, dY_max, dZ_neg, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_max, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_min, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_neg, dU_neg, dV_neg);
// z min
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_min, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_min, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_min, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_min, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_min, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_min, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_min, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_min, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_min, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_min, dU_pos, dV_neg);
// z max
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_max, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_max, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_max, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_max, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_min, dY_pos, dZ_max, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_neg, dZ_max, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_max, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_max, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_max, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_max, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_neg, dZ_max, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_pos, dZ_max, dU_max, dV_neg);
// y min
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_max, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_max, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_min, dY_min, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_min, dY_min, dZ_neg, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_min, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_min, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_min, dZ_neg, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_max, dY_min, dZ_pos, dU_max, dV_neg);
// y max
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_max, dU_pos, dV_min);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_min, dU_pos, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_min, dU_neg, dV_max);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_max, dU_neg, dV_min);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_max, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_max, dZ_neg, dU_min, dV_pos);
tessellator.addVertexWithUV(dX_min, dY_max, dZ_pos, dU_min, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_max, dZ_pos, dU_max, dV_neg);
tessellator.addVertexWithUV(dX_max, dY_max, dZ_neg, dU_max, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_max, dZ_pos, dU_pos, dV_neg);
} else {
// center cube
if (!canConnectY_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_pos, dV_pos);
}
if (!canConnectY_pos) {
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_pos);
}
if (!canConnectZ_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_pos, dV_pos);
}
if (!canConnectZ_pos) {
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_pos);
}
if (!canConnectX_neg) {
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_neg, dU_neg, dV_pos);
tessellator.addVertexWithUV(dX_neg, dY_neg, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_neg, dY_pos, dZ_neg, dU_pos, dV_pos);
}
if (!canConnectX_pos) {
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_neg, dU_pos, dV_pos);
tessellator.addVertexWithUV(dX_pos, dY_pos, dZ_pos, dU_pos, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_pos, dU_neg, dV_neg);
tessellator.addVertexWithUV(dX_pos, dY_neg, dZ_neg, dU_neg, dV_pos);
}
}
return true;
}
@Override
public boolean shouldRender3DInInventory(final int modelId) {
return false;
}
@Override
public int getRenderId() {
return renderId;
}
}
/**/