diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..f35ab6fef --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: unlikepaladin diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..2b185361b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: Bug Report +description: "For reporting bugs and other defects" +labels: + - bug +body: + - type: markdown + attributes: + value: >- + **Note: This issue tracker is not intended for support requests!** If you need help with crashes or other issues, then + you should [ask on our Discord server](https://discord.gg/zbMDUPB) instead. +

+ Additionally, please make sure you have done the following: + + - **Have you ensured that all of your mods are up-to-date?** The latest version of Paladin's Furniture Mod + can always be found [on Modrinth](https://modrinth.com/mod/paladins-furniture) or [on CurseForge](https://www.curseforge.com/minecraft/mc-mods/paladins-furniture). + + - **Have you used the [search tool](https://github.com/UnlikePaladin/paladins-furniture/issues) to check whether your issue + has already been reported?** If it has been, then consider adding more information to the existing issue instead. + + - **Have you determined the minimum set of instructions to reproduce the issue?** If your problem only occurs + with other mods installed, then you should narrow down exactly which mods are causing the issue. Please do not + provide your entire list of mods to us and expect that we will be able to figure out the problem. +
+ + This issue template was based [off of Sodium's](https://github.com/CaffeineMC/sodium-fabric/blob/dev/.github/ISSUE_TEMPLATE/bug_report.yml) + - type: textarea + id: description + attributes: + label: Bug Description + description: >- + Use this section to describe the issue you are experiencing in as much depth as possible. The description should + explain what behavior you were expecting, and why you believe the issue to be a bug. If the issue you are reporting + only occurs with specific mods installed, then provide the name and version of each mod. + + **Hint:** If you have any screenshots, videos, or other information that you feel is necessary to + explain the issue, you can attach them here. + - type: textarea + id: description-reproduction-steps + attributes: + label: Reproduction Steps + description: >- + Provide as much information as possible on how to reproduce this bug. Make sure your instructions are as clear and + concise as possible, because other people will need to be able to follow your guide in order to re-create the issue. + + **Hint:** A common way to fill this section out is to write a step-by-step guide. + validations: + required: true + - type: textarea + id: log-file + attributes: + label: Log File + description: >- + **Hint:** You can usually find the log files within the folder `.minecraft/logs`. Most often, you will want the `latest.log` + file, since that file belongs to the last played session of the game. + placeholder: >- + Drag-and-drop the log file here. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..4fdf39b79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +blank_issues_enabled: true +contact_links: + - name: For help with other issues, join the Discord community + url: https://discord.gg/zbMDUPB + about: This is the best option for getting help with mod installation, performance issues, and any other support inquiries + # Copied from https://github.com/CaffeineMC/sodium-fabric#community + # Copied from https://github.com/CaffeineMC/sodium-fabric/blob/dev/.github/ISSUE_TEMPLATE/config.yml \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..7de897952 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,26 @@ +name: Feature Request +description: "For requesting new features or improvements" +labels: + - enhancement +body: + - type: markdown + attributes: + value: >- + This form is for requesting new features or improvements, and should not be used for bug reports or other issues. + - type: markdown + attributes: + value: >- + Make sure you have used the [search tool](https://github.com/UnlikePaladin/paladins-furniture/issues) to see if a similar + request already exists. If we have previously closed a feature request, then please do not create another request. + - type: markdown + attributes: + value: >- + This template was based [off of Sodium's](https://github.com/CaffeineMC/sodium-fabric/blob/dev/.github/ISSUE_TEMPLATE/feature_request.yml) + - type: textarea + id: description + attributes: + label: Request Description + description: >- + Use this section to describe the feature or improvement that you are looking for. The description should explain + what you would like to see added, and a clear and concise description + of what you would like changed. \ No newline at end of file diff --git a/build.gradle b/build.gradle index beb6b1d77..8f83869e1 100755 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false } architectury { diff --git a/common/build.gradle b/common/build.gradle index 8484bd218..7e53ec437 100755 --- a/common/build.gradle +++ b/common/build.gradle @@ -25,7 +25,13 @@ dependencies { // Do NOT use other classes from fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" // Remove the next line if you don't want to depend on the API - modImplementation "me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}" + modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}"){ + exclude(group: "net.fabricmc.fabric-api") + exclude(group: "me.shedaniel.cloth") + } + modCompileOnly("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + } modCompileOnlyApi("mezz.jei:jei-${rootProject.minecraft_version}-fabric:${rootProject.jei_version}") { exclude group: "mezz.jei" } diff --git a/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java b/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java index afc1ae70d..8d14a91bc 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java +++ b/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java @@ -99,6 +99,14 @@ public static Loader getLoader() { throw new AssertionError(); } + public static boolean isOptifineLoaded() { + try { + Class.forName("net.optifine.shaders.Shaders"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } public enum Loader implements StringIdentifiable { FORGE("forge"), FABRIC_LIKE("fabric_like"); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicShowerHandleBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicShowerHandleBlock.java index e3a6af50c..736d2ae55 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicShowerHandleBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicShowerHandleBlock.java @@ -108,7 +108,8 @@ public BlockState toggleOpen(BlockState state, World world, BlockPos pos, boolea state = state.cycle(POWERED);} world.setBlockState(pos, state, Block.NOTIFY_ALL); this.updateNeighbors(state, world, pos); - ((ShowerHandleBlockEntity)(world.getBlockEntity(pos))).setState(state.get(POWERED)); + if (world.getBlockEntity(pos) instanceof ShowerHandleBlockEntity) + ((ShowerHandleBlockEntity)(world.getBlockEntity(pos))).setState(state.get(POWERED)); return state; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java index bb39986a7..7ff6a7fa2 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java @@ -114,7 +114,8 @@ public BlockState togglePower(BlockState state, World world, BlockPos pos, boole state = state.cycle(POWERED);} world.setBlockState(pos, state, Block.NOTIFY_ALL); this.updateNeighbors(state, world, pos); - ((LightSwitchBlockEntity)world.getBlockEntity(pos)).setState(state.get(POWERED)); + if (world.getBlockEntity(pos) instanceof LightSwitchBlockEntity) + ((LightSwitchBlockEntity)world.getBlockEntity(pos)).setState(state.get(POWERED)); return state; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/LightSwitchBlockEntity.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/LightSwitchBlockEntity.java index 323f3c154..f4fdaace6 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/LightSwitchBlockEntity.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/LightSwitchBlockEntity.java @@ -47,18 +47,21 @@ public void addLight(long pos) } } + + public void setState(boolean powered) { if(!lights.isEmpty()) { - lights.removeIf(lightPos -> + lights.removeIf(offset -> { - BlockState state = world.getBlockState(lightPos); + BlockState state = world.getBlockState(this.pos.subtract(offset)); return !(state.getBlock() instanceof PowerableBlock); }); - lights.forEach(lightPos -> + lights.forEach(offset -> { - BlockState state = world.getBlockState(lightPos); - ((PowerableBlock) state.getBlock()).setPowered(world, lightPos, powered); + BlockPos actualPos = this.pos.subtract(offset); + BlockState state = world.getBlockState(actualPos); + ((PowerableBlock) state.getBlock()).setPowered(world, actualPos, powered); }); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/ShowerHandleBlockEntity.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/ShowerHandleBlockEntity.java index 89c24a078..3c23d5c6b 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/ShowerHandleBlockEntity.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/ShowerHandleBlockEntity.java @@ -10,17 +10,17 @@ import net.minecraft.util.math.BlockPos; public class ShowerHandleBlockEntity extends BlockEntity { - protected BlockPos showerHead; + protected BlockPos showerOffset; public ShowerHandleBlockEntity(BlockPos pos, BlockState state) { super(BlockEntities.SHOWER_HANDLE_BLOCK_ENTITY, pos, state); - this.showerHead = null; + this.showerOffset = null; } @Override public void writeNbt(NbtCompound nbt) { super.writeNbt(nbt); - if (this.showerHead != null) { - NbtLong showerHeadPos = NbtLong.of(this.showerHead.asLong()); + if (this.showerOffset != null) { + NbtLong showerHeadPos = NbtLong.of(this.showerOffset.asLong()); nbt.put("showerHead", showerHeadPos); } } @@ -29,21 +29,22 @@ public void writeNbt(NbtCompound nbt) { public void readNbt(NbtCompound nbt) { super.readNbt(nbt); if(nbt.contains("showerHead", NbtElement.LONG_TYPE)){ - this.showerHead = BlockPos.fromLong(nbt.getLong("showerHead")); + this.showerOffset = BlockPos.fromLong(nbt.getLong("showerHead")); } } public void setState(boolean open) { - if (this.showerHead != null) { - if(this.world.getBlockEntity(this.showerHead) != null) { + if (this.showerOffset != null) { + BlockPos showerHeadPos = this.pos.subtract(this.showerOffset); + if(this.world.getBlockEntity(showerHeadPos) != null) { - BlockState state = world.getBlockState(this.showerHead); - ((ShowerHeadBlockEntity)world.getBlockEntity(this.showerHead)).setOpen(open); + BlockState state = world.getBlockState(showerHeadPos); + ((ShowerHeadBlockEntity)world.getBlockEntity(showerHeadPos)).setOpen(open); - world.updateListeners(this.showerHead, state, state, Block.NOTIFY_LISTENERS); - } else if (this.world.getBlockEntity(this.showerHead) == null) { - this.showerHead = null; + world.updateListeners(showerHeadPos, state, state, Block.NOTIFY_LISTENERS); + } else if (this.world.getBlockEntity(showerHeadPos) == null) { + this.showerOffset = null; } } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java b/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java index f46566dd8..bc0c508c9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java +++ b/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java @@ -1,5 +1,7 @@ package com.unlikepaladin.pfm.config; +import com.google.gson.*; +import com.google.gson.reflect.TypeToken; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.config.option.AbstractConfigOption; import com.unlikepaladin.pfm.config.option.BooleanConfigOption; @@ -7,9 +9,8 @@ import net.minecraft.text.Text; import net.minecraft.text.TranslatableTextContent; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; +import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.Path; import java.util.*; @@ -22,10 +23,12 @@ public class PaladinFurnitureModConfig { private static final String COMMENT = "This file stores configuration options for Paladin's Furniture Mod"; private final Path propertiesPath; + private final Path directoryPath; public HashMap options = new LinkedHashMap<>(); public static final String MOD_OPTIONS = "pfm.config.categories.mod_options"; public static final String GAMEPLAY_OPTIONS = "pfm.config.categories.gameplay_options"; + static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); public PaladinFurnitureModConfig(Path propertiesPath) { this.addOptions( @@ -41,7 +44,8 @@ public PaladinFurnitureModConfig(Path propertiesPath) { renderImmersivePortalsMirrors = new BooleanConfigOption(Text.translatable("pfm.option.renderImmersivePortalsMirrors"), Text.translatable("pfm.option.renderImmersivePortalsMirrors.tooltip"), GAMEPLAY_OPTIONS, true, Side.CLIENT), spawnImmersivePortalsMirror = new BooleanConfigOption(Text.translatable("pfm.option.spawnImmersivePortalsMirror"), Text.translatable("pfm.option.spawnImmersivePortalsMirror.tooltip"), GAMEPLAY_OPTIONS, true, Side.SERVER) ); - this.propertiesPath = propertiesPath; + this.propertiesPath = propertiesPath.resolve("pfm.json"); + this.directoryPath = propertiesPath; } private void addOptions(AbstractConfigOption... args) { @@ -134,17 +138,74 @@ public Path getPath() { * * @throws IOException if the file cannot be loaded */ - public void load() throws IOException { + Path legacyConfig = directoryPath.resolve("pfm.properties"); + if (Files.exists(legacyConfig)) + loadLegacyProperties(legacyConfig); + if (!Files.exists(propertiesPath)) { return; } + JsonObject config = new JsonObject(); + try (FileReader reader = new FileReader(propertiesPath.toString())) { + JsonElement element = new JsonParser().parse(reader); + if (element.isJsonObject()) { + config = element.getAsJsonObject(); + } + } + + checkForUpdates.setValue(getFromJsonElement(config.get("checkForUpdates"), true)); + shaderSolidFix.setValue(getFromJsonElement(config.get("shaderSolidFix"), false)); + doChairsFacePlayer.setValue(getFromJsonElement(config.get("chairsFacePlayer"), true)); + countersOfDifferentMaterialsConnect.setValue(getFromJsonElement(config.get("countersOfDifferentMaterialsConnect"), false)); + tablesOfDifferentMaterialsConnect.setValue(getFromJsonElement(config.get("tablesOfDifferentMaterialsConnect"), false)); + foodPopsOffStove.setValue(getFromJsonElement(config.get("foodPopsOffStove"), false)); + enableBook.setValue(getFromJsonElement(config.get("enableBook"), false)); + differentMirrorsConnect.setValue(getFromJsonElement(config.get("differentMirrorsConnect"), false)); + mobsSitOnChairs.setValue(getFromJsonElement(config.get("mobsSitOnChairs"), false)); + renderImmersivePortalsMirrors.setValue(getFromJsonElement(config.get("renderImmersivePortalsMirrors"), true)); + spawnImmersivePortalsMirror.setValue(getFromJsonElement(config.get("spawnImmersivePortalsMirror"), true)); + + for (String key : options.keySet()) { + if (!config.has(key.replace("pfm.option.", ""))){ + PaladinFurnitureMod.GENERAL_LOGGER.warn("Missing Config Option: " + key.replace("pfm.option.", "") + ", resetting to default value."); + options.get(key).setValue(options.get(key).getDefaultValue()); + save(); + } + } + } + + + public static T getFromJsonElement(JsonElement element, T defaultValue) { + if (element != null && element.isJsonPrimitive()) { + JsonPrimitive primitive = element.getAsJsonPrimitive(); + + Type targetType; + + if (primitive.isString()) { + targetType = new TypeToken() {}.getType(); + } else if (primitive.isBoolean()) { + targetType = new TypeToken() {}.getType(); + } else if (primitive.isNumber()) { + targetType = new TypeToken() {}.getType(); + } else { + // Handle the case where the primitive type is not supported + return null; + } + + return GSON.fromJson(primitive, targetType); + } + return defaultValue; + } + + public void loadLegacyProperties(Path legacyConfigFile) throws IOException { Properties properties = new Properties(); // NB: This uses ISO-8859-1 with unicode escapes as the encoding - try (InputStream is = Files.newInputStream(propertiesPath)) { + try (InputStream is = Files.newInputStream(legacyConfigFile)) { properties.load(is); } + checkForUpdates.setValue("true".equals(properties.getProperty("checkForUpdates"))); shaderSolidFix.setValue(!"false".equals(properties.getProperty("shaderSolidFix"))); doChairsFacePlayer.setValue("true".equals(properties.getProperty("chairsFacePlayer"))); @@ -156,14 +217,9 @@ public void load() throws IOException { mobsSitOnChairs.setValue("true".equals(properties.getProperty("mobsSitOnChairs"))); renderImmersivePortalsMirrors.setValue("true".equals(properties.getProperty("renderImmersivePortalsMirrors"))); spawnImmersivePortalsMirror.setValue("true".equals(properties.getProperty("spawnImmersivePortalsMirror"))); - - for (String key : options.keySet()) { - if (!properties.containsKey(key.replace("pfm.option.", ""))){ - PaladinFurnitureMod.GENERAL_LOGGER.warn("Missing Config Option: " + key.replace("pfm.option.", "") + ", resetting to default value."); - options.get(key).setValue(options.get(key).getDefaultValue()); - save(); - } - } + save(); + Files.delete(legacyConfigFile); + PaladinFurnitureMod.GENERAL_LOGGER.info("Successfully migrated to new config"); } /** @@ -172,22 +228,21 @@ public void load() throws IOException { * @throws IOException file exceptions */ public void save() throws IOException { - Properties properties = new Properties(); - properties.setProperty("checkForUpdates", checkForUpdates.getValue() ? "true" : "false"); - properties.setProperty("shaderSolidFix", shaderSolidFix.getValue() ? "true" : "false"); - properties.setProperty("chairsFacePlayer", doChairsFacePlayer.getValue() ? "true" : "false"); - properties.setProperty("countersOfDifferentMaterialsConnect", countersOfDifferentMaterialsConnect.getValue() ? "true" : "false"); - properties.setProperty("foodPopsOffStove", foodPopsOffStove.getValue() ? "true" : "false"); - properties.setProperty("tablesOfDifferentMaterialsConnect",tablesOfDifferentMaterialsConnect.getValue() ? "true" : "false"); - properties.setProperty("enableBook",enableBook.getValue() ? "true" : "false"); - properties.setProperty("differentMirrorsConnect", differentMirrorsConnect.getValue() ? "true" : "false"); - properties.setProperty("mobsSitOnChairs", mobsSitOnChairs.getValue() ? "true" : "false"); - properties.setProperty("renderImmersivePortalsMirrors", renderImmersivePortalsMirrors.getValue() ? "true" : "false"); - properties.setProperty("spawnImmersivePortalsMirror", spawnImmersivePortalsMirror.getValue() ? "true" : "false"); - - // NB: This uses ISO-8859-1 with unicode escapes as the encoding - try (OutputStream os = Files.newOutputStream(propertiesPath)) { - properties.store(os, COMMENT); + JsonObject object = new JsonObject(); + object.addProperty("checkForUpdates", checkForUpdates.getValue()); + object.addProperty("shaderSolidFix", shaderSolidFix.getValue()); + object.addProperty("chairsFacePlayer", doChairsFacePlayer.getValue()); + object.addProperty("countersOfDifferentMaterialsConnect", countersOfDifferentMaterialsConnect.getValue()); + object.addProperty("foodPopsOffStove", foodPopsOffStove.getValue()); + object.addProperty("tablesOfDifferentMaterialsConnect", tablesOfDifferentMaterialsConnect.getValue()); + object.addProperty("enableBook", enableBook.getValue()); + object.addProperty("differentMirrorsConnect", differentMirrorsConnect.getValue()); + object.addProperty("mobsSitOnChairs", mobsSitOnChairs.getValue()); + object.addProperty("renderImmersivePortalsMirrors", renderImmersivePortalsMirrors.getValue()); + object.addProperty("spawnImmersivePortalsMirror", spawnImmersivePortalsMirror.getValue()); + + try (FileWriter writer = new FileWriter(propertiesPath.toString())) { + GSON.toJson(object, writer); } } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/PFMTags.java b/common/src/main/java/com/unlikepaladin/pfm/data/PFMTags.java index ac60ec115..04c5107a5 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/PFMTags.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/PFMTags.java @@ -7,6 +7,7 @@ public class PFMTags { public static TagKey TUCKABLE_BLOCKS = createTag(new Identifier("pfm", "tuckable_blocks")); + public static TagKey FURNITURE = createTag(new Identifier("pfm", "furniture")); @ExpectPlatform public static TagKey createTag(Identifier identifier) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java index 46edcd130..a30015711 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java @@ -19,23 +19,22 @@ public class ExtraCounterVariant extends VariantBase { public static ExtraCounterVariant DARK_CONCRETE = new ExtraCounterVariant(Blocks.GRAY_CONCRETE, Blocks.WHITE_CONCRETE, "dark_concrete"); - public static ExtraCounterVariant CONCRETE = new ExtraCounterVariant(Blocks.WHITE_CONCRETE, PaladinFurnitureModBlocksItems.RAW_CONCRETE, "concrete"); + public static ExtraCounterVariant CONCRETE = new ExtraCounterVariant(Blocks.WHITE_CONCRETE, null, "concrete"); public static ExtraCounterVariant SMOOTH_STONE = new ExtraCounterVariant(Blocks.WHITE_CONCRETE, Blocks.SMOOTH_STONE,"smooth_stone"); public static ExtraCounterVariant DEEPSLATE_TILE = new ExtraCounterVariant(Blocks.QUARTZ_BLOCK, Blocks.DEEPSLATE_TILES,"deepslate_tile"); private final String name; private final Block baseBlock; static final List DEFAULT_VARIANTS = new ArrayList<>(); - static { - DEFAULT_VARIANTS.add(DARK_CONCRETE); - DEFAULT_VARIANTS.add(CONCRETE); - DEFAULT_VARIANTS.add(SMOOTH_STONE); - DEFAULT_VARIANTS.add(DEEPSLATE_TILE); - } - private final Block secondaryBlock; public static List values() { + if (DEFAULT_VARIANTS.isEmpty()) { + DEFAULT_VARIANTS.add(DARK_CONCRETE); + DEFAULT_VARIANTS.add(CONCRETE); + DEFAULT_VARIANTS.add(SMOOTH_STONE); + DEFAULT_VARIANTS.add(DEEPSLATE_TILE); + } return DEFAULT_VARIANTS; } @@ -61,6 +60,9 @@ public Block getBaseBlock() { @Override public Block getSecondaryBlock() { + if (secondaryBlock == null) + return PaladinFurnitureModBlocksItems.RAW_CONCRETE; + return secondaryBlock; } @@ -110,7 +112,7 @@ public Block mainChild() { @Override public Identifier getTexture(BlockType type) { if (type == BlockType.SECONDARY) - return ModelHelper.getTextureId(secondaryBlock); + return ModelHelper.getTextureId(getSecondaryBlock()); return ModelHelper.getTextureId(baseBlock); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java index f0487d3fe..95d53e233 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java @@ -28,14 +28,13 @@ public class ExtraStoolVariant extends VariantBase { private final Block secondaryBlock; static final List DEFAULT_VARIANTS = new ArrayList<>(); - static { - DEFAULT_VARIANTS.add(GRAY_DARK_OAK); - DEFAULT_VARIANTS.add(WHITE); - DEFAULT_VARIANTS.add(GRAY); - DEFAULT_VARIANTS.add(LIGHT_GRAY_DARK_OAK); - } - public static List values() { + if (DEFAULT_VARIANTS.isEmpty()) { + DEFAULT_VARIANTS.add(GRAY_DARK_OAK); + DEFAULT_VARIANTS.add(WHITE); + DEFAULT_VARIANTS.add(GRAY); + DEFAULT_VARIANTS.add(LIGHT_GRAY_DARK_OAK); + } return DEFAULT_VARIANTS; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/items/LightSwitchItem.java b/common/src/main/java/com/unlikepaladin/pfm/items/LightSwitchItem.java index 253e0053a..2ff71050f 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/items/LightSwitchItem.java +++ b/common/src/main/java/com/unlikepaladin/pfm/items/LightSwitchItem.java @@ -84,18 +84,22 @@ protected boolean canPlace(ItemPlacementContext context, BlockState state) { NbtList lights = getLights(context.getStack()); if (lights != null) { ArrayList removedLights = new ArrayList<>(); - Direction facing = context.getHorizontalPlayerFacing(); - + ArrayList lightOffsets = new ArrayList<>(); for (Iterator iterator = lights.iterator(); iterator.hasNext();) { NbtElement nbtElement = iterator.next(); BlockPos lightPos = BlockPos.fromLong(((NbtLong) nbtElement).longValue()); - BlockPos placedPos = pos.offset(facing); - double distance = Math.sqrt(lightPos.getSquaredDistance(placedPos.getX() + 0.5, placedPos.getY() + 0.5, placedPos.getZ() + 0.5)); + double distance = Math.sqrt(lightPos.getSquaredDistance(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5)); if (distance > 16) { removedLights.add(BlockPos.fromLong(((NbtLong) nbtElement).longValue())); iterator.remove(); + } else { + lightOffsets.add(pos.subtract(lightPos)); } } + context.getStack().setNbt(new NbtCompound()); + for (BlockPos blockPos : lightOffsets) { + addLight(context.getStack(), blockPos); + } if (!removedLights.isEmpty() && context.getWorld().isClient){ context.getPlayer().sendMessage(Text.translatable("message.pfm.light_switch_far", removedLights.toString()), false); diff --git a/common/src/main/java/com/unlikepaladin/pfm/items/ShowerHandleItem.java b/common/src/main/java/com/unlikepaladin/pfm/items/ShowerHandleItem.java index aeeab7e00..35bba8bbb 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/items/ShowerHandleItem.java +++ b/common/src/main/java/com/unlikepaladin/pfm/items/ShowerHandleItem.java @@ -62,20 +62,22 @@ public ActionResult useOnBlock(ItemUsageContext context) { protected boolean canPlace(ItemPlacementContext context, BlockState state) { BlockPos pos = context.getBlockPos(); WorldView world = context.getWorld(); - NbtLong showerHeadPos = getShowerHead(context.getStack()); + NbtLong showerHeadLong = getShowerHead(context.getStack()); Direction playerFacing = context.getHorizontalPlayerFacing(); Direction placeDirection = context.getSide(); - if (showerHeadPos != null) { - BlockPos lightPos = BlockPos.fromLong(showerHeadPos.longValue()); + if (showerHeadLong != null) { + BlockPos headPos = BlockPos.fromLong(showerHeadLong.longValue()); BlockPos placedPos = pos.offset(playerFacing); - double distance = Math.sqrt(lightPos.getSquaredDistance(placedPos.getX() + 0.5, placedPos.getY() + 0.5, placedPos.getZ() + 0.5)); + double distance = Math.sqrt(headPos.getSquaredDistance(placedPos.getX() + 0.5, placedPos.getY() + 0.5, placedPos.getZ() + 0.5)); if (distance > 16 && world.isClient()){ - context.getPlayer().sendMessage(Text.translatable("message.pfm.shower_handle_far", lightPos.toString()), false); + context.getPlayer().sendMessage(Text.translatable("message.pfm.shower_handle_far", headPos.toString()), false); } if (distance > 16) { context.getStack().setNbt(null); + } else { + setShowerHeadPosNBT(context.getStack(), pos.subtract(headPos)); } return state.getBlock().canPlaceAt(state, world, pos) && placeDirection.getAxis().isHorizontal(); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java index 38f1c9646..1fd6ddd4a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java @@ -136,7 +136,8 @@ protected void generateTags() { .add(PaladinFurnitureModBlocksItems.IRON_CHAIN) .add(sinkBlocks) .add(PaladinFurnitureModBlocksItems.BASIC_SHOWER_HANDLE) - .add(PaladinFurnitureModBlocksItems.BASIC_SHOWER_HEAD); + .add(PaladinFurnitureModBlocksItems.BASIC_SHOWER_HEAD) + .add(PaladinFurnitureModBlocksItems.BASIC_BATHTUB); KitchenCounterBlock[] woodCounters = KitchenCounterBlock.streamWoodCounters().map(FurnitureBlock::getBlock).toArray(KitchenCounterBlock[]::new); KitchenWallCounterBlock[] woodWallCounters = KitchenWallCounterBlock.streamWallWoodCounters().map(FurnitureBlock::getBlock).toArray(KitchenWallCounterBlock[]::new); @@ -232,6 +233,9 @@ protected void generateTags() { .add(stoneNaturalTables) .add(logTables); + getOrCreateTagBuilder(PFMTags.FURNITURE) + .add(PaladinFurnitureModBlocksItems.BLOCKS.toArray(Block[]::new)); + PaladinFurnitureMod.pfmModCompatibilities.forEach(PFMModCompatibility::generateTags); } diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom.json index f35f77904..bd1cee7cd 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom_open.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom_open.json index cdc88da33..25750f33b 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom_open.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_bottom_open.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_full.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_full.json index c862e1d28..e397b25fd 100755 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_full.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_full.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle.json index b77b35db6..0afab21b3 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle_open.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle_open.json index 85914ac5b..397d07d9a 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle_open.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_middle_open.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single.json index 9d92cacb6..f09b67a21 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single_open.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single_open.json index b104b3937..eb47bbc7c 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single_open.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_single_open.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top.json index 24b70519c..84b7f54be 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top_open.json b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top_open.json index 95c83f688..34cc68e1f 100644 --- a/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top_open.json +++ b/common/src/main/resources/assets/pfm/models/block/iron_fridge/iron_fridge_top_open.json @@ -3,7 +3,8 @@ "textures": { "2": "pfm:block/fridge/fridge_back", "legs": "block/light_gray_concrete", - "base": "block/iron_block" + "base": "block/iron_block", + "particle": "block/iron_block" }, "elements": [ { diff --git a/common/src/main/resources/pfm.accesswidener b/common/src/main/resources/pfm.accesswidener index 403a48b85..1ef416f6c 100644 --- a/common/src/main/resources/pfm.accesswidener +++ b/common/src/main/resources/pfm.accesswidener @@ -13,4 +13,5 @@ accessible field net/minecraft/resource/featuretoggle/FeatureSet universe Lnet/m accessible field net/minecraft/resource/featuretoggle/FeatureSet featuresMask J mutable field net/minecraft/resource/featuretoggle/FeatureFlag mask J accessible field net/minecraft/resource/featuretoggle/FeatureFlag mask J -accessible class net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder \ No newline at end of file +accessible class net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder +accessible field net/minecraft/block/AbstractBlock$Settings material Lnet/minecraft/block/Material; diff --git a/fabric/build.gradle b/fabric/build.gradle index c8e9453cd..e808d5229 100755 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -85,15 +85,15 @@ else { modCompileOnly("maven.modrinth:sandwichable:${rootProject.sandwichable_version}"){ exclude(group: "net.fabricmc.fabric-api") } - modCompileOnly("dev.lambdaurora:spruceui:${rootProject.spruceui_version}"){ - exclude(group: "net.fabricmc.fabric-api") - } } } if (rootProject.rei_compatibility == "true"){ dependencies { modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:${rootProject.rei_version}"){ + transitive(false) + } + modRuntimeOnly("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } } @@ -121,21 +121,6 @@ else { } } -if (rootProject.arrp_compatibility == "true") { - dependencies { - modImplementation("curse.maven:arrp-463113:${rootProject.arrp_version}"){ - exclude(group: "net.fabricmc.fabric-api") - } - } -} -else { - dependencies { - modCompileOnly("curse.maven:arrp-463113:${rootProject.arrp_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - } -} - if (rootProject.immersive_portals_compatibility_fabric == "true"){ dependencies { modImplementation ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version_fabric}"){ @@ -168,11 +153,13 @@ dependencies { modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") { exclude(group: "net.fabricmc.fabric-api") - transitive = false + transitive(false) } // modRuntimeOnly("com.terraformersmc:terrestria:${rootProject.terrestria}") - modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${rootProject.rei_version}" + modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${rootProject.rei_version}") { + transitive(false) + } modCompileOnly("maven.modrinth:iris:${rootProject.iris_version}") modCompileOnly("curse.maven:farmers-delight-fabric-482834:${rootProject.farmers_delight_version_fabric}") @@ -197,6 +184,7 @@ dependencies { dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" + modApi "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_api_version}" common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelLoadingPlugin.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelLoadingPlugin.java index bef70fc22..e330e055d 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelLoadingPlugin.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelLoadingPlugin.java @@ -23,6 +23,7 @@ import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; +import com.unlikepaladin.pfm.blocks.models.ladder.UnbakedLadderModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -129,6 +130,9 @@ else if (UnbakedFreezerModel.FREEZER_MODEL_IDS.contains(resourceId)){ else if (UnbakedBasicLampModel.LAMP_MODEL_IDS.contains(resourceId)){ return new UnbakedBasicLampModel(); } + else if (UnbakedLadderModel.LADDER_MODEL_IDS.contains(resourceId)){ + return new UnbakedLadderModel(); + } else return null; } @@ -204,6 +208,9 @@ public List provideExtraModels() { for (Identifier id : UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_PARTS_BASE) { out.add(id); } + for (Identifier id : UnbakedLadderModel.LADDER_PARTS_BASE) { + out.add(id); + } out.addAll(UnbakedMirrorModel.ALL_MODEL_IDS); out.addAll(UnbakedIronFridgeModel.ALL_MODEL_IDS); out.addAll(UnbakedFridgeModel.ALL_MODEL_IDS); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/PFMImmersivePortalsImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/PFMImmersivePortalsImpl.java index e9e857e04..00e660b03 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/PFMImmersivePortalsImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/PFMImmersivePortalsImpl.java @@ -16,10 +16,11 @@ public class PFMImmersivePortalsImpl implements PFMModCompatibility { private PFMClientModCompatibility clientModCompatibility; - public static final EntityType MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); + public static EntityType MIRROR; @Override public void registerEntityTypes() { + MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); EntityRegistry.registerEntityType("mirror_entity", MIRROR); } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/entity/PFMMirrorEntity.java b/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/entity/PFMMirrorEntity.java index 1c5a7cc5d..22c9cb51d 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/entity/PFMMirrorEntity.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/entity/PFMMirrorEntity.java @@ -24,7 +24,6 @@ import java.util.stream.Stream; public class PFMMirrorEntity extends Mirror { - public static EntityType entityType = PFMImmersivePortalsImpl.MIRROR; @Nullable public IntBox wallArea; @Nullable @@ -34,7 +33,6 @@ public class PFMMirrorEntity extends Mirror { public PFMMirrorEntity(EntityType entityType, World world) { super(entityType, world); - PFMMirrorEntity.entityType = entityType; } @Override @@ -151,7 +149,7 @@ public static void createMirror(ServerWorld world, BlockPos glassPos, Direction return; } - PFMMirrorEntity pfmMirrorEntity = PFMMirrorEntity.entityType.create(world); + PFMMirrorEntity pfmMirrorEntity = PFMImmersivePortalsImpl.MIRROR.create(world); double distanceToCenter = -0.452; Box wallBox = getWallBox(world, shape.area.stream()); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java b/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java index 70c19b352..5287b25d8 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java @@ -63,7 +63,7 @@ public void onInitialize() { // This code runs as soon as Minecraft is in a mod-load-ready state. // However, some things (like resources) may still be uninitialized. // Proceed with mild caution. - pfmConfig = new PaladinFurnitureModConfig(FabricLoader.getInstance().getConfigDir().resolve("pfm.properties")); + pfmConfig = new PaladinFurnitureModConfig(FabricLoader.getInstance().getConfigDir()); try { pfmConfig.initialize(); } catch (IOException e) { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index b2bf6743b..c0bb136e2 100755 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -54,11 +54,13 @@ "suggests": { "patchouli": "*" }, - "modmenu": { - "links": { - "modmenu.discord": "https://discord.gg/zbMDUPB", - "modmenu.kofi": "https://ko-fi.com/unlikepaladin", - "modmenu.modrinth": "https://modrinth.com/mod/paladins-furniture/" + "custom": { + "modmenu": { + "links": { + "modmenu.discord": "https://discord.gg/zbMDUPB", + "modmenu.kofi": "https://ko-fi.com/unlikepaladin", + "modmenu.modrinth": "https://modrinth.com/mod/paladins-furniture/" + } } } } \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index ee5610fef..898f591d9 100755 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -35,6 +35,11 @@ repositories { name = "Progwml6 maven" url = "https://dvs1.progwml6.com/files/maven/" } + maven { + // location of a maven mirror for JEI files, as a fallback + name = "ModMaven" + url = "https://modmaven.dev" + } maven { url "https://cursemaven.com" content { @@ -67,8 +72,12 @@ dependencies { modImplementation("vazkii.patchouli:Patchouli:${rootProject.patchouli_version_forge}-FORGE") modCompileOnlyApi("mezz.jei:jei-${rootProject.minecraft_version}-forge-api:${rootProject.jei_version}") - modCompileOnlyApi "me.shedaniel:RoughlyEnoughItems-api-forge:${rootProject.rei_version}" - modCompileOnlyApi "me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}" + modCompileOnlyApi("me.shedaniel:RoughlyEnoughItems-api-forge:${rootProject.rei_version}") { + transitive(false) + } + modCompileOnlyApi("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}") { + transitive(false) + } //modRuntimeOnly("curse.maven:biomesop-220318:3562256") modCompileOnly ("maven.modrinth:oculus:${rootProject.oculus_version}") @@ -82,7 +91,7 @@ if(rootProject.jei_compatibility == "true") { dependencies { modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}") } -} +}fi if (rootProject.immersive_portals_compatibility_forge == "true"){ dependencies { modImplementation("curse.maven:imm_ptl-355440:${rootProject.immersive_portals_version_forge}") @@ -98,6 +107,9 @@ if (rootProject.lazy_dfu_enabled == "true"){ if (rootProject.rei_compatibility == "true"){ dependencies { modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}") + modRuntimeOnly("me.shedaniel.cloth:cloth-config-forge:${rootProject.cloth_config_version}") { + transitive(false) + } } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/FreezerBlockEntityImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/FreezerBlockEntityImpl.java index 9f84fb0b6..420168ad2 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/FreezerBlockEntityImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/FreezerBlockEntityImpl.java @@ -3,10 +3,52 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.blockentities.FreezerBlockEntity; import com.unlikepaladin.pfm.compat.cookingforblockheads.forge.FreezerBlockEntityBalm; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.ForgeCapabilities; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.wrapper.SidedInvWrapper; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class FreezerBlockEntityImpl extends FreezerBlockEntity { + + private final LazyOptional[] handlers; + + public FreezerBlockEntityImpl(BlockPos pos, BlockState state) { + super(pos, state); + this.handlers = SidedInvWrapper.create(this, Direction.UP, Direction.DOWN, Direction.NORTH); + } -public class FreezerBlockEntityImpl { public static BlockEntityType.BlockEntityFactory getFactory() { - return PaladinFurnitureMod.getModList().contains("cookingforblockheads") ? FreezerBlockEntityBalm::new : FreezerBlockEntity::new; + return PaladinFurnitureMod.getModList().contains("cookingforblockheads") ? FreezerBlockEntityBalm::new : FreezerBlockEntityImpl::new; + } + + @Override + public @NotNull LazyOptional getCapability(Capability cap, @Nullable Direction side) { + if (cap == ForgeCapabilities.ITEM_HANDLER) { + if (side == Direction.UP) + return handlers[0].cast(); + else if (side == Direction.DOWN) { + return handlers[1].cast(); + } else { + return handlers[2].cast(); + } + } + return LazyOptional.empty(); + } + + @Override + public void invalidateCaps() { + super.invalidateCaps(); + for (LazyOptional handler : this.handlers) { + handler.invalidate(); + } } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/MicrowaveBlockEntityImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/MicrowaveBlockEntityImpl.java index b05de7414..2bafb31bf 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/MicrowaveBlockEntityImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/forge/MicrowaveBlockEntityImpl.java @@ -23,7 +23,7 @@ import java.util.Objects; -public class MicrowaveBlockEntityImpl extends MicrowaveBlockEntity { +public class MicrowaveBlockEntityImpl extends MicrowaveBlockEntity { public MicrowaveBlockEntityImpl(BlockPos pos, BlockState state) { super(pos, state); } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java index 7b0257f21..6f8337cc3 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -1,5 +1,6 @@ package com.unlikepaladin.pfm.blocks.models.forge; +import com.google.common.collect.Iterables; import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; @@ -50,8 +51,13 @@ public List getQuadsWithTexture(List quads, List t if (quads == null) return Collections.emptyList(); - if (replacements == null || toReplace == null || toReplace.size() != replacements.size()) { - PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list is not the same size or was null, skipping transformation"); + if (replacements == null || toReplace == null) { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list was null, skipping transformation"); + return quads; + } else if (toReplace.size() != replacements.size()) { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list was not the same size, skipping transformation, expected {} sprites, got {}", toReplace.size(), replacements.size()); + PaladinFurnitureMod.GENERAL_LOGGER.debug(toReplace); + PaladinFurnitureMod.GENERAL_LOGGER.debug(replacements); return quads; } if (toReplace.equals(replacements)) @@ -81,7 +87,7 @@ public List getQuadsWithTexture(List quads, List t .orElse(-1); if (index != -1) { - Sprite replacement = replacements.get(index); + Sprite replacement = Iterables.get(replacements, index, toReplace.get(index)); transformedQuads.addAll(getQuadsWithTexture(entry.getValue().stream().filter(quads::contains).toList(), replacement)); } else { transformedQuads.addAll(entry.getValue().stream().filter(quads::contains).toList()); @@ -93,13 +99,15 @@ public List getQuadsWithTexture(List quads, List t Map, BakedQuad> quadToTransformedQuad = new ConcurrentHashMap<>(); public List getQuadsWithTexture(List quads, Sprite sprite) { List transformedQuads = new ArrayList<>(quads.size()); + + // I basically have to disable caching if Optifine is present, otherwise it breaks uvs quads.forEach(quad -> { Pair quadKey = new Pair<>(sprite.getContents().getId(), quad); - if (quad.getSprite().getContents().getId() == sprite.getContents().getId() && !quadToTransformedQuad.containsKey(quadKey)) { + if (quad.getSprite().getContents().getId() == sprite.getContents().getId() && !quadToTransformedQuad.containsKey(quadKey) && !PaladinFurnitureMod.isOptifineLoaded()) { quadToTransformedQuad.put(quadKey, quad); transformedQuads.add(quad); } - else if (quadToTransformedQuad.containsKey(quadKey)) { + else if (quadToTransformedQuad.containsKey(quadKey) && !PaladinFurnitureMod.isOptifineLoaded()) { transformedQuads.add(quadToTransformedQuad.get(quadKey)); } else { @@ -166,4 +174,5 @@ public Sprite getParticleIcon(@NotNull ModelData data) { public Sprite getParticleSprite() { return getTemplateBakedModels().get(0).getParticleSprite(); } + } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientImpl.java index 2253ed1f5..d90e50d64 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientImpl.java @@ -7,7 +7,7 @@ public class PaladinFurnitureModClientImpl { public static boolean areShadersOn() { - if (PaladinFurnitureMod.getModList().contains("oculus")) + if (PaladinFurnitureMod.getModList().contains("oculus") || PaladinFurnitureMod.getModList().contains("iris")) return IrisApi.getInstance().isShaderPackInUse(); try { diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/FreezerBlockEntityBalm.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/FreezerBlockEntityBalm.java index 01d6161b9..7a8fbfc7c 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/FreezerBlockEntityBalm.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/FreezerBlockEntityBalm.java @@ -5,6 +5,7 @@ import com.google.common.collect.Table; import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.blocks.blockentities.FreezerBlockEntity; +import com.unlikepaladin.pfm.blocks.blockentities.forge.FreezerBlockEntityImpl; import net.blay09.mods.balm.api.Balm; import net.blay09.mods.balm.api.container.BalmContainerProvider; import net.blay09.mods.balm.api.container.ContainerUtils; @@ -37,7 +38,7 @@ import java.util.*; -public class FreezerBlockEntityBalm extends FreezerBlockEntity implements BalmContainerProvider, BalmProviderHolder, BlockEntityContract { +public class FreezerBlockEntityBalm extends FreezerBlockEntityImpl implements BalmContainerProvider, BalmProviderHolder, BlockEntityContract { private final DefaultKitchenItemProvider itemProvider; public FreezerBlockEntityBalm(BlockPos pos, BlockState state) { diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java index 1b168b1ed..44894db3d 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java @@ -7,10 +7,12 @@ import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry; import com.unlikepaladin.pfm.runtime.data.FurnitureRecipeJsonFactory; import com.unlikepaladin.pfm.runtime.data.PFMRecipeProvider; +import com.unlikepaladin.pfm.runtime.data.PFMTagProvider; import net.blay09.mods.cookingforblockheads.CookingForBlockheads; import net.blay09.mods.cookingforblockheads.item.ModItems; import net.minecraft.block.Blocks; import net.minecraft.data.server.recipe.RecipeJsonProvider; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.Identifier; import java.util.Optional; @@ -22,6 +24,14 @@ public class PFMCookingForBlockheadsImpl extends PFMCookingForBlockheads { public PFMCookingForBlockheadsImpl() { } + @Override + public void generateTags() { + super.generateTags(); + + PFMTagProvider.getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE) + .add(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK); + } + @Override public void generateRecipes(Consumer exporter) { FurnitureRecipeJsonFactory.create(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK, 4).group("kitchen").criterion(PFMRecipeProvider.getCriterionNameFromOutput(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK), PFMRecipeProvider.conditionsFromItem(ModItems.recipeBook)).input(ModItems.recipeBook).input(Blocks.WHITE_CONCRETE, 2).input(Blocks.GRAY_CONCRETE).offerTo(exporter, new Identifier("pfm", PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK.asItem().getTranslationKey().replace("block.pfm.", ""))); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/PFMImmersivePortalsImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/PFMImmersivePortalsImpl.java index e682d3433..857cf5011 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/PFMImmersivePortalsImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/PFMImmersivePortalsImpl.java @@ -16,10 +16,11 @@ public class PFMImmersivePortalsImpl implements PFMModCompatibility { private PFMClientModCompatibility clientModCompatibility; - public static final EntityType MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); + public static EntityType MIRROR; @Override public void registerEntityTypes() { + MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); EntityRegistry.registerEntityType("mirror_entity", MIRROR); } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/entity/PFMMirrorEntity.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/entity/PFMMirrorEntity.java index fed1e7135..4cf761d86 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/entity/PFMMirrorEntity.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/entity/PFMMirrorEntity.java @@ -24,7 +24,6 @@ import java.util.stream.Stream; public class PFMMirrorEntity extends Mirror { - public static EntityType entityType = PFMImmersivePortalsImpl.MIRROR; @Nullable public IntBox wallArea; @Nullable @@ -34,7 +33,6 @@ public class PFMMirrorEntity extends Mirror { public PFMMirrorEntity(EntityType entityType, World world) { super(entityType, world); - PFMMirrorEntity.entityType = entityType; } @Override @@ -151,7 +149,7 @@ public static void createMirror(ServerWorld world, BlockPos glassPos, Direction return; } - PFMMirrorEntity pfmMirrorEntity = PFMMirrorEntity.entityType.create(world); + PFMMirrorEntity pfmMirrorEntity = PFMImmersivePortalsImpl.MIRROR.create(world); double distanceToCenter = -0.452; Box wallBox = getWallBox(world, shape.area.stream()); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java b/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java index 235bc8c1e..9eb886c60 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java @@ -38,7 +38,7 @@ public class PaladinFurnitureModForge extends PaladinFurnitureMod { public static PaladinFurnitureModConfig pfmConfig; public PaladinFurnitureModForge() { - pfmConfig = new PaladinFurnitureModConfig(FMLPaths.CONFIGDIR.get().resolve("pfm.properties")); + pfmConfig = new PaladinFurnitureModConfig(FMLPaths.CONFIGDIR.get()); try { pfmConfig.initialize(); } catch (IOException e) { diff --git a/gradle.properties b/gradle.properties index 90dc23c2b..b6a3e4d20 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.19.4 enabled_platforms=fabric,forge archives_base_name=paladin-furniture-mod -mod_version=1.2.1-rc2 +mod_version=1.2.1-rc.3 maven_group=com.unlikepaladin architectury_version=5.12.42 @@ -15,7 +15,7 @@ yarn_mappings=1.19.4+build.2 forge_version=1.19.4-45.1.16 -#Fabric Dependencies +#Mod Dependencies rei_version=11.0.633 patchouli_version_fabric=1.19.4-79.1-FABRIC sandwichable_version=1.3.a+1.19 @@ -25,8 +25,7 @@ rei_compatibility=false patchouli_compatibility=false arrp_version=4180873 arrp_compatibility=false -cloth_config_compatibility=true -cloth_config_version=10.0.96 +cloth_config_compatibility=false modmenu_version=6.3.1 jei_version=13.1.0.15 patchouli_version_forge=1.19.4-79.1 @@ -48,4 +47,5 @@ cookingforblockheads_version_forge=4513815 farmers_delight_version_fabric=4640626 farmers_delight_version_forge=4679319 emi_version=1.0.18+1.19.4 -emi_compatibility=false \ No newline at end of file +emi_compatibility=false +cloth_config_version=10.0.96 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 59bc51a20..db9a6b825 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists