Fixes for latest forge and more rendering.

This commit is contained in:
Modmuss50 2015-11-26 17:35:31 +00:00
parent 82b99fed34
commit b0784c44d2
16 changed files with 168 additions and 120 deletions

View file

@ -2,6 +2,8 @@ package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@ -13,6 +15,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.api.IBlockTextureProvider;
import reborncore.common.multiblock.BlockMultiblockBase;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileMachineCasing;
@ -20,7 +23,7 @@ import techreborn.tiles.TileMachineCasing;
import java.util.List;
import java.util.Random;
public class BlockMachineCasing extends BlockMultiblockBase {
public class BlockMachineCasing extends BlockMultiblockBase implements IBlockTextureProvider{
public static final String[] types = new String[]
{"standard", "reinforced", "advanced"};
@ -30,10 +33,29 @@ public class BlockMachineCasing extends BlockMultiblockBase {
setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.machineCasing");
setHardness(2F);
this.setDefaultState(this.blockState.getBaseState().withProperty(METADATA, 0));
}
public static int getHeatFromMeta(int meta) {
switch (meta) {
public PropertyInteger METADATA;
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(METADATA, meta);
}
@Override
public int getMetaFromState(IBlockState state) {
return (Integer) state.getValue(METADATA);
}
protected BlockState createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length);
return new BlockState(this, METADATA);
}
public int getHeatFromState(IBlockState state) {
switch (getMetaFromState(state)) {
case 0:
return 1020 / 25;
case 1:
@ -76,4 +98,14 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
return block == (Block) this;
}
@Override
public String getTextureName(IBlockState blockState, EnumFacing facing) {
return "techreborn:blocks/machine/casing" + types[getMetaFromState(blockState)] + "_full";
}
@Override
public int amoutOfVariants() {
return types.length;
}
}

View file

@ -67,7 +67,7 @@ public class BlockOre extends BaseBlock implements IBlockTextureProvider {
@Deprecated
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
int metadata = 0; //TODO meta fix
int metadata = getMetaFromState(state);
Random random = new Random();
//Ruby
if (metadata == 2) {
@ -151,6 +151,7 @@ public class BlockOre extends BaseBlock implements IBlockTextureProvider {
}
return meta;
}
@Override
public String getTextureName(IBlockState blockState, EnumFacing facing) {
return "techreborn:blocks/ore/ore" + types[getMetaFromState(blockState)];

View file

@ -98,13 +98,11 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ) {
if (super.onBlockActivated(world, x, y, z, entityplayer, side, hitX, hitY, hitZ)) {
return true;
}
// int newMeta = (world.getBlockMetadata(x, y, z) + 1) % 3;
int newMeta = 0; //TODO meta fix
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ) {
// int newMeta = (world.getBlockMetadata(x, y, z) + 1) % 3;
int newMeta = getMetaFromState(state);
String message = "";
switch (newMeta) {
case 0:

View file

@ -16,7 +16,7 @@ import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileQuantumChest;
public class BlockQuantumChest extends BlockContainer {
public class BlockQuantumChest extends BlockMachineBase {
public BlockQuantumChest() {
super(Material.rock);
@ -38,63 +38,4 @@ public class BlockQuantumChest extends BlockContainer {
return true;
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
super.onBlockAdded(worldIn, pos, state);
this.setDefaultDirection(worldIn, pos);
}
private void setDefaultDirection(World world, BlockPos pos) {
if (!world.isRemote) {
Block block1 = world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1)).getBlock();
Block block2 = world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)).getBlock();
Block block3 = world.getBlockState(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ())).getBlock();
Block block4 = world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ())).getBlock();
byte b = 3;
if (block1.isOpaqueCube() && !block2.isOpaqueCube()) {
b = 3;
}
if (block2.isOpaqueCube() && !block1.isOpaqueCube()) {
b = 2;
}
if (block3.isOpaqueCube() && !block4.isOpaqueCube()) {
b = 5;
}
if (block4.isOpaqueCube() && !block3.isOpaqueCube()) {
b = 4;
}
//TODO 1.8 meta
// world.setBlockMetadataWithNotify(x, y, z, b, 2);
// setTileRotation(world, pos, b);
}
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
//TODO fix rotaion
// int l = MathHelper
// .floor_double((double) (placer.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
//
// if (l == 0) {
// setTileRotation(worldIn, pos, 2);
// }
// if (l == 1) {
// setTileRotation(worldIn, pos, 5);
// }
// if (l == 2) {
// setTileRotation(worldIn, pos, 3);
// }
// if (l == 3) {
// setTileRotation(worldIn, pos, 4);
// }
}
}

View file

@ -0,0 +1,12 @@
package techreborn.blocks.fluid;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
public class TechRebornFluid extends Fluid {
public TechRebornFluid(String fluidName) {
super(fluidName, new ModelResourceLocation("techreborn:textures/block/" + fluidName + "_flowing"), new ModelResourceLocation("techreborn:textures/block/" + fluidName + "_flowing"));
}
}

View file

@ -6,10 +6,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.blocks.BlockMachineBase;
import techreborn.blocks.IRotationTexture;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileAssemblingMachine;
public class BlockAssemblingMachine extends BlockMachineBase {
public class BlockAssemblingMachine extends BlockMachineBase implements IRotationTexture {
public BlockAssemblingMachine(Material material) {
@ -32,4 +33,31 @@ public class BlockAssemblingMachine extends BlockMachineBase {
return true;
}
private final String prefix = "techreborn:/blocks/machine/";
@Override
public String getFrontOff() {
return prefix + "assembling_machine_front_off";
}
@Override
public String getFrontOn() {
return prefix + "assembling_machine_front_on";
}
@Override
public String getSide() {
return prefix + "machine_side";
}
@Override
public String getTop() {
return prefix + "machine_top";
}
@Override
public String getBottom() {
return prefix + "assembling_machine_top";
}
}

View file

@ -6,10 +6,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.blocks.BlockMachineBase;
import techreborn.blocks.IRotationTexture;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileBlastFurnace;
public class BlockBlastFurnace extends BlockMachineBase {
public class BlockBlastFurnace extends BlockMachineBase implements IRotationTexture {
public BlockBlastFurnace(Material material) {
@ -38,5 +39,31 @@ public class BlockBlastFurnace extends BlockMachineBase {
return true;
}
private final String prefix = "techreborn:/blocks/machine/";
@Override
public String getFrontOff() {
return prefix + "industrial_blast_furnace_front_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_blast_furnace_front_on";
}
@Override
public String getSide() {
return prefix + "advanced_machine_side";
}
@Override
public String getTop() {
return prefix + "advanced_machine_side";
}
@Override
public String getBottom() {
return prefix + "assembling_machine_top";
}
}

View file

@ -7,77 +7,78 @@ import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import reborncore.api.fuel.FluidPowerManager;
import techreborn.blocks.fluid.BlockFluidTechReborn;
import techreborn.blocks.fluid.TechRebornFluid;
import techreborn.lib.ModInfo;
public class ModFluids {
public static Fluid fluidberylium = new Fluid("fluidberylium");
public static Fluid fluidberylium = new TechRebornFluid("fluidberylium");
public static Block BlockFluidBerylium;
public static Fluid fluidcalcium = new Fluid("fluidcalcium");
public static Fluid fluidcalcium = new TechRebornFluid("fluidcalcium");
public static Block BlockFluidCalcium;
public static Fluid fluidcalciumcarbonate = new Fluid("fluidcalciumcarbonate");
public static Fluid fluidcalciumcarbonate = new TechRebornFluid("fluidcalciumcarbonate");
public static Block BlockFluidCalciumCarbonate;
public static Fluid fluidChlorite = new Fluid("fluidchlorite");
public static Fluid fluidChlorite = new TechRebornFluid("fluidchlorite");
public static Block BlockFluidChlorite;
public static Fluid fluidDeuterium = new Fluid("fluiddeuterium");
public static Fluid fluidDeuterium = new TechRebornFluid("fluiddeuterium");
public static Block BlockFluidDeuterium;
public static Fluid fluidGlyceryl = new Fluid("fluidglyceryl");
public static Fluid fluidGlyceryl = new TechRebornFluid("fluidglyceryl");
public static Block BlockFluidGlyceryl;
public static Fluid fluidHelium = new Fluid("fluidhelium");
public static Fluid fluidHelium = new TechRebornFluid("fluidhelium");
public static Block BlockFluidHelium;
public static Fluid fluidHelium3 = new Fluid("fluidhelium3");
public static Fluid fluidHelium3 = new TechRebornFluid("fluidhelium3");
public static Block BlockFluidHelium3;
public static Fluid fluidHeliumplasma = new Fluid("fluidheliumplasma");
public static Fluid fluidHeliumplasma = new TechRebornFluid("fluidheliumplasma");
public static Block BlockFluidHeliumplasma;
public static Fluid fluidHydrogen = new Fluid("fluidhydrogen");
public static Fluid fluidHydrogen = new TechRebornFluid("fluidhydrogen");
public static Block BlockFluidHydrogen;
public static Fluid fluidLithium = new Fluid("fluidlithium");
public static Fluid fluidLithium = new TechRebornFluid("fluidlithium");
public static Block BlockFluidLithium;
public static Fluid fluidMercury = new Fluid("fluidmercury");
public static Fluid fluidMercury = new TechRebornFluid("fluidmercury");
public static Block BlockFluidMercury;
public static Fluid fluidMethane = new Fluid("fluidmethane");
public static Fluid fluidMethane = new TechRebornFluid("fluidmethane");
public static Block BlockFluidMethane;
public static Fluid fluidNitrocoalfuel = new Fluid("fluidnitrocoalfuel");
public static Fluid fluidNitrocoalfuel = new TechRebornFluid("fluidnitrocoalfuel");
public static Block BlockFluidNitrocoalfuel;
public static Fluid fluidNitrofuel = new Fluid("fluidnitrofuel");
public static Fluid fluidNitrofuel = new TechRebornFluid("fluidnitrofuel");
public static Block BlockFluidNitrofuel;
public static Fluid fluidNitrogen = new Fluid("fluidnitrogen");
public static Fluid fluidNitrogen = new TechRebornFluid("fluidnitrogen");
public static Block BlockFluidNitrogen;
public static Fluid fluidNitrogendioxide = new Fluid("fluidnitrogendioxide");
public static Fluid fluidNitrogendioxide = new TechRebornFluid("fluidnitrogendioxide");
public static Block BlockFluidNitrogendioxide;
public static Fluid fluidPotassium = new Fluid("fluidpotassium");
public static Fluid fluidPotassium = new TechRebornFluid("fluidpotassium");
public static Block BlockFluidPotassium;
public static Fluid fluidSilicon = new Fluid("fluidsilicon");
public static Fluid fluidSilicon = new TechRebornFluid("fluidsilicon");
public static Block BlockFluidSilicon;
public static Fluid fluidSodium = new Fluid("fluidsodium");
public static Fluid fluidSodium = new TechRebornFluid("fluidsodium");
public static Block BlockFluidSodium;
public static Fluid fluidSodiumpersulfate = new Fluid("fluidsodiumpersulfate");
public static Fluid fluidSodiumpersulfate = new TechRebornFluid("fluidsodiumpersulfate");
public static Block BlockFluidSodiumpersulfate;
public static Fluid fluidTritium = new Fluid("fluidtritium");
public static Fluid fluidTritium = new TechRebornFluid("fluidtritium");
public static Block BlockFluidTritium;
public static Fluid fluidWolframium = new Fluid("fluidwolframium");
public static Fluid fluidWolframium = new TechRebornFluid("fluidwolframium");
public static Block BlockFluidWolframium;
public static void init() {

View file

@ -103,7 +103,8 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
}
for (IMultiblockPart part : casing.connectedParts) {
// heat += BlockMachineCasing.getHeatFromMeta(part.getWorld().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z));
BlockMachineCasing casing1 = (BlockMachineCasing) worldObj.getBlockState(part.getPos()).getBlock();
heat += casing1.getHeatFromState(part.getWorld().getBlockState(part.getWorldLocation().toBlockPos()));
//TODO meta fix
}

View file

@ -86,8 +86,8 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IFlui
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(), getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
BlockMachineCasing machineCasing = (BlockMachineCasing) tileEntity.getBlockType();
int heat = machineCasing.getHeatFromState(tileEntity.getWorld().getBlockState(tileEntity.getPos()));
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ())).getBlock().getUnlocalizedName().equals("tile.lava")) {

View file

@ -74,7 +74,8 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
BlockMachineCasing machineCasing = (BlockMachineCasing) tileEntity.getBlockType();
heat = machineCasing.getHeatFromState(tileEntity.getWorld().getBlockState(tileEntity.getPos()));
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ())).getBlock().getUnlocalizedName().equals("tile.lava")) {

View file

@ -60,7 +60,8 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) tileEntity.getBlockType();
heat = blockMachineCasing.getHeatFromState(tileEntity.getWorld().getBlockState(tileEntity.getPos()));
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlockState(location.getBlockPos()).getBlock().getUnlocalizedName().equals("tile.lava")) {

View file

@ -3,6 +3,7 @@ package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import techreborn.blocks.BlockMachineBase;
import techreborn.powerSystem.TilePowerAcceptor;
import java.util.Iterator;
@ -53,17 +54,19 @@ public class TilePlayerDectector extends TilePowerAcceptor {
while (tIterator.hasNext()) {
EntityPlayer player = (EntityPlayer) tIterator.next();
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D, (double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
// if(worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == 0){//ALL
// redstone = true;
// } else if (blockMetadata == 1){//Others
// if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
// redstone = true;
// }
// } else {//You
// if(!owenerUdid.isEmpty() &&owenerUdid.equals(player.getUniqueID().toString())){
// redstone = true;
// }
// }//TODO meta fix
BlockMachineBase blockMachineBase = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
int meta = blockMachineBase.getMetaFromState(worldObj.getBlockState(pos));
if(meta == 0){//ALL
redstone = true;
} else if (meta == 1){//Others
if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
redstone = true;
}
} else {//You
if(!owenerUdid.isEmpty() &&owenerUdid.equals(player.getUniqueID().toString())){
redstone = true;
}
}
redstone = true;
}
}

View file

@ -1,6 +1,7 @@
package techreborn.tiles;
import ic2.api.tile.IWrenchable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -10,6 +11,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import reborncore.common.util.Inventory;
import techreborn.api.recipe.RecipeCrafter;
import techreborn.blocks.BlockMachineCasing;
import techreborn.init.ModBlocks;
import techreborn.lib.Reference;
import techreborn.powerSystem.TilePowerAcceptor;
@ -222,9 +224,11 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
if (worldObj.getBlockState(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k)).getBlock() != ModBlocks.MachineCasing) {
return false;
}
// if (worldObj.getBlockMetadata(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1)) {
// return false;
// }//TODO meta fix
IBlockState blockState = worldObj.getBlockState(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k));
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) blockState.getBlock();
if (blockMachineCasing.getMetaFromState(blockState) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1)) {
return false;
}
} else if (!worldObj.isAirBlock(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k))) {
return false;
}

View file

@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import org.apache.commons.lang3.StringUtils;
import reborncore.common.misc.Functions;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.powerSystem.TilePowerAcceptor;
@ -45,19 +46,17 @@ public class TileIDSU extends TilePowerAcceptor {
}
//TODO meta fix
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
//return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) != Functions.getIntDirFromDirection(direction);
return true;
return getFacingEnum() != direction;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
//return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == Functions.getIntDirFromDirection(direction);
return true;
return getFacingEnum() == direction;
}
@Override
public double getMaxOutput() {
return output;

View file

@ -32,7 +32,6 @@ public class TROreGen implements IWorldGenerator {
WorldGenMinable oreSilver;
public TROreGen() {
//TODO meta fix
// World
oreGalena = new WorldGenMinable(ModBlocks.ore.getStateFromMeta(0), ConfigTechReborn.GalenaOreRare);
oreIridium = new WorldGenMinable(ModBlocks.ore.getStateFromMeta(1), ConfigTechReborn.IridiumOreRare);