Skip to content

Commit

Permalink
added getDefaultMiningSpeed method to IAntimatterTool
Browse files Browse the repository at this point in the history
also fixed an array initialization using the c format instead of the java format
  • Loading branch information
Trinsdar committed Dec 7, 2023
1 parent ae498d4 commit 4100766
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ protected void serverTick(Level level, BlockPos pos, BlockState state) {
public void onServerTickPre(Level level, BlockPos pos, boolean aFirst) {
transferredAmount = 0;

PlatformFluidHandler adjacentFluidHandlers[] = new PlatformFluidHandler[6];
PlatformFluidHandler[] adjacentFluidHandlers = new PlatformFluidHandler[6];
PipeFluidHandler pipeFluidHandler = fluidHandler.orElse(null);
if (pipeFluidHandler == null) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ default Tier getTier(ItemStack stack) {
return tier.orElseGet(() -> resolveTierTag(dataTag));
}

default float getDefaultMiningSpeed(ItemStack stack){
return getTier(stack).getSpeed() * getAntimatterToolType().getMiningSpeedMultiplier();
}

default ItemStack resolveStack(Material primary, Material secondary, long startingEnergy, long maxEnergy) {
Item item = getItem();
ItemStack stack = new ItemStack(item);
Expand Down Expand Up @@ -232,7 +236,7 @@ default void onGenericAddInformation(ItemStack stack, List<Component> tooltip, T
tooltip.add(Utils.translatable("antimatter.tooltip.energy").append(": " + getCurrentEnergy(stack) + " / " + getMaxEnergy(stack)));
if (getAntimatterToolType().getTooltip().size() != 0) tooltip.addAll(getAntimatterToolType().getTooltip());
tooltip.add(Utils.translatable("antimatter.tooltip.mining_level", getTier(stack).getLevel()).withStyle(ChatFormatting.YELLOW));
tooltip.add(Utils.translatable("antimatter.tooltip.tool_speed", Utils.literal("" + getItem().getDestroySpeed(stack, Blocks.AIR.defaultBlockState())).withStyle(ChatFormatting.LIGHT_PURPLE)));
tooltip.add(Utils.translatable("antimatter.tooltip.tool_speed", Utils.literal("" + getDefaultMiningSpeed(stack)).withStyle(ChatFormatting.LIGHT_PURPLE)));
for (Map.Entry<String, IBehaviour<IAntimatterTool>> e : getAntimatterToolType().getBehaviours().entrySet()) {
IBehaviour<?> b = e.getValue();
if (!(b instanceof IAddInformation addInformation)) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity atta

@Override
public float getDestroySpeed(ItemStack stack, BlockState state) {
float destroySpeed = state.getBlock() == Blocks.AIR || isCorrectToolForDrops(stack, state) ? getTier(stack).getSpeed() * getAntimatterToolType().getMiningSpeedMultiplier() : 1.0F;
float destroySpeed = state.getBlock() == Blocks.AIR || isCorrectToolForDrops(stack, state) ? getDefaultMiningSpeed(stack) : 1.0F;
if (type.isPowered() && getCurrentEnergy(stack) == 0){
destroySpeed = 0.0f;
}
Expand Down

0 comments on commit 4100766

Please sign in to comment.