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";
}
}