This commit is contained in:
Boblet 2025-07-03 15:01:24 +02:00
parent 3da96091da
commit 6282bd028d
5 changed files with 53 additions and 48 deletions

View File

@ -1,7 +1,10 @@
## Changed ## Changed
* The chemistry achievement now requires the new chemical plant * The chemistry achievement now requires the new chemical plant
* The new chemical plant can now be used to upgrade the meteorite sword * The new chemical plant can now be used to upgrade the meteorite sword
* Fluid containers are now re-registered when using `/ntmreload` which should correctly generate fluid container items for freshly added custom fluids
* Recipe configs will no longer try to parse null value recipes, meaing that trailing commas in a recipe config will no longer create an error
## Fixed ## Fixed
* Fixed crash caused by breaking a tool while the fortune or silk touch ability is enabled * Fixed crash caused by breaking a tool while the fortune or silk touch ability is enabled
* Fixed NTM adding mob spawns to the mushroom island * Fixed NTM adding mob spawns to the mushroom island
# Fixed line break not working on the tip of the day

View File

@ -1,6 +1,7 @@
package com.hbm.commands; package com.hbm.commands;
import com.hbm.config.ItemPoolConfigJSON; import com.hbm.config.ItemPoolConfigJSON;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.particle.helper.SkeletonCreator; import com.hbm.particle.helper.SkeletonCreator;
@ -27,7 +28,9 @@ public class CommandReloadRecipes extends CommandBase {
@Override @Override
public void processCommand(ICommandSender sender, String[] args) { public void processCommand(ICommandSender sender, String[] args) {
try { try {
FluidContainerRegistry.clearRegistry(); // we do this first so IFluidRegisterListener can go wild with the registry
Fluids.reloadFluids(); Fluids.reloadFluids();
FluidContainerRegistry.register();
SerializableRecipe.initialize(); SerializableRecipe.initialize();
ItemPoolConfigJSON.initialize(); ItemPoolConfigJSON.initialize();
DamageResistanceHandler.init(); DamageResistanceHandler.init();

View File

@ -23,7 +23,13 @@ public class FluidContainerRegistry {
public static List<FluidContainer> allContainers = new ArrayList<FluidContainer>(); public static List<FluidContainer> allContainers = new ArrayList<FluidContainer>();
private static HashMap<FluidType, List<FluidContainer>> containerMap = new HashMap<FluidType, List<FluidContainer>>(); private static HashMap<FluidType, List<FluidContainer>> containerMap = new HashMap<FluidType, List<FluidContainer>>();
public static void clearRegistry() {
allContainers.clear();
containerMap.clear();
}
public static void register() { public static void register() {
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.water_bucket), new ItemStack(Items.bucket), Fluids.WATER, 1000)); FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.water_bucket), new ItemStack(Items.bucket), Fluids.WATER, 1000));
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.potionitem), new ItemStack(Items.glass_bottle), Fluids.WATER, 250)); FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.potionitem), new ItemStack(Items.glass_bottle), Fluids.WATER, 250));
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.lava_bucket), new ItemStack(Items.bucket), Fluids.LAVA, 1000)); FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.lava_bucket), new ItemStack(Items.bucket), Fluids.LAVA, 1000));
@ -103,8 +109,7 @@ public class FluidContainerRegistry {
} }
public static FluidContainer getContainer(FluidType type, ItemStack stack) { public static FluidContainer getContainer(FluidType type, ItemStack stack) {
if(stack == null) if(stack == null) return null;
return null;
ItemStack sta = stack.copy(); ItemStack sta = stack.copy();
sta.stackSize = 1; sta.stackSize = 1;
@ -141,9 +146,7 @@ public class FluidContainerRegistry {
} }
public static FluidType getFluidType(ItemStack stack) { public static FluidType getFluidType(ItemStack stack) {
if(stack == null) return Fluids.NONE;
if(stack == null)
return Fluids.NONE;
ItemStack sta = stack.copy(); ItemStack sta = stack.copy();
sta.stackSize = 1; sta.stackSize = 1;
@ -157,14 +160,12 @@ public class FluidContainerRegistry {
} }
public static ItemStack getFullContainer(ItemStack stack, FluidType type) { public static ItemStack getFullContainer(ItemStack stack, FluidType type) {
if(stack == null) if(stack == null) return null;
return null;
ItemStack sta = stack.copy(); ItemStack sta = stack.copy();
sta.stackSize = 1; sta.stackSize = 1;
if (!containerMap.containsKey(type)) if(!containerMap.containsKey(type)) return null;
return null;
for(FluidContainer container : containerMap.get(type)) { for(FluidContainer container : containerMap.get(type)) {
if(ItemStack.areItemStacksEqual(container.emptyContainer, sta) && ItemStack.areItemStackTagsEqual(container.emptyContainer, sta)) if(ItemStack.areItemStacksEqual(container.emptyContainer, sta) && ItemStack.areItemStackTagsEqual(container.emptyContainer, sta))
@ -175,8 +176,7 @@ public class FluidContainerRegistry {
} }
public static ItemStack getEmptyContainer(ItemStack stack) { public static ItemStack getEmptyContainer(ItemStack stack) {
if(stack == null) if(stack == null) return null;
return null;
ItemStack sta = stack.copy(); ItemStack sta = stack.copy();
sta.stackSize = 1; sta.stackSize = 1;
@ -188,5 +188,4 @@ public class FluidContainerRegistry {
return null; return null;
} }
} }

View File

@ -166,7 +166,7 @@ public class LoadingScreenRendererNT extends LoadingScreenRenderer {
this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (width - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, height / 2 - 4 - 16, 16777215); this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (width - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, height / 2 - 4 - 16, 16777215);
this.mc.fontRenderer.drawStringWithShadow(this.message, (width - this.mc.fontRenderer.getStringWidth(this.message)) / 2, height / 2 - 4 + 8, 16777215); this.mc.fontRenderer.drawStringWithShadow(this.message, (width - this.mc.fontRenderer.getStringWidth(this.message)) / 2, height / 2 - 4 + 8, 16777215);
String[] frags = this.tipOfTheDay.split("$"); String[] frags = this.tipOfTheDay.split("\\$");
for(int i = 0; i < frags.length; i++) { for(int i = 0; i < frags.length; i++) {
String frag = frags[i]; String frag = frags[i];
this.mc.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW + frag, (width - this.mc.fontRenderer.getStringWidth(frag)) / 2, height / 2 - 4 - 60 + i * 10, 16777215); this.mc.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW + frag, (width - this.mc.fontRenderer.getStringWidth(frag)) / 2, height / 2 - 4 - 60 + i * 10, 16777215);

View File

@ -237,7 +237,7 @@ public abstract class SerializableRecipe {
JsonObject json = gson.fromJson(reader, JsonObject.class); JsonObject json = gson.fromJson(reader, JsonObject.class);
JsonArray recipes = json.get("recipes").getAsJsonArray(); JsonArray recipes = json.get("recipes").getAsJsonArray();
for(JsonElement recipe : recipes) { for(JsonElement recipe : recipes) {
this.readRecipe(recipe); if(recipe != null) this.readRecipe(recipe);
} }
} }