mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -8,52 +8,49 @@ import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFalling extends Block
|
||||
{
|
||||
public class BlockFalling extends Block {
|
||||
public static boolean fallInstantly;
|
||||
|
||||
public BlockFalling()
|
||||
{
|
||||
public BlockFalling() {
|
||||
super(Material.craftedSnow);
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
}
|
||||
|
||||
public BlockFalling(Material p_i45405_1_)
|
||||
{
|
||||
public BlockFalling(Material p_i45405_1_) {
|
||||
super(p_i45405_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded (World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
|
||||
{
|
||||
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
|
||||
p_149726_1_.scheduleBlockUpdate(p_149726_2_, p_149726_3_, p_149726_4_, this, this.tickRate(p_149726_1_));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange (World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
|
||||
{
|
||||
public void onNeighborBlockChange(
|
||||
World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
|
||||
p_149695_1_.scheduleBlockUpdate(p_149695_2_, p_149695_3_, p_149695_4_, this, this.tickRate(p_149695_1_));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
|
||||
{
|
||||
if (!p_149674_1_.isRemote)
|
||||
{
|
||||
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
|
||||
if (!p_149674_1_.isRemote) {
|
||||
this.func_149830_m(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
}
|
||||
}
|
||||
|
||||
private void func_149830_m (World p_149830_1_, int p_149830_2_, int p_149830_3_, int p_149830_4_)
|
||||
{
|
||||
if (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ >= 0)
|
||||
{
|
||||
private void func_149830_m(World p_149830_1_, int p_149830_2_, int p_149830_3_, int p_149830_4_) {
|
||||
if (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!fallInstantly && p_149830_1_.checkChunksExist(p_149830_2_ - b0, p_149830_3_ - b0, p_149830_4_ - b0, p_149830_2_ + b0, p_149830_3_ + b0, p_149830_4_ + b0))
|
||||
{
|
||||
if (!p_149830_1_.isRemote)
|
||||
{
|
||||
if (!fallInstantly
|
||||
&& p_149830_1_.checkChunksExist(
|
||||
p_149830_2_ - b0,
|
||||
p_149830_3_ - b0,
|
||||
p_149830_4_ - b0,
|
||||
p_149830_2_ + b0,
|
||||
p_149830_3_ + b0,
|
||||
p_149830_4_ + b0)) {
|
||||
if (!p_149830_1_.isRemote) {
|
||||
// EntityFallingBlock entityfallingblock = new
|
||||
// EntityFallingBlock(p_149830_1_,
|
||||
// (double)((float)p_149830_2_ + 0.5F),
|
||||
@@ -64,48 +61,35 @@ public class BlockFalling extends Block
|
||||
// this.func_149829_a(entityfallingblock);
|
||||
// p_149830_1_.spawnEntityInWorld(entityfallingblock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_149830_1_.setBlockToAir(p_149830_2_, p_149830_3_, p_149830_4_);
|
||||
|
||||
while (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ > 0)
|
||||
{
|
||||
while (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ > 0) {
|
||||
--p_149830_3_;
|
||||
}
|
||||
|
||||
if (p_149830_3_ > 0)
|
||||
{
|
||||
if (p_149830_3_ > 0) {
|
||||
p_149830_1_.setBlock(p_149830_2_, p_149830_3_, p_149830_4_, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void func_149829_a (EntityFallingBlock p_149829_1_)
|
||||
{
|
||||
}
|
||||
protected void func_149829_a(EntityFallingBlock p_149829_1_) {}
|
||||
|
||||
@Override
|
||||
public int tickRate (World p_149738_1_)
|
||||
{
|
||||
public int tickRate(World p_149738_1_) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static boolean func_149831_e (World p_149831_0_, int p_149831_1_, int p_149831_2_, int p_149831_3_)
|
||||
{
|
||||
public static boolean func_149831_e(World p_149831_0_, int p_149831_1_, int p_149831_2_, int p_149831_3_) {
|
||||
Block block = p_149831_0_.getBlock(p_149831_1_, p_149831_2_, p_149831_3_);
|
||||
|
||||
if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_))
|
||||
{
|
||||
if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_)) {
|
||||
return true;
|
||||
}
|
||||
else if (block == Blocks.fire)
|
||||
{
|
||||
} else if (block == Blocks.fire) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// TODO: King, take a look here when doing liquids!
|
||||
// Material material = block.blockMaterial;
|
||||
// return material == Material.water ? true : material ==
|
||||
@@ -114,7 +98,5 @@ public class BlockFalling extends Block
|
||||
}
|
||||
}
|
||||
|
||||
public void func_149828_a (World p_149828_1_, int p_149828_2_, int p_149828_3_, int p_149828_4_, int p_149828_5_)
|
||||
{
|
||||
}
|
||||
}
|
||||
public void func_149828_a(World p_149828_1_, int p_149828_2_, int p_149828_3_, int p_149828_4_, int p_149828_5_) {}
|
||||
}
|
||||
@@ -13,20 +13,17 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class SlabBase extends MantleBlock
|
||||
{
|
||||
public class SlabBase extends MantleBlock {
|
||||
Block modelBlock;
|
||||
int startingMeta;
|
||||
int totalSize;
|
||||
|
||||
public SlabBase(Material material)
|
||||
{
|
||||
public SlabBase(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
public SlabBase(Material material, Block model, int meta, int totalSize)
|
||||
{
|
||||
public SlabBase(Material material, Block model, int meta, int totalSize) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.modelBlock = model;
|
||||
@@ -35,70 +32,66 @@ public class SlabBase extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity)
|
||||
{
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, entity);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender ()
|
||||
{
|
||||
public void setBlockBoundsForItemRender() {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z) / 8;
|
||||
float minY = meta == 1 ? 0.5F : 0.0F;
|
||||
float maxY = meta == 1 ? 1.0F : 0.5F;
|
||||
setBlockBounds(0.0F, minY, 0F, 1.0F, maxY, 1.0F);
|
||||
}
|
||||
|
||||
public int onBlockPlaced (World par1World, int blockX, int blockY, int blockZ, int side, float clickX, float clickY, float clickZ, int metadata)
|
||||
{
|
||||
if (side == 1)
|
||||
return metadata;
|
||||
if (side == 0 || clickY >= 0.5F)
|
||||
return metadata | 8;
|
||||
public int onBlockPlaced(
|
||||
World par1World,
|
||||
int blockX,
|
||||
int blockY,
|
||||
int blockZ,
|
||||
int side,
|
||||
float clickX,
|
||||
float clickY,
|
||||
float clickZ,
|
||||
int metadata) {
|
||||
if (side == 1) return metadata;
|
||||
if (side == 0 || clickY >= 0.5F) return metadata | 8;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = meta % 8 + startingMeta;
|
||||
return modelBlock.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < totalSize; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < totalSize; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta % 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,11 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class TConstructBlock extends MantleBlock
|
||||
{
|
||||
public class TConstructBlock extends MantleBlock {
|
||||
public String[] textureNames;
|
||||
public IIcon[] icons;
|
||||
|
||||
public TConstructBlock(Material material, float hardness, String[] tex)
|
||||
{
|
||||
public TConstructBlock(Material material, float hardness, String[] tex) {
|
||||
super(material);
|
||||
setHardness(hardness);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
@@ -24,47 +22,38 @@ public class TConstructBlock extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return meta < icons.length ? icons[meta] : icons[0];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSideTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getSideTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// TODO getSubBlocks
|
||||
@Override
|
||||
public void getSubBlocks (Item block, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < icons.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item block, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < icons.length; iter++) {
|
||||
list.add(new ItemStack(block, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,36 +12,29 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
|
||||
public class DryingRackLogic extends InventoryLogic
|
||||
{
|
||||
public class DryingRackLogic extends InventoryLogic {
|
||||
int currentTime;
|
||||
int maxTime;
|
||||
|
||||
public DryingRackLogic()
|
||||
{
|
||||
public DryingRackLogic() {
|
||||
super(1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
||||
{
|
||||
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultName ()
|
||||
{
|
||||
public String getDefaultName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (!worldObj.isRemote && maxTime > 0 && currentTime < maxTime)
|
||||
{
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote && maxTime > 0 && currentTime < maxTime) {
|
||||
currentTime++;
|
||||
if (currentTime >= maxTime)
|
||||
{
|
||||
if (currentTime >= maxTime) {
|
||||
inventory[0] = DryingRackRecipes.getDryingResult(inventory[0]);
|
||||
updateDryingTime();
|
||||
}
|
||||
@@ -49,103 +42,88 @@ public class DryingRackLogic extends InventoryLogic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
super.setInventorySlotContents(slot, itemstack);
|
||||
updateDryingTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
ItemStack stack = super.decrStackSize(slot, quantity);
|
||||
maxTime = 0;
|
||||
currentTime = 0;
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void updateDryingTime ()
|
||||
{
|
||||
public void updateDryingTime() {
|
||||
currentTime = 0;
|
||||
if (inventory[0] != null)
|
||||
maxTime = DryingRackRecipes.getDryingTime(inventory[0]);
|
||||
else
|
||||
maxTime = 0;
|
||||
if (inventory[0] != null) maxTime = DryingRackRecipes.getDryingTime(inventory[0]);
|
||||
else maxTime = 0;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
currentTime = tags.getInteger("Time");
|
||||
maxTime = tags.getInteger("MaxTime");
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
tags.setInteger("Time", currentTime);
|
||||
tags.setInteger("MaxTime", maxTime);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox ()
|
||||
{
|
||||
AxisAlignedBB cbb = AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
AxisAlignedBB cbb =
|
||||
AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
return cbb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
public void closeInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
public void openInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@@ -13,20 +13,17 @@ import tconstruct.world.entity.BlueSlime;
|
||||
import tconstruct.world.entity.KingBlueSlime;
|
||||
import tconstruct.world.entity.SlimeBase;
|
||||
|
||||
public class SlimeFluid extends BlockFluidClassic
|
||||
{
|
||||
public class SlimeFluid extends BlockFluidClassic {
|
||||
IIcon stillIcon;
|
||||
IIcon flowIcon;
|
||||
|
||||
public SlimeFluid(Fluid fluid, Material material)
|
||||
{
|
||||
public SlimeFluid(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
stillIcon = iconRegister.registerIcon("tinker:slime_blue");
|
||||
flowIcon = iconRegister.registerIcon("tinker:slime_blue_flow");
|
||||
TinkerWorld.blueSlimeFluid.setStillIcon(stillIcon);
|
||||
@@ -35,31 +32,25 @@ public class SlimeFluid extends BlockFluidClassic
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return stillIcon;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) return stillIcon;
|
||||
return flowIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
super.updateTick(world, x, y, z, rand);
|
||||
if (rand.nextInt(100) == 0 && world.getBlockMetadata(x, y, z) == 0 && world.checkNoEntityCollision(AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 2, y + 2, z + 2)))
|
||||
{
|
||||
if (rand.nextInt(100) == 0
|
||||
&& world.getBlockMetadata(x, y, z) == 0
|
||||
&& world.checkNoEntityCollision(
|
||||
AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 2, y + 2, z + 2))) {
|
||||
SlimeBase slime;
|
||||
if(rand.nextInt(300) == 0)
|
||||
slime = new KingBlueSlime(world);
|
||||
else
|
||||
slime = new BlueSlime(world);
|
||||
if (rand.nextInt(300) == 0) slime = new KingBlueSlime(world);
|
||||
else slime = new BlueSlime(world);
|
||||
slime.setPosition((double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D);
|
||||
world.spawnEntityInWorld(slime);
|
||||
}
|
||||
}
|
||||
|
||||
public void getSubBlocks (int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
||||
}
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {}
|
||||
}
|
||||
@@ -13,45 +13,42 @@ import net.minecraft.world.World;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class SlimeGel extends TConstructBlock
|
||||
{
|
||||
public SlimeGel()
|
||||
{
|
||||
super(Material.sponge, 0.5f, new String[] { "slimeblock_blue", "slimeblock_green", "slimeblock_purple" });
|
||||
public class SlimeGel extends TConstructBlock {
|
||||
public SlimeGel() {
|
||||
super(Material.sponge, 0.5f, new String[] {"slimeblock_blue", "slimeblock_green", "slimeblock_purple"});
|
||||
setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEnableStats ()
|
||||
{
|
||||
public boolean getEnableStats() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMobilityFlag ()
|
||||
{
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (entity.motionY < 0)
|
||||
{
|
||||
if (entity.motionY < -0.08F)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity.motionY < 0) {
|
||||
if (entity.motionY < -0.08F) {
|
||||
Block var9 = (Block) this;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var9.stepSound.soundName, (var9.stepSound.getVolume()) / 2.0F, var9.stepSound.getPitch() * 0.65F);
|
||||
world.playSoundEffect(
|
||||
x + 0.5F,
|
||||
y + 0.5F,
|
||||
z + 0.5F,
|
||||
var9.stepSound.soundName,
|
||||
(var9.stepSound.getVolume()) / 2.0F,
|
||||
var9.stepSound.getPitch() * 0.65F);
|
||||
}
|
||||
entity.motionY *= -1.2F;
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.jump.id, 1, 2));
|
||||
}
|
||||
}
|
||||
@@ -59,8 +56,7 @@ public class SlimeGel extends TConstructBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
|
||||
}
|
||||
|
||||
@@ -68,15 +64,13 @@ public class SlimeGel extends TConstructBlock
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks (Block b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
public void getSubBlocks(Block b, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
par3List.add(new ItemStack(b, 1, 0));
|
||||
par3List.add(new ItemStack(b, 1, 1));
|
||||
// par3List.add(new ItemStack(par1, 1, 2));
|
||||
}
|
||||
|
||||
public boolean canSustainLeaves (World world, int x, int y, int z)
|
||||
{
|
||||
public boolean canSustainLeaves(World world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,14 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class SlimeGrass extends MantleBlock
|
||||
{
|
||||
public String[] textureNames = { "slimegrass_green_top", "slimedirt_blue", "slimegrass_green_blue_side", "slimegrass_green_dirt_side" };// green,
|
||||
// purple
|
||||
public class SlimeGrass extends MantleBlock {
|
||||
public String[] textureNames = {
|
||||
"slimegrass_green_top", "slimedirt_blue", "slimegrass_green_blue_side", "slimegrass_green_dirt_side"
|
||||
}; // green,
|
||||
// purple
|
||||
public IIcon[] icons;
|
||||
|
||||
public SlimeGrass()
|
||||
{
|
||||
public SlimeGrass() {
|
||||
super(Material.grass);
|
||||
setHardness(0.6f);
|
||||
this.setTickRandomly(true);
|
||||
@@ -31,11 +31,9 @@ public class SlimeGrass extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
if (meta == 1) // dirt
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
else
|
||||
// slime dirt
|
||||
return 5;
|
||||
@@ -43,90 +41,71 @@ public class SlimeGrass extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (meta >= 2)
|
||||
meta = 0;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta >= 2) meta = 0;
|
||||
|
||||
if (side == 0)
|
||||
{
|
||||
if (side == 0) {
|
||||
return meta % 2 == 1 ? Blocks.dirt.getIcon(0, 0) : icons[1];
|
||||
}
|
||||
else if (side == 1)
|
||||
{
|
||||
} else if (side == 1) {
|
||||
return icons[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[meta + 2];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 1; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 1; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
|
||||
{
|
||||
public boolean canSustainPlant(
|
||||
IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant) {
|
||||
EnumPlantType plantType = plant.getPlantType(world, x, y + 1, z);
|
||||
return plantType == EnumPlantType.Plains && plant.getPlant(world, x, y + 1, z) != Blocks.tallgrass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlantGrow (World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ)
|
||||
{
|
||||
public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) {
|
||||
world.setBlock(x, y, z, TinkerTools.craftedSoil, 5, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (!world.isRemote) {
|
||||
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2) {
|
||||
world.setBlock(x, y, z, TinkerTools.craftedSoil, 5, 3);
|
||||
}
|
||||
else if (world.getBlockLightValue(x, y + 1, z) >= 9)
|
||||
{
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
} else if (world.getBlockLightValue(x, y + 1, z) >= 9) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
int posX = x + random.nextInt(3) - 1;
|
||||
int posY = y + random.nextInt(5) - 3;
|
||||
int posZ = z + random.nextInt(3) - 1;
|
||||
Block blockAbove = world.getBlock(posX, posY + 1, posZ);
|
||||
|
||||
if (world.getBlockLightValue(posX, posY + 1, posZ) >= 4 && world.getBlockLightOpacity(posX, posY + 1, posZ) <= 2 && blockAbove != TinkerTools.craftedSoil && blockAbove != this)
|
||||
{
|
||||
if (world.getBlockLightValue(posX, posY + 1, posZ) >= 4
|
||||
&& world.getBlockLightOpacity(posX, posY + 1, posZ) <= 2
|
||||
&& blockAbove != TinkerTools.craftedSoil
|
||||
&& blockAbove != this) {
|
||||
Block block = world.getBlock(posX, posY, posZ);
|
||||
if (block == Blocks.dirt)
|
||||
{
|
||||
if (block == Blocks.dirt) {
|
||||
world.setBlock(posX, posY, posZ, (Block) this, 1, 3);
|
||||
return;
|
||||
}
|
||||
int blockMeta = world.getBlockMetadata(posX, posY, posZ);
|
||||
if (block == TinkerTools.craftedSoil)
|
||||
{
|
||||
if (blockMeta == 5)
|
||||
world.setBlock(posX, posY, posZ, (Block) this, 0, 3);
|
||||
if (block == TinkerTools.craftedSoil) {
|
||||
if (blockMeta == 5) world.setBlock(posX, posY, posZ, (Block) this, 0, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,19 +113,14 @@ public class SlimeGrass extends MantleBlock
|
||||
}
|
||||
}
|
||||
|
||||
public Block blockDropped (int metadata, Random random, int fortune)
|
||||
{
|
||||
if (metadata == 1)
|
||||
return Blocks.dirt;
|
||||
else
|
||||
return TinkerTools.craftedSoil;
|
||||
public Block blockDropped(int metadata, Random random, int fortune) {
|
||||
if (metadata == 1) return Blocks.dirt;
|
||||
else return TinkerTools.craftedSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int p_149650_3_) {
|
||||
if (metadata == 1)
|
||||
return Blocks.dirt.getItemDropped(metadata, random, p_149650_3_);
|
||||
else
|
||||
return ItemSaddle.getItemFromBlock(TinkerTools.craftedSoil);
|
||||
if (metadata == 1) return Blocks.dirt.getItemDropped(metadata, random, p_149650_3_);
|
||||
else return ItemSaddle.getItemFromBlock(TinkerTools.craftedSoil);
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,17 @@ import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
public class SlimeLeaves extends BlockLeaves
|
||||
{
|
||||
private static final String[] fastLeaves = new String[] { "slimeleaves_blue_fast" };
|
||||
private static final String[] fancyLeaves = new String[] { "slimeleaves_blue_fancy" };
|
||||
public class SlimeLeaves extends BlockLeaves {
|
||||
private static final String[] fastLeaves = new String[] {"slimeleaves_blue_fast"};
|
||||
private static final String[] fancyLeaves = new String[] {"slimeleaves_blue_fancy"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] fastIcons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] fancyIcons;
|
||||
|
||||
public SlimeLeaves()
|
||||
{
|
||||
public SlimeLeaves() {
|
||||
super();
|
||||
setCreativeTab(TConstructRegistry.blockTab);
|
||||
setLightOpacity(1);
|
||||
@@ -31,34 +31,29 @@ public class SlimeLeaves extends BlockLeaves
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockColor ()
|
||||
{
|
||||
public int getBlockColor() {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor (int par1)
|
||||
{
|
||||
public int getRenderColor(int par1) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.fastIcons = new IIcon[fastLeaves.length];
|
||||
this.fancyIcons = new IIcon[fancyLeaves.length];
|
||||
|
||||
for (int i = 0; i < this.fastIcons.length; i++)
|
||||
{
|
||||
for (int i = 0; i < this.fastIcons.length; i++) {
|
||||
this.fastIcons[i] = iconRegister.registerIcon("tinker:" + fastLeaves[i]);
|
||||
this.fancyIcons[i] = iconRegister.registerIcon("tinker:" + fancyLeaves[i]);
|
||||
}
|
||||
@@ -66,28 +61,22 @@ public class SlimeLeaves extends BlockLeaves
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
int tex = meta % 1;
|
||||
this.setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);
|
||||
if (this.field_150121_P)
|
||||
return fancyIcons[tex];
|
||||
else
|
||||
return fastIcons[tex];
|
||||
if (this.field_150121_P) return fancyIcons[tex];
|
||||
else return fastIcons[tex];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < fastIcons.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < fastIcons.length; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,8 +86,7 @@ public class SlimeLeaves extends BlockLeaves
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public Item getItemDropped (int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(TinkerWorld.slimeSapling);
|
||||
}
|
||||
|
||||
@@ -106,10 +94,8 @@ public class SlimeLeaves extends BlockLeaves
|
||||
* Drops the block items with a specified chance of dropping the specified items
|
||||
*/
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance (World world, int x, int y, int z, int meta, float chance, int fortune)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune) {
|
||||
if (!world.isRemote) {
|
||||
int dropChance = 35;
|
||||
|
||||
/*if ((meta & 3) == 3)
|
||||
@@ -117,44 +103,37 @@ public class SlimeLeaves extends BlockLeaves
|
||||
j1 = 40;
|
||||
}*/
|
||||
|
||||
if (fortune > 0)
|
||||
{
|
||||
if (fortune > 0) {
|
||||
dropChance -= 2 << fortune;
|
||||
|
||||
if (dropChance < 15)
|
||||
{
|
||||
if (dropChance < 15) {
|
||||
dropChance = 15;
|
||||
}
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(dropChance) == 0)
|
||||
{
|
||||
if (world.rand.nextInt(dropChance) == 0) {
|
||||
Item k1 = this.getItemDropped(meta, world.rand, fortune);
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(k1, 1, this.damageDropped(meta)));
|
||||
}
|
||||
|
||||
dropChance = 80;
|
||||
|
||||
if (fortune > 0)
|
||||
{
|
||||
if (fortune > 0) {
|
||||
dropChance -= 10 << fortune;
|
||||
|
||||
if (dropChance < 20)
|
||||
{
|
||||
if (dropChance < 20) {
|
||||
dropChance = 20;
|
||||
}
|
||||
}
|
||||
|
||||
if ((meta & 3) == 0 && world.rand.nextInt(dropChance) == 0)
|
||||
{
|
||||
if ((meta & 3) == 0 && world.rand.nextInt(dropChance) == 0) {
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(TinkerWorld.strangeFood, 1, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] func_150125_e ()
|
||||
{
|
||||
return new String[] { "slime" };
|
||||
public String[] func_150125_e() {
|
||||
return new String[] {"slime"};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,11 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.gen.SlimeTreeGen;
|
||||
|
||||
public class SlimeSapling extends BlockSapling
|
||||
{
|
||||
public class SlimeSapling extends BlockSapling {
|
||||
public IIcon[] icons;
|
||||
public String[] textureNames = new String[] { "blue" };
|
||||
public String[] textureNames = new String[] {"blue"};
|
||||
|
||||
public SlimeSapling()
|
||||
{
|
||||
public SlimeSapling() {
|
||||
super();
|
||||
float f = 0.4F;
|
||||
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
@@ -33,95 +31,74 @@ public class SlimeSapling extends BlockSapling
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:slimesapling_" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOn (Block id)
|
||||
{
|
||||
public boolean canPlaceBlockOn(Block id) {
|
||||
return id == Blocks.grass || id == Blocks.dirt || id == TinkerWorld.slimeGrass || id == TinkerTools.craftedSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
super.updateTick(world, x, y, z, random);
|
||||
int md = world.getBlockMetadata(x, y, z);
|
||||
if (random.nextInt(10) == 0 && world.getBlockLightValue(x, y + 1, z) >= 9)
|
||||
{
|
||||
if ((md & 8) == 0)
|
||||
world.setBlockMetadataWithNotify(x, y, z, md | 8, 4);
|
||||
|
||||
else
|
||||
growTree(world, x, y, z, random);
|
||||
if (random.nextInt(10) == 0 && world.getBlockLightValue(x, y + 1, z) >= 9) {
|
||||
if ((md & 8) == 0) world.setBlockMetadataWithNotify(x, y, z, md | 8, 4);
|
||||
else growTree(world, x, y, z, random);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[meta % icons.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149879_c (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
public void func_149879_c(World world, int x, int y, int z, Random random) {
|
||||
boneFertilize(world, x, y, z, random, null);
|
||||
}
|
||||
|
||||
public boolean boneFertilize (World world, int x, int y, int z, Random random, EntityPlayer player)
|
||||
{
|
||||
public boolean boneFertilize(World world, int x, int y, int z, Random random, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta % 8 == 0 && (player == null || !player.capabilities.isCreativeMode))
|
||||
return false;
|
||||
if (meta % 8 == 0 && (player == null || !player.capabilities.isCreativeMode)) return false;
|
||||
|
||||
if ((meta & 8) == 0)
|
||||
{
|
||||
if ((meta & 8) == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta | 8, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.growTree(world, x, y, z, random);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void growTree (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
public void growTree(World world, int x, int y, int z, Random random) {
|
||||
int md = world.getBlockMetadata(x, y, z) % 8;
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
WorldGenerator obj = null;
|
||||
|
||||
obj = new SlimeTreeGen(true, 5, 4, 1, 0);
|
||||
|
||||
if (!(obj.generate(world, random, x, y, z)))
|
||||
world.setBlock(x, y, z, this, md + 8, 3);
|
||||
if (!(obj.generate(world, random, x, y, z))) world.setBlock(x, y, z, this, md + 8, 3);
|
||||
}
|
||||
|
||||
public int damageDropped (int i)
|
||||
{
|
||||
public int damageDropped(int i) {
|
||||
return i % 8;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int i = 0; i < 1; i++) par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,13 @@ import net.minecraft.world.*;
|
||||
import net.minecraftforge.common.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
{
|
||||
private static final String[] grassTypes = new String[] { "slimegrass_blue_tall" };
|
||||
public class SlimeTallGrass extends BlockBush implements IShearable {
|
||||
private static final String[] grassTypes = new String[] {"slimegrass_blue_tall"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] iconArray;
|
||||
|
||||
public SlimeTallGrass()
|
||||
{
|
||||
public SlimeTallGrass() {
|
||||
super(Material.vine);
|
||||
float f = 0.4F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
|
||||
@@ -32,17 +31,15 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
/**
|
||||
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
|
||||
*/
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
meta = MathHelper.clamp_int(meta, 0, iconArray.length-1);
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = MathHelper.clamp_int(meta, 0, iconArray.length - 1);
|
||||
return this.iconArray[meta];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
public int idDropped (int par1, Random par2Random, int par3)
|
||||
{
|
||||
public int idDropped(int par1, Random par2Random, int par3) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -51,8 +48,7 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
* (inclusive).
|
||||
*/
|
||||
@Override
|
||||
public int quantityDroppedWithBonus (int par1, Random par2Random)
|
||||
{
|
||||
public int quantityDroppedWithBonus(int par1, Random par2Random) {
|
||||
return 1 + par2Random.nextInt(par1 * 2 + 1);
|
||||
}
|
||||
|
||||
@@ -60,8 +56,7 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
* Get the block's damage value (for use with pick block).
|
||||
*/
|
||||
@Override
|
||||
public int getDamageValue (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
public int getDamageValue(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.getBlockMetadata(par2, par3, par4);
|
||||
}
|
||||
|
||||
@@ -69,10 +64,8 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks (Block b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int j = 0; j < 1; ++j)
|
||||
{
|
||||
public void getSubBlocks(Block b, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int j = 0; j < 1; ++j) {
|
||||
par3List.add(new ItemStack(b, 1, j));
|
||||
}
|
||||
}
|
||||
@@ -83,42 +76,35 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
|
||||
* is the only chance you get to register icons.
|
||||
*/
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
this.iconArray = new IIcon[grassTypes.length];
|
||||
|
||||
for (int i = 0; i < this.iconArray.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.iconArray.length; ++i) {
|
||||
this.iconArray[i] = par1IconRegister.registerIcon("tinker:" + grassTypes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops (World world, int x, int y, int z, int meta, int fortune)
|
||||
{
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
if (world.rand.nextInt(8) != 0)
|
||||
{
|
||||
if (world.rand.nextInt(8) != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ItemStack item = ForgeHooks.getGrassSeed(world);
|
||||
if (item != null)
|
||||
{
|
||||
if (item != null) {
|
||||
ret.add(item);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShearable (ItemStack item, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> onSheared (ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
{
|
||||
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
|
||||
return ret;
|
||||
|
||||
@@ -13,13 +13,11 @@ import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.model.BarricadeRender;
|
||||
|
||||
public class BarricadeBlock extends MantleBlock
|
||||
{
|
||||
public class BarricadeBlock extends MantleBlock {
|
||||
Block modelBlock;
|
||||
int modelMeta;
|
||||
|
||||
public BarricadeBlock(Block model, int meta)
|
||||
{
|
||||
public BarricadeBlock(Block model, int meta) {
|
||||
super(Material.wood);
|
||||
this.modelBlock = model;
|
||||
this.modelMeta = meta;
|
||||
@@ -29,79 +27,69 @@ public class BarricadeBlock extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return modelBlock.getIcon(2, modelMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return BarricadeRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int x, int y, int z) {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
if (meta % 4 > 0)
|
||||
{
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
if (meta % 4 > 0) {
|
||||
world.setBlock(x, y, z, this, meta - 1, 3);
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if ((stack != null) && (stack.getItem() == Item.getItemFromBlock(this)) && (!player.isSneaking()))
|
||||
{
|
||||
if ((stack != null) && (stack.getItem() == Item.getItemFromBlock(this)) && (!player.isSneaking())) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta % 4 != 3)
|
||||
{
|
||||
if (meta % 4 != 3) {
|
||||
world.setBlock(x, y, z, this, meta + 1, 3);
|
||||
this.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
this.onPostBlockPlaced(world, x, y, z, meta);
|
||||
|
||||
Block var9 = this;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var9.stepSound.soundName, (var9.stepSound.getVolume() + 1.0F) / 2.0F, var9.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(
|
||||
x + 0.5F,
|
||||
y + 0.5F,
|
||||
z + 0.5F,
|
||||
var9.stepSound.soundName,
|
||||
(var9.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
var9.stepSound.getPitch() * 0.8F);
|
||||
player.swingItem();
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize -= 1;
|
||||
if (!player.capabilities.isCreativeMode) stack.stackSize -= 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -110,25 +98,21 @@ public class BarricadeBlock extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockExploded (World world, int x, int y, int z, Explosion explosion)
|
||||
{
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||
double distance = (x - explosion.explosionX) + (y - explosion.explosionY) + (z - explosion.explosionZ);
|
||||
distance = Math.abs(distance);
|
||||
double power = (explosion.explosionSize * 2) / distance;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int trueMeta = meta % 4;
|
||||
trueMeta -= power;
|
||||
if (trueMeta < 0)
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 0);
|
||||
else
|
||||
world.setBlockMetadataWithNotify(x, y, z, (int) (meta - power), 3);
|
||||
if (trueMeta < 0) world.setBlock(x, y, z, Blocks.air, 0, 0);
|
||||
else world.setBlockMetadataWithNotify(x, y, z, (int) (meta - power), 3);
|
||||
onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,11 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class Landmine extends MantleBlock
|
||||
{
|
||||
public class Landmine extends MantleBlock {
|
||||
/** The mob type that can trigger this pressure plate. */
|
||||
private EnumCreatureType triggerMobType;
|
||||
|
||||
public Landmine(EnumCreatureType par3EnumCreatureType, Material par4Material)
|
||||
{
|
||||
public Landmine(EnumCreatureType par3EnumCreatureType, Material par4Material) {
|
||||
super(par4Material);
|
||||
this.triggerMobType = EnumCreatureType.monster;
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
@@ -30,11 +28,9 @@ public class Landmine extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y - 1, z);
|
||||
if (block != null)
|
||||
{
|
||||
if (block != null) {
|
||||
return block.getIcon(world, x, y - 1, z, side);
|
||||
}
|
||||
return Blocks.sponge.getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
@@ -42,22 +38,17 @@ public class Landmine extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.sponge.getIcon(1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {}
|
||||
|
||||
/**
|
||||
* How many world ticks before ticking
|
||||
*/
|
||||
public int tickRate ()
|
||||
{
|
||||
public int tickRate() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@@ -66,8 +57,7 @@ public class Landmine extends MantleBlock
|
||||
* box can change after the pool has been cleared to be reused)
|
||||
*/
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -77,8 +67,7 @@ public class Landmine extends MantleBlock
|
||||
* the player can attach torches, redstone wire, etc to this block.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,14 +76,12 @@ public class Landmine extends MantleBlock
|
||||
* (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -103,9 +90,9 @@ public class Landmine extends MantleBlock
|
||||
* coordinates. Args: world, x, y, z
|
||||
*/
|
||||
@Override
|
||||
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4));
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
|
||||
|| BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,17 +100,15 @@ public class Landmine extends MantleBlock
|
||||
* neighbor changed (coordinates passed are their own) Args: x, y, z,
|
||||
* neighbor blockID
|
||||
*/
|
||||
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5)
|
||||
{
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
boolean var6 = false;
|
||||
|
||||
if (!par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) && !BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4)))
|
||||
{
|
||||
if (!par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
|
||||
&& !BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4))) {
|
||||
var6 = true;
|
||||
}
|
||||
|
||||
if (var6)
|
||||
{
|
||||
if (var6) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
// par1World.setBlock(par2, par3, par4, 0);
|
||||
}
|
||||
@@ -133,12 +118,9 @@ public class Landmine extends MantleBlock
|
||||
* Ticks the block if it's been scheduled
|
||||
*/
|
||||
@Override
|
||||
public void updateTick (World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 0)
|
||||
{
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 0) {
|
||||
this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@@ -149,12 +131,9 @@ public class Landmine extends MantleBlock
|
||||
* block). Args: world, x, y, z, entity
|
||||
*/
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 1)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 1) {
|
||||
this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@@ -164,21 +143,34 @@ public class Landmine extends MantleBlock
|
||||
* Checks if there are mobs on the plate. If a mob is on the plate and it is
|
||||
* off, it turns it on, and vice versa.
|
||||
*/
|
||||
private void setStateIfMobInteractsWithPlate (World world, int posX, int posY, int posZ)
|
||||
{
|
||||
private void setStateIfMobInteractsWithPlate(World world, int posX, int posY, int posZ) {
|
||||
boolean var5 = world.getBlockMetadata(posX, posY, posZ) == 1;
|
||||
boolean var6 = false;
|
||||
float var7 = 0.125F;
|
||||
List var8 = null;
|
||||
|
||||
if (this.triggerMobType == EnumCreatureType.creature)
|
||||
{
|
||||
var8 = world.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + 1) - var7)));
|
||||
if (this.triggerMobType == EnumCreatureType.creature) {
|
||||
var8 = world.getEntitiesWithinAABBExcludingEntity(
|
||||
(Entity) null,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) posX + var7),
|
||||
(double) posY,
|
||||
(double) ((float) posZ + var7),
|
||||
(double) ((float) (posX + 1) - var7),
|
||||
(double) posY + 0.25D,
|
||||
(double) ((float) (posZ + 1) - var7)));
|
||||
}
|
||||
|
||||
if (this.triggerMobType == EnumCreatureType.monster)
|
||||
{
|
||||
var8 = world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + 1) - var7)));
|
||||
if (this.triggerMobType == EnumCreatureType.monster) {
|
||||
var8 = world.getEntitiesWithinAABB(
|
||||
EntityLiving.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) posX + var7),
|
||||
(double) posY,
|
||||
(double) ((float) posZ + var7),
|
||||
(double) ((float) (posX + 1) - var7),
|
||||
(double) posY + 0.25D,
|
||||
(double) ((float) (posZ + 1) - var7)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -190,24 +182,20 @@ public class Landmine extends MantleBlock
|
||||
* 1) - var7))); }
|
||||
*/
|
||||
|
||||
if (!var8.isEmpty())
|
||||
{
|
||||
if (!var8.isEmpty()) {
|
||||
Iterator var9 = var8.iterator();
|
||||
|
||||
while (var9.hasNext())
|
||||
{
|
||||
while (var9.hasNext()) {
|
||||
Entity var10 = (Entity) var9.next();
|
||||
|
||||
if (!var10.doesEntityNotTriggerPressurePlate())
|
||||
{
|
||||
if (!var10.doesEntityNotTriggerPressurePlate()) {
|
||||
var6 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (var6 && !var5)
|
||||
{
|
||||
if (var6 && !var5) {
|
||||
WorldHelper.setBlockToAir(world, posX, posY, posZ);
|
||||
world.createExplosion((Entity) null, posX, posY, posZ, 2.0F, true);
|
||||
/*
|
||||
@@ -230,7 +218,7 @@ public class Landmine extends MantleBlock
|
||||
* posY, posZ, posX, posY, posZ); par1World.playSoundEffect((double)posX
|
||||
* + 0.5D, (double)posY + 0.1D, (double)posZ + 0.5D, "random.click",
|
||||
* 0.3F, 0.5F); }
|
||||
*
|
||||
*
|
||||
* if (var6) { par1World.scheduleBlockUpdate(posX, posY, posZ,
|
||||
* this.blockID, this.tickRate()); }
|
||||
*/
|
||||
@@ -241,10 +229,8 @@ public class Landmine extends MantleBlock
|
||||
* update, as appropriate
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock (World par1World, int par2, int par3, int par4, Block par5, int par6)
|
||||
{
|
||||
if (par6 > 0)
|
||||
{
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
if (par6 > 0) {
|
||||
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this);
|
||||
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this);
|
||||
}
|
||||
@@ -257,17 +243,13 @@ public class Landmine extends MantleBlock
|
||||
* z
|
||||
*/
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
boolean var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 1;
|
||||
float var6 = 0.0625F;
|
||||
|
||||
if (var5)
|
||||
{
|
||||
if (var5) {
|
||||
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.03125F, 1.0F - var6);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.0625F, 1.0F - var6);
|
||||
}
|
||||
}
|
||||
@@ -276,8 +258,7 @@ public class Landmine extends MantleBlock
|
||||
* Sets the block's bounds for rendering it as an item
|
||||
*/
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender ()
|
||||
{
|
||||
public void setBlockBoundsForItemRender() {
|
||||
float var1 = 0.5F;
|
||||
float var2 = 0.125F;
|
||||
float var3 = 0.5F;
|
||||
@@ -289,8 +270,7 @@ public class Landmine extends MantleBlock
|
||||
* but can move over, 2 = total immobility and stop pistons
|
||||
*/
|
||||
@Override
|
||||
public int getMobilityFlag ()
|
||||
{
|
||||
public int getMobilityFlag() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,9 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.model.PunjiRender;
|
||||
|
||||
public class Punji extends MantleBlock
|
||||
{
|
||||
public class Punji extends MantleBlock {
|
||||
|
||||
public Punji()
|
||||
{
|
||||
public Punji() {
|
||||
super(Material.plants);
|
||||
this.setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.375f, 0.875f);
|
||||
this.stepSound = Block.soundTypeGrass;
|
||||
@@ -29,13 +27,10 @@ public class Punji extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
int damage = world.getBlockMetadata(x, y, z) / 2 + 1;
|
||||
if (entity.fallDistance > 0)
|
||||
damage += ((entity.fallDistance) * 1.5 + 2);
|
||||
if (entity.fallDistance > 0) damage += ((entity.fallDistance) * 1.5 + 2);
|
||||
entity.attackEntityFrom(DamageSource.cactus, damage);
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 1));
|
||||
}
|
||||
@@ -43,26 +38,28 @@ public class Punji extends MantleBlock
|
||||
|
||||
/* Right-click adds sticks */
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int par6, float hitX, float hitY, float hitZ) {
|
||||
/*
|
||||
* if (world.isRemote) return false;
|
||||
*/
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta < 4)
|
||||
{
|
||||
if (meta < 4) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji))
|
||||
{
|
||||
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji)) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.stepSound.soundName, (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(
|
||||
(double) ((float) x + 0.5F),
|
||||
(double) ((float) y + 0.5F),
|
||||
(double) ((float) z + 0.5F),
|
||||
this.stepSound.soundName,
|
||||
(this.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
this.stepSound.getPitch() * 0.8F);
|
||||
player.swingItem();
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
if (stack.stackSize <= 0)
|
||||
player.destroyCurrentEquippedItem();
|
||||
if (stack.stackSize <= 0) player.destroyCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,8 +67,7 @@ public class Punji extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped (int meta, int fortune, Random random)
|
||||
{
|
||||
public int quantityDropped(int meta, int fortune, Random random) {
|
||||
return meta + 1;
|
||||
}
|
||||
|
||||
@@ -81,8 +77,7 @@ public class Punji extends MantleBlock
|
||||
* the player can attach torches, redstone wire, etc to this block.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,29 +86,24 @@ public class Punji extends MantleBlock
|
||||
* (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return PunjiRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon("tinker:punji");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user