still not working
This commit is contained in:
@@ -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) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
|
||||||
|
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
System.out.println("tile: " + pos);
|
|
||||||
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
|
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
|
||||||
ItemStack pItem = player.inventory.getCurrentItem();
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
|
System.out.println(tile.getSlotStack(0));
|
||||||
if(state.getValue(ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
|
if(state.getValue(ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
|
||||||
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, false));
|
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, false));
|
||||||
tile.setCharge(0.0F);
|
tile.setCharge(0.0F);
|
||||||
@@ -123,8 +123,14 @@ public class Breaker extends CustomContainerFacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(pItem.getItem() instanceof WorkMallet){
|
if(pItem.getItem() instanceof WorkMallet){
|
||||||
System.out.println(pItem);
|
//System.out.println(pItem);
|
||||||
tile.setSlotStack(0, 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);
|
pItem.shrink(1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class TileBreaker extends TileBaseSlot implements ITickable {
|
|||||||
this.charge = charge;
|
this.charge = charge;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(2, ItemStack.EMPTY);
|
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(10, ItemStack.EMPTY);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update () {
|
public void update () {
|
||||||
@@ -33,15 +33,20 @@ public class TileBreaker extends TileBaseSlot implements ITickable {
|
|||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
IBlockState state = world.getBlockState(this.pos);
|
IBlockState state = world.getBlockState(this.pos);
|
||||||
for(int i =0; i < this.getSlotListSize(); i++) {
|
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
|
// NBT
|
||||||
// ***************************************************************************** //
|
// ***************************************************************************** //
|
||||||
@Override
|
/*@Override
|
||||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
super.readNBT(nbt);
|
super.readNBT(nbt);
|
||||||
@@ -55,6 +60,6 @@ public class TileBreaker extends TileBaseSlot implements ITickable {
|
|||||||
nbt.setFloat("charge", this.charge);
|
nbt.setFloat("charge", this.charge);
|
||||||
super.writeNBT(nbt);
|
super.writeNBT(nbt);
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user