Iron furnace drops experience. Still need to save fuel time to tag

This commit is contained in:
drcrazy 2019-08-28 02:46:56 +03:00
parent 09b59d6c87
commit 0d68f794ae
4 changed files with 57 additions and 25 deletions

View file

@ -60,7 +60,7 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
int outputSlot = 1;
int fuelSlot = 2;
boolean active = false;
private float experience;
public float experience;
public IronFurnaceBlockEntity() {
super(TRBlockEntities.IRON_FURNACE);
@ -161,10 +161,10 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
totalExperience -= expToDrop;
player.world.spawnEntity(new ExperienceOrbEntity(player.world, player.x, player.y + 0.5D, player.z + 0.5D, expToDrop));
}
experience = 0;
}
experience = 0;
}
private void updateState() {
BlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof BlockMachineBase) {
@ -269,6 +269,14 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
public void setProgress(int progress) {
this.progress = progress;
}
public float getExperience() {
return experience;
}
public void setExperience(float experience) {
this.experience = experience;
}
@Override
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
@ -276,6 +284,8 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
.addInventory().blockEntity(this).fuelSlot(2, 56, 53).slot(0, 56, 17).outputSlot(1, 116, 35)
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getProgress, this::setProgress)
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this, syncID);
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime)
.sync(this::getExperience, this::setExperience)
.addInventory().create(this, syncID);
}
}