Skip to content

Commit

Permalink
HardcodedBlockType (hardcodedStuff): Renamed & Added alexscave's leave
Browse files Browse the repository at this point in the history
  • Loading branch information
Xelbayria committed Dec 22, 2024
1 parent 3edef04 commit bab9d9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.mehvahdjukaar.every_compat.EveryCompat;
import net.mehvahdjukaar.every_compat.dynamicpack.ClientDynamicResourcesHandler;
import net.mehvahdjukaar.every_compat.dynamicpack.ServerDynamicResourcesHandler;
import net.mehvahdjukaar.every_compat.misc.HardcodedStuff;
import net.mehvahdjukaar.every_compat.misc.HardcodedBlockType;
import net.mehvahdjukaar.moonlight.api.events.AfterLanguageLoadEvent;
import net.mehvahdjukaar.moonlight.api.misc.Registrator;
import net.mehvahdjukaar.moonlight.api.platform.ClientHelper;
Expand Down Expand Up @@ -213,10 +213,10 @@ public boolean isEntryAlreadyRegistered(String name, BlockType woodType, Registr

// ugly hardcoded stuff
if (woodType instanceof WoodType wt) {
Boolean hardcoded = HardcodedStuff.isWoodBlockAlreadyRegistered(name, wt, modId, shortenedId());
Boolean hardcoded = HardcodedBlockType.isWoodBlockAlreadyRegistered(name, wt, modId, shortenedId());
if (hardcoded != null) return hardcoded;
} else if (woodType instanceof LeavesType lt) {
Boolean hardcoded = HardcodedStuff.isLeavesBlockAlreadyRegistered(name, lt, modId, shortenedId());
Boolean hardcoded = HardcodedBlockType.isLeavesBlockAlreadyRegistered(name, lt, modId, shortenedId());
if (hardcoded != null) return hardcoded;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import net.mehvahdjukaar.moonlight.api.set.wood.WoodType;
import org.jetbrains.annotations.Nullable;

// ugly mess. Too coupled with wood types and too many hardcoded exceptions
public class HardcodedStuff {
// ugly mess. Too coupled with WoodTypes|LeavesTypes and too many hardcoded exceptions
public class HardcodedBlockType {

@Nullable
public static Boolean isWoodBlockAlreadyRegistered(String name, WoodType woodType, String modId, String shortenedId) {
String woodNamespace = woodType.getNamespace();
String woodID = woodType.getId().toString();
String woodTypeID = woodType.getId().toString();

// Unrelated to Quark's ancient_leaves & Alex's Cave (ancient_leaves) should be included
if (modId.equals("quark") && woodNamespace.equals("alexscaves") && woodTypeID.equals("ancient")) return false;

// Better Nether & Better End have stripped_bark as stripped_wood but bark from Bewitchment caused EC to skip
if (woodNamespace.matches("betternether|betterend") && shortenedId.equals("bw")) return false;
Expand All @@ -21,7 +24,7 @@ public static Boolean isWoodBlockAlreadyRegistered(String name, WoodType woodTyp
// Garden-Of-The-dead's whistle must be skipped for branches from Regions-Unexplored
// Nether's Exoticism & Snifferent already has branches, branches from Regions-Unexplored is not needed
if ((woodNamespace.matches("gardens_of_the_dead|snifferent") ||
woodID.equals("nethers_exoticism:jabuticaba")) && name.contains("branch"))
woodTypeID.equals("nethers_exoticism:jabuticaba")) && name.contains("branch"))
return true;

// Quark & Woodworks have chest & trapped_chest.
Expand All @@ -42,11 +45,11 @@ public static Boolean isWoodBlockAlreadyRegistered(String name, WoodType woodTyp
// check if TerraFirmaCraft (tfc) mod exist, then won't discards wood types
if (woodNamespace.equals("tfc")) return false;

if (woodID.equals("ecologics:azalea")) {
if (woodTypeID.equals("ecologics:azalea")) {
if (modId.equals("quark")) return false; //ecologics and quark azalea. tbh not sure why needed
}
//also this is wrong
if (woodID.equals("twilightforest:mangrove") && name.equals("mangrove_chest")) {
if (woodTypeID.equals("twilightforest:mangrove") && name.equals("mangrove_chest")) {
return false;//mangrove waaa so much pain
}

Expand Down

1 comment on commit bab9d9d

@Xelbayria
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Related to #732

Please sign in to comment.