Skip to content

Commit

Permalink
SimpleModule & HardcodedBlockType: Reorganized
Browse files Browse the repository at this point in the history
  • Loading branch information
Xelbayria committed Dec 22, 2024
1 parent bab9d9d commit 088e956
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,24 @@ public boolean isEntryAlreadyRegistered(String name, BlockType woodType, Registr

// Default
//TODO: improve
public boolean isEntryAlreadyRegistered(String name, BlockType woodType, Registry<?> registry) {
if (woodType.isVanilla()) return true;
public boolean isEntryAlreadyRegistered(String name, BlockType blockType, Registry<?> registry) {
if (blockType.isVanilla()) return true;

//ec:twigs/bop/willow_table
name = name.substring(name.lastIndexOf("/") + 1); //gets the base name

String woodFrom = woodType.getNamespace();
String woodFrom = blockType.getNamespace();

String slashConvention = woodFrom + "/" + name; //quark/blossom_chair
String underscoreConvention = woodFrom + "_" + name; //quark_blossom_chair

if (this.getAlreadySupportedMods().contains(woodFrom)) return true;

// ugly hardcoded stuff
if (woodType instanceof WoodType wt) {
if (blockType instanceof WoodType wt) {
Boolean hardcoded = HardcodedBlockType.isWoodBlockAlreadyRegistered(name, wt, modId, shortenedId());
if (hardcoded != null) return hardcoded;
} else if (woodType instanceof LeavesType lt) {
} else if (blockType instanceof LeavesType lt) {
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 @@ -8,66 +8,67 @@
public class HardcodedBlockType {

@Nullable
public static Boolean isWoodBlockAlreadyRegistered(String name, WoodType woodType, String modId, String shortenedId) {
String woodNamespace = woodType.getNamespace();
public static Boolean isWoodBlockAlreadyRegistered(String blockName, WoodType woodType, String supportedModId, String shortenedId) {
String woodMod = woodType.getNamespace();
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;
if (woodMod.matches("betternether|betterend") && shortenedId.equals("bw")) return false;

// Discarding Dynamic Trees and its addons
if (woodNamespace.contains("dynamictrees") || woodNamespace.contains("dt")) return true;
if (woodMod.contains("dynamictrees") || woodMod.contains("dt")) return true;

// 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") ||
woodTypeID.equals("nethers_exoticism:jabuticaba")) && name.contains("branch"))
if ((woodMod.matches("gardens_of_the_dead|snifferent") ||
woodTypeID.equals("nethers_exoticism:jabuticaba")) && blockName.contains("branch"))
return true;

// Quark & Woodworks have chest & trapped_chest.
//is this needed? shouldnt it be covered by the next statements?
if (woodNamespace.equals("quark") && shortenedId.equals("abnww") && name.contains("chest")) return true;
if (woodMod.equals("quark") && shortenedId.equals("abnww") && blockName.contains("chest")) return true;

// Create's windows will be skipped blc [Let's do] Blooming Nature & Meadow already has windows
if ((woodNamespace.equals("bloomingnature") || woodNamespace.equals("meadow")) && name.contains("window")) return false;
if ((woodMod.equals("bloomingnature") || woodMod.equals("meadow")) && blockName.contains("window")) return false;

// ArchitectPalette's boards will be skipped blc Upgrade-Aqautic already has boards but have no recipes &
// no item in CreativeMode
if (woodNamespace.equals("upgrade_aquatic") && (name.equals("driftwood_boards") || name.equals("river_boards")))
if (woodMod.equals("upgrade_aquatic") && (blockName.equals("driftwood_boards") || blockName.equals("river_boards")))
return false;

// Similar to above, Architect's Palette - boards will be skipped due to the existing boards in Autumnity
if (woodNamespace.equals("autumnity") && name.equals("maple_boards")) return false;
if (woodMod.equals("autumnity") && blockName.equals("maple_boards")) return false;

// check if TerraFirmaCraft (tfc) mod exist, then won't discards wood types
if (woodNamespace.equals("tfc")) return false;
if (woodMod.equals("tfc")) return false;

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

if (shortenedId.equals("af")) return false; //hardcoding
// if (this.shortenedId().equals("ap")) return false; //hardcoding dont remember why i had this. Incase you want o
if (shortenedId.equals("vs")) return false; //we always register everything for these
if (shortenedId.equals("abnww") && woodNamespace.equals("architects_palette"))
if (shortenedId.equals("abnww") && woodMod.equals("architects_palette"))
return false; //we always register everything for these

return null;
}

@Nullable
public static Boolean isLeavesBlockAlreadyRegistered(String name, LeavesType woodType, String modId, String shortenedId) {
String woodFrom = woodType.getNamespace();
public static Boolean isLeavesBlockAlreadyRegistered(String blockName, LeavesType leavesType, String supportedModId, String shortenedId) {
String leaveMod = leavesType.getNamespace();
String leaveTypeID = leavesType.getId().toString();

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

// Macaw's Fences&Walls or MrCrayFish's Furniture - hedges will be skipped because Quark already has hedges
if (woodFrom.equals("quark") && (shortenedId.equals("mcf") || shortenedId.equals("cfm"))) return false;
if (leaveMod.equals("quark") && (shortenedId.equals("mcf") || shortenedId.equals("cfm"))) return false;

return null;
}
Expand Down

0 comments on commit 088e956

Please sign in to comment.