mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-18 19:39:12 +00:00
Fix Some of the rendering errors/Tree errors.
This commit is contained in:
1 parent
1bc13bad5b
commit
db764e4fa1
7 files changed
+82
-92
No files matched your search
@@ -3,6 +3,10 @@ package tconstruct.blocks;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import tconstruct.client.block.OreberryRender;
|
||||
import tconstruct.common.TRepo;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -21,10 +25,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.client.block.OreberryRender;
|
||||
import tconstruct.common.TRepo;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -37,8 +37,6 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
public String[] oreTypes;
|
||||
public int itemMeat;
|
||||
private int subitems;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected int field_150127_b;
|
||||
|
||||
public OreberryBush(String[] textureNames, int meta, int sub, String[] oreTypes)
|
||||
{
|
||||
@@ -50,7 +48,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
this.setTickRandomly(true);
|
||||
random = new Random();
|
||||
this.setHardness(0.3F);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
this.setStepSound(Block.soundTypeMetal);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
@@ -74,10 +72,9 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int metadata)
|
||||
{
|
||||
if (net.minecraft.client.Minecraft.getMinecraft().gameSettings.fancyGraphics)
|
||||
if (field_150121_P)
|
||||
{
|
||||
if (metadata < 12)
|
||||
{
|
||||
@@ -200,9 +197,8 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
/*
|
||||
* if (world.isRemote) return false;
|
||||
*/
|
||||
/*if (world.isRemote)
|
||||
return false;*/
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 12)
|
||||
@@ -226,6 +222,11 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setGraphicsLevel (boolean flag)
|
||||
{
|
||||
field_150121_P = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
@@ -239,10 +240,9 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int x, int y, int z, int meta)
|
||||
{
|
||||
if (meta > 7 || net.minecraft.client.Minecraft.getMinecraft().gameSettings.fancyGraphics)
|
||||
if (meta > 7 || field_150121_P)
|
||||
{
|
||||
return super.shouldSideBeRendered(iblockaccess, x, y, z, meta);
|
||||
}
|
||||
@@ -262,8 +262,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
return;
|
||||
}
|
||||
|
||||
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <=
|
||||
// 8)
|
||||
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8)
|
||||
{
|
||||
if (world.getFullBlockLightValue(x, y, z) < 10)
|
||||
{
|
||||
@@ -273,10 +272,10 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
world.setBlock(x, y, z, this, meta + 4, 3);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* else if (meta < 8) { world.setBlock(x, y, z, blockID, meta + 4,
|
||||
* 3); }
|
||||
*/
|
||||
/*else if (meta < 8)
|
||||
{
|
||||
world.setBlock(x, y, z, blockID, meta + 4, 3);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,20 +294,27 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Resistance to fire */
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye
|
||||
* returns 16 items)
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int var4 = 8; var4 < 8 + subitems; ++var4)
|
||||
{
|
||||
par3List.add(new ItemStack(b, 1, var4));
|
||||
par3List.add(new ItemStack(par1, 1, var4));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return EnumPlantType.Cave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getPlant (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@@ -327,18 +333,4 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
if (!(entity instanceof EntityItem))
|
||||
entity.attackEntityFrom(DamageSource.cactus, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return EnumPlantType.Cave;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setGraphicsLevel (boolean p_150122_1_)
|
||||
{
|
||||
this.field_150121_P = p_150122_1_;
|
||||
this.field_150127_b = (p_150122_1_ ? 0 : 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -40,8 +40,9 @@ public class TankAirBlock extends BlockContainer
|
||||
return TankAirRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -74,23 +74,23 @@ public class SlimeLeaves extends BlockLeaves
|
||||
{
|
||||
int tex = meta % 4;
|
||||
|
||||
if (net.minecraft.client.Minecraft.getMinecraft().gameSettings.fancyGraphics)
|
||||
if (this.field_150121_P)
|
||||
return fancyIcons[tex];
|
||||
else
|
||||
return fastIcons[tex];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < fastIcons.length; iter++)
|
||||
{
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves (IBlockAccess world, int x, int y, int z)
|
||||
public boolean isLeaves(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -101,14 +101,13 @@ public class SlimeLeaves extends BlockLeaves
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public Item getItemDropped (int par1, Random par2Random, int par3)
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return new ItemStack(TRepo.slimeSapling).getItem();
|
||||
return Item.getItemFromBlock(TRepo.slimeSapling);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the block items with a specified chance of dropping the specified
|
||||
* items
|
||||
* Drops the block items with a specified chance of dropping the specified items
|
||||
*/
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance (World world, int x, int y, int z, int meta, float chance, int fortune)
|
||||
@@ -117,9 +116,10 @@ public class SlimeLeaves extends BlockLeaves
|
||||
{
|
||||
int dropChance = 35;
|
||||
|
||||
/*
|
||||
* if ((meta & 3) == 3) { j1 = 40; }
|
||||
*/
|
||||
/*if ((meta & 3) == 3)
|
||||
{
|
||||
j1 = 40;
|
||||
}*/
|
||||
|
||||
if (fortune > 0)
|
||||
{
|
||||
@@ -161,4 +161,4 @@ public class SlimeLeaves extends BlockLeaves
|
||||
{
|
||||
return new String[] { "slime" };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class SlimeSapling extends BlockSapling
|
||||
float f = 0.4F;
|
||||
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
this.setHardness(0.0F);
|
||||
this.stepSound = Block.soundTypeGrass;
|
||||
this.setStepSound(Block.soundTypeGrass);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
@@ -47,9 +47,10 @@ public class SlimeSapling extends BlockSapling
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canThisPlantGrowOnThisBlockID (Block b)
|
||||
@Override
|
||||
protected boolean canPlaceBlockOn(Block p_149854_1_)
|
||||
{
|
||||
return b == Blocks.grass || b == Blocks.dirt || b == TRepo.slimeGrass || b == TRepo.craftedSoil;
|
||||
return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt || p_149854_1_ == TRepo.slimeGrass || p_149854_1_ == TRepo.craftedSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,7 +113,7 @@ public class SlimeSapling extends BlockSapling
|
||||
obj = new SlimeTreeGen(true, 5, 4, 1, 0);
|
||||
|
||||
if (!(obj.generate(world, random, x, y, z)))
|
||||
world.setBlock(x, y, z, Blocks.air, md + 8, 3);
|
||||
world.setBlock(x, y, z, this, md + 8, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,9 +124,9 @@ public class SlimeSapling extends BlockSapling
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
par3List.add(new ItemStack(b, 1, i));
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.common.TRepo;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Type;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TClientTickHandler
|
||||
{
|
||||
@@ -15,22 +15,15 @@ public class TClientTickHandler
|
||||
|
||||
TControls controlInstance = ((TProxyClient) TConstruct.proxy).controlInstance;
|
||||
|
||||
public TClientTickHandler()
|
||||
{
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onTick (ClientTickEvent event)
|
||||
public void tickEnd (ClientTickEvent event)
|
||||
{
|
||||
|
||||
if (event.phase.equals(Phase.END) && event.type.equals(Type.RENDER))
|
||||
{
|
||||
TRepo.oreBerry.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TRepo.oreBerrySecond.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TRepo.slimeLeaves.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround)
|
||||
controlInstance.landOnGround();
|
||||
}
|
||||
TRepo.oreBerry.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TRepo.oreBerrySecond.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TRepo.slimeLeaves.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround)
|
||||
controlInstance.landOnGround();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -148,6 +148,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
|
||||
public class TProxyClient extends TProxyCommon
|
||||
@@ -289,6 +290,7 @@ public class TProxyClient extends TProxyCommon
|
||||
@Override
|
||||
public void registerTickHandler ()
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(new TClientTickHandler());
|
||||
new TClientTickHandler();
|
||||
// TickRegistry.registerTickHandler(new TimeTicker(), Side.CLIENT);
|
||||
// TickRegistry.registerTickHandler(new TCommonTickHandler(),
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SlimeTreeGen extends WorldGenerator
|
||||
this.metaLeaves = leavesMeta;
|
||||
this.seekHeight = !notify;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean generate (World world, Random random, int xPos, int yPos, int zPos)
|
||||
{
|
||||
@@ -45,11 +45,12 @@ public class SlimeTreeGen extends WorldGenerator
|
||||
{
|
||||
Block soil = world.getBlock(xPos, yPos - 1, zPos);
|
||||
boolean isSoil = (soil != null && soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, TRepo.slimeSapling));
|
||||
|
||||
|
||||
if (isSoil)
|
||||
{
|
||||
if (!checkClear(world, xPos, yPos, zPos, height))
|
||||
return false;
|
||||
//TODO Fix this for 1.7
|
||||
//if (!checkClear(world, xPos, yPos, zPos, height))
|
||||
// return false;
|
||||
|
||||
soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos);
|
||||
placeCanopy(world, random, xPos, yPos, zPos, height);
|
||||
@@ -75,8 +76,8 @@ public class SlimeTreeGen extends WorldGenerator
|
||||
{
|
||||
for (int zPos = range; zPos <= range; zPos++)
|
||||
{
|
||||
Block block = world.getBlock(x + xPos, y + yPos, z + zPos);
|
||||
if (block != null && block != TRepo.slimeSapling && !block.isLeaves(world, x + xPos, y + yPos, z + zPos))
|
||||
Block blockID = world.getBlock(x + xPos, y + yPos, z + zPos);
|
||||
if (blockID != null && blockID != TRepo.slimeSapling && !blockID.isLeaves(world, x + xPos, y + yPos, z + zPos))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -90,8 +91,8 @@ public class SlimeTreeGen extends WorldGenerator
|
||||
int height = y;
|
||||
do
|
||||
{
|
||||
Block heightBL = world.getBlock(x, height, z);
|
||||
if ((heightBL == TRepo.craftedSoil || heightBL == TRepo.slimeGrass) && !world.getBlock(x, height + 1, z).isOpaqueCube())
|
||||
Block heightID = world.getBlock(x, height, z);
|
||||
if ((heightID == TRepo.craftedSoil || heightID == TRepo.slimeGrass) && !world.getBlock(x, height + 1, z).isOpaqueCube())
|
||||
{
|
||||
ret = height + 1;
|
||||
break;
|
||||
@@ -117,7 +118,7 @@ public class SlimeTreeGen extends WorldGenerator
|
||||
this.setBlockAndMetadata(world, xPos - 1, yPos + height - 3, zPos + 1, Blocks.air, 0);
|
||||
this.setBlockAndMetadata(world, xPos - 1, yPos + height - 3, zPos - 1, Blocks.air, 0);
|
||||
|
||||
// Drippers
|
||||
//Drippers
|
||||
this.setBlockAndMetadata(world, xPos + 3, yPos + height - 4, zPos, TRepo.slimeLeaves, this.metaLeaves);
|
||||
this.setBlockAndMetadata(world, xPos - 3, yPos + height - 4, zPos, TRepo.slimeLeaves, this.metaLeaves);
|
||||
this.setBlockAndMetadata(world, xPos, yPos + height - 4, zPos - 3, TRepo.slimeLeaves, this.metaLeaves);
|
||||
@@ -155,28 +156,28 @@ public class SlimeTreeGen extends WorldGenerator
|
||||
{
|
||||
for (int localHeight = 0; localHeight < height; ++localHeight)
|
||||
{
|
||||
Block block = world.getBlock(xPos, yPos + localHeight, zPos);
|
||||
Block blockID = world.getBlock(xPos, yPos + localHeight, zPos);
|
||||
|
||||
if (block == null || block == Blocks.air || block.isLeaves(world, xPos, yPos + localHeight, zPos))
|
||||
if (blockID == Blocks.air || blockID == null || blockID.isLeaves(world, xPos, yPos + localHeight, zPos))
|
||||
{
|
||||
this.setBlockAndMetadata(world, xPos, yPos + localHeight, zPos, TRepo.slimeGel, this.metaWood);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setBlockAndMetadata (World world, int x, int y, int z, Block block, int blockMeta)
|
||||
protected void setBlockAndMetadata (World world, int x, int y, int z, Block blockID, int blockMeta)
|
||||
{
|
||||
Block blockWorld = world.getBlock(x, y, z);
|
||||
if (blockWorld == null || blockWorld == Blocks.air || blockWorld.canPlaceBlockAt(world, x, y, z))
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null || block.canPlaceBlockAt(world, x, y, z))
|
||||
{
|
||||
if (this.notify)
|
||||
{
|
||||
world.setBlock(x, y, z, block, blockMeta, 3);
|
||||
world.setBlock(x, y, z, blockID, blockMeta, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlock(x, y, z, block, blockMeta, 2);
|
||||
world.setBlock(x, y, z, blockID, blockMeta, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user