mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
root package of block, first pass done
This commit is contained in:
1 parent
3fe15e6b7d
commit
999705294d
40 files changed
+416
-632
No files matched your search
@@ -4,6 +4,9 @@
|
||||
so Botania knows what property to set the color on (todo actually do this)
|
||||
* ICorporeaSpark.getInventory had to be changed to ICorporeaSpark.getSparkInventory because the signature clashed (IInventory vs ItemStack[], respectively)
|
||||
This can be changed to match vanilla signature, but either would break backward compat.
|
||||
* SubTileEntity.getComparatorInputOverride parameter removed (it was actually incorrect also. Not side, but the meta of the block).
|
||||
Anyways, vanilla removed it from their method so we follow suit.
|
||||
* SubTileEntity's methods that are copied from block (onBlockadded, etc.) updated to match vanilla counterparts
|
||||
|
||||
-- Other --
|
||||
* Most things left untouched to make patches from upstream easier
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
package vazkii.botania.api.subtile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -113,33 +115,33 @@ public class SubTileEntity {
|
||||
/**
|
||||
* Called when this sub tile is placed in the world (by an entity).
|
||||
*/
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks this sub tile.
|
||||
*/
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return false; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { return false; }
|
||||
|
||||
/**
|
||||
* Called when this sub tile is added to the world.
|
||||
*/
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
//NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this sub tile is harvested
|
||||
*/
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int side, EntityPlayer player) {
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
//NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows additional processing of sub tile drops
|
||||
*/
|
||||
public ArrayList<ItemStack> getDrops(ArrayList<ItemStack> list) {
|
||||
public List<ItemStack> getDrops(List<ItemStack> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -208,14 +210,14 @@ public class SubTileEntity {
|
||||
/**
|
||||
* Gets the comparator input value for this SubTileEntity
|
||||
*/
|
||||
public int getComparatorInputOverride(int side) {
|
||||
public int getComparatorInputOverride() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the redstone power level for this SubTileEntity
|
||||
*/
|
||||
public int getPowerLevel(int side) {
|
||||
public int getPowerLevel(EnumFacing side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -29,7 +28,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
@@ -66,11 +64,6 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldRegisterInNameSet() {
|
||||
return false;
|
||||
|
||||
@@ -14,7 +14,8 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -23,12 +24,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.common.util.RotationHelper;
|
||||
import vazkii.botania.api.item.IAvatarWieldable;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -40,8 +39,6 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
|
||||
private static final int[] META_ROTATIONS = new int[] { 2, 5, 3, 4 };
|
||||
|
||||
Random random;
|
||||
|
||||
protected BlockAvatar() {
|
||||
@@ -49,14 +46,19 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setUnlocalizedName(LibBlockNames.AVATAR);
|
||||
setBlockBounds(true);
|
||||
|
||||
setBlockBounds(EnumFacing.Axis.Z);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
|
||||
TileAvatar avatar = (TileAvatar) world.getTileEntity(x, y, z);
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.CARDINALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
TileAvatar avatar = (TileAvatar) world.getTileEntity(pos);
|
||||
ItemStack stackOnAvatar = avatar.getStackInSlot(0);
|
||||
ItemStack stackOnPlayer = player.getCurrentEquippedItem();
|
||||
if(stackOnAvatar != null) {
|
||||
@@ -76,25 +78,25 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) {
|
||||
setBlockBounds(w.getBlockMetadata(x, y, z) < 4);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess w, BlockPos pos) {
|
||||
setBlockBounds(((EnumFacing) w.getBlockState(pos).getValue(BotaniaStateProps.CARDINALS)).getAxis());
|
||||
}
|
||||
|
||||
public void setBlockBounds(boolean horiz) {
|
||||
public void setBlockBounds(EnumFacing.Axis horiz) {
|
||||
float f = 1F / 16F;
|
||||
float w = f * 9;
|
||||
float l = f * 6;
|
||||
float ws = (1F - w) / 2;
|
||||
float ls = (1F - l) / 2;
|
||||
|
||||
if(horiz)
|
||||
if(horiz == EnumFacing.Axis.Z)
|
||||
setBlockBounds(ws, 0F, ls, 1F - ws, 1F + f, 1F - ls);
|
||||
else setBlockBounds(ls, 0F, ws, 1F - ls, 1F + f, 1F - ws);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(pos);
|
||||
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
@@ -112,7 +114,7 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
entityitem = new EntityItem(par1World, pos.getX() + f, pos.getY() + f1, pos.getZ() + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
@@ -124,26 +126,15 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
par1World.updateComparatorOutputLevel(pos, state.getBlock());
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
|
||||
int l = MathHelper.floor_double(p_149689_5_.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, META_ROTATIONS[l], 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
|
||||
return RotationHelper.rotateVanillaBlock(Blocks.furnace, worldObj, x, y, z, axis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
public void onBlockPlacedBy(World p_149689_1_, BlockPos pos, IBlockState state, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
|
||||
p_149689_1_.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, p_149689_5_.getHorizontalFacing().getOpposite()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,7 +148,7 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -59,19 +60,19 @@ public class BlockBifrost extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(ModItems.rainbowRod);
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered1(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
public boolean shouldSideBeRendered1(IBlockAccess p_149646_1_, BlockPos pos, EnumFacing side) {
|
||||
Block block = p_149646_1_.getBlockState(pos).getBlock();
|
||||
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
return shouldSideBeRendered1(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, 1 - p_149646_5_);
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, BlockPos pos, EnumFacing side) {
|
||||
return shouldSideBeRendered1(p_149646_1_, pos, 1 - p_149646_5_); //todo 1.8 wtf
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,7 +81,7 @@ public class BlockBifrost extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(int meta, int fortune, Random random) {
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -94,12 +95,6 @@ public class BlockBifrost extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileBifrost();
|
||||
|
||||
@@ -14,10 +14,12 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -39,36 +41,26 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return ModBlocks.bifrost.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered1(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
public boolean shouldSideBeRendered1(IBlockAccess p_149646_1_, BlockPos pos, EnumFacing side) {
|
||||
Block block = p_149646_1_.getBlockState(pos).getBlock();
|
||||
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
return shouldSideBeRendered1(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, 1 - p_149646_5_);
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, BlockPos pos, EnumFacing side) {
|
||||
return shouldSideBeRendered1(p_149646_1_, pos, 1 - p_149646_5_); //todo 1.8 wtf
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
if(rand.nextBoolean())
|
||||
Botania.proxy.sparkleFX(world, x + Math.random(), y + Math.random(), z + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,15 +11,17 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.tile.TileCacophonium;
|
||||
@@ -27,8 +29,6 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockCacophonium extends BlockModContainer {
|
||||
|
||||
IIcon top;
|
||||
|
||||
protected BlockCacophonium() {
|
||||
super(Material.wood);
|
||||
setUnlocalizedName(LibBlockNames.CACOPHONIUM);
|
||||
@@ -36,18 +36,7 @@ public class BlockCacophonium extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
blockIcon = IconHelper.forBlock(reg, this, 0);
|
||||
top = IconHelper.forBlock(reg, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == 1 ? blockIcon : top;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -57,7 +46,7 @@ public class BlockCacophonium extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) {
|
||||
boolean power = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
boolean powered = (meta & 8) != 0;
|
||||
@@ -72,16 +61,16 @@ public class BlockCacophonium extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
public void onBlockHarvested(World par1World, BlockPos pos, IBlockState state, EntityPlayer par6EntityPlayer) {
|
||||
if(!par6EntityPlayer.capabilities.isCreativeMode)
|
||||
dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
|
||||
dropBlockAsItem(par1World, pos, state, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> stacks = new ArrayList();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile instanceof TileCacophonium) {
|
||||
stacks.add(new ItemStack(Blocks.noteblock));
|
||||
ItemStack thingy = ((TileCacophonium) tile).stack;
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -122,26 +123,22 @@ public abstract class BlockCamo extends BlockModContainer<TileCamo> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess par1World, int par2, int par3, int par4) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
public int colorMultiplier(IBlockAccess par1World, BlockPos pos, int pass) {
|
||||
TileEntity tile = par1World.getTileEntity(pos);
|
||||
if(tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if(block != null)
|
||||
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);
|
||||
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, pos, pass);
|
||||
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) {
|
||||
return getIcon(side, meta);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,12 +11,15 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -33,7 +36,7 @@ public class BlockCell extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,16 +11,18 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -43,17 +45,7 @@ public class BlockCocoon extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return Blocks.web.getBlockTextureFromSide(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,25 +60,25 @@ public class BlockCocoon extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
|
||||
TileCocoon cocoon = (TileCocoon) world.getTileEntity(x, y, z);
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
TileCocoon cocoon = (TileCocoon) world.getTileEntity(pos);
|
||||
ItemStack item = player.getCurrentEquippedItem();
|
||||
if(cocoon.emeraldsGiven < TileCocoon.MAX_EMERALDS && item != null && item.getItem() == Items.emerald) {
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
item.stackSize--;
|
||||
cocoon.emeraldsGiven++;
|
||||
world.playAuxSFX(2005, x, y, z, 6 + world.rand.nextInt(4));
|
||||
world.playAuxSFX(2005, pos, 6 + world.rand.nextInt(4));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -28,25 +29,28 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockEnderEye extends BlockModContainer implements ILexiconable {
|
||||
|
||||
IIcon iconOff, iconOn;
|
||||
|
||||
protected BlockEnderEye() {
|
||||
super(Material.iron);
|
||||
setHardness(3F);
|
||||
setResistance(10F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setUnlocalizedName(LibBlockNames.ENDER_EYE_BLOCK);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWER, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconOff = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
iconOn = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.POWER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return meta == 0 ? iconOff : iconOn;
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.POWER, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((Integer) state.getValue(BotaniaStateProps.POWER));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,8 +59,8 @@ public class BlockEnderEye extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
public int isProvidingWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||
return ((Integer) state.getValue(BotaniaStateProps.POWER));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,15 +11,18 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -36,19 +39,19 @@ public class BlockFakeAir extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
if(shouldRemove(world, x, y, z))
|
||||
world.scheduleBlockUpdate(x, y, z, this, tickRate(world));
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) {
|
||||
if(shouldRemove(world, pos))
|
||||
world.scheduleUpdate(pos, this, tickRate(world));
|
||||
}
|
||||
|
||||
private boolean shouldRemove(World world, int x, int y, int z) {
|
||||
return !world.isRemote && world.getTileEntity(x, y, z) == null || !(world.getTileEntity(x, y, z) instanceof TileFakeAir) || !((TileFakeAir) world.getTileEntity(x, y, z)).canStay();
|
||||
private boolean shouldRemove(World world, BlockPos pos) {
|
||||
return !world.isRemote && world.getTileEntity(pos) == null || !(world.getTileEntity(pos) instanceof TileFakeAir) || !((TileFakeAir) world.getTileEntity(pos)).canStay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
if(shouldRemove(world, x, y, z))
|
||||
world.setBlock(x, y, z, Blocks.water);
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
if(shouldRemove(world, pos))
|
||||
world.setBlockState(pos, Blocks.water.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,17 +75,17 @@ public class BlockFakeAir extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity e) {
|
||||
public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideCheck(int par1, boolean par2) {
|
||||
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,17 +95,17 @@ public class BlockFakeAir extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return new ArrayList(); // Empty List
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
public AxisAlignedBB getCollisionBoundingBox(World par1World, BlockPos pos, IBlockState state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z) {
|
||||
public boolean isAir(IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityBlaze;
|
||||
@@ -20,7 +21,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -38,52 +39,51 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final String TAG_FEL_SPAWNED = "Botania-FelSpawned";
|
||||
|
||||
IIcon top, face;
|
||||
|
||||
public BlockFelPumpkin() {
|
||||
super(Material.gourd);
|
||||
setBlockName(LibBlockNames.FEL_PUMPKIN);
|
||||
setHardness(1F);
|
||||
setStepSound(soundTypeWood);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return p_149691_1_ == 1 ? top : p_149691_1_ == 0 ? top : p_149691_2_ == 2 && p_149691_1_ == 2 ? face : p_149691_2_ == 3 && p_149691_1_ == 5 ? face : p_149691_2_ == 0 && p_149691_1_ == 3 ? face : p_149691_2_ == 1 && p_149691_1_ == 4 ? face : blockIcon;
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.CARDINALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
|
||||
super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_);
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((EnumFacing) state.getValue(BotaniaStateProps.CARDINALS)).getHorizontalIndex();
|
||||
}
|
||||
|
||||
if(!p_149726_1_.isRemote && p_149726_1_.getBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_) == Blocks.iron_bars && p_149726_1_.getBlock(p_149726_2_, p_149726_3_ - 2, p_149726_4_) == Blocks.iron_bars) {
|
||||
p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0), 0, 2);
|
||||
p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
|
||||
p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0), 0, 2);
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World p_149726_1_, BlockPos pos, IBlockState state) {
|
||||
super.onBlockAdded(p_149726_1_, pos, state);
|
||||
|
||||
if(!p_149726_1_.isRemote && p_149726_1_.getBlockState(pos.down()).getBlock() == Blocks.iron_bars && p_149726_1_.getBlockState(pos.down(2)).getBlock() == Blocks.iron_bars) {
|
||||
p_149726_1_.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
||||
p_149726_1_.setBlockState(pos.down(), Blocks.air.getDefaultState(), 2);
|
||||
p_149726_1_.setBlockState(pos.down(2), Blocks.air.getDefaultState(), 2);
|
||||
EntityBlaze blaze = new EntityBlaze(p_149726_1_);
|
||||
blaze.setLocationAndAngles(p_149726_2_ + 0.5D, p_149726_3_ - 1.95D, p_149726_4_ + 0.5D, 0.0F, 0.0F);
|
||||
blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
blaze.getEntityData().setBoolean(TAG_FEL_SPAWNED, true);
|
||||
p_149726_1_.spawnEntityInWorld(blaze);
|
||||
p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0));
|
||||
p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
|
||||
p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0));
|
||||
p_149726_1_.notifyNeighborsOfStateChange(pos, Blocks.air);
|
||||
p_149726_1_.notifyNeighborsOfStateChange(pos.down(), Blocks.air);
|
||||
p_149726_1_.notifyNeighborsOfStateChange(pos.down(2), Blocks.air);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
|
||||
int l = MathHelper.floor_double(p_149689_5_.rotationYaw * 4.0F / 360.0F + 2.5D) & 3;
|
||||
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, l, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_) {
|
||||
face = IconHelper.forBlock(p_149651_1_, this);
|
||||
top = Blocks.pumpkin.getIcon(0, 0);
|
||||
blockIcon = Blocks.pumpkin.getIcon(2, 0);
|
||||
public void onBlockPlacedBy(World p_149689_1_, BlockPos pos, IBlockState state, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
|
||||
p_149689_1_.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, p_149689_5_.getHorizontalFacing().getOpposite()));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -54,13 +55,13 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, Category.SHAPELESS, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
int currentLight = ((TileSpecialFlower) world.getTileEntity(x, y, z)).getLightValue();
|
||||
if(currentLight == -1)
|
||||
currentLight = originalLight;
|
||||
return LightHelper.getPackedColor(world.getBlockMetadata(x, y, z), currentLight);
|
||||
}
|
||||
// @Override todo 1.8 coloredlights dep
|
||||
// public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
// int currentLight = ((TileSpecialFlower) world.getTileEntity(x, y, z)).getLightValue();
|
||||
// if(currentLight == -1)
|
||||
// currentLight = originalLight;
|
||||
// return LightHelper.getPackedColor(world.getBlockMetadata(x, y, z), currentLight);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
@@ -68,18 +69,18 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getComparatorInputOverride(side);
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).getComparatorInputOverride();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getPowerLevel(side);
|
||||
public int isProvidingWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).getPowerLevel(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return isProvidingWeakPower(world, x, y, z, side);
|
||||
public int isProvidingStrongPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||
return isProvidingWeakPower(world, pos, state, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,7 +89,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@@ -102,9 +103,10 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
String name = ((TileSpecialFlower) world.getTileEntity(x, y, z)).subTileName;
|
||||
return ItemBlockSpecialFlower.ofType(new ItemStack(world.getBlock(x, y, z)), name);
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
String name = ((TileSpecialFlower) world.getTileEntity(pos)).subTileName;
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
return ItemBlockSpecialFlower.ofType(new ItemStack(state.getBlock(), state.getBlock().getMetaFromState(state), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,13 +154,13 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
((TileSpecialFlower) world.getTileEntity(x, y, z)).onBlockAdded(world, x, y, z);
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileSpecialFlower) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,6 +175,6 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getEntry();
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).getEntry();
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,10 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -27,8 +25,6 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockForestEye extends BlockModContainer implements ILexiconable {
|
||||
|
||||
IIcon[] icons;
|
||||
|
||||
public BlockForestEye() {
|
||||
super(Material.iron);
|
||||
setHardness(5.0F);
|
||||
@@ -39,19 +35,7 @@ public class BlockForestEye extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[6];
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(icons.length - 1, par1)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -66,8 +50,8 @@ public class BlockForestEye extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileForestEye eye = (TileForestEye) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TileForestEye eye = (TileForestEye) par1World.getTileEntity(pos);
|
||||
return Math.min(15, Math.max(0, eye.entities - 1));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSkull;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
@@ -27,33 +28,28 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class BlockGaiaHead extends BlockSkull {
|
||||
|
||||
public BlockGaiaHead() {
|
||||
setBlockName(LibBlockNames.GAIA_HEAD);
|
||||
setUnlocalizedName(LibBlockNames.GAIA_HEAD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
|
||||
public Item getItem(World p_149694_1_, BlockPos pos) {
|
||||
return ModItems.gaiaHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageValue(World p_149643_1_, int p_149643_2_, int p_149643_3_, int p_149643_4_) {
|
||||
public int getDamageValue(World p_149643_1_, BlockPos pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int p_149692_1_) {
|
||||
public int damageDropped(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
@@ -40,19 +40,13 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
super(true);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
setBlockName(LibBlockNames.GHOST_RAIL);
|
||||
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -60,8 +54,9 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
int x = MathHelper.floor_double(event.entity.posX);
|
||||
int y = MathHelper.floor_double(event.entity.posY);
|
||||
int z = MathHelper.floor_double(event.entity.posZ);
|
||||
Block block = event.entity.worldObj.getBlock(x, y, z);
|
||||
boolean air = block.isAir(event.entity.worldObj, x, y, z);
|
||||
BlockPos entPos = new BlockPos(event.entity);
|
||||
Block block = event.entity.worldObj.getBlockState(entPos).getBlock();
|
||||
boolean air = block.isAir(event.entity.worldObj, entPos);
|
||||
int floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS);
|
||||
|
||||
if(block == this)
|
||||
@@ -69,20 +64,20 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
else if(block instanceof BlockRailBase || block == ModBlocks.dreamwood) {
|
||||
event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, 0);
|
||||
if(floatTicks > 0)
|
||||
event.entity.worldObj.playAuxSFX(2003, x, y, z, 0);
|
||||
event.entity.worldObj.playAuxSFX(2003, entPos, 0);
|
||||
}
|
||||
floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS);
|
||||
|
||||
if(floatTicks > 0) {
|
||||
Block blockBelow = event.entity.worldObj.getBlock(x, y - 1, z);
|
||||
boolean airBelow = blockBelow.isAir(event.entity.worldObj, x, y - 1, z);
|
||||
Block blockBelow = event.entity.worldObj.getBlockState(entPos.down()).getBlock();
|
||||
boolean airBelow = blockBelow.isAir(event.entity.worldObj, entPos.down());
|
||||
if(air && airBelow || !air && !airBelow)
|
||||
event.entity.noClip = true;
|
||||
event.entity.motionY = 0.2;
|
||||
event.entity.motionX *= 1.4;
|
||||
event.entity.motionZ *= 1.4;
|
||||
event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, floatTicks - 1);
|
||||
event.entity.worldObj.playAuxSFX(2000, x, y, z, 0);
|
||||
event.entity.worldObj.playAuxSFX(2000, entPos, 0);
|
||||
} else event.entity.noClip = false;
|
||||
}
|
||||
|
||||
@@ -91,4 +86,8 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
return LexiconData.ghostRail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProperty getShapeProperty() {
|
||||
return null; // todo 1.8 ??
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,9 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,7 +25,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
@@ -61,8 +60,8 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xs, float ys, float zs) {
|
||||
TileHourglass hourglass = (TileHourglass) world.getTileEntity(x, y, z);
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float xs, float ys, float zs) {
|
||||
TileHourglass hourglass = (TileHourglass) world.getTileEntity(pos);
|
||||
ItemStack hgStack = hourglass.getStackInSlot(0);
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null && stack.getItem() == ModItems.twigWand)
|
||||
@@ -97,7 +96,7 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
public int isProvidingWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||
return world.getBlockMetadata(x, y, z) == 0 ? 0 : 15;
|
||||
}
|
||||
|
||||
@@ -107,13 +106,13 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 1 | 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(pos);
|
||||
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
@@ -131,7 +130,7 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
entityitem = new EntityItem(par1World, pos.getX() + f, pos.getY() + f1, pos.getZ() + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
@@ -143,20 +142,10 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
par1World.updateComparatorOutputLevel(pos, state.getBlock());
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return ModBlocks.manaGlass.getIcon(0, 0);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,7 +154,7 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -182,7 +171,7 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
@Override
|
||||
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
|
||||
if(!world.isRemote && !burst.isFake()) {
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(x, y, z);
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
|
||||
tile.move = !tile.move;
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(tile);
|
||||
}
|
||||
@@ -190,14 +179,14 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(x, y, z);
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
|
||||
tile.lock = !tile.lock;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(x, y, z);
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
|
||||
tile.renderHUD(res);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -19,12 +20,10 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.common.util.RotationHelper;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -35,19 +34,33 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockIncensePlate extends BlockModContainer implements ILexiconable {
|
||||
|
||||
private static final int[] META_ROTATIONS = new int[] { 2, 5, 3, 4 };
|
||||
|
||||
protected BlockIncensePlate() {
|
||||
super(Material.wood);
|
||||
setUnlocalizedName(LibBlockNames.INCENSE_PLATE);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockBounds(true);
|
||||
setBlockBounds(EnumFacing.Axis.Z);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
|
||||
TileIncensePlate plate = (TileIncensePlate) world.getTileEntity(x, y, z);
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.CARDINALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((EnumFacing) state.getValue(BotaniaStateProps.CARDINALS)).getHorizontalIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
TileIncensePlate plate = (TileIncensePlate) world.getTileEntity(pos);
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
ItemStack plateStack = plate.getStackInSlot(0);
|
||||
boolean did = false;
|
||||
@@ -81,9 +94,8 @@ public class BlockIncensePlate extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
|
||||
int l = MathHelper.floor_double(p_149689_5_.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, META_ROTATIONS[l], 2);
|
||||
public void onBlockPlacedBy(World p_149689_1_, BlockPos pos, IBlockState state, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
|
||||
p_149689_1_.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, p_149689_5_.getHorizontalFacing().getOpposite()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,48 +104,33 @@ public class BlockIncensePlate extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
return ((TileIncensePlate) world.getTileEntity(x, y, z)).comparatorOutput;
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return ((TileIncensePlate) world.getTileEntity(pos)).comparatorOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) {
|
||||
setBlockBounds(w.getBlockMetadata(x, y, z) < 4);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess w, BlockPos pos) {
|
||||
setBlockBounds(((EnumFacing) w.getBlockState(pos).getValue(BotaniaStateProps.CARDINALS)).getAxis());
|
||||
}
|
||||
|
||||
public void setBlockBounds(boolean horiz) {
|
||||
public void setBlockBounds(EnumFacing.Axis axis) {
|
||||
float f = 1F / 16F;
|
||||
float w = 12 * f;
|
||||
float l = 4 * f;
|
||||
float xs = (1F - w) / 2;
|
||||
float zs = (1F - l) / 2;
|
||||
if(horiz)
|
||||
if(axis == EnumFacing.Axis.Z)
|
||||
setBlockBounds(xs, 0F, zs, 1F - xs, f, 1f - zs);
|
||||
else setBlockBounds(zs, 0F, xs, 1F - zs, f, 1f - xs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
|
||||
return RotationHelper.rotateVanillaBlock(Blocks.furnace, worldObj, x, y, z, axis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return ModBlocks.livingwood.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -23,9 +24,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.block.tile.TileLightRelay;
|
||||
@@ -49,18 +50,18 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_) {
|
||||
public boolean isPassable(IBlockAccess p_149655_1_, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
boolean power = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) {
|
||||
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0|| world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
boolean powered = (meta & 8) != 0;
|
||||
|
||||
@@ -71,10 +72,10 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
|
||||
}
|
||||
|
||||
public void pickUpEntities(World world, int x, int y, int z) {
|
||||
public void pickUpEntities(World world, BlockPos pos) {
|
||||
List<TileLightRelay> relays = new ArrayList();
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
TileEntity tile = world.getTileEntity(x + dir.offsetX, y, z + dir.offsetZ);
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(dir));
|
||||
if(tile instanceof TileLightRelay) {
|
||||
TileLightRelay relay = (TileLightRelay) tile;
|
||||
if(relay.getBinding() != null)
|
||||
@@ -83,7 +84,7 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
if(!relays.isEmpty()) {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1);
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(pos, pos.add(1, 1, 1));
|
||||
List<Entity> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, aabb);
|
||||
entities.addAll(world.getEntitiesWithinAABB(EntityItem.class, aabb));
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -24,7 +24,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -66,7 +65,7 @@ public class BlockLightRelay extends BlockModContainer implements IWandable, ILe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
public int damageDropped(IBlockState state) {
|
||||
return meta == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -76,18 +75,18 @@ public class BlockLightRelay extends BlockModContainer implements IWandable, ILe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_) {
|
||||
public boolean isPassable(IBlockAccess p_149655_1_, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
|
||||
((TileLightRelay) world.getTileEntity(x, y, z)).mountEntity(player);
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
((TileLightRelay) world.getTileEntity(pos)).mountEntity(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
|
||||
public AxisAlignedBB getCollisionBoundingBox(World p_149668_1_, BlockPos pos, IBlockState state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -97,7 +96,7 @@ public class BlockLightRelay extends BlockModContainer implements IWandable, ILe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) & -9, 1 | 2);
|
||||
}
|
||||
|
||||
@@ -107,26 +106,13 @@ public class BlockLightRelay extends BlockModContainer implements IWandable, ILe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int s) {
|
||||
public int isProvidingWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing s) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return (meta & 8) != 0 ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
invIcon = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
worldIcon = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
invIconRed = IconHelper.forBlock(par1IconRegister, this, 2);
|
||||
worldIconRed = IconHelper.forBlock(par1IconRegister, this, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return meta > 0 ? invIconRed : invIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,11 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -34,7 +32,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
public class BlockLivingrock extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final int TYPES = 5;
|
||||
IIcon[] icons;
|
||||
|
||||
public BlockLivingrock() {
|
||||
super(Material.rock);
|
||||
@@ -67,19 +64,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[TYPES];
|
||||
for(int i = 0; i < TYPES; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(TYPES - 1, par2)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(this, 1, meta);
|
||||
}
|
||||
|
||||
@@ -14,13 +14,12 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -35,7 +34,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
public class BlockLivingwood extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final int TYPES = 6;
|
||||
IIcon[] icons;
|
||||
|
||||
public BlockLivingwood() {
|
||||
this(LibBlockNames.LIVING_WOOD);
|
||||
@@ -54,8 +52,8 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,25 +73,13 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[TYPES];
|
||||
for(int i = 0; i < TYPES; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(TYPES - 1, par2)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(this, 1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos) {
|
||||
return world.getBlockMetadata(x, y, z) == 5 ? 12 : 0;
|
||||
}
|
||||
|
||||
@@ -104,7 +90,7 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) {
|
||||
return world.getBlockMetadata(x, y, z) == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -39,10 +40,10 @@ public class BlockManaBomb extends BlockMod implements IManaTrigger, ILexiconabl
|
||||
@Override
|
||||
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
|
||||
if(!burst.isFake() && !world.isRemote) {
|
||||
world.playAuxSFX(2001, x, y, z, getIdFromBlock(this));
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.playAuxSFX(2001, pos, Block.getStateId(this.getDefaultState()));
|
||||
world.setBlockToAir(pos);
|
||||
EntityManaStorm storm = new EntityManaStorm(world);
|
||||
storm.setPosition(x + 0.5, y + 0.5, z + 0.5);
|
||||
storm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
world.spawnEntityInWorld(storm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import vazkii.botania.api.recipe.IElvenItem;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
@@ -33,10 +32,10 @@ public class BlockMod extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
if(shouldRegisterInNameSet())
|
||||
GameRegistry.registerBlock(this, this instanceof IElvenItem ? ItemBlockElven.class : ItemBlockMod.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
protected boolean shouldRegisterInNameSet() {
|
||||
@@ -49,12 +48,6 @@ public class BlockMod extends Block {
|
||||
return super.setLightLevel(p_149715_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
|
||||
boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ package vazkii.botania.common.block;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
@@ -50,12 +49,6 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
|
||||
return super.setLightLevel(p_149715_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
|
||||
public boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
@@ -63,19 +64,19 @@ public class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconab
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
if(!par1Str.equals("doublePlant"))
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
public Item getItemDropped(IBlockState state, Random p_149650_2_, int p_149650_3_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int p_149692_1_) {
|
||||
public int damageDropped(IBlockState p_149692_1_) {
|
||||
return p_149692_1_ & 7;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,16 +16,17 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -45,9 +46,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable {
|
||||
|
||||
public static IIcon[] icons;
|
||||
public static IIcon[] iconsAlt;
|
||||
|
||||
public int originalLight;
|
||||
|
||||
public static final String ALT_DIR = "alt";
|
||||
@@ -57,13 +55,34 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
}
|
||||
|
||||
protected BlockModFlower(String name) {
|
||||
super(0);
|
||||
setBlockName(name);
|
||||
super();
|
||||
setUnlocalizedName(name);
|
||||
setHardness(0F);
|
||||
setStepSound(soundTypeGrass);
|
||||
setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F);
|
||||
setTickRandomly(false);
|
||||
setCreativeTab(registerInCreative() ? BotaniaCreativeTab.INSTANCE : null);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.RED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.COLOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getBlockType() {
|
||||
return EnumFlowerColor.RED;
|
||||
}
|
||||
|
||||
public boolean registerInCreative() {
|
||||
@@ -77,21 +96,9 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[17];
|
||||
iconsAlt = new IIcon[17];
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
iconsAlt[i] = IconHelper.forBlock(par1IconRegister, this, i, ALT_DIR);
|
||||
}
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,28 +107,25 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
return super.setLightLevel(p_149715_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return (ConfigHandler.altFlowerTextures ? iconsAlt : icons)[Math.min(icons.length - 1, par2)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idSpecialFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
float[] color = EntitySheep.fleeceColorTable[meta];
|
||||
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
|
||||
int hex = ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
if(par5Random.nextDouble() < ConfigHandler.flowerParticleFrequency)
|
||||
Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.5 + par5Random.nextFloat() * 0.5, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5);
|
||||
Botania.proxy.sparkleFX(par1World, pos.getX() + 0.3 + par5Random.nextFloat() * 0.5, pos.getY() + 0.5 + par5Random.nextFloat() * 0.5, pos.getZ() + 0.3 + par5Random.nextFloat() * 0.5, r, g, b, par5Random.nextFloat(), 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,17 +139,17 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149851_a(World world, int x, int y, int z, boolean fuckifiknow) {
|
||||
return world.isAirBlock(x, y + 1, z);
|
||||
public boolean canGrow(World world, BlockPos pos, IBlockState state, boolean fuckifiknow) {
|
||||
return world.isAirBlock(pos.up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149852_a(World world, Random rand, int x, int y, int z) {
|
||||
return func_149851_a(world, x, y, z, false);
|
||||
public boolean canUseBonemeal(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
return canGrow(world, pos, state, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149853_b(World world, Random rand, int x, int y, int z) {
|
||||
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
placeDoubleFlower(world, x, y, z, meta, 1 | 2);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.block;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -24,7 +25,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -32,7 +32,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -50,13 +49,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockOpenCrate extends BlockModContainer implements ILexiconable, IWandable, IWandHUD {
|
||||
|
||||
IIcon iconSide;
|
||||
IIcon iconBottom;
|
||||
IIcon iconSideCraft;
|
||||
IIcon iconBottomCraft;
|
||||
|
||||
IIcon[] sidePatternIcons;
|
||||
|
||||
Random random;
|
||||
|
||||
private static final int SUBTYPES = 2;
|
||||
@@ -88,8 +80,8 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,14 +91,14 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileOpenCrate crate = (TileOpenCrate) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TileOpenCrate crate = (TileOpenCrate) par1World.getTileEntity(pos);
|
||||
return crate.getSignal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(pos);
|
||||
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
@@ -124,7 +116,7 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
entityitem = new EntityItem(par1World, pos.getX() + f, pos.getY() + f1, pos.getZ() + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
@@ -136,10 +128,10 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
par1World.updateComparatorOutputLevel(pos, state.getBlock());
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,19 +146,7 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
sidePatternIcons[i] = IconHelper.forName(par1IconRegister, "ocPattern" + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return meta == 0 ? side == 0 ? iconBottom : iconSide : side == 0 ? iconBottomCraft : iconSideCraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile != null && tile instanceof TileCraftCrate && ((TileCraftCrate) tile).pattern != -1 && side != 0)
|
||||
return sidePatternIcons[((TileCraftCrate) tile).pattern];
|
||||
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
@@ -180,13 +160,13 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
TileOpenCrate crate = (TileOpenCrate) world.getTileEntity(x, y, z);
|
||||
TileOpenCrate crate = (TileOpenCrate) world.getTileEntity(pos);
|
||||
return crate.onWanded(player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileCraftCrate) {
|
||||
TileCraftCrate craft = (TileCraftCrate) tile;
|
||||
|
||||
@@ -213,7 +193,7 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
ItemStack item = craft.getStackInSlot(index);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, item, xp, yp);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(item, xp, yp);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonExtension;
|
||||
import net.minecraft.block.BlockPistonMoving;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -33,7 +36,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -57,7 +59,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
|
||||
public BlockPistonRelay() {
|
||||
super(Material.gourd);
|
||||
setBlockName(LibBlockNames.PISTON_RELAY);
|
||||
setUnlocalizedName(LibBlockNames.PISTON_RELAY);
|
||||
setHardness(2F);
|
||||
setResistance(10F);
|
||||
setStepSound(soundTypeMetal);
|
||||
@@ -67,7 +69,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(int meta, int fortune, Random random) {
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -77,16 +79,16 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
mapCoords(par1World.provider.dimensionId, par2, par3, par4, 2);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
mapCoords(par1World.provider.getDimensionId(), pos, 2);
|
||||
}
|
||||
|
||||
public static String getCoordsAsString(int world, BlockPos pos) {
|
||||
return world + ":" + pos.getX() + ":" + pos.getY() + ":" + pos.getZ();
|
||||
}
|
||||
|
||||
static void mapCoords(int world, int x, int y, int z, int time) {
|
||||
String coords = getCoordsAsString(world, x, y, z);
|
||||
static void mapCoords(int world, BlockPos pos, int time) {
|
||||
String coords = getCoordsAsString(world, pos);
|
||||
coordsToCheck.put(coords, time);
|
||||
}
|
||||
|
||||
@@ -110,18 +112,18 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
String[] tokens = key.split(":");
|
||||
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
|
||||
World world = server.worldServerForDimension(worldId);
|
||||
return world.getBlock(x, y, z);
|
||||
return world.getBlockState(new BlockPos(x, y, z)).getBlock();
|
||||
}
|
||||
|
||||
static int getBlockMetaAt(String key) {
|
||||
static IBlockState getStateAt(String key) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
if(server == null)
|
||||
return 0;
|
||||
return null;
|
||||
|
||||
String[] tokens = key.split(":");
|
||||
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
|
||||
World world = server.worldServerForDimension(worldId);
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
return world.getBlockState(new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,13 +132,13 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
return false;
|
||||
|
||||
if(!player.isSneaking()) {
|
||||
playerPositions.put(player.getCommandSenderName(), getCoordsAsString(world.provider.dimensionId, x, y, z));
|
||||
world.playSoundEffect(x, y, z, "botania:ding", 0.5F, 1F);
|
||||
playerPositions.put(player.getCommandSenderName(), getCoordsAsString(world.provider.getDimensionId(), pos));
|
||||
world.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:ding", 0.5F, 1F);
|
||||
} else {
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(this));
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
if(!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y , z, Block.getIdFromBlock(this));
|
||||
world.playAuxSFX(2001, pos, Block.getIdFromBlock(this));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -164,11 +166,11 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
mappedPositions.clear();
|
||||
|
||||
Collection<String> tags = nbttagcompound.func_150296_c();
|
||||
Collection<String> tags = nbttagcompound.getKeySet();
|
||||
for(String key : tags) {
|
||||
NBTBase tag = nbttagcompound.getTag(key);
|
||||
if(tag instanceof NBTTagString) {
|
||||
String value = ((NBTTagString) tag).func_150285_a_();
|
||||
String value = ((NBTTagString) tag).getString();
|
||||
|
||||
mappedPositions.put(key, value);
|
||||
}
|
||||
@@ -182,15 +184,15 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
}
|
||||
|
||||
public static WorldData get(World world) {
|
||||
if(world.mapStorage == null)
|
||||
if(world.getMapStorage() == null)
|
||||
return null;
|
||||
|
||||
WorldData data = (WorldData) world.mapStorage.loadData(WorldData.class, ID);
|
||||
WorldData data = (WorldData) world.getMapStorage().loadData(WorldData.class, ID);
|
||||
|
||||
if (data == null) {
|
||||
data = new WorldData(ID);
|
||||
data.markDirty();
|
||||
world.mapStorage.setData(ID, data);
|
||||
world.getMapStorage().setData(ID, data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -207,9 +209,9 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
|
||||
Block block = getBlockAt(s);
|
||||
if(block == Blocks.piston_extension) {
|
||||
int meta = getBlockMetaAt(s);
|
||||
boolean sticky = (meta & 8) == 8;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8);
|
||||
IBlockState state = getStateAt(s);
|
||||
boolean sticky = BlockPistonExtension.EnumPistonType.STICKY == state.getValue(BlockPistonMoving.TYPE);
|
||||
EnumFacing dir = ((EnumFacing) state.getValue(BlockPistonMoving.FACING)).getOpposite();
|
||||
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
|
||||
@@ -219,34 +221,35 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
|
||||
{
|
||||
String[] tokens = s.split(":");
|
||||
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
World world = server.worldServerForDimension(worldId);
|
||||
if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay);
|
||||
if(world.isAirBlock(pos.offset(dir)))
|
||||
world.setBlockState(pos.offset(dir), ModBlocks.pistonRelay.getDefaultState());
|
||||
else if(!world.isRemote) {
|
||||
ItemStack stack = new ItemStack(ModBlocks.pistonRelay);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, stack));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + dir.getFrontOffsetX(), y + dir.getFrontOffsetY(), z + dir.getFrontOffsetZ(), stack));
|
||||
}
|
||||
checkedCoords.add(s);
|
||||
newPos = getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
newPos = getCoordsAsString(world.provider.getDimensionId(), pos.offset(dir));
|
||||
}
|
||||
|
||||
if(mappedPositions.containsKey(s)) {
|
||||
String pos = mappedPositions.get(s);
|
||||
String[] tokens = pos.split(":");
|
||||
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
|
||||
BlockPos pos2 = new BlockPos(x, y, z);
|
||||
World world = server.worldServerForDimension(worldId);
|
||||
|
||||
Block srcBlock = world.getBlock(x, y, z);
|
||||
int srcMeta = world.getBlockMetadata(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
Material mat = srcBlock.getMaterial();
|
||||
IBlockState srcState = world.getBlockState(pos2);
|
||||
TileEntity tile = world.getTileEntity(pos2);
|
||||
Material mat = srcState.getBlock().getMaterial();
|
||||
|
||||
if(!sticky && tile == null && mat.getMaterialMobility() == 0 && srcBlock.getBlockHardness(world, x, y, z) != -1 && !srcBlock.isAir(world, x, y, z)) {
|
||||
Material destMat = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial();
|
||||
if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) || destMat.isReplaceable()) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, srcBlock, srcMeta, 1 | 2);
|
||||
mappedPositions.put(s, getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ));
|
||||
if(!sticky && tile == null && mat.getMaterialMobility() == 0 && srcState.getBlock().getBlockHardness(world, pos2) != -1 && !srcState.getBlock().isAir(world, pos2)) {
|
||||
Material destMat = world.getBlockState(pos2.offset(dir)).getBlock().getMaterial();
|
||||
if(world.isAirBlock(pos2.offset(dir)) || destMat.isReplaceable()) {
|
||||
world.setBlockState(pos2, Blocks.air.getDefaultState());
|
||||
world.setBlockState(pos2.offset(dir), srcState, 1 | 2);
|
||||
mappedPositions.put(s, getCoordsAsString(world.provider.getDimensionId(), pos2.offset(dir)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -24,7 +23,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -39,7 +37,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable {
|
||||
|
||||
IIcon[] icons;
|
||||
private static final int SUBTYPES = 3;
|
||||
|
||||
public BlockPlatform() {
|
||||
@@ -73,26 +70,14 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[SUBTYPES];
|
||||
for(int i = 0; i < SUBTYPES; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(SUBTYPES - 1, par2)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
public void addCollisionBoxesToList(World par1World, BlockPos pos, IBlockState state, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
if(meta == 2 || meta == 0 && par7Entity != null && par7Entity.posY > par3 + (par7Entity instanceof EntityPlayer ? 2 : 0) && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World par1World, int par2, int par3, int par4) {
|
||||
public float getBlockHardness(World par1World, BlockPos pos) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
return meta == 2 ? -1F : super.getBlockHardness(par1World, par2, par3, par4);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -23,7 +22,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.crafting.IInfusionStabiliser;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -60,11 +58,6 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
@@ -76,11 +69,6 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
par3.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par2 == 0 ? Blocks.diamond_block.getIcon(0, 0) : ModBlocks.storage.getIcon(0, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BlockRoot extends BlockMod implements ILexiconable {
|
||||
super(Material.plants);
|
||||
setHardness(1.2F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.ROOT);
|
||||
setUnlocalizedName(LibBlockNames.ROOT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -23,7 +22,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -37,7 +35,6 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockSparkChanger extends BlockModContainer implements ILexiconable {
|
||||
|
||||
IIcon[] icons;
|
||||
Random random;
|
||||
|
||||
public BlockSparkChanger() {
|
||||
@@ -67,25 +64,13 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[3];
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(2, par1)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
boolean power = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) {
|
||||
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0 || world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
boolean powered = (meta & 8) != 0;
|
||||
|
||||
if(power && !powered) {
|
||||
((TileSparkChanger) world.getTileEntity(x, y, z)).doSwap();
|
||||
((TileSparkChanger) world.getTileEntity(pos)).doSwap();
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta | 8, 4);
|
||||
} else if(!power && powered)
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
@@ -34,7 +33,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -183,23 +181,6 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
return EnumFlowerColor.RED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for(String s : BotaniaAPI.getAllSubTiles())
|
||||
if(!s.isEmpty())
|
||||
BotaniaAPI.getSignatureForName(s).registerIcons(par1IconRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return ((TileSpecialFlower) par1iBlockAccess.getTileEntity(par2, par3, par4)).getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return BlockModFlower.icons[16];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
String name = ((TileSpecialFlower) world.getTileEntity(pos)).subTileName;
|
||||
@@ -257,12 +238,12 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, x, y, z);
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -281,7 +262,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
world.setBlockState(pos, state.withProperty(BotaniaStateProps.COLOR, newColor), 1 | 2);
|
||||
}
|
||||
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,13 +15,11 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -38,14 +36,12 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final int SUBTYPES = 5;
|
||||
|
||||
IIcon[] icons;
|
||||
|
||||
public BlockStorage() {
|
||||
super(Material.iron);
|
||||
setHardness(3F);
|
||||
setResistance(10F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockName(LibBlockNames.STORAGE);
|
||||
setUnlocalizedName(LibBlockNames.STORAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,9 +51,9 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockStorage.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,19 +66,6 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[SUBTYPES];
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(icons.length - 1, par2)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beaconPos) {
|
||||
return true;
|
||||
|
||||
@@ -2,6 +2,7 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
@@ -21,9 +22,12 @@ public class BotaniaStateProps {
|
||||
// All 6 directions
|
||||
public static final PropertyEnum FACING = PropertyEnum.create("facing", EnumFacing.class);
|
||||
|
||||
// Redstone power
|
||||
// Redstone power - boolean
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
// Redstone power - int
|
||||
public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15);
|
||||
|
||||
/** Properties for individual blocks **/
|
||||
|
||||
// BlockAltGrass
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
@@ -25,6 +26,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -65,11 +67,11 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
setBlockBounds(f, f, f, 1F - f, 1F - f, 1F - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "easycoloredlights")
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return ColoredLightHelper.getPackedColor(world.getBlockMetadata(x, y, z), originalLight);
|
||||
}
|
||||
// @Override todo 1.8 coloredlights dep
|
||||
// @Optional.Method(modid = "easycoloredlights")
|
||||
// public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
// return ColoredLightHelper.getPackedColor(world.getBlockMetadata(x, y, z), originalLight);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected boolean shouldRegisterInNameSet() {
|
||||
@@ -87,7 +89,7 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
float[] color = EntitySheep.fleeceColorTable[meta];
|
||||
|
||||
@@ -95,11 +97,6 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.5 + par5Random.nextFloat() * 0.5, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2, List par3) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
@@ -107,8 +104,8 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,20 +114,15 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return Blocks.dirt.getIcon(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null) {
|
||||
IFloatingFlower flower = (IFloatingFlower) world.getTileEntity(x, y, z);
|
||||
IFloatingFlower flower = (IFloatingFlower) world.getTileEntity(pos);
|
||||
IslandType type = null;
|
||||
if(stack.getItem() == Items.snowball)
|
||||
type = IslandType.SNOW;
|
||||
@@ -143,7 +135,7 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
if(type != null && type != flower.getIslandType()) {
|
||||
if(!world.isRemote) {
|
||||
flower.setIslandType(type);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, , x);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
}
|
||||
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
@@ -170,7 +162,7 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStabaliseInfusion(World world, int x, int y, int z) {
|
||||
public boolean canStabaliseInfusion(World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class TileCacophonium extends TileMod {
|
||||
public ItemStack stack;
|
||||
|
||||
public void annoyDirewolf() {
|
||||
ItemCacophonium.playSound(worldObj, stack, xCoord, yCoord, zCoord, 1F);
|
||||
ItemCacophonium.playSound(worldObj, stack, pos.getX(), pos.getY(), pos.getZ(), 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -152,26 +154,26 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
|
||||
return subTile == null ? false : subTile.onWanded(player, wand);
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
if (subTile != null)
|
||||
subTile.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
subTile.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return subTile == null ? false : subTile.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return subTile == null ? false : subTile.onBlockActivated(world, pos, state, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
if (subTile != null)
|
||||
subTile.onBlockAdded(world, x, y, z);
|
||||
subTile.onBlockAdded(world, pos, state);
|
||||
}
|
||||
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int side, EntityPlayer player) {
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
if (subTile != null)
|
||||
subTile.onBlockHarvested(world, x, y, z, side, player);
|
||||
subTile.onBlockHarvested(world, pos, state, player);
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getDrops(ArrayList<ItemStack> list) {
|
||||
public List<ItemStack> getDrops(List<ItemStack> list) {
|
||||
if (subTile != null)
|
||||
subTile.getDrops(list);
|
||||
|
||||
@@ -194,14 +196,14 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
|
||||
public boolean canSelect(EntityPlayer player, ItemStack wand, BlockPos pos, EnumFacing side) {
|
||||
if(subTile == null)
|
||||
return false;
|
||||
return subTile.canSelect(player, wand, , x, , y);
|
||||
return subTile.canSelect(player, wand, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bindTo(EntityPlayer player, ItemStack wand, BlockPos pos, EnumFacing side) {
|
||||
if(subTile == null)
|
||||
return false;
|
||||
return subTile.bindTo(player, wand, , x, , y);
|
||||
return subTile.bindTo(player, wand, pos, side);
|
||||
}
|
||||
|
||||
public int getLightValue() {
|
||||
@@ -210,10 +212,10 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
|
||||
return subTile.getLightValue();
|
||||
}
|
||||
|
||||
public int getComparatorInputOverride(int side) {
|
||||
public int getComparatorInputOverride() {
|
||||
if(subTile == null)
|
||||
return 0;
|
||||
return subTile.getComparatorInputOverride(side);
|
||||
return subTile.getComparatorInputOverride();
|
||||
}
|
||||
|
||||
public int getPowerLevel(int side) {
|
||||
|
||||
Reference in new issue
Block a user