mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 10:45:02 +00:00
Refactor ICarvable to receive world and pos references. Closes #147.
This commit is contained in:
1 parent
2658e099a3
commit
1292a68d8d
19 files changed
+163
-81
No files matched your search
@@ -43,14 +43,14 @@ import com.cricketcraft.chisel.block.BlockLavastone;
|
||||
import com.cricketcraft.chisel.block.BlockLeaf;
|
||||
import com.cricketcraft.chisel.block.BlockMarbleBookshelf;
|
||||
import com.cricketcraft.chisel.block.BlockMarbleCarpet;
|
||||
import com.cricketcraft.chisel.block.CarvableStairsMaker;
|
||||
import com.cricketcraft.chisel.block.IStairsCreator;
|
||||
import com.cricketcraft.chisel.block.BlockMarbleTexturedOre;
|
||||
import com.cricketcraft.chisel.block.BlockPresent;
|
||||
import com.cricketcraft.chisel.block.BlockRoadLine;
|
||||
import com.cricketcraft.chisel.block.BlockSnakestone;
|
||||
import com.cricketcraft.chisel.block.BlockSnakestoneObsidian;
|
||||
import com.cricketcraft.chisel.block.BlockWaterstone;
|
||||
import com.cricketcraft.chisel.block.CarvableStairsMaker;
|
||||
import com.cricketcraft.chisel.block.IStairsCreator;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.cricketcraft.chisel.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
@@ -12,6 +15,26 @@ public interface ICarvable {
|
||||
*
|
||||
* @param metadata
|
||||
* The metadata of the block
|
||||
* @param world
|
||||
* {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to this method's use in rendering.
|
||||
* @param x
|
||||
* X coord of the block
|
||||
* @param y
|
||||
* Y coord of the block
|
||||
* @param z
|
||||
* Z coord of the block
|
||||
* @param metadata
|
||||
* The metadata of the block
|
||||
* @return The {@link CarvableVariation} that represents this block in the world.
|
||||
*/
|
||||
public CarvableVariation getVariation(int metadata);
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata);
|
||||
|
||||
/**
|
||||
* Gets the {@link CarvableVariation} for this block when it is in item form.
|
||||
*
|
||||
* @param stack
|
||||
* The {@link ItemStack} representing this block;
|
||||
* @return A {@link CarvableVariation}
|
||||
*/
|
||||
public CarvableVariation getVariation(ItemStack stack);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
@@ -78,9 +79,14 @@ public class BlockCarvable extends Block implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
public static class SoundType extends Block.SoundType {
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
@@ -39,7 +41,7 @@ public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube() {
|
||||
return true;
|
||||
@@ -71,10 +73,15 @@ public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
|
||||
@@ -8,8 +8,10 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
@@ -53,18 +55,20 @@ public class BlockCarvableIce extends BlockIce implements ICarvable {
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
|
||||
/*
|
||||
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5,
|
||||
* par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) {
|
||||
* ItemStack itemstack = this.createStackedBlock(par6);
|
||||
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
|
||||
* this.createStackedBlock(par6);
|
||||
*
|
||||
* if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4,
|
||||
* par5, itemstack); } }
|
||||
* if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5, itemstack); } }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,10 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
@@ -53,18 +55,20 @@ public class BlockCarvablePackedIce extends Block implements ICarvable {
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
|
||||
/*
|
||||
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5,
|
||||
* par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) {
|
||||
* ItemStack itemstack = this.createStackedBlock(par6);
|
||||
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
|
||||
* this.createStackedBlock(par6);
|
||||
*
|
||||
* if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4,
|
||||
* par5, itemstack); } }
|
||||
* if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5, itemstack); } }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
@@ -68,7 +70,12 @@ public class BlockCarvablePane extends BlockPane implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.cricketcraft.chisel.block;
|
||||
|
||||
import net.minecraft.block.BlockPumpkin;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
@@ -43,10 +45,15 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
public void setInformation(String textureLocation) {
|
||||
this.faceLocation = textureLocation;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.block.BlockSand;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
@@ -72,10 +73,15 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
public static class SoundType extends Block.SoundType {
|
||||
|
||||
public final String soundNameStep;
|
||||
@@ -83,13 +89,10 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
public final String soundNamePlace;
|
||||
|
||||
/**
|
||||
* Creates a SoundType with automatic names for step and break sounds.
|
||||
* Sound names dig.soundName and step.soundName must be specified in the
|
||||
* sounds.json
|
||||
* Creates a SoundType with automatic names for step and break sounds. Sound names dig.soundName and step.soundName must be specified in the sounds.json
|
||||
*
|
||||
* @param soundName
|
||||
* block of the sound. Will automatically be expanded to
|
||||
* "mod:dig.soundName" and "mod:step.soundName" respectively)
|
||||
* block of the sound. Will automatically be expanded to "mod:dig.soundName" and "mod:step.soundName" respectively)
|
||||
* @param volume
|
||||
* default 1.0f
|
||||
* @param frequency
|
||||
@@ -103,8 +106,7 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a SoundType with manual names for step and break sounds.
|
||||
* Sound names must be specified in the sounds.json
|
||||
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the sounds.json
|
||||
*
|
||||
* @param soundNameBreak
|
||||
* block break sound
|
||||
@@ -123,8 +125,7 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a SoundType with manual names for step, break and place
|
||||
* sounds. Sound names must be specified in the sounds.json
|
||||
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the sounds.json
|
||||
*
|
||||
* @param soundNameBreak
|
||||
* block break sound
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
@@ -77,7 +78,12 @@ public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(blockMeta + (metadata / 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
@@ -15,70 +17,67 @@ import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableTorch extends BlockTorch implements ICarvable
|
||||
{
|
||||
public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
private String texLocation;
|
||||
protected boolean emitsParticles = true;
|
||||
|
||||
public BlockCarvableTorch()
|
||||
{
|
||||
public BlockCarvableTorch() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper();
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(0.9375F);
|
||||
setBlockName("torch");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister icon){
|
||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/"+ texLocation);
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
public void setInformation(String textureLocation){
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
||||
}
|
||||
|
||||
public void setInformation(String textureLocation) {
|
||||
this.texLocation = textureLocation;
|
||||
}
|
||||
public BlockCarvableTorch disableParticles()
|
||||
{
|
||||
|
||||
public BlockCarvableTorch disableParticles() {
|
||||
this.emitsParticles = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_)
|
||||
{
|
||||
if(emitsParticles)
|
||||
{
|
||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) {
|
||||
if (emitsParticles) {
|
||||
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
||||
double d0 = (double)((float)p_149734_2_ + 0.5F);
|
||||
double d1 = (double)((float)p_149734_3_ + 0.7F);
|
||||
double d2 = (double)((float)p_149734_4_ + 0.5F);
|
||||
double d0 = (double) ((float) p_149734_2_ + 0.5F);
|
||||
double d1 = (double) ((float) p_149734_3_ + 0.7F);
|
||||
double d2 = (double) ((float) p_149734_4_ + 0.5F);
|
||||
double d3 = 0.2199999988079071D;
|
||||
double d4 = 0.27000001072883606D;
|
||||
|
||||
if (l == 1)
|
||||
{
|
||||
if (l == 1) {
|
||||
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
} else if (l == 2) {
|
||||
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
} else if (l == 3) {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 4)
|
||||
{
|
||||
} else if (l == 4) {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
@@ -54,8 +55,12 @@ public class BlockMarbleCarpet extends BlockCarpet implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
@@ -52,7 +54,12 @@ public class BlockMarbleTexturedOre extends BlockTexturedOre implements ICarvabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -282,7 +282,12 @@ public class BlockPresent extends BlockChest implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class BlockAdvancedMarbleRenderer 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);
|
||||
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(meta);
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
|
||||
switch (var == null ? 0 : var.kind) {
|
||||
case CarvableHelper.CTMX:
|
||||
|
||||
@@ -38,23 +38,23 @@ public class BlockCTMNoLightRenderer 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);
|
||||
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(meta);
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
|
||||
switch (var == null ? 0 : var.kind) {
|
||||
case CarvableHelper.CTMX:
|
||||
rendererCTMNoLight.blockAccess = world;
|
||||
rendererCTMNoLight.renderMaxX = 1.0;
|
||||
rendererCTMNoLight.renderMaxY = 1.0;
|
||||
rendererCTMNoLight.renderMaxZ = 1.0;
|
||||
case CarvableHelper.CTMX:
|
||||
rendererCTMNoLight.blockAccess = world;
|
||||
rendererCTMNoLight.renderMaxX = 1.0;
|
||||
rendererCTMNoLight.renderMaxY = 1.0;
|
||||
rendererCTMNoLight.renderMaxZ = 1.0;
|
||||
|
||||
rendererCTMNoLight.submap = var.submap;
|
||||
rendererCTMNoLight.submapSmall = var.submapSmall;
|
||||
rendererCTMNoLight.submap = var.submap;
|
||||
rendererCTMNoLight.submapSmall = var.submapSmall;
|
||||
|
||||
rendererCTMNoLight.rendererOld = rendererOld;
|
||||
rendererCTMNoLight.rendererOld = rendererOld;
|
||||
|
||||
return rendererCTMNoLight.renderStandardBlock(block, x, y, z);
|
||||
default:
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
return rendererCTMNoLight.renderStandardBlock(block, x, y, z);
|
||||
default:
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
@@ -33,7 +34,8 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
public List<String> getWailaBody(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
if (accessor.getBlock() instanceof ICarvable) {
|
||||
ICarvable block = (ICarvable) accessor.getBlock();
|
||||
strings.add(block.getVariation(accessor.getMetadata()).getDescription());
|
||||
MovingObjectPosition pos = accessor.getPosition();
|
||||
strings.add(block.getVariation(accessor.getWorld(), pos.blockX, pos.blockY, pos.blockZ, accessor.getMetadata()).getDescription());
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemCarvable extends ItemBlock {
|
||||
return;
|
||||
|
||||
ICarvable carvable = (ICarvable) block;
|
||||
CarvableVariation var = carvable.getVariation(stack.getItemDamage());
|
||||
CarvableVariation var = carvable.getVariation(stack);
|
||||
if (var == null)
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user