still not working

This commit is contained in:
Mohammad-Ali Minaie
2017-04-11 07:06:46 -04:00
parent 871bb014f9
commit e34f1fdc11
2 changed files with 18 additions and 7 deletions

View File

@@ -60,9 +60,9 @@ public class Breaker extends CustomContainerFacing {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
System.out.println("tile: " + pos);
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
System.out.println(tile.getSlotStack(0));
if(state.getValue(ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, false));
tile.setCharge(0.0F);
@@ -123,8 +123,14 @@ public class Breaker extends CustomContainerFacing {
}
if(pItem.getItem() instanceof WorkMallet){
System.out.println(pItem);
tile.setSlotStack(0, pItem);
//System.out.println(pItem);
for(int i = 0; i < tile.getSlotListSize(); i++) {
tile.setSlotStack(i, pItem);
System.out.println(tile.getSlotStack(i));
tile.update();
tile.updateBlock();
tile.updateContainingBlockInfo();
}
pItem.shrink(1);
return true;

View File

@@ -25,7 +25,7 @@ public class TileBreaker extends TileBaseSlot implements ITickable {
this.charge = charge;
}
//public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(2, ItemStack.EMPTY);
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(10, ItemStack.EMPTY);
@Override
public void update () {
@@ -33,15 +33,20 @@ public class TileBreaker extends TileBaseSlot implements ITickable {
if (!world.isRemote) {
IBlockState state = world.getBlockState(this.pos);
for(int i =0; i < this.getSlotListSize(); i++) {
System.out.println(this.getSlotStack(i));
//System.out.println(this.getSlotStack(i));
}
}
}
@Override
public int getSlotLimit() {
return 1;
}
// ***************************************************************************** //
// NBT
// ***************************************************************************** //
@Override
/*@Override
public NBTTagCompound readNBT(NBTTagCompound nbt)
{
super.readNBT(nbt);
@@ -55,6 +60,6 @@ public class TileBreaker extends TileBaseSlot implements ITickable {
nbt.setFloat("charge", this.charge);
super.writeNBT(nbt);
return nbt;
}
}*/
}