Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public class ItemCollectorBlockEntity extends BlockEntity
IItemResourceHandlerHolder {

private static final Table<Level, ChunkPos, Set<ItemCollectorBlockEntity>> POACHING_COLLECTORS = HashBasedTable.create();
public static final int[][] POWER_CONSUMPTION = {
{8, 12, 20, 32},
{5, 8, 12, 20},
{3, 5, 8, 12},
{2, 3, 5, 8}
};

private final WatchableCyclingValue<Integer> rangeRadius = new WatchableCyclingValue<>(
"rangeRadius", _ -> this.setChanged(),
Expand Down Expand Up @@ -115,20 +121,13 @@ public BlockPos getPos() {
return this.getBlockPos();
}

private static final Map<Integer, Map<Integer, Integer>> POWER_CONSUMPTION = Map.of(
0,
Map.of(1, 8, 2, 12, 4, 20, 8, 32),
2,
Map.of(1, 5, 2, 8, 4, 12, 8, 20),
10,
Map.of(1, 3, 2, 5, 4, 8, 8, 12),
60,
Map.of(1, 2, 2, 3, 4, 5, 8, 8)
);
public int getPowerConsumption() {
return POWER_CONSUMPTION[this.cooldown.index()][this.rangeRadius.index()];
}

@Override
public int getInputPower() {
int power = ItemCollectorBlockEntity.POWER_CONSUMPTION.get(this.cooldown.get()).get(this.rangeRadius.get());
int power = getPowerConsumption();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [Checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck> reported by reviewdog 🐶
Method call to 'getPowerConsumption' needs "this.".

if (level == null) return power;
return getBlockState().getValue(ItemCollectorBlock.POWERED) ? 0 : power;
}
Expand Down
Loading