diff --git a/build.gradle b/build.gradle index d467b8b..3ae1b19 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ repositories { } minecraft { - mappings channel: "official", version: "1.18.2" + mappings channel: "official", version: "${version_minecraft}" runs { client { workingDirectory project.file('run') diff --git a/gradle.properties b/gradle.properties index 83400e8..af548e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,4 +7,4 @@ meta_download=https://www.curseforge.com/minecraft/mc-mods/engineers-decor/ version_minecraft=1.18.2 version_forge_minecraft=1.18.2-40.0.32 version_jei=1.18.2:9.5.4.171 -version_engineersdecor=1.1.22-b1 +version_engineersdecor=1.1.22-b2 diff --git a/meta/update.json b/meta/update.json index 4e64573..695143d 100644 --- a/meta/update.json +++ b/meta/update.json @@ -1,6 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "1.18.2": { + "1.1.22-b2": "[F] Fixed stairs block reference (issue #207, ty freopt)", "1.1.22-b1": "[U] Updated to 1.18.2.", "1.1.21": "[A] Added French translation (PR#203, dracnis).", "1.1.20": "[F] Fixed Shingle Roof Wire Conduit collision shape (thx os, issue #202).\n[F] Mineral Melter accepts input items only when empty (issue #198, ty Archie).", @@ -54,6 +55,6 @@ }, "promos": { "1.18.2-recommended": "1.1.21", - "1.18.2-latest": "1.1.22-b1" + "1.18.2-latest": "1.1.22-b2" } } \ No newline at end of file diff --git a/readme.md b/readme.md index 93856a4..a891616 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.18.x. ## Version history + - v1.1.22-b2 [F] Fixed stairs block reference (issue #207, ty freopt) + - v1.1.22-b1 [U] Updated to 1.18.2. - v1.1.21 [A] Added French translation (PR#203, dracnis). diff --git a/src/main/java/wile/engineersdecor/ModContent.java b/src/main/java/wile/engineersdecor/ModContent.java index f99fcf2..0cbcbb8 100644 --- a/src/main/java/wile/engineersdecor/ModContent.java +++ b/src/main/java/wile/engineersdecor/ModContent.java @@ -90,7 +90,7 @@ public class ModContent )); Registries.addBlock("clinker_brick_stairs", ()->new StandardStairsBlock( StandardBlocks.CFG_DEFAULT, - ()->Registries.getBlock("clinker_brick").defaultBlockState(), + ()->Registries.getBlock("clinker_brick_block").defaultBlockState(), BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).strength(0.5f, 7f).sound(SoundType.STONE) )); Registries.addBlock("clinker_brick_wall", ()->new EdWallBlock( @@ -107,7 +107,7 @@ public class ModContent )); Registries.addBlock("clinker_brick_stained_stairs", ()->new StandardStairsBlock( StandardBlocks.CFG_DEFAULT, - ()->Registries.getBlock("clinker_brick_stained").defaultBlockState(), + ()->Registries.getBlock("clinker_brick_stained_block").defaultBlockState(), BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).strength(0.5f, 7f).sound(SoundType.STONE) )); Registries.addBlock("clinker_brick_sastor_corner_block", ()->new EdCornerOrnamentedBlock( @@ -160,7 +160,7 @@ public class ModContent )); Registries.addBlock("slag_brick_stairs", ()->new StandardStairsBlock( StandardBlocks.CFG_DEFAULT, - ()->Registries.getBlock("slag_brick").defaultBlockState(), + ()->Registries.getBlock("slag_brick_block").defaultBlockState(), BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).strength(0.5f, 7f).sound(SoundType.STONE) )); Registries.addBlock("slag_brick_wall", ()->new EdWallBlock( @@ -1048,7 +1048,7 @@ public class ModContent public static void processContentClientSide(final FMLClientSetupEvent event) { // Block renderer selection - for(Block block: getRegisteredBlocks()) { + for(Block block: Registries.getRegisteredBlocks()) { if(block instanceof IStandardBlock) { switch(((IStandardBlock)block).getRenderTypeHint()) { case CUTOUT: ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); break; diff --git a/src/main/java/wile/engineersdecor/ModEngineersDecor.java b/src/main/java/wile/engineersdecor/ModEngineersDecor.java index c134b58..83acce6 100644 --- a/src/main/java/wile/engineersdecor/ModEngineersDecor.java +++ b/src/main/java/wile/engineersdecor/ModEngineersDecor.java @@ -47,15 +47,12 @@ public class ModEngineersDecor MinecraftForge.EVENT_BUS.register(this); } - public static Logger logger() { return LOGGER; } - // // Events // private void onSetup(final FMLCommonSetupEvent event) { - LOGGER.info("Registering recipe condition processor ..."); CraftingHelper.register(OptionalRecipeCondition.Serializer.INSTANCE); wile.engineersdecor.libmc.detail.Networking.init(MODID); } @@ -99,10 +96,10 @@ public class ModEngineersDecor public static void onConfigReload(final ModConfigEvent.Reloading event) { try { - ModEngineersDecor.logger().info("Config file changed {}", event.getConfig().getFileName()); + Auxiliaries.logger().info("Config file changed {}", event.getConfig().getFileName()); ModConfig.apply(); } catch(Throwable e) { - ModEngineersDecor.logger().error("Failed to load changed config: " + e.getMessage()); + Auxiliaries.logger().error("Failed to load changed config: " + e.getMessage()); } } } diff --git a/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java b/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java index f90eb1e..f9fc1f4 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java @@ -416,7 +416,7 @@ public class EdCraftingTable result_.setItem(0, stack); broadcastChanges(); } catch(Throwable exc) { - ModEngineersDecor.logger().error("Recipe failed:", exc); + Auxiliaries.logger().error("Recipe failed:", exc); } }); } @@ -690,7 +690,7 @@ public class EdCraftingTable } onCraftMatrixChanged(); } catch(Throwable exc) { - ModEngineersDecor.logger().error("Recipe failed:", exc); + Auxiliaries.logger().error("Recipe failed:", exc); } }); } @@ -1270,7 +1270,7 @@ public class EdCraftingTable stash_ = nbt.getString("stash"); update_current(); } catch(Throwable ex) { - ModEngineersDecor.logger().error("Exception reading crafting table history NBT, resetting, exception is:" + ex.getMessage()); + Auxiliaries.logger().error("Exception reading crafting table history NBT, resetting, exception is:" + ex.getMessage()); clear(); } } @@ -1388,7 +1388,7 @@ public class EdCraftingTable if(!(recipe instanceof CraftingRecipe)) return null; return new Tuple<>((CraftingRecipe)recipe, stacks); } catch(Throwable ex) { - ModEngineersDecor.logger().error("History stack building failed: " + ex.getMessage()); + Auxiliaries.logger().error("History stack building failed: " + ex.getMessage()); return null; } } diff --git a/src/main/java/wile/engineersdecor/blocks/EdDropper.java b/src/main/java/wile/engineersdecor/blocks/EdDropper.java index 550e1cd..36e36ef 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdDropper.java +++ b/src/main/java/wile/engineersdecor/blocks/EdDropper.java @@ -601,7 +601,7 @@ public class EdDropper final boolean dropped = res.getA(); final List remaining = res.getB(); for(ItemStack st:remaining) { - if(!storage_slot_range_.insert(st).isEmpty()) ModEngineersDecor.logger().debug("NOT ALL NON-DROPPED ITEMS PUT BACK:" + st); + if(!storage_slot_range_.insert(st).isEmpty()) Auxiliaries.logger().debug("NOT ALL NON-DROPPED ITEMS PUT BACK:" + st); } if(dropped || (!remaining.isEmpty())) dirty = true; // cooldown diff --git a/src/main/java/wile/engineersdecor/blocks/EdPlacer.java b/src/main/java/wile/engineersdecor/blocks/EdPlacer.java index 6dd6fcb..3fbac9b 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdPlacer.java +++ b/src/main/java/wile/engineersdecor/blocks/EdPlacer.java @@ -484,11 +484,11 @@ public class EdPlacer // The block really needs a player or other issues happened during placement. // A hard crash should not be fired here, instead spit out the item to indicated that this // block is not compatible. - ModEngineersDecor.logger().error("Exception while trying to place " + ((block==null)?(""):(""+block)) + ", spitting out. Exception is: " + e); + Auxiliaries.logger().error("Exception while trying to place " + ((block==null)?(""):(""+block)) + ", spitting out. Exception is: " + e); try { level.removeBlock(placement_pos, false); } catch(Throwable e1) { - ModEngineersDecor.logger().error("Exception while removing failed block placement " + ((block==null)?(""):(""+block)) + ", spitting out. Exception is: " + e1); + Auxiliaries.logger().error("Exception while removing failed block placement " + ((block==null)?(""):(""+block)) + ", spitting out. Exception is: " + e1); } return spit_out(facing, true); } diff --git a/src/main/java/wile/engineersdecor/detail/ModRenderers.java b/src/main/java/wile/engineersdecor/detail/ModRenderers.java index b8674f7..bc5544c 100644 --- a/src/main/java/wile/engineersdecor/detail/ModRenderers.java +++ b/src/main/java/wile/engineersdecor/detail/ModRenderers.java @@ -28,10 +28,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.blocks.EdCraftingTable; import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableBlock; import wile.engineersdecor.blocks.EdLabeledCrate; +import wile.engineersdecor.libmc.detail.Auxiliaries; public class ModRenderers @@ -118,8 +118,8 @@ public class ModRenderers } } catch(Throwable e) { if(--tesr_error_counter<=0) { - ModEngineersDecor.logger().error("TER was disabled because broken, exception was: " + e.getMessage()); - ModEngineersDecor.logger().error(e.getStackTrace()); + Auxiliaries.logger().error("TER was disabled because broken, exception was: " + e.getMessage()); + Auxiliaries.logger().error(e.getStackTrace()); } } } @@ -166,7 +166,7 @@ public class ModRenderers mxs.popPose(); } catch(Throwable e) { if(--tesr_error_counter<=0) { - ModEngineersDecor.logger().error("TER was disabled (because broken), exception was: " + e.getMessage()); + Auxiliaries.logger().error("TER was disabled (because broken), exception was: " + e.getMessage()); } } } diff --git a/src/main/java/wile/engineersdecor/detail/TreeCutting.java b/src/main/java/wile/engineersdecor/detail/TreeCutting.java index a2837b8..579996b 100644 --- a/src/main/java/wile/engineersdecor/detail/TreeCutting.java +++ b/src/main/java/wile/engineersdecor/detail/TreeCutting.java @@ -27,8 +27,6 @@ import java.util.*; public class TreeCutting { - private static final org.apache.logging.log4j.Logger LOGGER = ModEngineersDecor.logger(); - public static boolean canChop(BlockState state) { return isLog(state); } diff --git a/src/main/java/wile/engineersdecor/eapi/jei/JEIPlugin.java b/src/main/java/wile/engineersdecor/eapi/jei/JEIPlugin.java index ed0151a..1202648 100644 --- a/src/main/java/wile/engineersdecor/eapi/jei/JEIPlugin.java +++ b/src/main/java/wile/engineersdecor/eapi/jei/JEIPlugin.java @@ -21,11 +21,10 @@ import mezz.jei.api.registration.IRecipeTransferRegistration; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.runtime.IJeiRuntime; import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableTileEntity; +import wile.engineersdecor.blocks.EdCraftingTable; import wile.engineersdecor.libmc.detail.Auxiliaries; -import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModConfig; import wile.engineersdecor.ModContent; -import wile.engineersdecor.blocks.EdCraftingTable; import java.util.HashSet; import java.util.List; @@ -50,7 +49,7 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin 1, 9, 10, 36+CraftingTableTileEntity.NUM_OF_STORAGE_SLOTS ); } catch(Throwable e) { - ModEngineersDecor.logger().warn("Exception in JEI crafting table handler registration: '" + e.getMessage() + "'."); + Auxiliaries.logger().warn("Exception in JEI crafting table handler registration: '" + e.getMessage() + "'."); } } } @@ -74,7 +73,7 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin try { jeiRuntime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM, blacklist); } catch(Exception e) { - ModEngineersDecor.logger().warn("Exception in JEI opt-out processing: '" + e.getMessage() + "', skipping further JEI optout processing."); + Auxiliaries.logger().warn("Exception in JEI opt-out processing: '" + e.getMessage() + "', skipping further JEI optout processing."); } } } diff --git a/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java b/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java index 99e13eb..bbf97be 100644 --- a/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java +++ b/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java @@ -8,7 +8,7 @@ * Mainly needed for: * - MC block defaults. * - Tooltip functionality - * - Model initialisation + * - Model initialization */ package wile.engineersdecor.libmc.blocks; @@ -60,7 +60,7 @@ import java.util.*; import java.util.function.Function; import java.util.function.Supplier; - +@SuppressWarnings("deprecation") public class StandardBlocks { public static final long CFG_DEFAULT = 0x0000000000000000L; // no special config diff --git a/src/main/java/wile/engineersdecor/libmc/detail/Registries.java b/src/main/java/wile/engineersdecor/libmc/detail/Registries.java index ae8ab9a..ee85df9 100644 --- a/src/main/java/wile/engineersdecor/libmc/detail/Registries.java +++ b/src/main/java/wile/engineersdecor/libmc/detail/Registries.java @@ -7,6 +7,7 @@ * Common game registry handling. */ package wile.engineersdecor.libmc.detail; +import wile.engineersdecor.libmc.blocks.StandardBlocks; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -21,7 +22,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.registries.ForgeRegistries; -import wile.engineersdecor.libmc.blocks.StandardBlocks; import javax.annotation.Nonnull; import java.util.*; @@ -147,6 +147,17 @@ public class Registries })); } + @SuppressWarnings("unchecked") + public static void addBlockEntityType(String registry_name, BlockEntityType.BlockEntitySupplier ctor, Class block_clazz) + { + block_entity_type_suppliers.add(new Tuple<>(registry_name, ()->{ + final Block[] blocks = registered_blocks.values().stream().filter(block_clazz::isInstance).collect(Collectors.toList()).toArray(new Block[]{}); + final BlockEntityType instance = BlockEntityType.Builder.of(ctor, blocks).build(null); + instance.setRegistryName(modid, registry_name); + return instance; + })); + } + @SuppressWarnings("unchecked") public static > void addEntityType(String registry_name, Supplier> supplier) { entity_type_suppliers.add(new Tuple<>(registry_name, supplier)); } @@ -184,7 +195,10 @@ public class Registries registered_block_tag_keys.put(tag_name, key); } - public static void addOptionaItemTag(String tag_name, ResourceLocation... default_items) + public static void addOptionalBlockTag(String tag_name, String... default_blocks) + { addOptionalBlockTag(tag_name, Arrays.stream(default_blocks).map(ResourceLocation::new).collect(Collectors.toList()).toArray(new ResourceLocation[]{})); } + + public static void addOptionalItemTag(String tag_name, ResourceLocation... default_items) { final Set> default_suppliers = new HashSet<>(); for(ResourceLocation rl: default_items) default_suppliers.add(()->ForgeRegistries.ITEMS.getValue(rl)); @@ -192,6 +206,9 @@ public class Registries registered_item_tag_keys.put(tag_name, key); } + public static void addOptionalItemTag(String tag_name, String... default_items) + { addOptionalBlockTag(tag_name, Arrays.stream(default_items).map(ResourceLocation::new).collect(Collectors.toList()).toArray(new ResourceLocation[]{})); } + // ------------------------------------------------------------------------------------------------------------- public static void onBlockRegistry(BiConsumer registration)