Skip to content

Commit

Permalink
Use architectury fuel api for basic generator (fixed #244)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rearth committed Feb 3, 2025
1 parent c820f6f commit 89727ab
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package rearth.oritech.block.entity.generators;

import dev.architectury.registry.fuel.FuelRegistry;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Pair;
Expand All @@ -22,13 +21,10 @@

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class BasicGeneratorEntity extends UpgradableGeneratorBlockEntity {

public static final Map<Item, Integer> FUEL_MAP = AbstractFurnaceBlockEntity.createFuelTimeMap();

public BasicGeneratorEntity(BlockPos pos, BlockState state) {
super(BlockEntitiesContent.BASIC_GENERATOR_ENTITY, pos, state, Oritech.CONFIG.generators.basicGeneratorData.energyPerTick());
}
Expand All @@ -48,7 +44,7 @@ protected void tryConsumeInput() {
var firstItem = this.getInputView().get(0);
if (firstItem.isEmpty() || firstItem.getItem() instanceof BucketItem) return;

var fuelTime = FUEL_MAP.getOrDefault(firstItem.getItem(), 0);
var fuelTime = FuelRegistry.get(firstItem);
if (fuelTime > 0) {
if (firstItem.getItem() instanceof BucketItem) {
this.getInputView().set(0, ItemVariant.of(Items.BUCKET, firstItem.getComponentChanges()).toStack());
Expand Down

0 comments on commit 89727ab

Please sign in to comment.