Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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 @@ -113,6 +113,10 @@ public class FixesConfig {
@Config.DefaultBoolean(true)
public static boolean fixFriendlyCreatureSounds;

@Config.Comment("Fix vanilla furnaces' burn time overflowing from long burn time fuel")
@Config.DefaultBoolean(true)
public static boolean fixFuelOverflow;

@Config.Comment("Fix Volume Slider is ineffective until reaching the lower end")
@Config.DefaultBoolean(true)
public static boolean logarithmicVolumeControl;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ public enum Mixins implements IMixins {
.setApplyIf(() -> SpeedupsConfig.speedupVanillaFurnace)
.addRequiredMod(TargetedMod.GTNHLIB)
.setPhase(Phase.EARLY)),
FIX_FUEL_OVERFLOW(new MixinBuilder("Fix vanilla furnace fuel overflow")
.addCommonMixins("minecraft.MixinTileEntityFurnace_FixFuelOverflow")
.setApplyIf(() -> FixesConfig.fixFuelOverflow)
.setPhase(Phase.EARLY)),
GAMEOVER_GUI_LOCKED_DISABLED(new MixinBuilder("Fix Gameover GUI")
.addClientMixins("minecraft.MixinGuiGameOver")
.setApplyIf(() -> FixesConfig.fixGuiGameOver)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(TileEntityFurnace.class)
public class MixinTileEntityFurnace_FixFuelOverflow {

/**
* Fixes BurnTime overflow with fuel over Short.MAX_VALUE BurnTime
* <p>
* Writes an Integer instead of a short for the BurnTime tag
*/
@Redirect(
method = "writeToNBT",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/nbt/NBTTagCompound;setShort(Ljava/lang/String;S)V",
ordinal = 0))
private void hodgepodge$writeBurnTime(NBTTagCompound compound, String key, short value) {
compound.setInteger(key, ((TileEntityFurnace) (Object) this).furnaceBurnTime);
}

/**
* Fixes BurnTime overflow with fuel over Short.MAX_VALUE BurnTime
* <p>
* Overwrites the getShort earlier in the method, additionally allows conversion of old short BurnTime to an Integer
*/
@Inject(method = "readFromNBT", at = @At("RETURN"))
Comment thread
playfuldoggo marked this conversation as resolved.
Outdated
private void hodgepodge$readBurnTime(NBTTagCompound compound, CallbackInfo ci) {
if (compound.hasKey("BurnTime", 3)) {
Comment thread
playfuldoggo marked this conversation as resolved.
Outdated
((TileEntityFurnace) (Object) this).furnaceBurnTime = compound.getInteger("BurnTime");
}
}
}
Loading