Fixed stairs block reference (issue #207).

This commit is contained in:
stfwi 2022-04-03 13:23:19 +02:00
parent c59d1c8500
commit 71dab20e75
14 changed files with 47 additions and 33 deletions

View file

@ -25,7 +25,7 @@ repositories {
} }
minecraft { minecraft {
mappings channel: "official", version: "1.18.2" mappings channel: "official", version: "${version_minecraft}"
runs { runs {
client { client {
workingDirectory project.file('run') workingDirectory project.file('run')

View file

@ -7,4 +7,4 @@ meta_download=https://www.curseforge.com/minecraft/mc-mods/engineers-decor/
version_minecraft=1.18.2 version_minecraft=1.18.2
version_forge_minecraft=1.18.2-40.0.32 version_forge_minecraft=1.18.2-40.0.32
version_jei=1.18.2:9.5.4.171 version_jei=1.18.2:9.5.4.171
version_engineersdecor=1.1.22-b1 version_engineersdecor=1.1.22-b2

View file

@ -1,6 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.18.2": { "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.22-b1": "[U] Updated to 1.18.2.",
"1.1.21": "[A] Added French translation (PR#203, dracnis).", "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).", "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": { "promos": {
"1.18.2-recommended": "1.1.21", "1.18.2-recommended": "1.1.21",
"1.18.2-latest": "1.1.22-b1" "1.18.2-latest": "1.1.22-b2"
} }
} }

View file

@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.18.x.
## Version history ## 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.22-b1 [U] Updated to 1.18.2.
- v1.1.21 [A] Added French translation (PR#203, dracnis). - v1.1.21 [A] Added French translation (PR#203, dracnis).

View file

@ -90,7 +90,7 @@ public class ModContent
)); ));
Registries.addBlock("clinker_brick_stairs", ()->new StandardStairsBlock( Registries.addBlock("clinker_brick_stairs", ()->new StandardStairsBlock(
StandardBlocks.CFG_DEFAULT, 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) BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).strength(0.5f, 7f).sound(SoundType.STONE)
)); ));
Registries.addBlock("clinker_brick_wall", ()->new EdWallBlock( Registries.addBlock("clinker_brick_wall", ()->new EdWallBlock(
@ -107,7 +107,7 @@ public class ModContent
)); ));
Registries.addBlock("clinker_brick_stained_stairs", ()->new StandardStairsBlock( Registries.addBlock("clinker_brick_stained_stairs", ()->new StandardStairsBlock(
StandardBlocks.CFG_DEFAULT, 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) BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).strength(0.5f, 7f).sound(SoundType.STONE)
)); ));
Registries.addBlock("clinker_brick_sastor_corner_block", ()->new EdCornerOrnamentedBlock( Registries.addBlock("clinker_brick_sastor_corner_block", ()->new EdCornerOrnamentedBlock(
@ -160,7 +160,7 @@ public class ModContent
)); ));
Registries.addBlock("slag_brick_stairs", ()->new StandardStairsBlock( Registries.addBlock("slag_brick_stairs", ()->new StandardStairsBlock(
StandardBlocks.CFG_DEFAULT, 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) BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).strength(0.5f, 7f).sound(SoundType.STONE)
)); ));
Registries.addBlock("slag_brick_wall", ()->new EdWallBlock( Registries.addBlock("slag_brick_wall", ()->new EdWallBlock(
@ -1048,7 +1048,7 @@ public class ModContent
public static void processContentClientSide(final FMLClientSetupEvent event) public static void processContentClientSide(final FMLClientSetupEvent event)
{ {
// Block renderer selection // Block renderer selection
for(Block block: getRegisteredBlocks()) { for(Block block: Registries.getRegisteredBlocks()) {
if(block instanceof IStandardBlock) { if(block instanceof IStandardBlock) {
switch(((IStandardBlock)block).getRenderTypeHint()) { switch(((IStandardBlock)block).getRenderTypeHint()) {
case CUTOUT: ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); break; case CUTOUT: ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); break;

View file

@ -47,15 +47,12 @@ public class ModEngineersDecor
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
public static Logger logger() { return LOGGER; }
// //
// Events // Events
// //
private void onSetup(final FMLCommonSetupEvent event) private void onSetup(final FMLCommonSetupEvent event)
{ {
LOGGER.info("Registering recipe condition processor ...");
CraftingHelper.register(OptionalRecipeCondition.Serializer.INSTANCE); CraftingHelper.register(OptionalRecipeCondition.Serializer.INSTANCE);
wile.engineersdecor.libmc.detail.Networking.init(MODID); wile.engineersdecor.libmc.detail.Networking.init(MODID);
} }
@ -99,10 +96,10 @@ public class ModEngineersDecor
public static void onConfigReload(final ModConfigEvent.Reloading event) public static void onConfigReload(final ModConfigEvent.Reloading event)
{ {
try { try {
ModEngineersDecor.logger().info("Config file changed {}", event.getConfig().getFileName()); Auxiliaries.logger().info("Config file changed {}", event.getConfig().getFileName());
ModConfig.apply(); ModConfig.apply();
} catch(Throwable e) { } catch(Throwable e) {
ModEngineersDecor.logger().error("Failed to load changed config: " + e.getMessage()); Auxiliaries.logger().error("Failed to load changed config: " + e.getMessage());
} }
} }
} }

View file

@ -416,7 +416,7 @@ public class EdCraftingTable
result_.setItem(0, stack); result_.setItem(0, stack);
broadcastChanges(); broadcastChanges();
} catch(Throwable exc) { } catch(Throwable exc) {
ModEngineersDecor.logger().error("Recipe failed:", exc); Auxiliaries.logger().error("Recipe failed:", exc);
} }
}); });
} }
@ -690,7 +690,7 @@ public class EdCraftingTable
} }
onCraftMatrixChanged(); onCraftMatrixChanged();
} catch(Throwable exc) { } 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"); stash_ = nbt.getString("stash");
update_current(); update_current();
} catch(Throwable ex) { } 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(); clear();
} }
} }
@ -1388,7 +1388,7 @@ public class EdCraftingTable
if(!(recipe instanceof CraftingRecipe)) return null; if(!(recipe instanceof CraftingRecipe)) return null;
return new Tuple<>((CraftingRecipe)recipe, stacks); return new Tuple<>((CraftingRecipe)recipe, stacks);
} catch(Throwable ex) { } catch(Throwable ex) {
ModEngineersDecor.logger().error("History stack building failed: " + ex.getMessage()); Auxiliaries.logger().error("History stack building failed: " + ex.getMessage());
return null; return null;
} }
} }

View file

@ -601,7 +601,7 @@ public class EdDropper
final boolean dropped = res.getA(); final boolean dropped = res.getA();
final List<ItemStack> remaining = res.getB(); final List<ItemStack> remaining = res.getB();
for(ItemStack st:remaining) { 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; if(dropped || (!remaining.isEmpty())) dirty = true;
// cooldown // cooldown

View file

@ -484,11 +484,11 @@ public class EdPlacer
// The block really needs a player or other issues happened during placement. // 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 // A hard crash should not be fired here, instead spit out the item to indicated that this
// block is not compatible. // 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 { try {
level.removeBlock(placement_pos, false); level.removeBlock(placement_pos, false);
} catch(Throwable e1) { } 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); return spit_out(facing, true);
} }

View file

@ -28,10 +28,10 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.EdCraftingTable; import wile.engineersdecor.blocks.EdCraftingTable;
import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableBlock; import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableBlock;
import wile.engineersdecor.blocks.EdLabeledCrate; import wile.engineersdecor.blocks.EdLabeledCrate;
import wile.engineersdecor.libmc.detail.Auxiliaries;
public class ModRenderers public class ModRenderers
@ -118,8 +118,8 @@ public class ModRenderers
} }
} catch(Throwable e) { } catch(Throwable e) {
if(--tesr_error_counter<=0) { 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());
ModEngineersDecor.logger().error(e.getStackTrace()); Auxiliaries.logger().error(e.getStackTrace());
} }
} }
} }
@ -166,7 +166,7 @@ public class ModRenderers
mxs.popPose(); mxs.popPose();
} catch(Throwable e) { } catch(Throwable e) {
if(--tesr_error_counter<=0) { 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());
} }
} }
} }

View file

@ -27,8 +27,6 @@ import java.util.*;
public class TreeCutting public class TreeCutting
{ {
private static final org.apache.logging.log4j.Logger LOGGER = ModEngineersDecor.logger();
public static boolean canChop(BlockState state) public static boolean canChop(BlockState state)
{ return isLog(state); } { return isLog(state); }

View file

@ -21,11 +21,10 @@ import mezz.jei.api.registration.IRecipeTransferRegistration;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.runtime.IJeiRuntime; import mezz.jei.api.runtime.IJeiRuntime;
import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableTileEntity; import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableTileEntity;
import wile.engineersdecor.blocks.EdCraftingTable;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.ModConfig; import wile.engineersdecor.ModConfig;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.blocks.EdCraftingTable;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; 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 1, 9, 10, 36+CraftingTableTileEntity.NUM_OF_STORAGE_SLOTS
); );
} catch(Throwable e) { } 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 { try {
jeiRuntime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM, blacklist); jeiRuntime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM, blacklist);
} catch(Exception e) { } 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.");
} }
} }
} }

View file

@ -8,7 +8,7 @@
* Mainly needed for: * Mainly needed for:
* - MC block defaults. * - MC block defaults.
* - Tooltip functionality * - Tooltip functionality
* - Model initialisation * - Model initialization
*/ */
package wile.engineersdecor.libmc.blocks; package wile.engineersdecor.libmc.blocks;
@ -60,7 +60,7 @@ import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
@SuppressWarnings("deprecation")
public class StandardBlocks public class StandardBlocks
{ {
public static final long CFG_DEFAULT = 0x0000000000000000L; // no special config public static final long CFG_DEFAULT = 0x0000000000000000L; // no special config

View file

@ -7,6 +7,7 @@
* Common game registry handling. * Common game registry handling.
*/ */
package wile.engineersdecor.libmc.detail; package wile.engineersdecor.libmc.detail;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey; 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.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.*; import java.util.*;
@ -147,6 +147,17 @@ public class Registries
})); }));
} }
@SuppressWarnings("unchecked")
public static <T extends BlockEntity> void addBlockEntityType(String registry_name, BlockEntityType.BlockEntitySupplier<T> ctor, Class<? extends Block> 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<T> instance = BlockEntityType.Builder.of(ctor, blocks).build(null);
instance.setRegistryName(modid, registry_name);
return instance;
}));
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T extends EntityType<?>> void addEntityType(String registry_name, Supplier<EntityType<?>> supplier) public static <T extends EntityType<?>> void addEntityType(String registry_name, Supplier<EntityType<?>> supplier)
{ entity_type_suppliers.add(new Tuple<>(registry_name, 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); 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<Supplier<Item>> default_suppliers = new HashSet<>(); final Set<Supplier<Item>> default_suppliers = new HashSet<>();
for(ResourceLocation rl: default_items) default_suppliers.add(()->ForgeRegistries.ITEMS.getValue(rl)); 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); 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<ResourceLocation, Block> registration) public static void onBlockRegistry(BiConsumer<ResourceLocation, Block> registration)