Merge pull request #2121 from Ovionyx/mc1.16/dev

custom namespace support of CustomRenderedItemModels
This commit is contained in:
PepperCode1 2021-08-28 11:58:20 -07:00 committed by GitHub
commit 8a68911335
Failed to generate hash of commit
9 changed files with 32 additions and 18 deletions

View file

@ -1,11 +1,11 @@
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, "wrench");

View file

@ -1,11 +1,11 @@
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, "wand_of_symmetry");
@ -16,5 +16,5 @@ public class SymmetryWandModel extends CustomRenderedItemModel {
public ItemStackTileEntityRenderer createRenderer() {
return new SymmetryWandItemRenderer();
}
}

View file

@ -1,11 +1,11 @@
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, "extendo_grip");

View file

@ -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,7 +79,7 @@ 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, "");

View file

@ -1,11 +1,11 @@
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, "potato_cannon");

View file

@ -1,11 +1,11 @@
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, "handheld_worldshaper");

View file

@ -1,11 +1,11 @@
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, "linked_controller");

View file

@ -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);
}
}

View file

@ -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;
@ -18,12 +17,14 @@ import net.minecraftforge.client.model.BakedModelWrapper;
public abstract class CustomRenderedItemModel extends BakedModelWrapper<IBakedModel> {
protected String namespace;
protected String basePath;
protected Map<String, IBakedModel> 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<IBakedMo
}
private ResourceLocation getPartialModelLocation(String name) {
return new ResourceLocation(Create.ID, "item/" + basePath + "/" + name);
return new ResourceLocation(namespace, "item/" + basePath + "/" + name);
}
public IBakedModel getPartial(String name) {