use of net.minecraft.block.entity.AbstractFurnaceBlockEntity in project LittleMaidReBirth-Fabric by SistrScarlet.
the class CookingMode method tick.
@Override
public void tick() {
AbstractFurnaceBlockEntity furnace = getFurnace(furnacePos).orElse(getFurnace(findFurnacePos().orElse(null)).orElse(null));
if (furnace == null) {
furnacePos = null;
return;
}
this.mob.getLookControl().lookAt(furnacePos.getX() + 0.5, furnacePos.getY() + 0.5, furnacePos.getZ() + 0.5);
if (!this.mob.getBlockPos().isWithinDistance(furnacePos, 2)) {
if (this.mob.isSneaking()) {
this.mob.setSneaking(false);
}
if (--this.timeToRecalcPath <= 0) {
this.timeToRecalcPath = 10;
this.mob.getNavigation().startMovingTo(furnacePos.getX() + 0.5D, furnacePos.getY() + 0.5D, furnacePos.getZ() + 0.5D, 1);
}
return;
}
this.mob.getNavigation().stop();
if (!this.mob.isSneaking()) {
this.mob.setSneaking(true);
}
Inventory inventory = this.mob.getInventory();
RecipeType<? extends AbstractCookingRecipe> recipeType = ((AbstractFurnaceAccessor) furnace).getRecipeType_LM();
getCookable(recipeType).ifPresent(cookableIndex -> tryInsertCookable(furnace, inventory, cookableIndex));
getFuel().ifPresent(fuelIndex -> tryInsertFuel(furnace, inventory, fuelIndex));
tryExtractItem(furnace, inventory);
}
use of net.minecraft.block.entity.AbstractFurnaceBlockEntity in project Polymorph by TheIllusiveC4.
the class PolymorphMod method onInitialize.
@Override
public void onInitialize() {
PolymorphNetwork.setup();
PolymorphCommands.setup();
CommonEventsListener.setup();
PolymorphIntegrations.init();
PolymorphIntegrations.setup();
PolymorphCommon commonApi = PolymorphApi.common();
commonApi.registerBlockEntity2RecipeData(AbstractFurnaceBlockEntity.class, blockEntity -> new FurnaceRecipeData((AbstractFurnaceBlockEntity) blockEntity));
commonApi.registerScreenHandler2BlockEntity(container -> {
for (Slot inventorySlot : container.slots) {
Inventory inventory = inventorySlot.inventory;
if (inventory instanceof BlockEntity) {
return (BlockEntity) inventory;
}
}
return null;
});
}
Aggregations