mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Another status update.
Getting to the finish line when it comes to removing compile-breaking bugs!
This commit is contained in:
parent
02e66e23df
commit
db1e183e45
14 changed files with 203 additions and 290 deletions
|
@ -18,6 +18,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
|
@ -29,11 +30,11 @@ public class Position extends BlockPos{
|
|||
super(x, y, z);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(World world){
|
||||
public TileEntity getTileEntity(IBlockAccess world){
|
||||
return world != null ? world.getTileEntity(this) : null;
|
||||
}
|
||||
|
||||
public Material getMaterial(World world){
|
||||
public Material getMaterial(IBlockAccess world){
|
||||
if(world != null){
|
||||
Block block = this.getBlock(world);
|
||||
if(block != null){
|
||||
|
@ -43,11 +44,11 @@ public class Position extends BlockPos{
|
|||
return null;
|
||||
}
|
||||
|
||||
public Item getItemBlock(World world){
|
||||
public Item getItemBlock(IBlockAccess world){
|
||||
return world != null ? Item.getItemFromBlock(this.getBlock(world)) : null;
|
||||
}
|
||||
|
||||
public Block getBlock(World world){
|
||||
public Block getBlock(IBlockAccess world){
|
||||
if(world != null){
|
||||
IBlockState state = this.getBlockState(world);
|
||||
if(state != null){
|
||||
|
@ -57,12 +58,12 @@ public class Position extends BlockPos{
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getMetadata(World world){
|
||||
public int getMetadata(IBlockAccess world){
|
||||
//TODO Fix meta
|
||||
return /*world != null ? world.getBlockMetadata(this.x, this.y, this.z) : */0;
|
||||
}
|
||||
|
||||
public void setMetadata(World world, int meta, int flag){
|
||||
public void setMetadata(IBlockAccess world, int meta, int flag){
|
||||
//TODO Fix meta
|
||||
/*if(world != null){
|
||||
world.setBlockMetadataWithNotify(this.x, this.y, this.z, meta, flag);
|
||||
|
@ -95,7 +96,7 @@ public class Position extends BlockPos{
|
|||
return new Vec3(this.getX(), this.getY(), this.getZ());
|
||||
}
|
||||
|
||||
public IBlockState getBlockState(World world){
|
||||
public IBlockState getBlockState(IBlockAccess world){
|
||||
return world != null ? world.getBlockState(this) : null;
|
||||
}
|
||||
|
||||
|
@ -103,9 +104,12 @@ public class Position extends BlockPos{
|
|||
return new Position(this.getX()+side.getFrontOffsetX(), this.getY()+side.getFrontOffsetY(), this.getZ()+side.getFrontOffsetZ());
|
||||
}
|
||||
|
||||
public Position getOffsetPosition(int x, int y, int z){
|
||||
return new Position(this.getX()+x, this.getY()+y, this.getZ()+z);
|
||||
}
|
||||
|
||||
public static Position fromTileEntity(TileEntity tile){
|
||||
BlockPos pos = tile.getPos();
|
||||
return new Position(pos.getX(), pos.getY(), pos.getZ());
|
||||
return fromBlockPos(tile.getPos());
|
||||
}
|
||||
|
||||
public static Position fromBlockPos(BlockPos pos){
|
||||
|
|
|
@ -10,16 +10,15 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
@ -27,20 +26,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockGiantChest extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockGiantChest(String name){
|
||||
super(Material.wood, name);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
|
@ -55,40 +49,26 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return side == 1 ? this.topIcon : (side == 0 ? this.bottomIcon : this.blockIcon);
|
||||
}
|
||||
|
||||
@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, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(x, y, z);
|
||||
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos);
|
||||
if(chest != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
|
@ -99,14 +79,14 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, pos, state, fortune);
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
int place = ItemUtil.getPlaceAt(slots, new ItemStack(InitItems.itemCrateKeeper), false);
|
||||
|
@ -137,14 +117,14 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
if(!ItemUtil.contains(((TileEntityGiantChest)tile).slots, new ItemStack(InitItems.itemCrateKeeper), false)){
|
||||
this.dropInventory(world, x, y, z);
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,31 +10,24 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockItemRepairer extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockItemRepairer(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -50,23 +43,11 @@ public class BlockItemRepairer extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 0){
|
||||
return this.bottomIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@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, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(x, y, z);
|
||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos);
|
||||
if(repairer != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -74,26 +55,18 @@ public class BlockItemRepairer extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0;
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos){
|
||||
return Position.fromBlockPos(pos).getMetadata(world) == 1 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,22 +10,22 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
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.init.Blocks;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -40,14 +40,9 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axis, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,25 +50,19 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
return AssetUtil.laserRelayRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata){
|
||||
return side;
|
||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
|
||||
return this.getStateFromMeta(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
|
||||
int meta = Position.fromBlockPos(pos).getMetadata(world);
|
||||
|
||||
float pixel = 1F/16F;
|
||||
if(meta == 0){
|
||||
|
@ -96,15 +85,9 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.stone.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,20 +10,21 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -45,20 +46,9 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.fullBlock.getIcon(side, this.meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axis, list, entity);
|
||||
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,19 +57,19 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float hitX, float hitY, float hitZ, int meta){
|
||||
if(side == 1){
|
||||
return meta;
|
||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
|
||||
if(facing.ordinal() == 1){
|
||||
return this.getStateFromMeta(meta);
|
||||
}
|
||||
if(side == 0 || hitY >= 0.5F){
|
||||
return meta+1;
|
||||
if(facing.ordinal() == 0 || hitY >= 0.5F){
|
||||
return this.getStateFromMeta(meta+1);
|
||||
}
|
||||
return meta;
|
||||
return this.getStateFromMeta(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
|
||||
int meta = Position.fromBlockPos(pos).getMetadata(world);
|
||||
float minY = meta == 1 ? 0.5F : 0.0F;
|
||||
float maxY = meta == 1 ? 1.0F : 0.5F;
|
||||
this.setBlockBounds(0.0F, minY, 0F, 1.0F, maxY, 1.0F);
|
||||
|
@ -90,12 +80,6 @@ public class BlockSlabs extends BlockBase{
|
|||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
|
@ -103,7 +87,7 @@ public class BlockSlabs extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
@ -115,15 +99,16 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
|
||||
if(world.getBlock(x, y, z) == this.field_150939_a && ((side == 1 && world.getBlockMetadata(x, y, z) == 0) || (side == 0 && world.getBlockMetadata(x, y, z) == 1))){
|
||||
if(world.setBlock(x, y, z, ((BlockSlabs)this.field_150939_a).fullBlock, ((BlockSlabs)this.field_150939_a).meta, 3)){
|
||||
world.playSoundEffect(x+0.5F, y+0.5F, z+0.5F, this.field_150939_a.stepSound.getBreakSound(), (this.field_150939_a.stepSound.getVolume()+1.0F)/2.0F, this.field_150939_a.stepSound.getPitch()*0.8F);
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
|
||||
Position thePos = Position.fromBlockPos(pos);
|
||||
if(thePos.getBlock(world) == this.block && ((side.ordinal() == 1 && thePos.getMetadata(world) == 0) || (side.ordinal() == 0 && thePos.getMetadata(world) == 1))){
|
||||
if(thePos.setBlock(world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){
|
||||
world.playSoundEffect(thePos.getX()+0.5F, thePos.getY()+0.5F, thePos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F);
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
@ -110,18 +111,18 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
|
||||
this.updateRedstoneState(world, pos);
|
||||
this.updateRedstoneState(world, Position.fromBlockPos(pos));
|
||||
}
|
||||
|
||||
public void updateRedstoneState(World world, Position pos){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityBase){
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0;
|
||||
boolean wasPowered = ((TileEntityBase)tile).isRedstonePowered;
|
||||
if(powered && !wasPowered){
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
}
|
||||
((TileEntityBase)tile).setRedstonePowered(true);
|
||||
}
|
||||
|
@ -133,9 +134,9 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random){
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
((IRedstoneToggle)tile).activateOnPulse();
|
||||
}
|
||||
|
@ -143,9 +144,9 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
((IEnergySaver)tile).setEnergy(stack.getTagCompound().getInteger("Energy"));
|
||||
|
@ -171,9 +172,9 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player){
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
this.dropBlockAsItem(world, pos, state, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,8 +184,8 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public int getComparatorInputOverride(World world, BlockPos pos){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IInventory){
|
||||
return Container.calcRedstoneFromInventory((IInventory)tile);
|
||||
}
|
||||
|
@ -192,12 +193,12 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null){
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(metadata, Util.RANDOM, fortune), 1, this.damageDropped(metadata));
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(state, Util.RANDOM, fortune), 1, this.damageDropped(state));
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
int energy = ((IEnergySaver)tile).getEnergy();
|
||||
|
@ -236,7 +237,7 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
|
||||
this.updateRedstoneState(world, pos);
|
||||
this.updateRedstoneState(world, Position.fromBlockPos(pos));
|
||||
}
|
||||
|
||||
public boolean tryToggleRedstone(World world, Position pos, EntityPlayer player){
|
||||
|
|
|
@ -13,14 +13,10 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemAxeAA extends ItemAxe{
|
||||
|
||||
|
@ -66,16 +62,4 @@ public class ItemAxeAA extends ItemAxe{
|
|||
public EnumRarity getRarity(ItemStack stack){
|
||||
return this.rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
|
@ -19,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -83,12 +85,12 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
WorldUtil.fillBucket(tank, slots, 1, 2);
|
||||
|
||||
if(this.tank.getFluidAmount() > 0){
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.DOWN, this.tank);
|
||||
if(!this.isRedstonePowered){
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.NORTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.EAST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.SOUTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.WEST, this.tank);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +123,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -131,37 +133,37 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return slot == 2 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain){
|
||||
if(resource.getFluid() == InitBlocks.fluidCanolaOil){
|
||||
return this.tank.drain(resource.amount, doDrain);
|
||||
}
|
||||
|
@ -169,22 +171,22 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain){
|
||||
return this.tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
public boolean canFill(EnumFacing from, Fluid fluid){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return from != ForgeDirection.UP;
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid){
|
||||
return from != EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -129,7 +129,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){
|
||||
if(this.storage.getEnergyStored() >= ENERGY_USED){
|
||||
if(this.brewTime%30 == 0){
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, ModUtil.MOD_ID_LOWER+":coffeeMachine", 0.35F, 1.0F);
|
||||
this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":coffeeMachine", 0.35F, 1.0F);
|
||||
}
|
||||
|
||||
this.brewTime++;
|
||||
|
@ -167,7 +167,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return slot == SLOT_OUTPUT || (slot >= 3 && slot < this.slots.length-2 && ItemCoffee.getIngredientFromStack(stack) == null) || slot == SLOT_WATER_OUTPUT;
|
||||
}
|
||||
|
||||
|
@ -189,52 +189,52 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
return resource.getFluid() == FluidRegistry.WATER && from != ForgeDirection.DOWN ? this.tank.fill(resource, doFill) : 0;
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill){
|
||||
return resource.getFluid() == FluidRegistry.WATER && from != EnumFacing.DOWN ? this.tank.fill(resource, doFill) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
public boolean canFill(EnumFacing from, Fluid fluid){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,11 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -80,14 +81,15 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
|
||||
if(flag != (this.firstSmeltTime > 0 || this.secondSmeltTime > 0)){
|
||||
this.markDirty();
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
Position thisPos = Position.fromTileEntity(this);
|
||||
int meta = thisPos.getMetadata(worldObj);
|
||||
if(meta > 3){
|
||||
if(!this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1) && !this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2)){
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta-4, 2);
|
||||
thisPos.setMetadata(worldObj, meta-4, 2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta+4, 2);
|
||||
thisPos.setMetadata(worldObj, meta+4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +119,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
|
||||
public boolean canSmeltOn(int theInput, int theOutput){
|
||||
if(this.slots[theInput] != null){
|
||||
ItemStack output = FurnaceRecipes.smelting().getSmeltingResult(this.slots[theInput]);
|
||||
ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.slots[theInput]);
|
||||
if(this.slots[theInput] != null){
|
||||
if(output != null){
|
||||
if(this.slots[theOutput] == null || (this.slots[theOutput].isItemEqual(output) && this.slots[theOutput].stackSize <= this.slots[theOutput].getMaxStackSize()-output.stackSize)){
|
||||
|
@ -130,7 +132,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
public void finishBurning(int theInput, int theOutput){
|
||||
ItemStack output = FurnaceRecipes.smelting().getSmeltingResult(this.slots[theInput]);
|
||||
ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.slots[theInput]);
|
||||
if(this.slots[theOutput] == null){
|
||||
this.slots[theOutput] = output.copy();
|
||||
}
|
||||
|
@ -160,37 +162,37 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,12 +13,13 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -50,22 +51,22 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -124,14 +125,15 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
|
||||
if(flag != (this.firstCrushTime > 0 || this.secondCrushTime > 0)){
|
||||
this.markDirty();
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
Position thisPos = Position.fromTileEntity(this);
|
||||
int meta = thisPos.getMetadata(worldObj);
|
||||
if(meta == 1){
|
||||
if(!this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2) && (!this.isDouble || !this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2))){
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
|
||||
thisPos.setMetadata(worldObj, 0, 2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
|
||||
thisPos.setMetadata(worldObj, 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,7 +144,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
if(shouldPlaySound){
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, ModUtil.MOD_ID_LOWER+":crusher", 0.25F, 1.0F);
|
||||
this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":crusher", 0.25F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +254,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -262,7 +264,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.block.BlockLiquid;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -51,7 +51,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
super.updateEntity();
|
||||
if(!this.worldObj.isRemote){
|
||||
if(this.layerAt == -1){
|
||||
this.layerAt = this.yCoord-1;
|
||||
this.layerAt = this.getPos().getY()-1;
|
||||
}
|
||||
|
||||
if(!this.isRedstonePowered && this.ticksElapsed%5 == 0){
|
||||
|
@ -90,7 +90,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block)+(meta << 12));
|
||||
worldObj.setBlockToAir(x, y, z);
|
||||
|
||||
WorldUtil.addToInventory(this, drops, ForgeDirection.UNKNOWN, true);
|
||||
WorldUtil.addToInventory(this, drops, true, true);
|
||||
this.markDirty();
|
||||
|
||||
this.storage.extractEnergy(actualUse, false);
|
||||
|
@ -122,7 +122,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
}
|
||||
}
|
||||
|
||||
String reg = Block.blockRegistry.getNameForObject(block);
|
||||
String reg = block.getRegistryName();
|
||||
if(reg != null && !reg.isEmpty()){
|
||||
for(String string : ConfigValues.minerExtraWhitelist){
|
||||
if(reg.equals(string)){
|
||||
|
@ -136,7 +136,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
}
|
||||
|
||||
private boolean isBlacklisted(Block block){
|
||||
String reg = Block.blockRegistry.getNameForObject(block);
|
||||
String reg = block.getRegistryName();
|
||||
if(reg != null && !reg.isEmpty()){
|
||||
for(String string : ConfigValues.minerBlacklist){
|
||||
if(reg.equals(string)){
|
||||
|
@ -148,7 +148,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
}
|
||||
|
||||
private void shootParticles(int endX, int endY, int endZ){
|
||||
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(xCoord, yCoord, zCoord, endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 96));
|
||||
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -168,32 +168,32 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -43,7 +44,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
this.range = upgradeRange(RANGE, worldObj, xCoord, yCoord, zCoord);
|
||||
this.range = upgradeRange(RANGE, worldObj, Position.fromBlockPos(this.getPos()));
|
||||
|
||||
if(!this.hasBoundPosition()){
|
||||
this.boundPosition = null;
|
||||
|
@ -54,12 +55,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
this.boundPosBefore = this.boundPosition;
|
||||
this.boundBlockBefore = this.boundPosition == null ? null : this.boundPosition.getBlock(worldObj);
|
||||
|
||||
this.getWorldObj().markBlockForUpdate(this.xCoord+1, this.yCoord, this.zCoord);
|
||||
this.getWorldObj().markBlockForUpdate(this.xCoord-1, this.yCoord, this.zCoord);
|
||||
this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord+1, this.zCoord);
|
||||
this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord-1, this.zCoord);
|
||||
this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord+1);
|
||||
this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord-1);
|
||||
this.worldObj.markBlockForUpdate(new Position(this.getPos().getX()+1, this.getPos().getY(), this.getPos().getZ()));
|
||||
this.worldObj.markBlockForUpdate(new Position(this.getPos().getX()-1, this.getPos().getY(), this.getPos().getZ()));
|
||||
this.worldObj.markBlockForUpdate(new Position(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ()));
|
||||
this.worldObj.markBlockForUpdate(new Position(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()));
|
||||
this.worldObj.markBlockForUpdate(new Position(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()+1));
|
||||
this.worldObj.markBlockForUpdate(new Position(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()-1));
|
||||
this.sendUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
|
@ -96,10 +97,10 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
}
|
||||
|
||||
public static int upgradeRange(int defaultRange, World world, int x, int y, int z){
|
||||
public static int upgradeRange(int defaultRange, World world, Position pos){
|
||||
int newRange = defaultRange;
|
||||
for(int i = 0; i < 3; i++){
|
||||
Block block = world.getBlock(x, y+1+i, z);
|
||||
Block block = pos.getOffsetPosition(0, 1+i, 0).getBlock(world);
|
||||
if(block == InitBlocks.blockPhantomBooster){
|
||||
newRange = newRange*2;
|
||||
}
|
||||
|
@ -113,7 +114,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
@Override
|
||||
public boolean hasBoundPosition(){
|
||||
if(this.boundPosition != null){
|
||||
if(worldObj.getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IPhantomTile || (this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ())){
|
||||
if(worldObj.getTileEntity(boundPosition) instanceof IPhantomTile || (this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ())){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
|
@ -133,17 +134,17 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
double d5 = (double)(Util.RANDOM.nextFloat()*1.0F*(float)j1);
|
||||
double d0 = (double)this.boundPosition.getX()+0.5D+0.25D*(double)i1;
|
||||
double d3 = (double)(Util.RANDOM.nextFloat()*1.0F*(float)i1);
|
||||
worldObj.spawnParticle("portal", d0, d1, d2, d3, d4, d5);
|
||||
worldObj.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
|
||||
}
|
||||
|
||||
if(this.ticksElapsed%80 == 0){
|
||||
PacketParticle.renderParticlesFromAToB(xCoord, yCoord, zCoord, boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), 2, 0.35F, COLORS, 3);
|
||||
PacketParticle.renderParticlesFromAToB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), 2, 0.35F, COLORS, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundThingInRange(){
|
||||
return this.hasBoundPosition() && this.boundPosition.toVec().distanceTo(Vec3.createVectorHelper(xCoord, yCoord, zCoord)) <= this.range;
|
||||
return this.hasBoundPosition() && this.boundPosition.toVec().distanceTo(Position.fromBlockPos(this.getPos()).toVec()) <= this.range;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -167,12 +168,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,10 +259,6 @@ public class WorldUtil{
|
|||
return blocks;
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, int start, int end, ArrayList<ItemStack> stacks, boolean actuallyDo){
|
||||
return addToInventory(inventory, start, end, stacks, EnumFacing.UP, actuallyDo, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an ArrayList of ItemStacks to an Array of slots
|
||||
*
|
||||
|
@ -315,12 +311,12 @@ public class WorldUtil{
|
|||
return working >= stacks.size();
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, boolean actuallyDo){
|
||||
return addToInventory(inventory, stacks, EnumFacing.UP, actuallyDo);
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, boolean actuallyDo, boolean shouldAlwaysWork){
|
||||
return addToInventory(inventory, stacks, EnumFacing.UP, actuallyDo, shouldAlwaysWork);
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, EnumFacing side, boolean actuallyDo){
|
||||
return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, false);
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, EnumFacing side, boolean actuallyDo, boolean shouldAlwaysWork){
|
||||
return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork);
|
||||
}
|
||||
|
||||
public static int findFirstFilledSlot(ItemStack[] slots){
|
||||
|
@ -369,11 +365,11 @@ public class WorldUtil{
|
|||
Block block = pos.getBlock(world);
|
||||
int meta = pos.getMetadata(world);
|
||||
//If the Block can be harvested or not
|
||||
boolean canHarvest = block.canHarvestBlock(world, pos.toBlockPos(), player);
|
||||
boolean canHarvest = block.canHarvestBlock(world, pos, player);
|
||||
|
||||
//Send Block Breaking Event
|
||||
if(player instanceof EntityPlayerMP){
|
||||
int event = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).theItemInWorldManager.getGameType(), (EntityPlayerMP)player, pos.toBlockPos());
|
||||
int event = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).theItemInWorldManager.getGameType(), (EntityPlayerMP)player, pos);
|
||||
if(event == -1){
|
||||
return false;
|
||||
}
|
||||
|
@ -381,29 +377,29 @@ public class WorldUtil{
|
|||
|
||||
if(!world.isRemote){
|
||||
//Server-Side only, special cases
|
||||
block.onBlockHarvested(world, pos.toBlockPos(), pos.getBlockState(world), player);
|
||||
block.onBlockHarvested(world, pos, pos.getBlockState(world), player);
|
||||
}
|
||||
else{
|
||||
//Shows the Harvest Particles and plays the Block's Sound
|
||||
world.playAuxSFX(2001, pos.toBlockPos(), Block.getIdFromBlock(block)+(meta << 12));
|
||||
world.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(meta << 12));
|
||||
}
|
||||
|
||||
//If the Block was actually "removed", meaning it will drop an Item
|
||||
boolean removed = block.removedByPlayer(world, pos.toBlockPos(), player, canHarvest);
|
||||
boolean removed = block.removedByPlayer(world, pos, player, canHarvest);
|
||||
//Actually removes the Block from the World
|
||||
if(removed){
|
||||
//Before the Block is destroyed, special cases
|
||||
block.onBlockDestroyedByPlayer(world, pos.toBlockPos(), pos.getBlockState(world));
|
||||
block.onBlockDestroyedByPlayer(world, pos, pos.getBlockState(world));
|
||||
|
||||
if(!world.isRemote && !player.capabilities.isCreativeMode){
|
||||
//Actually drops the Block's Items etc.
|
||||
if(canHarvest){
|
||||
block.harvestBlock(world, player, pos.toBlockPos(), pos.getBlockState(world), pos.getTileEntity(world));
|
||||
block.harvestBlock(world, player, pos, pos.getBlockState(world), pos.getTileEntity(world));
|
||||
}
|
||||
//Only drop XP when no Silk Touch is applied
|
||||
if(!EnchantmentHelper.getSilkTouchModifier(player)){
|
||||
//Drop XP depending on Fortune Level
|
||||
block.dropXpOnBlockBreak(world, pos.toBlockPos(), block.getExpDrop(world, pos.toBlockPos(), EnchantmentHelper.getFortuneModifier(player)));
|
||||
block.dropXpOnBlockBreak(world, pos, block.getExpDrop(world, pos, EnchantmentHelper.getFortuneModifier(player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +407,7 @@ public class WorldUtil{
|
|||
if(!world.isRemote){
|
||||
//Update the Client of a Block Change
|
||||
if(player instanceof EntityPlayerMP){
|
||||
((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos.toBlockPos()));
|
||||
((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos));
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
Loading…
Reference in a new issue