mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 11:49:37 +00:00
block. corporea, dispenser, mana, string. some of the base pkg too
This commit is contained in:
1 parent
3f9d5c888f
commit
921370b546
61 files changed
+501
-426
No files matched your search
@@ -38,7 +38,7 @@ public class BlockAlfPortal extends BlockModContainer implements IWandable, ILex
|
||||
super(Material.wood);
|
||||
setHardness(10F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.ALF_PORTAL);
|
||||
setUnlocalizedName(LibBlockNames.ALF_PORTAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,7 +65,7 @@ public class BlockAlfPortal extends BlockModContainer implements IWandable, ILex
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
boolean did = ((TileAlfPortal) world.getTileEntity(x, y, z)).onWanded();
|
||||
boolean did = ((TileAlfPortal) world.getTileEntity(pos)).onWanded();
|
||||
if(did && player != null)
|
||||
player.addStat(ModAchievements.elfPortalOpen, 1);
|
||||
return did;
|
||||
|
||||
@@ -11,39 +11,54 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockAltGrass extends BlockMod {
|
||||
|
||||
private static final int SUBTYPES = 6;
|
||||
IIcon[] icons;
|
||||
|
||||
public BlockAltGrass() {
|
||||
super(Material.grass);
|
||||
setHardness(0.6F);
|
||||
setStepSound(soundTypeGrass);
|
||||
setBlockName(LibBlockNames.ALT_GRASS);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassType.DRY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.ALTGRASS_VARIANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((AltGrassType) state.getValue(BotaniaStateProps.ALTGRASS_VARIANT)).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassType.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,75 +79,75 @@ public class BlockAltGrass extends BlockMod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[SUBTYPES * 2];
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == 0 || meta >= SUBTYPES ? Blocks.dirt.getIcon(side, meta) : side == 1 ? icons[meta * 2] : icons[meta * 2 + 1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
if(!world.isRemote && world.getBlockLightValue(x, y + 1, z) >= 9) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
if(!world.isRemote && world.getLight(pos.up()) >= 9) {
|
||||
AltGrassType variant = ((AltGrassType) state.getValue(BotaniaStateProps.ALTGRASS_VARIANT));
|
||||
for(int l = 0; l < 4; ++l) {
|
||||
int i1 = x + rand.nextInt(3) - 1;
|
||||
int j1 = y + rand.nextInt(5) - 3;
|
||||
int k1 = z + rand.nextInt(3) - 1;
|
||||
BlockPos pos1 = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);
|
||||
|
||||
Block block = world.getBlock(i1, j1 + 1, k1);
|
||||
Block block = world.getBlockState(pos1.up()).getBlock();
|
||||
|
||||
if(world.getBlock(i1, j1, k1) == Blocks.dirt && world.getBlockMetadata(i1, j1, k1) == 0 && world.getBlockLightValue(i1, j1 + 1, k1) >= 4 && world.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
world.setBlock(i1, j1, k1, this, meta, 1 | 2);
|
||||
if(world.getBlockState(pos1).getBlock() == Blocks.dirt && world.getBlockState(pos).getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && world.getLight(pos1.up()) >= 4 && world.getBlockLightOpacity(pos.up()) <= 2)
|
||||
world.setBlockState(pos, this.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, variant), 1 | 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Blocks.dirt.getItemDropped(0, p_149650_2_, p_149650_3_);
|
||||
public Item getItemDropped(IBlockState state, Random p_149650_2_, int p_149650_3_) {
|
||||
return Blocks.dirt.getItemDropped(state, p_149650_2_, p_149650_3_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
||||
return plantable.getPlantType(world, x, y - 1, z) == EnumPlantType.Plains;
|
||||
public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
|
||||
return plantable.getPlantType(world, pos.down()) == EnumPlantType.Plains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random r) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch(meta) {
|
||||
case 0: // Dry
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random r) {
|
||||
AltGrassType variant = ((AltGrassType) state.getValue(BotaniaStateProps.ALTGRASS_VARIANT));
|
||||
switch(variant) {
|
||||
case DRY: // Dry
|
||||
break;
|
||||
case 1: // Golden
|
||||
case GOLDEN: // Golden
|
||||
break;
|
||||
case 2: // Vivid
|
||||
case VIVID: // Vivid
|
||||
break;
|
||||
case 3: // Scorched
|
||||
case SCORCHED: // Scorched
|
||||
if(r.nextInt(80) == 0)
|
||||
world.spawnParticle("flame", x + r.nextFloat(), y + 1.1, z + r.nextFloat(), 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + r.nextFloat(), pos.getY() + 1.1, pos.getZ() + r.nextFloat(), 0, 0, 0);
|
||||
break;
|
||||
case 4: // Infused
|
||||
case INFUSED: // Infused
|
||||
if(r.nextInt(100) == 0)
|
||||
Botania.proxy.sparkleFX(world, x + r.nextFloat(), y + 1.05, z + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
break;
|
||||
case 5: // Mutated
|
||||
case MUTATED: // Mutated
|
||||
if(r.nextInt(100) == 0) {
|
||||
if(r.nextInt(100) > 25)
|
||||
Botania.proxy.sparkleFX(world, x + r.nextFloat(), y + 1.05, z + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
else Botania.proxy.sparkleFX(world, x + r.nextFloat(), y + 1.05, z + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
else Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public enum AltGrassType implements IStringSerializable {
|
||||
DRY,
|
||||
GOLDEN,
|
||||
VIVID,
|
||||
SCORCHED,
|
||||
INFUSED,
|
||||
MUTATED;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.Entity;
|
||||
@@ -27,6 +28,7 @@ import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
@@ -56,7 +58,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
super(Material.rock);
|
||||
setHardness(3.5F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.ALTAR);
|
||||
setUnlocalizedName(LibBlockNames.ALTAR);
|
||||
|
||||
float f = 1F / 16F * 2F;
|
||||
setBlockBounds(f, f, f, 1F - f, 1F / 16F * 20F, 1F - f);
|
||||
@@ -75,9 +77,9 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,23 +89,23 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, Entity par5Entity) {
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);
|
||||
TileAltar tile = (TileAltar) par1World.getTileEntity(pos);
|
||||
tile.collideEntityItem((EntityItem) par5Entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
TileAltar tile = (TileAltar) world.getTileEntity(x, y, z);
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos) {
|
||||
TileAltar tile = (TileAltar) world.getTileEntity(pos);
|
||||
return tile.hasLava ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);
|
||||
TileAltar tile = (TileAltar) par1World.getTileEntity(pos);
|
||||
|
||||
if(par5EntityPlayer.isSneaking()) {
|
||||
for(int i = tile.getSizeInventory() - 1; i >= 0; i--) {
|
||||
@@ -113,7 +115,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
if(!par5EntityPlayer.inventory.addItemStackToInventory(copy))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(copy, false);
|
||||
tile.setInventorySlotContents(i, null);
|
||||
par1World.func_147453_f(par2, par3, par4, this);
|
||||
par1World.updateComparatorOutputLevel(pos, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +130,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, getContainer(stack));
|
||||
|
||||
tile.setWater(true);
|
||||
par1World.func_147453_f(par2, par3, par4, this);
|
||||
par1World.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -138,7 +140,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
|
||||
tile.setLava(true);
|
||||
tile.setWater(false);
|
||||
par1World.func_147453_f(par2, par3, par4, this);
|
||||
par1World.updateComparatorOutputLevel(pos, this);
|
||||
|
||||
return true;
|
||||
} else if(stack != null && stack.getItem() == Items.bucket && (tile.hasWater || tile.hasLava) && !Botania.gardenOfGlassLoaded) {
|
||||
@@ -154,7 +156,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
if(tile.hasLava)
|
||||
tile.setLava(false);
|
||||
else tile.setWater(false);
|
||||
par1World.func_147453_f(par2, par3, par4, this);
|
||||
par1World.updateComparatorOutputLevel(pos, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -164,8 +166,8 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
private boolean isValidWaterContainer(ItemStack stack) {
|
||||
@@ -206,7 +208,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -221,8 +223,8 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -240,7 +242,7 @@ public class BlockAltar 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;
|
||||
@@ -252,10 +254,10 @@ public class BlockAltar 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
|
||||
@@ -264,8 +266,8 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileAltar altar = (TileAltar) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TileAltar altar = (TileAltar) par1World.getTileEntity(pos);
|
||||
return altar.hasWater ? 15 : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.AVATAR);
|
||||
setUnlocalizedName(LibBlockNames.AVATAR);
|
||||
setBlockBounds(true);
|
||||
|
||||
random = new Random();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BlockBifrost extends BlockModContainer implements ILexiconable {
|
||||
|
||||
public BlockBifrost() {
|
||||
super(Material.glass);
|
||||
setBlockName(LibBlockNames.BIFROST);
|
||||
setUnlocalizedName(LibBlockNames.BIFROST);
|
||||
setLightOpacity(0);
|
||||
setLightLevel(1F);
|
||||
setBlockUnbreakable();
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BlockCacophonium extends BlockModContainer {
|
||||
|
||||
protected BlockCacophonium() {
|
||||
super(Material.wood);
|
||||
setBlockName(LibBlockNames.CACOPHONIUM);
|
||||
setUnlocalizedName(LibBlockNames.CACOPHONIUM);
|
||||
setHardness(0.8F);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class BlockCell extends BlockModContainer implements ILexiconable {
|
||||
|
||||
public BlockCell() {
|
||||
super(Material.gourd);
|
||||
setBlockName(LibBlockNames.CELL_BLOCK);
|
||||
setUnlocalizedName(LibBlockNames.CELL_BLOCK);
|
||||
setStepSound(soundTypeCloth);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BlockCocoon extends BlockModContainer implements ILexiconable {
|
||||
setHardness(3.0F);
|
||||
setResistance(50.0F);
|
||||
setStepSound(soundTypeCloth);
|
||||
setBlockName(LibBlockNames.COCOON);
|
||||
setUnlocalizedName(LibBlockNames.COCOON);
|
||||
float f = 3F / 16F;
|
||||
float f1 = 14F / 16F;
|
||||
setBlockBounds(f, 0F, f, 1F - f, f1, 1F - f);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockEnderEye extends BlockModContainer implements ILexiconable {
|
||||
setHardness(3F);
|
||||
setResistance(10F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockName(LibBlockNames.ENDER_EYE_BLOCK);
|
||||
setUnlocalizedName(LibBlockNames.ENDER_EYE_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BlockFakeAir extends BlockModContainer {
|
||||
|
||||
public BlockFakeAir() {
|
||||
super(Material.air);
|
||||
setBlockName(LibBlockNames.FAKE_AIR);
|
||||
setUnlocalizedName(LibBlockNames.FAKE_AIR);
|
||||
setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockForestEye extends BlockModContainer implements ILexiconable {
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F);
|
||||
setBlockName(LibBlockNames.FOREST_EYE);
|
||||
setUnlocalizedName(LibBlockNames.FOREST_EYE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
|
||||
|
||||
protected BlockHourglass() {
|
||||
super(Material.iron);
|
||||
setBlockName(LibBlockNames.HOURGLASS);
|
||||
setUnlocalizedName(LibBlockNames.HOURGLASS);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeMetal);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BlockIncensePlate extends BlockModContainer implements ILexiconable
|
||||
|
||||
protected BlockIncensePlate() {
|
||||
super(Material.wood);
|
||||
setBlockName(LibBlockNames.INCENSE_PLATE);
|
||||
setUnlocalizedName(LibBlockNames.INCENSE_PLATE);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockBounds(true);
|
||||
|
||||
@@ -46,13 +46,13 @@ public class BlockLightRelay extends BlockModContainer implements IWandable, ILe
|
||||
super(Material.glass);
|
||||
float f = 5F / 16F;
|
||||
setBlockBounds(f, f, f, 1F - f, 1F - f, 1F - f);
|
||||
setBlockName(LibBlockNames.LIGHT_RELAY);
|
||||
setUnlocalizedName(LibBlockNames.LIGHT_RELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
register(par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
void register(String name) {
|
||||
|
||||
@@ -34,10 +34,10 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
if(shouldRegisterInNameSet())
|
||||
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
protected boolean shouldRegisterInNameSet() {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.OPEN_CRATE);
|
||||
setUnlocalizedName(LibBlockNames.OPEN_CRATE);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
@@ -76,9 +76,9 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -46,7 +47,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
setBlockName(LibBlockNames.PLATFORM);
|
||||
setUnlocalizedName(LibBlockNames.PLATFORM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,14 +56,14 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +110,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
TilePlatform tile = (TilePlatform) world.getTileEntity(x, y, z);
|
||||
TilePlatform tile = (TilePlatform) world.getTileEntity(pos);
|
||||
return tile.onWanded(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -42,7 +43,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
super(Material.iron);
|
||||
setHardness(5.5F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockName(LibBlockNames.PYLON);
|
||||
setUnlocalizedName(LibBlockNames.PYLON);
|
||||
setLightLevel(0.5F);
|
||||
|
||||
float f = 1F / 16F * 2F;
|
||||
@@ -54,9 +55,9 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,8 +66,8 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +87,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnchantPowerBonus(World world, int x, int y, int z) {
|
||||
public float getEnchantPowerBonus(World world, BlockPos pos) {
|
||||
return world.getBlockMetadata(x, y, z) == 0 ? 8 : 15;
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
|
||||
return meta == 0 ? LexiconData.pylon : meta == 1 ? LexiconData.alfhomancyIntro : LexiconData.gaiaRitual;
|
||||
}
|
||||
@Override
|
||||
public boolean canStabaliseInfusion(World world, int x, int y, int z) {
|
||||
public boolean canStabaliseInfusion(World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.block;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -35,12 +36,12 @@ public class BlockRoot extends BlockMod implements ILexiconable {
|
||||
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
public Item getItemDropped(IBlockState p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return ModItems.manaResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int p_149692_1_) {
|
||||
public int damageDropped(IBlockState p_149692_1_) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -32,37 +33,36 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
public class BlockSolidVines extends BlockVine implements ILexiconable {
|
||||
|
||||
public BlockSolidVines() {
|
||||
setBlockName(LibBlockNames.SOLID_VINE);
|
||||
setUnlocalizedName(LibBlockNames.SOLID_VINE);
|
||||
setHardness(0.5F);
|
||||
setStepSound(soundTypeGrass);
|
||||
setBlockTextureName("vine");
|
||||
setCreativeTab(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World w, int x, int y, int z) {
|
||||
setBlockBoundsBasedOnState(w, x, y, z);
|
||||
return new AxisAlignedBB(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ);
|
||||
public AxisAlignedBB getCollisionBoundingBox(World w, BlockPos pos, IBlockState state) {
|
||||
setBlockBoundsBasedOnState(w, pos);
|
||||
return new AxisAlignedBB(pos.add(minX, minY, minZ), pos.add(maxX, maxY, maxZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
|
||||
public void updateTick(World p_149674_1_, BlockPos pos, IBlockState state, Random p_149674_5_) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@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
|
||||
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) {
|
||||
public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@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(Blocks.vine);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,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.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -21,6 +22,7 @@ import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
@@ -44,13 +46,13 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.SPARK_CHANGER);
|
||||
setUnlocalizedName(LibBlockNames.SPARK_CHANGER);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -90,20 +92,20 @@ public class BlockSparkChanger 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) {
|
||||
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(x, y, z);
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(pos);
|
||||
ItemStack cstack = changer.getStackInSlot(0);
|
||||
ItemStack pstack = player.getCurrentEquippedItem();
|
||||
if(cstack != null) {
|
||||
changer.setInventorySlotContents(0, null);
|
||||
world.func_147453_f(x, y, z, this);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
changer.markDirty();
|
||||
if(!player.inventory.addItemStackToInventory(cstack))
|
||||
player.dropPlayerItemWithRandomChoice(cstack, false);
|
||||
return true;
|
||||
} else if(pstack != null && pstack.getItem() == ModItems.sparkUpgrade) {
|
||||
changer.setInventorySlotContents(0, pstack.copy().splitStack(1));
|
||||
world.func_147453_f(x, y, z, this);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
changer.markDirty();
|
||||
|
||||
pstack.stackSize--;
|
||||
@@ -117,8 +119,8 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -136,7 +138,7 @@ public class BlockSparkChanger 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;
|
||||
@@ -148,10 +150,10 @@ public class BlockSparkChanger 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
|
||||
@@ -160,8 +162,8 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int s) {
|
||||
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(x, y, z);
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(pos);
|
||||
ItemStack stack = changer.getStackInSlot(0);
|
||||
if(stack == null)
|
||||
return 0;
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
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;
|
||||
@@ -26,6 +28,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.tileentity.TileEntity;
|
||||
@@ -107,41 +110,47 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
protected BlockSpecialFlower() {
|
||||
super(0);
|
||||
setBlockName(LibBlockNames.SPECIAL_FLOWER);
|
||||
super();
|
||||
setUnlocalizedName(LibBlockNames.SPECIAL_FLOWER);
|
||||
setHardness(0.1F);
|
||||
setStepSound(soundTypeGrass);
|
||||
setTickRandomly(false);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
}
|
||||
|
||||
@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 = 0;
|
||||
return LightHelper.getPackedColor(world.getBlockMetadata(x, y, z), currentLight);
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.COLOR);
|
||||
}
|
||||
|
||||
// @Override todo 1.8 coloredlightscore dep
|
||||
// public int getLightValue(IBlockAccess world, BlockPos pos) {
|
||||
// int currentLight = ((TileSpecialFlower) world.getTileEntity(pos)).getLightValue();
|
||||
// if(currentLight == -1)
|
||||
// currentLight = 0;
|
||||
// return LightHelper.getPackedColor(world.getBlockMetadata(x, y, z), currentLight);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@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
|
||||
@@ -155,9 +164,9 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockSpecialFlower.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,6 +178,11 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getBlockType() {
|
||||
return EnumFlowerColor.RED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for(String s : BotaniaAPI.getAllSubTiles())
|
||||
@@ -187,8 +201,8 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
String name = ((TileSpecialFlower) world.getTileEntity(x, y, z)).subTileName;
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
String name = ((TileSpecialFlower) world.getTileEntity(pos)).subTileName;
|
||||
return ItemBlockSpecialFlower.ofType(name);
|
||||
}
|
||||
|
||||
@@ -198,17 +212,17 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
@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);
|
||||
((TileSpecialFlower) par1World.getTileEntity(par2, par3, par4)).onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
|
||||
dropBlockAsItem(par1World, pos, state, 0);
|
||||
((TileSpecialFlower) par1World.getTileEntity(pos)).onBlockHarvested(par1World, pos, state, par6EntityPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@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> list = new ArrayList();
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile != null) {
|
||||
String name = ((TileSpecialFlower) tile).subTileName;
|
||||
@@ -220,9 +234,9 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
public boolean onBlockEventReceived(World par1World, BlockPos pos, IBlockState state, int par5, int par6) {
|
||||
super.onBlockEventReceived(par1World, pos, state, par5, par6);
|
||||
TileEntity tileentity = par1World.getTileEntity(pos);
|
||||
return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false;
|
||||
}
|
||||
|
||||
@@ -233,46 +247,46 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).onWanded(stack, player);
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).onWanded(stack, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
((TileSpecialFlower) world.getTileEntity(x, y, z)).onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
}
|
||||
|
||||
@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, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
float[] rgb = EntitySheep.fleeceColorTable[world.getBlockMetadata(x, y, z)];
|
||||
return ((int) (rgb[0] * 255) << 16) + ((int) (rgb[1] * 255) << 8) + (int) (rgb[2] * 255);
|
||||
public int colorMultiplier(IBlockAccess world, BlockPos pos, int pass) {
|
||||
return ((EnumDyeColor) world.getBlockState(pos).getValue(BotaniaStateProps.COLOR))
|
||||
.getMapColor().colorValue;
|
||||
}
|
||||
|
||||
@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 && stack.getItem() == ModItems.dye) {
|
||||
int newMeta = stack.getItemDamage();
|
||||
int oldMeta = world.getBlockMetadata(x, y, z);
|
||||
if(newMeta != oldMeta)
|
||||
world.setBlockMetadataWithNotify(x, y, z, newMeta, 1 | 2);
|
||||
EnumDyeColor newColor = EnumDyeColor.byMetadata(stack.getItemDamage());
|
||||
EnumDyeColor oldColor = ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR));
|
||||
if(newColor != oldColor)
|
||||
world.setBlockState(pos, state.withProperty(BotaniaStateProps.COLOR, newColor), 1 | 2);
|
||||
}
|
||||
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -60,8 +61,8 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,13 +84,13 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beaconPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int meta = world.getBlockMetadata(pos);
|
||||
return meta == 0 ? LexiconData.pool : LexiconData.terrasteel;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -20,7 +20,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.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -33,13 +33,13 @@ public class BlockTeruTeruBozu extends BlockModContainer implements ILexiconable
|
||||
|
||||
public BlockTeruTeruBozu() {
|
||||
super(Material.cloth);
|
||||
setBlockName(LibBlockNames.TERU_TERU_BOZU);
|
||||
setUnlocalizedName(LibBlockNames.TERU_TERU_BOZU);
|
||||
float f = 0.25F;
|
||||
setBlockBounds(f, 0.01F, f, 1F - f, 0.99F, 1F - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity e) {
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, Entity e) {
|
||||
if(!world.isRemote && e instanceof EntityItem) {
|
||||
EntityItem item = (EntityItem) e;
|
||||
ItemStack stack = item.getEntityItem();
|
||||
@@ -52,7 +52,7 @@ public class BlockTeruTeruBozu 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) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null && ((isSunflower(stack) && removeRain(world)) || (isBlueOrchid(stack) && startRain(world)))) {
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
@@ -93,27 +93,17 @@ public class BlockTeruTeruBozu extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int s) {
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return world.isRaining() ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.wool.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ public class BlockTinyPlanet extends BlockModContainer implements ILexiconable {
|
||||
setStepSound(soundTypeStone);
|
||||
float size = 3F / 16F;
|
||||
setBlockBounds(size, size, size, 1F - size, 1F - size, 1F - size);
|
||||
setBlockName(LibBlockNames.TINY_PLANET);
|
||||
setUnlocalizedName(LibBlockNames.TINY_PLANET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Holds all Botania block state properties
|
||||
*/
|
||||
public class BotaniaStateProps {
|
||||
|
||||
/** Common properties to all blocks **/
|
||||
|
||||
// The 16 Minecraft colors
|
||||
public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class);
|
||||
|
||||
// Only the four cardinal directions
|
||||
public static final PropertyEnum CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
|
||||
|
||||
// All 6 directions
|
||||
public static final PropertyEnum FACING = PropertyEnum.create("facing", EnumFacing.class);
|
||||
|
||||
// Redstone power
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
/** Properties for individual blocks **/
|
||||
|
||||
// BlockAltGrass
|
||||
public static final PropertyEnum ALTGRASS_VARIANT = PropertyEnum.create("variant", BlockAltGrass.AltGrassType.class);
|
||||
|
||||
private BotaniaStateProps() {}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ package vazkii.botania.common.block.corporea;
|
||||
|
||||
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.item.EntityItem;
|
||||
@@ -35,7 +34,7 @@ public abstract class BlockCorporeaBase extends BlockModContainer<TileCorporeaBa
|
||||
|
||||
public BlockCorporeaBase(Material material, String name) {
|
||||
super(material);
|
||||
setBlockName(name);
|
||||
setUnlocalizedName(name);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
package vazkii.botania.common.block.corporea;
|
||||
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -45,11 +45,11 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null) {
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) world.getTileEntity(x, y, z);
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) world.getTileEntity(pos);
|
||||
cube.setRequestTarget(stack);
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,8 +97,8 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int s) {
|
||||
return ((TileCorporeaCrystalCube) world.getTileEntity(x, y, z)).compValue;
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return ((TileCorporeaCrystalCube) world.getTileEntity(pos)).compValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.corporea;
|
||||
|
||||
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;
|
||||
@@ -44,8 +45,8 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BlockCorporeaIndex extends BlockCorporeaBase implements ILexiconabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,12 @@ package vazkii.botania.common.block.corporea;
|
||||
import java.util.Random;
|
||||
|
||||
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;
|
||||
@@ -51,7 +53,7 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexi
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@@ -61,7 +63,7 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexi
|
||||
}
|
||||
|
||||
@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 ? 15 : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.corporea;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,11 +35,11 @@ public class BlockCorporeaRetainer extends BlockModContainer implements ILexicon
|
||||
super(Material.iron);
|
||||
setHardness(5.5F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockName(LibBlockNames.CORPOREA_RETAINER);
|
||||
setUnlocalizedName(LibBlockNames.CORPOREA_RETAINER);
|
||||
}
|
||||
|
||||
@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;
|
||||
@@ -56,8 +57,8 @@ public class BlockCorporeaRetainer extends BlockModContainer implements ILexicon
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int s) {
|
||||
return ((TileCorporeaRetainer) world.getTileEntity(x, y, z)).hasPendingRequest() ? 15 : 0;
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return ((TileCorporeaRetainer) world.getTileEntity(pos)).hasPendingRequest() ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
|
||||
public BlockFloatingFlower(String name) {
|
||||
super(Material.ground);
|
||||
setBlockName(name);
|
||||
setUnlocalizedName(name);
|
||||
setHardness(0.5F);
|
||||
setStepSound(soundTypeGravel);
|
||||
setLightLevel(1F);
|
||||
@@ -77,9 +77,9 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
register(par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
protected void register(String name) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
|
||||
setStepSound(soundTypeMetal);
|
||||
float size = 3F / 16F;
|
||||
setBlockBounds(size, size, size, 1F - size, 1F - size, 1F - size);
|
||||
setBlockName(LibBlockNames.MANA_BEACON);
|
||||
setUnlocalizedName(LibBlockNames.MANA_BEACON);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,9 +69,9 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public class BlockManaFlame extends BlockModContainer {
|
||||
|
||||
public BlockManaFlame() {
|
||||
super(Material.cloth);
|
||||
setBlockName(LibBlockNames.MANA_FLAME);
|
||||
setUnlocalizedName(LibBlockNames.MANA_FLAME);
|
||||
float f = 0.25F;
|
||||
setStepSound(soundTypeCloth);
|
||||
setBlockBounds(f, f, f, 1F - f, 1F - f, 1F - f);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockStarfield extends BlockModContainer implements ILexiconable {
|
||||
setHardness(5F);
|
||||
setResistance(2000F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockName(LibBlockNames.STARFIELD);
|
||||
setUnlocalizedName(LibBlockNames.STARFIELD);
|
||||
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 0.25F, 1F);
|
||||
}
|
||||
|
||||
@@ -40,15 +40,15 @@ public class BlockTinyPotato extends BlockModContainer implements ILexiconable {
|
||||
public BlockTinyPotato() {
|
||||
super(Material.cloth);
|
||||
setHardness(0.25F);
|
||||
setBlockName(LibBlockNames.TINY_POTATO);
|
||||
setUnlocalizedName(LibBlockNames.TINY_POTATO);
|
||||
float f = 1F / 16F * 6F;
|
||||
setBlockBounds(f, 0, f, 1F - f, f, 1F - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockTinyPotato.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,10 +14,12 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.entity.EntityPoolMinecart;
|
||||
@@ -26,21 +28,19 @@ public class BehaviourPoolMinecart extends BehaviorDefaultDispenseItem {
|
||||
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
|
||||
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
|
||||
EnumFacing enumfacing = BlockDispenser.getFacing(p_82487_1_.getBlockMetadata());
|
||||
World world = p_82487_1_.getWorld();
|
||||
double d0 = p_82487_1_.getX() + enumfacing.getFrontOffsetX() * 1.125F;
|
||||
double d1 = p_82487_1_.getY() + enumfacing.getFrontOffsetY() * 1.125F;
|
||||
double d2 = p_82487_1_.getZ() + enumfacing.getFrontOffsetZ() * 1.125F;
|
||||
int i = p_82487_1_.getXInt() + enumfacing.getFrontOffsetX();
|
||||
int j = p_82487_1_.getYInt() + enumfacing.getFrontOffsetY();
|
||||
int k = p_82487_1_.getZInt() + enumfacing.getFrontOffsetZ();
|
||||
Block block = world.getBlock(i, j, k);
|
||||
BlockPos pos = p_82487_1_.getBlockPos().offset(enumfacing);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
double d3;
|
||||
|
||||
if(BlockRailBase.func_150051_a(block))
|
||||
if(BlockRailBase.isRailBlock(state))
|
||||
d3 = 0.0D;
|
||||
else {
|
||||
if(block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
|
||||
if(state.getBlock().getMaterial() != Material.air || !BlockRailBase.isRailBlock(world.getBlockState(pos.down())))
|
||||
return super.dispenseStack(p_82487_1_, p_82487_2_);
|
||||
|
||||
d3 = -1.0D;
|
||||
@@ -49,7 +49,7 @@ public class BehaviourPoolMinecart extends BehaviorDefaultDispenseItem {
|
||||
EntityMinecart entityminecart = new EntityPoolMinecart(world, d0, d1 + d3, d2);
|
||||
|
||||
if(p_82487_2_.hasDisplayName())
|
||||
entityminecart.setMinecartName(p_82487_2_.getDisplayName());
|
||||
entityminecart.setCustomNameTag(p_82487_2_.getDisplayName());
|
||||
|
||||
world.spawnEntityInWorld(entityminecart);
|
||||
p_82487_2_.splitStack(1);
|
||||
@@ -58,7 +58,7 @@ public class BehaviourPoolMinecart extends BehaviorDefaultDispenseItem {
|
||||
|
||||
@Override
|
||||
protected void playDispenseSound(IBlockSource p_82485_1_) {
|
||||
p_82485_1_.getWorld().playAuxSFX(1000, p_82485_1_.getXInt(), p_82485_1_.getYInt(), p_82485_1_.getZInt(), 0);
|
||||
p_82485_1_.getWorld().playAuxSFX(1000, p_82485_1_.getBlockPos(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -28,14 +29,12 @@ public class BehaviourSeeds extends BehaviorDefaultDispenseItem {
|
||||
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
|
||||
EnumFacing facing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
|
||||
int x = par1IBlockSource.getXInt() + facing.getFrontOffsetX();
|
||||
int y = par1IBlockSource.getYInt() + facing.getFrontOffsetY();
|
||||
int z = par1IBlockSource.getZInt() + facing.getFrontOffsetZ();
|
||||
EnumFacing facing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
|
||||
BlockPos pos = par1IBlockSource.getBlockPos().offset(facing);
|
||||
World world = par1IBlockSource.getWorld();
|
||||
|
||||
if(world.getBlock(x, y, z).isAir(world, x, y, z) && block.canBlockStay(world, x, y, z)) {
|
||||
world.setBlock(x, y, z, block);
|
||||
if(world.getBlockState(pos).getBlock().isAir(world, pos) && block.canPlaceBlockAt(world, pos)) {
|
||||
world.setBlockState(pos, block.getDefaultState());
|
||||
par2ItemStack.stackSize--;
|
||||
return par2ItemStack;
|
||||
}
|
||||
|
||||
@@ -15,22 +15,21 @@ import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
|
||||
public class BehaviourWand extends BehaviorDefaultDispenseItem {
|
||||
|
||||
@Override
|
||||
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata()).ordinal());
|
||||
int x = par1IBlockSource.getXInt() + facing.offsetX;
|
||||
int y = par1IBlockSource.getYInt() + facing.offsetY;
|
||||
int z = par1IBlockSource.getZInt() + facing.offsetZ;
|
||||
EnumFacing facing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
|
||||
BlockPos pos = par1IBlockSource.getBlockPos().offset(facing);
|
||||
World world = par1IBlockSource.getWorld();
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if(block instanceof IWandable) {
|
||||
((IWandable) block).onUsedByWand(null, par2ItemStack, world, , x, , y);
|
||||
((IWandable) block).onUsedByWand(null, par2ItemStack, world, pos, facing.getOpposite());
|
||||
return par2ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
package vazkii.botania.common.block.mana;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
@@ -38,7 +40,7 @@ public class BlockBellows extends BlockModContainer implements ILexiconable {
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.BELLOWS);
|
||||
setUnlocalizedName(LibBlockNames.BELLOWS);
|
||||
|
||||
float f = (1F - 10 / 16F) / 2F;
|
||||
setBlockBounds(f, 0F, f, 1F - f, 10F / 16F, 1F - f);
|
||||
@@ -56,9 +58,9 @@ public class BlockBellows 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) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing s, float xs, float ys, float zs) {
|
||||
if(EntityDoppleganger.isTruePlayer(player))
|
||||
((TileBellows) world.getTileEntity(x, y, z)).interact();
|
||||
((TileBellows) world.getTileEntity(pos)).interact();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -68,7 +70,7 @@ public class BlockBellows extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ package vazkii.botania.common.block.mana;
|
||||
|
||||
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;
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack;
|
||||
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.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -44,7 +45,7 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
super(Material.rock);
|
||||
float f = 6F / 16F;
|
||||
setBlockBounds(f, 0.05F, f, 1F - f, 0.95F, 1F - f);
|
||||
setBlockName(LibBlockNames.BREWERY);
|
||||
setUnlocalizedName(LibBlockNames.BREWERY);
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
@@ -58,8 +59,8 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileBrewery brew = (TileBrewery) par1World.getTileEntity(par2, par3, par4);
|
||||
public boolean onBlockActivated(World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing side, float par7, float par8, float par9) {
|
||||
TileBrewery brew = (TileBrewery) par1World.getTileEntity(pos);
|
||||
|
||||
if(par5EntityPlayer.isSneaking()) {
|
||||
if(brew.recipe == null && par1World.getBlockMetadata(par2, par3, par4) == 0)
|
||||
@@ -70,7 +71,7 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
if(!par5EntityPlayer.inventory.addItemStackToInventory(copy))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(copy, false);
|
||||
brew.setInventorySlotContents(i, null);
|
||||
par1World.func_147453_f(par2, par3, par4, this);
|
||||
par1World.func_147453_f(pos, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -83,8 +84,8 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -102,7 +103,7 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
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;
|
||||
@@ -117,7 +118,7 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,8 +127,8 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileBrewery brew = (TileBrewery) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TileBrewery brew = (TileBrewery) par1World.getTileEntity(pos);
|
||||
return brew.signal;
|
||||
}
|
||||
|
||||
@@ -147,7 +148,7 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -163,7 +164,7 @@ public class BlockBrewery extends BlockModContainer implements ILexiconable, IWa
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileBrewery) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TileBrewery) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class BlockDistributor extends BlockModContainer implements ILexiconable
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.DISTRIBUTOR);
|
||||
setUnlocalizedName(LibBlockNames.DISTRIBUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,8 +12,8 @@ package vazkii.botania.common.block.mana;
|
||||
|
||||
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;
|
||||
@@ -52,7 +52,7 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
setResistance(5.0F);
|
||||
setLightLevel(1.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.ENCHANTER);
|
||||
setUnlocalizedName(LibBlockNames.ENCHANTER);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
}
|
||||
|
||||
@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 Item.getItemFromBlock(Blocks.lapis_block);
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
|
||||
public boolean onBlockActivated(World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing side, float par7, float par8, float par9) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(pos);
|
||||
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if(stack != null && stack.getItem() == ModItems.twigWand)
|
||||
return false;
|
||||
@@ -109,8 +109,8 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(pos);
|
||||
|
||||
ItemStack itemstack = enchanter.itemToEnchant;
|
||||
|
||||
@@ -126,7 +126,7 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
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 * 0.5;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
@@ -139,12 +139,12 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
((TileEnchanter) world.getTileEntity(x, y, z)).onWanded(player, stack);
|
||||
((TileEnchanter) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileEnchanter) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TileEnchanter) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -27,6 +28,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
@@ -70,7 +72,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -80,8 +82,8 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return state.getBlock().getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,7 +167,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
|
||||
if(!world.isRemote)
|
||||
for(int i = 0; i < 10; i++)
|
||||
world.playSoundEffect(x, y, z, "note.bd", 1F, 1F);
|
||||
else world.spawnParticle("note", x + 0.5, y + 1.2, z + 0.5D, 1.0 / 24.0, 0, 0);
|
||||
else world.spawnParticle(EnumParticleTypes.NOTE, x + 0.5, y + 1.2, z + 0.5D, 1.0 / 24.0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -21,6 +22,7 @@ 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.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -42,7 +44,7 @@ public class BlockManaDetector extends BlockModContainer implements ILexiconable
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setBlockName(LibBlockNames.MANA_DETECTOR);
|
||||
setUnlocalizedName(LibBlockNames.MANA_DETECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,14 +65,14 @@ public class BlockManaDetector extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
public int isProvidingWeakPower(IBlockAccess par1iBlockAccess, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||
return par1iBlockAccess.getBlockMetadata(par2, par3, par4) != 0 ? 15 : 0;
|
||||
}
|
||||
|
||||
@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) {
|
||||
if(par7Entity != null && !(par7Entity instanceof IManaBurst))
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
super.addCollisionBoxesToList(par1World, pos, state, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BlockManaVoid extends BlockModContainer implements ILexiconable, IP
|
||||
setHardness(2.0F);
|
||||
setResistance(2000F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setBlockName(LibBlockNames.MANA_VOID);
|
||||
setUnlocalizedName(LibBlockNames.MANA_VOID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -61,7 +62,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.POOL);
|
||||
setUnlocalizedName(LibBlockNames.POOL);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 0.5F, 1F);
|
||||
}
|
||||
|
||||
@@ -71,9 +72,9 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockPool.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,23 +83,23 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state) {
|
||||
return state.getBlock().getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TilePool pool = (TilePool) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TilePool pool = (TilePool) par1World.getTileEntity(pos);
|
||||
lastFragile = pool.fragile;
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@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> drops = new ArrayList();
|
||||
|
||||
if(!lastFragile)
|
||||
drops.add(new ItemStack(this, 1, metadata));
|
||||
drops.add(new ItemStack(this, 1, state.getBlock().getMetaFromState(state)));
|
||||
|
||||
return drops;
|
||||
}
|
||||
@@ -116,33 +117,33 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, Entity par5Entity) {
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TilePool tile = (TilePool) par1World.getTileEntity(par2, par3, par4);
|
||||
TilePool tile = (TilePool) par1World.getTileEntity(pos);
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(par1World, , par2);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(par1World, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) {
|
||||
public void addCollisionBoxesToList(World p_149743_1_, BlockPos pos, IBlockState state, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) {
|
||||
float f = 1F / 16F;
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, f, 0.5F, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, f);
|
||||
super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 0.5F, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return side == ForgeDirection.DOWN;
|
||||
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return side == EnumFacing.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,7 +152,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -171,8 +172,8 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TilePool pool = (TilePool) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TilePool pool = (TilePool) par1World.getTileEntity(pos);
|
||||
int val = (int) ((double) pool.getCurrentMana() / (double) pool.manaCap * 15.0);
|
||||
if(pool.getCurrentMana() > 0)
|
||||
val = Math.max(val, 1);
|
||||
@@ -182,12 +183,12 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TilePool) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TilePool) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
((TilePool) world.getTileEntity(x, y, z)).onWanded(player, stack);
|
||||
((TilePool) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,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.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -22,6 +23,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
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.World;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
@@ -46,7 +48,7 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
setHardness(0.3F);
|
||||
setStepSound(soundTypeGlass);
|
||||
setLightLevel(1.0F);
|
||||
setBlockName(LibBlockNames.PRISM);
|
||||
setUnlocalizedName(LibBlockNames.PRISM);
|
||||
float f = 0.25F;
|
||||
setBlockBounds(f, 0F, f, 1F - f, 1F, 1F - f);
|
||||
|
||||
@@ -71,7 +73,7 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -81,13 +83,13 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
public boolean onBlockActivated(World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing side, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(pos);
|
||||
if(!(tile instanceof TilePrism))
|
||||
return false;
|
||||
|
||||
@@ -131,8 +133,8 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TileEntity tile = par1World.getTileEntity(pos);
|
||||
if(!(tile instanceof TileSimpleInventory))
|
||||
return;
|
||||
|
||||
@@ -154,7 +156,7 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
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;
|
||||
@@ -169,7 +171,7 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,7 +181,7 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
|
||||
@Override
|
||||
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile instanceof TilePrism)
|
||||
((TilePrism) tile).onBurstCollision(burst);
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
package vazkii.botania.common.block.mana;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -28,6 +28,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.BlockModContainer;
|
||||
import vazkii.botania.common.block.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.mana.TilePump;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -35,37 +36,33 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockPump extends BlockModContainer implements ILexiconable {
|
||||
|
||||
private static final int[] META_ROTATIONS = new int[] { 2, 5, 3, 4 };
|
||||
|
||||
public BlockPump() {
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.PUMP);
|
||||
setUnlocalizedName(LibBlockNames.PUMP);
|
||||
setBlockBounds(true);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@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(p_149689_5_.getHorizontalFacing().getOpposite()), 2);
|
||||
}
|
||||
|
||||
@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) {
|
||||
EnumFacing facing = ((EnumFacing) w.getBlockState(pos).getValue(BotaniaStateProps.CARDINALS));
|
||||
setBlockBounds(facing.getAxis());
|
||||
}
|
||||
|
||||
public void setBlockBounds(boolean horiz) {
|
||||
if(horiz)
|
||||
public void setBlockBounds(EnumFacing.Axis axis) {
|
||||
if (axis == EnumFacing.Axis.X) {
|
||||
setBlockBounds(0F, 0F, 0.25F, 1F, 0.5F, 0.75F)
|
||||
} else if (axis == EnumFacing.Axis.Z) {
|
||||
setBlockBounds(0.25F, 0F, 0F, 0.75F, 0.5F, 1F);
|
||||
else setBlockBounds(0F, 0F, 0.25F, 1F, 0.5F, 0.75F);
|
||||
}
|
||||
|
||||
@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
|
||||
@@ -89,7 +86,7 @@ public class BlockPump extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,8 +96,8 @@ public class BlockPump extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
return ((TilePump) world.getTileEntity(x, y, z)).comparator;
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return ((TilePump) world.getTileEntity(pos)).comparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,15 +32,15 @@ public class BlockRFGenerator extends BlockModContainer implements ILexiconable
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.RF_GENERATOR);
|
||||
setUnlocalizedName(LibBlockNames.RF_GENERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "CoFHAPI|energy")
|
||||
public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos tilePos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile instanceof TileRFGenerator)
|
||||
((TileRFGenerator) tile).onNeighborTileChange(tileX, tileY, tileZ);
|
||||
((TileRFGenerator) tile).onNeighborTileChange(tilePos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,8 +12,8 @@ package vazkii.botania.common.block.mana;
|
||||
|
||||
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;
|
||||
@@ -48,7 +48,7 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(LibBlockNames.RUNE_ALTAR);
|
||||
setUnlocalizedName(LibBlockNames.RUNE_ALTAR);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(par2, par3, par4);
|
||||
public boolean onBlockActivated(World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing side, float par7, float par8, float par9) {
|
||||
TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(pos);
|
||||
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
|
||||
if(par5EntityPlayer.isSneaking()) {
|
||||
@@ -84,7 +84,7 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
if(!par5EntityPlayer.inventory.addItemStackToInventory(copy))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(copy, false);
|
||||
altar.setInventorySlotContents(i, null);
|
||||
par1World.func_147453_f(par2, par3, par4, this);
|
||||
par1World.updateComparatorOutputLevel(pos, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,8 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -115,7 +115,7 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
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;
|
||||
@@ -127,10 +127,10 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -149,14 +149,14 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(pos);
|
||||
return altar.signal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
((TileRuneAltar) world.getTileEntity(x, y, z)).onWanded(player, stack);
|
||||
((TileRuneAltar) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileRuneAltar) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TileRuneAltar) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockSpawnerClaw extends BlockModContainer implements ILexiconable
|
||||
public BlockSpawnerClaw() {
|
||||
super(Material.iron);
|
||||
setHardness(3.0F);
|
||||
setBlockName(LibBlockNames.SPAWNER_CLAW);
|
||||
setUnlocalizedName(LibBlockNames.SPAWNER_CLAW);
|
||||
|
||||
float f = 1F / 8F;
|
||||
float f1 = 1F / 16F;
|
||||
@@ -59,7 +59,7 @@ public class BlockSpawnerClaw extends BlockModContainer implements ILexiconable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
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;
|
||||
@@ -57,7 +58,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.SPREADER);
|
||||
setUnlocalizedName(LibBlockNames.SPREADER);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
@@ -68,14 +69,9 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,25 +81,25 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
|
||||
int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
|
||||
TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4);
|
||||
public void onBlockPlacedBy(World par1World, BlockPos pos, IBlockState state, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
|
||||
EnumFacing orientation = BlockPistonBase.getFacingFromEntity(par1World, pos, par5EntityLivingBase);
|
||||
TileSpreader spreader = (TileSpreader) par1World.getTileEntity(pos);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 1 | 2);
|
||||
|
||||
switch(orientation) {
|
||||
case 0:
|
||||
case DOWN:
|
||||
spreader.rotationY = -90F;
|
||||
break;
|
||||
case 1:
|
||||
case UP:
|
||||
spreader.rotationY = 90F;
|
||||
break;
|
||||
case 2:
|
||||
case NORTH:
|
||||
spreader.rotationX = 270F;
|
||||
break;
|
||||
case 3:
|
||||
case SOUTH:
|
||||
spreader.rotationX = 90F;
|
||||
break;
|
||||
case 4:
|
||||
case WEST:
|
||||
break;
|
||||
default:
|
||||
spreader.rotationX = 180F;
|
||||
@@ -112,8 +108,8 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
public int damageDropped(IBlockState par1) {
|
||||
return getMetaFromState(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,7 +118,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,8 +133,8 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
public boolean onBlockActivated(World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(pos);
|
||||
if(!(tile instanceof TileSpreader))
|
||||
return false;
|
||||
|
||||
@@ -183,8 +179,8 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, BlockPos pos, IBlockState state) {
|
||||
TileEntity tile = par1World.getTileEntity(pos);
|
||||
if(!(tile instanceof TileSpreader))
|
||||
return;
|
||||
|
||||
@@ -206,7 +202,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
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;
|
||||
@@ -218,15 +214,15 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
}
|
||||
}
|
||||
|
||||
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 boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
((TileSpreader) world.getTileEntity(x, y, z)).onWanded(player, stack);
|
||||
((TileSpreader) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -237,19 +233,20 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileSpreader) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TileSpreader) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int meta = world.getBlockMetadata(pos);
|
||||
return meta == 0 ? LexiconData.spreader : meta == 1 ? LexiconData.redstoneSpreader : LexiconData.dreamwoodSpreader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getWireframeAABB(World world, BlockPos pos) {
|
||||
float f = 1F / 16F;
|
||||
return new AxisAlignedBB(x + f, y + f, z + f, x + 1 - f, y + 1 - f, z + 1 - f);
|
||||
return new AxisAlignedBB(pos.getX() + f, pos.getY() + f, pos.getZ() + f,
|
||||
pos.getX() + 1 - f, pos.getY() + 1 - f, pos.getZ() + 1 - f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,11 +38,11 @@ public class BlockTerraPlate extends BlockModContainer implements ILexiconable {
|
||||
setHardness(3F);
|
||||
setResistance(10F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setBlockName(LibBlockNames.TERRA_PLATE);
|
||||
setUnlocalizedName(LibBlockNames.TERRA_PLATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BlockTerraPlate extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ public class BlockTerraPlate extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileTerraPlate plate = (TileTerraPlate) par1World.getTileEntity(par2, par3, par4);
|
||||
public int getComparatorInputOverride(World par1World, BlockPos pos) {
|
||||
TileTerraPlate plate = (TileTerraPlate) par1World.getTileEntity(pos);
|
||||
int val = (int) ((double) plate.getCurrentMana() / (double) TileTerraPlate.MAX_MANA * 15.0);
|
||||
if(plate.getCurrentMana() > 0)
|
||||
val = Math.max(val, 1);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BlockTurntable extends BlockModContainer implements IWandable, IWan
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName(LibBlockNames.TURNTABLE);
|
||||
setUnlocalizedName(LibBlockNames.TURNTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,12 +61,12 @@ public class BlockTurntable extends BlockModContainer implements IWandable, IWan
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileTurntable) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
((TileTurntable) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
((TileTurntable) world.getTileEntity(x, y, z)).onWanded(player, stack);
|
||||
((TileTurntable) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,14 @@ package vazkii.botania.common.block.string;
|
||||
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -26,6 +28,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.BlockModContainer;
|
||||
import vazkii.botania.common.block.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -41,18 +44,19 @@ public abstract class BlockRedString extends BlockModContainer<TileRedString> im
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(name);
|
||||
setUnlocalizedName(name);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
|
||||
int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, orientation, 1 | 2);
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.FACING);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
|
||||
return RotationHelper.rotateVanillaBlock(Blocks.piston, worldObj, x, y, z, axis);
|
||||
public void onBlockPlacedBy(World par1World, BlockPos pos, IBlockState state, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
|
||||
EnumFacing orientation = BlockPistonBase.getFacingFromEntity(par1World, pos, par5EntityLivingBase);
|
||||
par1World.setBlockState(pos, state.withProperty(BotaniaStateProps.FACING, orientation), 1 | 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.string;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
import vazkii.botania.common.block.tile.string.TileRedStringComparator;
|
||||
@@ -27,8 +28,8 @@ public class BlockRedStringComparator extends BlockRedString {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
return ((TileRedStringComparator) world.getTileEntity(x, y, z)).getComparatorValue();
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
return ((TileRedStringComparator) world.getTileEntity(pos)).getComparatorValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,8 @@ package vazkii.botania.common.block.string;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
import vazkii.botania.common.block.tile.string.TileRedStringFertilizer;
|
||||
@@ -25,23 +27,22 @@ public class BlockRedStringFertilizer extends BlockRedString implements IGrowabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149851_a(World world, int x, int y, int z, boolean something) {
|
||||
return ((TileRedStringFertilizer) world.getTileEntity(x, y, z)).func_149851_a(world, something);
|
||||
public boolean canGrow(World world, BlockPos pos, IBlockState state, boolean isClient) {
|
||||
return ((TileRedStringFertilizer) world.getTileEntity(pos)).canGrow(world, isClient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149852_a(World world, Random rand, int x, int y, int z) {
|
||||
return ((TileRedStringFertilizer) world.getTileEntity(x, y, z)).func_149852_a(world, rand);
|
||||
public boolean canUseBonemeal(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
return ((TileRedStringFertilizer) world.getTileEntity(pos)).canUseBonemeal(world, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149853_b(World world, Random rand, int x, int y, int z) {
|
||||
((TileRedStringFertilizer) world.getTileEntity(x, y, z)).func_149853_b(world, rand);
|
||||
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
((TileRedStringFertilizer) world.getTileEntity(pos)).grow(world, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileRedString createNewTileEntity(World world, int meta) {
|
||||
return new TileRedStringFertilizer();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,9 @@ package vazkii.botania.common.block.string;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -27,12 +30,13 @@ public class BlockRedStringInterceptor extends BlockRedString {
|
||||
public BlockRedStringInterceptor() {
|
||||
super(LibBlockNames.RED_STRING_INTERCEPTOR);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
// todo 1.8 completely override states from super
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
if(event.action == Action.RIGHT_CLICK_BLOCK)
|
||||
TileRedStringInterceptor.onInteract(event.entityPlayer, event.world, event.x, event.y, event.z);
|
||||
TileRedStringInterceptor.onInteract(event.entityPlayer, event.world, event.pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,12 +45,12 @@ public class BlockRedStringInterceptor extends BlockRedString {
|
||||
}
|
||||
|
||||
@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) & 8) == 0 ? 0 : 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random update) {
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random update) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) & -9, 1 | 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,24 +19,24 @@ import net.minecraft.world.World;
|
||||
|
||||
public class TileRedStringFertilizer extends TileRedString {
|
||||
|
||||
public boolean func_149851_a(World p_149851_1_, boolean p_149851_5_) {
|
||||
public boolean canGrow(World p_149851_1_, boolean p_149851_5_) {
|
||||
BlockPos binding = getBinding();
|
||||
Block block = getBlockAtBinding();
|
||||
|
||||
return block instanceof IGrowable ? ((IGrowable) block).func_149851_a(p_149851_1_, binding.posX, binding.posY, binding.posZ, p_149851_5_) : false;
|
||||
return block instanceof IGrowable ? ((IGrowable) block).canGrow(p_149851_1_, binding, p_149851_1_.getBlockState(binding), p_149851_5_) : false;
|
||||
}
|
||||
|
||||
public boolean func_149852_a(World p_149852_1_, Random p_149852_2_) {
|
||||
public boolean canUseBonemeal(World p_149852_1_, Random p_149852_2_) {
|
||||
BlockPos binding = getBinding();
|
||||
Block block = getBlockAtBinding();
|
||||
return block instanceof IGrowable ? ((IGrowable) block).func_149852_a(p_149852_1_, p_149852_2_, binding.posX, binding.posY, binding.posZ) : false;
|
||||
return block instanceof IGrowable ? ((IGrowable) block).canUseBonemeal(p_149852_1_, p_149852_2_, binding, p_149852_1_.getBlockState(binding)) : false;
|
||||
}
|
||||
|
||||
public void func_149853_b(World p_149853_1_, Random p_149853_2_) {
|
||||
public void grow(World p_149853_1_, Random p_149853_2_) {
|
||||
BlockPos binding = getBinding();
|
||||
Block block = getBlockAtBinding();
|
||||
if(block instanceof IGrowable)
|
||||
((IGrowable) block).func_149853_b(p_149853_1_, p_149853_2_, binding.posX, binding.posY, binding.posZ);
|
||||
((IGrowable) block).grow(p_149853_1_, p_149853_2_, binding, p_149853_1_.getBlockState(binding));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user