Skip to content

Commit

Permalink
Implement workaround for Custom Cake fuel log spam bug (#25)
Browse files Browse the repository at this point in the history
Workaround for #23. A proper fix needs to rework how we track state for custom cakes.

Avoids issue by updating the BlockCustomCake.cakeDimension value before rendering the TOP/WAILA overlays.
  • Loading branch information
Exaxxion authored Jun 2, 2021
1 parent 6de8d04 commit 162e385
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import jackyy.dimensionaledibles.item.*;
import jackyy.dimensionaledibles.registry.*;
import jackyy.dimensionaledibles.util.*;
import mcjty.theoneprobe.api.*;
import mcp.mobius.waila.api.*;
import net.minecraft.block.*;
import net.minecraft.block.state.*;
import net.minecraft.creativetab.*;
Expand All @@ -20,6 +22,8 @@

import javax.annotation.*;

import java.util.*;

import static jackyy.dimensionaledibles.DimensionalEdibles.logger;
import static net.minecraftforge.common.DimensionManager.isDimensionRegistered;

Expand Down Expand Up @@ -222,4 +226,29 @@ public ModConfig.CustomCoords customCoords(int dim) {
@Override
@Nonnull
public ItemStack defaultFuel() { return ItemStack.EMPTY; }

/*
These overrides work around the bug causing log spam in tooltips when
looking at a cake. We should still consider splitting up custom cakes
into separate objects per dimension as hot-swapping state is brittle.
*/
@Override
public void addProbeInfo(ProbeMode mode,
IProbeInfo probeInfo,
EntityPlayer player,
World world,
IBlockState blockState,
IProbeHitData data) {
this.cakeDimension = getDimension(world, data.getPos());
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
}

@Override
public List<String> getWailaBody(ItemStack itemStack,
List<String> currentTip,
IWailaDataAccessor accessor,
IWailaConfigHandler config) {
this.cakeDimension = getDimension(accessor.getWorld(), accessor.getPosition());
return super.getWailaBody(itemStack, currentTip, accessor, config);
}
}

0 comments on commit 162e385

Please sign in to comment.