Textures for turbine components! Still need to texture turbine structure blocks.

This commit is contained in:
aidancbrady 2016-01-22 19:36:39 -05:00
parent cfa2c1e4d9
commit 9cbc96a88e
16 changed files with 177 additions and 58 deletions

View file

@ -32,6 +32,11 @@ public class CTMRenderingHandler implements ISimpleBlockRenderingHandler
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld)
{
int meta = world.getBlockMetadata(x, y, z);
if(block instanceof IBlockCTM && !((IBlockCTM)block).shouldRenderBlock(world, x, y, z, meta))
{
return false;
}
CTMData blockCTM = ((IBlockCTM)block).getCTMData(world, x, y, z, meta);
@ -57,32 +62,27 @@ public class CTMRenderingHandler implements ISimpleBlockRenderingHandler
if(MachineType.get(block, meta) != null)
{
if(!MachineType.get(block, meta).hasModel)
TileEntity tile = world.getTileEntity(x, y, z);
int prevRotateTop = rendererOld.uvRotateTop;
int prevRotateBottom = rendererOld.uvRotateBottom;
if(tile instanceof TileEntityBasicBlock)
{
TileEntity tile = world.getTileEntity(x, y, z);
int prevRotateTop = rendererOld.uvRotateTop;
int prevRotateBottom = rendererOld.uvRotateBottom;
if(tile instanceof TileEntityBasicBlock)
if(((TileEntityBasicBlock)tile).facing >= 2)
{
if(((TileEntityBasicBlock)tile).facing >= 2)
{
rendererOld.uvRotateTop = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2];
rendererOld.uvRotateBottom = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2];
}
rendererOld.uvRotateTop = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2];
rendererOld.uvRotateBottom = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2];
}
rendererOld.renderStandardBlock(block, x, y, z);
rendererOld.setRenderBoundsFromBlock(block);
rendererOld.uvRotateTop = prevRotateTop;
rendererOld.uvRotateBottom = prevRotateBottom;
return true;
}
return false;
rendererOld.renderStandardBlock(block, x, y, z);
rendererOld.setRenderBoundsFromBlock(block);
rendererOld.uvRotateTop = prevRotateTop;
rendererOld.uvRotateBottom = prevRotateBottom;
return true;
}
return rendererOld.renderStandardBlock(block, x, y, z);

View file

@ -15,7 +15,6 @@ import net.minecraft.util.IIcon;
*/
public class RenderBlocksCTM extends RenderBlocks
{
RenderBlocksCTM()
{
super();

View file

@ -1,10 +1,11 @@
package mekanism.common.base;
import mekanism.common.CTMData;
import net.minecraft.world.IBlockAccess;
public interface IBlockCTM
{
public CTMData getCTMData(IBlockAccess world, int x, int y, int z, int meta);
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta);
}

View file

@ -1069,6 +1069,12 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
return ctms[meta][0];
}
@Override
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta)
{
return true;
}
public static enum BasicBlock
{

View file

@ -1,8 +1,12 @@
package mekanism.common.block;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.client;
@ -19,15 +23,63 @@ import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.Tier.BaseTier;
import mekanism.common.base.*;
import mekanism.common.base.IActiveState;
import mekanism.common.base.IBlockCTM;
import mekanism.common.base.IBoundingBlock;
import mekanism.common.base.IElectricChest;
import mekanism.common.base.IFactory;
import mekanism.common.base.IFactory.RecipeType;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.base.ISpecialBounds;
import mekanism.common.base.ISustainedData;
import mekanism.common.base.ISustainedInventory;
import mekanism.common.base.ISustainedTank;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.item.ItemBlockMachine;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.recipe.ShapedMekanismRecipe;
import mekanism.common.tile.*;
import mekanism.common.tile.TileEntityAdvancedFactory;
import mekanism.common.tile.TileEntityAmbientAccumulator;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityChargepad;
import mekanism.common.tile.TileEntityChemicalCrystallizer;
import mekanism.common.tile.TileEntityChemicalDissolutionChamber;
import mekanism.common.tile.TileEntityChemicalInfuser;
import mekanism.common.tile.TileEntityChemicalInjectionChamber;
import mekanism.common.tile.TileEntityChemicalOxidizer;
import mekanism.common.tile.TileEntityChemicalWasher;
import mekanism.common.tile.TileEntityCombiner;
import mekanism.common.tile.TileEntityContainerBlock;
import mekanism.common.tile.TileEntityCrusher;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.tile.TileEntityElectricPump;
import mekanism.common.tile.TileEntityElectrolyticSeparator;
import mekanism.common.tile.TileEntityEliteFactory;
import mekanism.common.tile.TileEntityEnergizedSmelter;
import mekanism.common.tile.TileEntityEnrichmentChamber;
import mekanism.common.tile.TileEntityEntangledBlock;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityLaser;
import mekanism.common.tile.TileEntityLaserAmplifier;
import mekanism.common.tile.TileEntityLaserTractorBeam;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityMetallurgicInfuser;
import mekanism.common.tile.TileEntityOredictionificator;
import mekanism.common.tile.TileEntityOsmiumCompressor;
import mekanism.common.tile.TileEntityPRC;
import mekanism.common.tile.TileEntityPortableTank;
import mekanism.common.tile.TileEntityPrecisionSawmill;
import mekanism.common.tile.TileEntityPurificationChamber;
import mekanism.common.tile.TileEntityRotaryCondensentrator;
import mekanism.common.tile.TileEntitySeismicVibrator;
import mekanism.common.tile.TileEntitySolarNeutronActivator;
import mekanism.common.tile.TileEntityTeleporter;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
@ -45,7 +97,11 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -53,8 +109,9 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.*;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Block class for handling multiple machine block IDs.
@ -1355,4 +1412,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
return ctms[meta][0];
}
@Override
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta)
{
return !MachineType.get(this, meta).hasModel;
}
}

View file

@ -100,18 +100,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if(block == GeneratorsBlocks.Generator)
{
int metadata = world.getBlockMetadata(x, y, z);
if(GeneratorType.getFromMetadata(metadata) == null || !GeneratorType.getFromMetadata(metadata).hasModel)
{
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBoundsFromBlock(block);
return true;
}
}
//Handled by CTMRenderingHandler
return false;
}

View file

@ -1,13 +1,16 @@
package mekanism.generators.common.block;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import mekanism.api.MekanismConfig.general;
import mekanism.api.energy.IEnergizedItem;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism;
import mekanism.common.base.IActiveState;
import mekanism.common.base.IBlockCTM;
import mekanism.common.base.IBoundingBlock;
import mekanism.common.base.ISpecialBounds;
import mekanism.common.base.ISustainedData;
@ -27,6 +30,8 @@ import mekanism.generators.common.tile.TileEntityGasGenerator;
import mekanism.generators.common.tile.TileEntityHeatGenerator;
import mekanism.generators.common.tile.TileEntitySolarGenerator;
import mekanism.generators.common.tile.TileEntityWindGenerator;
import mekanism.generators.common.tile.turbine.TileEntityElectromagneticCoil;
import mekanism.generators.common.tile.turbine.TileEntityPressureDisperser;
import mekanism.generators.common.tile.turbine.TileEntityRotationalComplex;
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
import net.minecraft.block.Block;
@ -69,9 +74,12 @@ import cpw.mods.fml.relauncher.SideOnly;
* @author AidanBrady
*
*/
public class BlockGenerator extends BlockContainer implements ISpecialBounds
public class BlockGenerator extends BlockContainer implements ISpecialBounds, IBlockCTM
{
public IIcon[][] icons = new IIcon[16][16];
public CTMData[] ctms = new CTMData[16];
public IIcon BASE_ICON;
public Random machineRand = new Random();
@ -89,8 +97,26 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
public void registerBlockIcons(IIconRegister register)
{
BASE_ICON = register.registerIcon("mekanism:SteelCasing");
ctms[10] = new CTMData("ctm/ElectromagneticCoil", this, Arrays.asList(10)).registerIcons(register);
icons[7][0] = register.registerIcon("mekanism:TurbineRod");
icons[8][0] = register.registerIcon("mekanism:TurbineRod");
icons[8][0] = register.registerIcon("mekanism:RotationalComplexSide");
icons[8][1] = register.registerIcon("mekanism:RotationalComplexTop");
icons[9][0] = register.registerIcon("mekanism:PressureDisperser");
icons[10][0] = ctms[10].mainTextureData.icon;
}
@Override
public CTMData getCTMData(IBlockAccess world, int x, int y, int z, int meta)
{
return ctms[meta];
}
@Override
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta)
{
return !GeneratorType.getFromMetadata(meta).hasModel;
}
@Override
@ -102,6 +128,20 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
return icons[meta][0];
}
else if(meta == GeneratorType.ROTATIONAL_COMPLEX.meta)
{
if(side != 0 && side != 1)
{
return icons[meta][0];
}
else {
return icons[meta][1];
}
}
else if(meta == GeneratorType.PRESSURE_DISPERSER.meta)
{
return icons[meta][0];
}
else if(meta == GeneratorType.ELECTROMAGNETIC_COIL.meta)
{
return icons[meta][0];
}
@ -517,7 +557,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
@Override
public int getRenderType()
{
return MekanismGenerators.proxy.GENERATOR_RENDER_ID;
return Mekanism.proxy.CTM_RENDER_ID;
}
/*This method is not used, metadata manipulation is required to create a Tile Entity.*/
@ -665,7 +705,9 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
ADVANCED_SOLAR_GENERATOR(5, "AdvancedSolarGenerator", 1, 200000, TileEntityAdvancedSolarGenerator.class, true),
WIND_GENERATOR(6, "WindGenerator", 5, 200000, TileEntityWindGenerator.class, true),
TURBINE_ROTOR(7, "TurbineRotor", -1, -1, TileEntityTurbineRotor.class, false),
ROTATIONAL_COMPLEX(8, "RotationalComplex", -1, -1, TileEntityRotationalComplex.class, false);
ROTATIONAL_COMPLEX(8, "RotationalComplex", -1, -1, TileEntityRotationalComplex.class, false),
PRESSURE_DISPERSER(9, "PressureDisperser", -1, -1, TileEntityPressureDisperser.class, false),
ELECTROMAGNETIC_COIL(10, "ElectromagneticCoil", -1, -1, TileEntityElectromagneticCoil.class, false);
public int meta;
public String name;

View file

@ -1,8 +1,8 @@
package mekanism.generators.common.block;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Arrays;
import java.util.List;
import mekanism.api.Coord4D;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher;
@ -14,7 +14,13 @@ import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.generators.common.GeneratorsBlocks;
import mekanism.generators.common.MekanismGenerators;
import mekanism.generators.common.tile.reactor.*;
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
import mekanism.generators.common.tile.reactor.TileEntityReactorFrame;
import mekanism.generators.common.tile.reactor.TileEntityReactorGlass;
import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix;
import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter;
import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture;
import mekanism.generators.common.tile.reactor.TileEntityReactorPort;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -29,9 +35,9 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.Arrays;
import java.util.List;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockReactor extends BlockContainer implements IBlockCTM
{
@ -304,6 +310,12 @@ public class BlockReactor extends BlockContainer implements IBlockCTM
return ctms[meta][0];
}
@Override
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)

View file

@ -1,12 +1,15 @@
package mekanism.generators.common.tile.turbine;
import net.minecraft.tileentity.TileEntity;
import mekanism.common.tile.TileEntityBasicBlock;
public class TileEntityElectromagneticCoil extends TileEntity
public class TileEntityElectromagneticCoil extends TileEntityBasicBlock
{
@Override
public boolean canUpdate()
{
return false;
}
@Override
public void onUpdate() {}
}

View file

@ -1,12 +1,15 @@
package mekanism.generators.common.tile.turbine;
import net.minecraft.tileentity.TileEntity;
import mekanism.common.tile.TileEntityBasicBlock;
public class TileEntityPressureDisperser extends TileEntity
public class TileEntityPressureDisperser extends TileEntityBasicBlock
{
@Override
public boolean canUpdate()
{
return false;
}
@Override
public void onUpdate() {}
}

View file

@ -312,6 +312,7 @@ fluid.lithium=Liquid Lithium
fluid.deuterium=Liquid Deuterium
fluid.tritium=Liquid Tritium
fluid.fusionFuelDT=Liquid D-T Fuel
fluid.steam=Steam
//OreGas names
oregas.iron=Iron Ore

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB