From 7ddf11004ba3a26cf6db8930f81a493ba572620a Mon Sep 17 00:00:00 2001 From: QubicQuantum Date: Sun, 15 Aug 2021 20:54:00 -0700 Subject: [PATCH 1/3] custom namespace support of CustomRenderedItemModels --- .../curiosities/symmetry/client/SymmetryWandModel.java | 4 ++-- .../create/content/curiosities/tools/ExtendoGripModel.java | 2 +- .../content/curiosities/weapons/PotatoCannonModel.java | 2 +- .../curiosities/zapper/terrainzapper/WorldshaperModel.java | 2 +- .../foundation/item/render/CustomRenderedItemModel.java | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java index f361c3c9f..aac4957b9 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; public class SymmetryWandModel extends CustomRenderedItemModel { public SymmetryWandModel(IBakedModel template) { - super(template, "wand_of_symmetry"); + super(template, "create", "wand_of_symmetry"); addPartials("bits", "core", "core_glow"); } @@ -16,5 +16,5 @@ public class SymmetryWandModel extends CustomRenderedItemModel { public ItemStackTileEntityRenderer createRenderer() { return new SymmetryWandItemRenderer(); } - + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java index cd37439f5..274a1f350 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; public class ExtendoGripModel extends CustomRenderedItemModel { public ExtendoGripModel(IBakedModel template) { - super(template, "extendo_grip"); + super(template, "create", "extendo_grip"); addPartials("cog", "thin_short", "wide_short", "thin_long", "wide_long"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java index 5896c4d8e..43645055b 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; public class PotatoCannonModel extends CustomRenderedItemModel { public PotatoCannonModel(IBakedModel template) { - super(template, "potato_cannon"); + super(template, "create", "potato_cannon"); addPartials("cog"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java index c27b76932..283005e3e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; public class WorldshaperModel extends CustomRenderedItemModel { public WorldshaperModel(IBakedModel template) { - super(template, "handheld_worldshaper"); + super(template, "create", "handheld_worldshaper"); addPartials("core", "core_glow", "accelerator"); } diff --git a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java index 23fa7f229..799c15a96 100644 --- a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java +++ b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java @@ -22,8 +22,9 @@ public abstract class CustomRenderedItemModel extends BakedModelWrapper partials = new HashMap<>(); protected ItemStackTileEntityRenderer renderer; - public CustomRenderedItemModel(IBakedModel template, String basePath) { + public CustomRenderedItemModel(IBakedModel template, String namespace, String basePath) { super(template); + this.namespace = namespace; this.basePath = basePath; this.renderer = createRenderer(); } @@ -72,7 +73,7 @@ public abstract class CustomRenderedItemModel extends BakedModelWrapper Date: Sun, 15 Aug 2021 21:14:26 -0700 Subject: [PATCH 2/3] fixed some stuff a --- .../create/content/contraptions/wrench/WrenchModel.java | 2 +- .../create/content/curiosities/tools/SandPaperItemRenderer.java | 2 +- .../create/content/logistics/item/LinkedControllerModel.java | 2 +- .../create/foundation/item/render/CustomRenderedItemModel.java | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java index 7d58c0514..2989dbe6d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; public class WrenchModel extends CustomRenderedItemModel { public WrenchModel(IBakedModel template) { - super(template, "wrench"); + super(template, "create", "wrench"); addPartials("gear"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java index bdc8946f5..f3f450b93 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java @@ -82,7 +82,7 @@ public class SandPaperItemRenderer extends ItemStackTileEntityRenderer { public static class SandPaperModel extends CustomRenderedItemModel { public SandPaperModel(IBakedModel template) { - super(template, ""); + super(template, "create",""); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java index a900bddf4..acbf99129 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; public class LinkedControllerModel extends CustomRenderedItemModel { public LinkedControllerModel(IBakedModel template) { - super(template, "linked_controller"); + super(template, "create", "linked_controller"); addPartials("powered", "button"); } diff --git a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java index 799c15a96..dfb8097cd 100644 --- a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java +++ b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java @@ -18,6 +18,7 @@ import net.minecraftforge.client.model.BakedModelWrapper; public abstract class CustomRenderedItemModel extends BakedModelWrapper { + protected String namespace; protected String basePath; protected Map partials = new HashMap<>(); protected ItemStackTileEntityRenderer renderer; From 20b2ec4b633aaec154bf4157e1a8e8475b98c16d Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Sat, 28 Aug 2021 11:53:45 -0700 Subject: [PATCH 3/3] Add CreateCustomRenderedItemModel - Allows Create's classes to not have to pass the namespace every time --- .../content/contraptions/wrench/WrenchModel.java | 6 +++--- .../symmetry/client/SymmetryWandModel.java | 6 +++--- .../content/curiosities/tools/ExtendoGripModel.java | 6 +++--- .../curiosities/tools/SandPaperItemRenderer.java | 6 +++--- .../curiosities/weapons/PotatoCannonModel.java | 6 +++--- .../zapper/terrainzapper/WorldshaperModel.java | 6 +++--- .../logistics/item/LinkedControllerModel.java | 6 +++--- .../item/render/CreateCustomRenderedItemModel.java | 13 +++++++++++++ .../item/render/CustomRenderedItemModel.java | 1 - 9 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/item/render/CreateCustomRenderedItemModel.java diff --git a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java index 2989dbe6d..eec309f87 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchModel.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.contraptions.wrench; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -public class WrenchModel extends CustomRenderedItemModel { +public class WrenchModel extends CreateCustomRenderedItemModel { public WrenchModel(IBakedModel template) { - super(template, "create", "wrench"); + super(template, "wrench"); addPartials("gear"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java index aac4957b9..df3a54952 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandModel.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.curiosities.symmetry.client; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -public class SymmetryWandModel extends CustomRenderedItemModel { +public class SymmetryWandModel extends CreateCustomRenderedItemModel { public SymmetryWandModel(IBakedModel template) { - super(template, "create", "wand_of_symmetry"); + super(template, "wand_of_symmetry"); addPartials("bits", "core", "core_glow"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java index 274a1f350..c43102214 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripModel.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.curiosities.tools; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -public class ExtendoGripModel extends CustomRenderedItemModel { +public class ExtendoGripModel extends CreateCustomRenderedItemModel { public ExtendoGripModel(IBakedModel template) { - super(template, "create", "extendo_grip"); + super(template, "extendo_grip"); addPartials("cog", "thin_short", "wide_short", "thin_long", "wide_long"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java index f3f450b93..cfbdd5f41 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.curiosities.tools; import com.mojang.blaze3d.matrix.MatrixStack; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.Minecraft; @@ -79,10 +79,10 @@ public class SandPaperItemRenderer extends ItemStackTileEntityRenderer { ms.popPose(); } - public static class SandPaperModel extends CustomRenderedItemModel { + public static class SandPaperModel extends CreateCustomRenderedItemModel { public SandPaperModel(IBakedModel template) { - super(template, "create",""); + super(template, ""); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java index 43645055b..29018ffa0 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonModel.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.curiosities.weapons; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -public class PotatoCannonModel extends CustomRenderedItemModel { +public class PotatoCannonModel extends CreateCustomRenderedItemModel { public PotatoCannonModel(IBakedModel template) { - super(template, "create", "potato_cannon"); + super(template, "potato_cannon"); addPartials("cog"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java index 283005e3e..a9c6b89bc 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperModel.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.curiosities.zapper.terrainzapper; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -public class WorldshaperModel extends CustomRenderedItemModel { +public class WorldshaperModel extends CreateCustomRenderedItemModel { public WorldshaperModel(IBakedModel template) { - super(template, "create", "handheld_worldshaper"); + super(template, "handheld_worldshaper"); addPartials("core", "core_glow", "accelerator"); } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java index acbf99129..e864ed5e5 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerModel.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.logistics.item; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModel; +import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -public class LinkedControllerModel extends CustomRenderedItemModel { +public class LinkedControllerModel extends CreateCustomRenderedItemModel { public LinkedControllerModel(IBakedModel template) { - super(template, "create", "linked_controller"); + super(template, "linked_controller"); addPartials("powered", "button"); } diff --git a/src/main/java/com/simibubi/create/foundation/item/render/CreateCustomRenderedItemModel.java b/src/main/java/com/simibubi/create/foundation/item/render/CreateCustomRenderedItemModel.java new file mode 100644 index 000000000..e5e128ca6 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/item/render/CreateCustomRenderedItemModel.java @@ -0,0 +1,13 @@ +package com.simibubi.create.foundation.item.render; + +import com.simibubi.create.Create; + +import net.minecraft.client.renderer.model.IBakedModel; + +public abstract class CreateCustomRenderedItemModel extends CustomRenderedItemModel { + + public CreateCustomRenderedItemModel(IBakedModel template, String basePath) { + super(template, Create.ID, basePath); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java index dfb8097cd..3324b383a 100644 --- a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java +++ b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java @@ -6,7 +6,6 @@ import java.util.Map; import java.util.stream.Collectors; import com.mojang.blaze3d.matrix.MatrixStack; -import com.simibubi.create.Create; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms;