Skip to content

Commit

Permalink
Merge branch 'master' into fastload
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Jun 24, 2024
2 parents 856c3db + f507d9f commit b184c31
Show file tree
Hide file tree
Showing 22 changed files with 518 additions and 26 deletions.
14 changes: 7 additions & 7 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ dependencies {

compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:1.0.2") { transitive = false }

transformedMod("com.github.GTNewHorizons:NotEnoughItems:2.5.27-GTNH:dev") // force a more up-to-date NEI version
transformedModCompileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-400-GTNH")
transformedMod("com.github.GTNewHorizons:NotEnoughItems:2.6.5-GTNH:dev") // force a more up-to-date NEI version
transformedModCompileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-405-GTNH")
transformedModCompileOnly("com.github.GTNewHorizons:Baubles:1.0.4:dev")
// Transitive updates to make runClient17 work
transformedModCompileOnly("com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev")
transformedModCompileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.46.02:dev")
transformedModCompileOnly("com.github.GTNewHorizons:harvestcraft:1.1.10-GTNH:dev")
transformedModCompileOnly("com.github.GTNewHorizons:ForgeMultipart:1.5.0:dev")
transformedModCompileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.48.37:dev")
transformedModCompileOnly("com.github.GTNewHorizons:harvestcraft:1.2.1-GTNH:dev")
transformedModCompileOnly("com.github.GTNewHorizons:HungerOverhaul:1.1.0-GTNH:dev")
transformedModCompileOnly("com.github.GTNewHorizons:MrTJPCore:1.1.7:dev") // Do not update, fixed afterwards
transformedModCompileOnly("com.github.GTNewHorizons:MrTJPCore:1.2.0:dev") // Do not update, fixed afterwards
transformedModCompileOnly("com.github.GTNewHorizons:Railcraft:9.15.8:dev") { exclude group: "thaumcraft", module: "Thaumcraft" }
transformedModCompileOnly("com.github.GTNewHorizons:TinkersConstruct:1.11.15-GTNH:dev")
transformedModCompileOnly("com.github.GTNewHorizons:TinkersConstruct:1.12.2-GTNH:dev")
transformedModCompileOnly(deobfCurse("bibliocraft-228027:2423369"))
transformedModCompileOnly("curse.maven:biomes-o-plenty-220318:2499612")
transformedModCompileOnly("curse.maven:cofh-core-69162:2388751")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
}


16 changes: 16 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/Hodgepodge.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.mitchej123.hodgepodge.util.AnchorAlarm;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ICrashCallable;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
Expand Down Expand Up @@ -36,6 +37,21 @@ public class Hodgepodge {
isGTNH = true;
}

public Hodgepodge() {
FMLCommonHandler.instance().registerCrashCallable(new ICrashCallable() {

@Override
public String getLabel() {
return "CPU Threads";
}

@Override
public String call() {
return String.valueOf(Runtime.getRuntime().availableProcessors());
}
});
}

@EventHandler
public void preinit(FMLPreInitializationEvent event) {
Compat.init(event.getSide());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
package com.mitchej123.hodgepodge;

import java.util.Set;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.ZombieEvent;

import com.mitchej123.hodgepodge.config.TweaksConfig;
import com.mitchej123.hodgepodge.net.MessageConfigSync;
import com.mitchej123.hodgepodge.net.NetworkHandler;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;

public class HodgepodgeEventHandler {

public static final Set<EntityPlayerMP> playersClosedContainers = new ReferenceOpenHashSet<>();

public void preinit() {
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
Expand All @@ -36,4 +44,26 @@ public void setAidTriggerDisabled(boolean disableAidTrigger) {
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
NetworkHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) event.player);
}

@SubscribeEvent
public void onItemToss(ItemTossEvent event) {
// Already handled
if (event.isCanceled()) return;

if (TweaksConfig.avoidDroppingItemsWhenClosing && event.player instanceof EntityPlayerMP
&& playersClosedContainers.contains(event.player)) {
if (event.player.inventory.addItemStackToInventory(event.entityItem.getEntityItem())) {
event.setCanceled(true);
}
}
}

@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
if (event.phase == TickEvent.Phase.END && TweaksConfig.avoidDroppingItemsWhenClosing
&& !playersClosedContainers.isEmpty()) {
playersClosedContainers.clear();
}
}

}
40 changes: 40 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixFriendlyCreatureSounds;

@Config.Comment("Fix Volume Slider is ineffective until reaching the lower end")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean logarithmicVolumeControl;

@Config.Comment("Fix vanilla light calculation sometimes cause NPE on thermos")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
Expand Down Expand Up @@ -317,6 +322,16 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean validatePacketEncodingBeforeSendingShouldCrash;

@Config.Comment("Checks saved TileEntity coordinates earlier to provide a more descriptive error message")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean earlyChunkTileCoordinateCheck;

@Config.Comment("Destroy and log TileEntities failing the safe coordinate instead of crashing the game (can cause loss of data)")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean earlyChunkTileCoordinateCheckDestructive;

// affecting multiple mods

@Config.Comment("Remove old/stale/outdated update checks.")
Expand Down Expand Up @@ -384,6 +399,11 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixExtraUtilitiesDrumEatingCells;

@Config.Comment("Fix Extra Utilities Lapis Caelestis microblocks rendering")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixExtraUtilitiesGreenscreenMicroblocks;

@Config.Comment("Fixes rendering issues with transparent items from Extra Utilities")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
Expand All @@ -394,6 +414,16 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixExtraUtilitiesUnEnchanting;

@Config.Comment("Remove rain from the Last Millenium (Extra Utilities)")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixExtraUtilitiesLastMilleniumRain;

@Config.Comment("Remove creatures from the Last Millenium (Extra Utilities)")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixExtraUtilitiesLastMilleniumCreatures;

// Galacticraft

@Config.Comment("Fix time commands with GC")
Expand Down Expand Up @@ -546,6 +576,11 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixThaumcraftLeavesLag;

@Config.Comment("Fix Thaumcraft wand pedestal vis duplication")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixWandPedestalVisDuplication;

// Thermal Dynamics

@Config.Comment("Prevent crash with Thermal Dynamics from Negative Array Exceptions from item duct transfers")
Expand Down Expand Up @@ -577,6 +612,11 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixWitcheryReflections;

@Config.Comment("Enhanced Witchery Thunder Detection for rituals and Witch Hunters")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixWitcheryThunderDetection;

// Xaero's World Map

@Config.Comment("Fix scrolling in the world map screen")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ public class TweaksConfig {
@Config.RequiresMcRestart
public static boolean makeBigFirsPlantable;

@Config.Comment("Remove the BOP quicksand generation")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean removeBOPQuicksandGeneration;

// Extra Utilities

@Config.Comment("Disables the spawn of zombie aid when zombie is killed by Extra Utilities Spikes, since it can spawn them too far.")
Expand Down Expand Up @@ -272,4 +277,8 @@ public class TweaksConfig {
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean disableModdedChunkPopulation;

@Config.Comment("Avoids droping items on container close, and instead places them in the player inventory. (Inspired from EFR)")
@Config.DefaultBoolean(true)
public static boolean avoidDroppingItemsWhenClosing;
}
38 changes: 37 additions & 1 deletion src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public enum Mixins {
FIX_FRIENDLY_CREATURE_SOUNDS(new Builder("Fix Friendly Creature Sounds").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinSoundHandler").setSide(Side.CLIENT).addTargetedMod(TargetedMod.VANILLA)
.setApplyIf(() -> FixesConfig.fixFriendlyCreatureSounds)),
LOGARITHMIC_VOLUME_CONTROL(new Builder("Logarithmic Volume Control").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinSoundManager", "minecraft.MixinSoundManagerLibraryLoader")
.setSide(Side.CLIENT).addTargetedMod(TargetedMod.VANILLA)
.setApplyIf(() -> FixesConfig.logarithmicVolumeControl)),
THROTTLE_ITEMPICKUPEVENT(new Builder("Throttle Item Pickup Event").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinEntityPlayer").setSide(Side.BOTH)
.setApplyIf(() -> FixesConfig.throttleItemPickupEvent).addTargetedMod(TargetedMod.VANILLA)),
Expand Down Expand Up @@ -387,6 +391,12 @@ public enum Mixins {
"minecraft.fastload.MixinPlayerInstance")
.setApplyIf(() -> SpeedupsConfig.fastChunkHandling)),

EARLY_CHUNK_TILE_COORDINATE_CHECK(
new Builder("Checks saved TileEntity coordinates earlier to provide a more descriptive error message")
.setPhase(Phase.EARLY).setSide(Side.BOTH).addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("minecraft.MixinChunk")
.setApplyIf(() -> FixesConfig.earlyChunkTileCoordinateCheck)),

// Ic2 adjustments
IC2_UNPROTECTED_GET_BLOCK_FIX(new Builder("IC2 Kinetic Fix").setPhase(Phase.EARLY).setSide(Side.BOTH)
.addMixinClasses("ic2.MixinIc2WaterKinetic").setApplyIf(() -> FixesConfig.fixIc2UnprotectedGetBlock)
Expand Down Expand Up @@ -494,6 +504,9 @@ public enum Mixins {
.addMixinClasses("thaumcraft.MixinBlockMagicalLeaves", "thaumcraft.MixinBlockMagicalLog")
.setPhase(Phase.LATE).setSide(Side.BOTH).setApplyIf(() -> FixesConfig.fixThaumcraftLeavesLag)
.addTargetedMod(TargetedMod.THAUMCRAFT)),
FIX_THAUMCRAFT_VIS_DUPLICATION(new Builder("Fix Thaumcraft Vis Duplication")
.addMixinClasses("thaumcraft.MixinTileWandPedestal_VisDuplication").setPhase(Phase.LATE).setSide(Side.BOTH)
.setApplyIf(() -> FixesConfig.fixWandPedestalVisDuplication).addTargetedMod(TargetedMod.THAUMCRAFT)),

// BOP
FIX_QUICKSAND_XRAY(new Builder("Fix Xray through block without collision boundingBox").setPhase(Phase.LATE)
Expand All @@ -514,7 +527,9 @@ public enum Mixins {
JAVA12_BOP(new Builder("BOP Java12-safe reflection").setPhase(Phase.LATE).setSide(Side.BOTH)
.addMixinClasses("biomesoplenty.MixinBOPBiomes").addMixinClasses("biomesoplenty.MixinBOPReflectionHelper")
.setApplyIf(() -> FixesConfig.java12BopCompat).addTargetedMod(TargetedMod.BOP)),

DISABLE_QUICKSAND_GENERATION(new Builder("Disable BOP quicksand").setPhase(Phase.LATE).setSide(Side.BOTH)
.addMixinClasses("biomesoplenty.MixinDisableQuicksandGeneration")
.setApplyIf(() -> TweaksConfig.removeBOPQuicksandGeneration).addTargetedMod(TargetedMod.BOP)),
// COFH
COFH_REMOVE_TE_CACHE(
new Builder("Remove CoFH tile entity cache").addMixinClasses("minecraft.MixinWorld_CoFH_TE_Cache")
Expand Down Expand Up @@ -644,6 +659,18 @@ public enum Mixins {
.addMixinClasses("extrautilities.MixinBlockDrum").setSide(Side.BOTH).setPhase(Phase.LATE)
.setApplyIf(() -> FixesConfig.fixExtraUtilitiesDrumEatingCells)
.addTargetedMod(TargetedMod.EXTRA_UTILITIES)),
FIX_GREENSCREEN_MICROBLOCKS(new Builder("Fix extra utilities Lapis Caelestis microblocks")
.addMixinClasses("extrautilities.MixinFullBrightMicroMaterial").setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> FixesConfig.fixExtraUtilitiesGreenscreenMicroblocks)
.addTargetedMod(TargetedMod.EXTRA_UTILITIES)),
FIX_LAST_MILLENIUM_RAIN(new Builder("Remove rain from the Last Millenium (Extra Utilities)")
.addMixinClasses("extrautilities.MixinChunkProviderEndOfTime").setPhase(Phase.LATE).setSide(Side.BOTH)
.setApplyIf(() -> FixesConfig.fixExtraUtilitiesLastMilleniumRain)
.addTargetedMod(TargetedMod.EXTRA_UTILITIES)),
FIX_LAST_MILLENIUM_CREATURES(new Builder("Remove creatures from the Last Millenium (Extra Utilities)")
.addMixinClasses("extrautilities.MixinWorldProviderEndOfTime").setPhase(Phase.LATE).setSide(Side.BOTH)
.setApplyIf(() -> FixesConfig.fixExtraUtilitiesLastMilleniumCreatures)
.addTargetedMod(TargetedMod.EXTRA_UTILITIES)),

// PortalGun
PORTALGUN_FIX_URLS(new Builder("Fix URLs used to download the sound pack")
Expand Down Expand Up @@ -686,6 +713,15 @@ public enum Mixins {
.setPhase(Phase.LATE).setApplyIf(() -> FixesConfig.fixWitcheryReflections)
.addTargetedMod(TargetedMod.WITCHERY)),

FIX_WITCHERY_THUNDERING_DETECTION(new Builder(
"Fixes Witchery Thunder Detection for rituals and Witch Hunters breaking with mods modifying thunder frequency")
.addMixinClasses(
"witchery.MixinBlockCircle",
"witchery.MixinEntityWitchHunter",
"witchery.MixinRiteClimateChange")
.setSide(Side.BOTH).setPhase(Phase.LATE).setApplyIf(() -> FixesConfig.fixWitcheryThunderDetection)
.addTargetedMod(TargetedMod.WITCHERY)),

// Various Exploits/Fixes
GC_TIME_COMMAND_FIX(new Builder("GC Time Fix").addMixinClasses("minecraft.MixinTimeCommandGalacticraftFix")
.setPhase(Phase.EARLY).setSide(Side.BOTH).setApplyIf(() -> FixesConfig.fixTimeCommandWithGC)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;

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

import com.mitchej123.hodgepodge.Common;
import com.mitchej123.hodgepodge.config.FixesConfig;

@Mixin(Chunk.class)
public class MixinChunk {

@Shadow
public World worldObj;

@Shadow
@Final
public int xPosition;

@Shadow
@Final
public int zPosition;

@Inject(method = "func_150812_a", at = @At("HEAD"), cancellable = true)
void hodgepodge$validateTileInBounds(int inChunkX, int inChunkY, int inChunkZ, TileEntity tile, CallbackInfo ci) {
if (inChunkX < 0 || inChunkX >= 16 || inChunkY < 0 || inChunkY >= 256 || inChunkZ < 0 || inChunkZ >= 16) {
int dimension = Integer.MIN_VALUE;
try {
dimension = this.worldObj.provider.dimensionId;
} catch (Throwable t) {
// no-op
}
String nbt;
try {
final NBTTagCompound tag = new NBTTagCompound();
tile.writeToNBT(tag);
nbt = tag.toString();
} catch (Exception e) {
nbt = "<error happened when serializing to string: " + e.getMessage() + ">";
}
final String message = String.format(
"Tile entity of type %s (%s) reports coordinates of (%d, %d, %d) that lie outside of the bounds of chunk (x=%d, z=%d) in dimension %d - ending up with illegal in-chunk coordinates of (%d, %d, %d). Serialized NBT of the offending TE: %s",
tile.getClass().getName(),
tile.getClass().getProtectionDomain().getCodeSource().getLocation(),
tile.xCoord,
tile.yCoord,
tile.zCoord,
this.xPosition,
this.zPosition,
dimension,
inChunkX,
inChunkY,
inChunkZ,
nbt);
final IllegalArgumentException e = new IllegalArgumentException(message);
Common.log.fatal("{}", message, e);
if (FixesConfig.earlyChunkTileCoordinateCheckDestructive) {
ci.cancel();
} else {
throw e;
}
}
}
}
Loading

0 comments on commit b184c31

Please sign in to comment.