Jump to content

Recommended Posts

Posted

I have made a model of a 'furnace' using Opl's Model Creator and uploaded it to my mod. The model works fine, but when I try to edit the script to allow it to rotate based on where it is placed, it turns into missing texture block. It will not accept even me setting it to a parent, returns missing texture. Also, side note: The particles are missing texture too, and any changes to fix, is rejected. Any thing helps!

 

Blockstate (as of right now, unedited for rotation (no variants))

{

"variants": {

"normal": {"model": "meimet:alloy_furnace"}

}

}

 

Model (same as blockstate) If this looks like too much in a comment, say so. I will put it in a pastebin and edit the post.

{

    "ambientocclusion": false,

    "textures": {

        "furnace_front_off": "blocks/furnace_front_off",

        "furnace_side": "blocks/furnace_side",

        "brick": "blocks/brick",

        "furnace_top": "blocks/furnace_top",

        "nether_brick": "blocks/nether_brick",

        "stone": "blocks/stone"

    },

    "elements": [

        {

 

            "from": [0,0,11],

            "to": [16,16,16],

            "faces": {

                "up": {

                    "texture": "#furnace_top"

                },

                "down": {

                    "uv": [0,16,16,11],

                    "texture": "#furnace_top"

                },

                "west": {

                    "texture": "#brick"

                },

                "east": {

                    "uv": [16,0,11,16],

                    "texture": "#brick"

                },

                "north": {

                    "texture": "#nether_brick"

                },

                "south": {

                    "texture": "#furnace_side"

                }

            }

        },

        {

            "from": [12,0,0],

            "to": [16,16,11],

            "faces": {

                "up": {

                    "texture": "#furnace_top"

                },

                "down": {

                    "uv": [12,11,16,0],

                    "texture": "#furnace_top"

                },

                "west": {

                    "texture": "#nether_brick"

                },

                "east": {

                    "uv": [11,0,0,16],

                    "texture": "#brick"

                },

                "north": {

                    "uv": [16,0,12,16],

                    "texture": "#furnace_side"

                }

            }

        },

        {

            "from": [0,0,0],

            "to": [4,16,11],

            "faces": {

                "up": {

                    "texture": "#furnace_top"

                },

                "down": {

                    "uv": [0,11,4,0],

                    "texture": "#furnace_top"

                },

                "west": {

                    "texture": "#brick"

                },

                "east": {

                    "texture": "#nether_brick"

                },

                "north": {

                    "uv": [4,0,0,16],

                    "texture": "#furnace_side"

                }

            }

        },

        {

            "from": [4,0,0],

            "to": [12,8,11],

            "faces": {

                "up": {

                    "texture": "#nether_brick"

                },

                "down": {

                    "uv": [4,11,12,0],

                    "texture": "#furnace_top"

                },

                "west": {

                    "texture": "#brick"

                },

                "east": {

                    "uv": [16,8,0,16],

                    "texture": "#brick"

                },

                "north": {

                    "uv": [11,8,5,16],

                    "texture": "#furnace_side"

                }

            }

        },

        {

            "from": [4,13,0],

            "to": [12,16,11],

            "faces": {

                "up": {

                    "texture": "#furnace_top"

                },

                "down": {

                    "texture": "#nether_brick"

                },

                "north": {

                    "texture": "#furnace_side"

                }

            }

        },

        {

            "from": [4,12,1],

            "to": [6,14,12],

            "faces": {

                "down": {

                    "texture": "#nether_brick"

                },

                "west": {

                    "texture": "#furnace_side"

                },

                "east": {

                    "texture": "#nether_brick"

                },

                "north": {

                    "texture": "#nether_brick"

                }

            }

        },

        {

            "from": [10,12,1],

            "to": [12,14,12],

            "faces": {

                "down": {

                    "texture": "#nether_brick"

                },

                "west": {

                    "texture": "#nether_brick"

                },

                "east": {

                    "texture": "#furnace_side"

                },

                "north": {

                    "texture": "#nether_brick"

                }

            }

        }

    ]

}

 

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

What is your code for the Block class for the furnace? I'll need to see that, thanks.

 

-Will

-Will. PLEASE do not send me messages with your problems, instead just post a thread first, and then other people can help you too. Thanks for the consideration.

Posted

Is this what you are looking for? (It has many other blocks registered in it, so i cut them out. Along with the end })

 

public class meiMetBlocks {

public static Block alloy_furnace;

 

public static void init() {

alloy_furnace = new Block(Material.rock).setUnlocalizedName("alloy_furnace").setCreativeTab(MeigmaMetallou.tabMeimetMisc);

 

public static void register() {

GameRegistry.registerBlock(alloy_furnace, alloy_furnace.getUnlocalizedName().substring(5));

 

public static void registerRenders() {

registerRender(alloy_furnace);

 

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

Use spoiler/code tags PLEASE.

 

this is my blockstate. You are never defining thbe variants

 

  Reveal hidden contents

 

 

And my models/block

 

 

  Reveal hidden contents

 

 

Posted

1. Sorry about that, how do I use hiddens?

2. I tried that. It turns into a missing texture block. No clue why. I have done exactly what you just posted.

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

well you need to make your block orientable.

 

package de.busybeever.survivaloverhaul.blocks;

import de.busybeever.survivaloverhaul.SurvivalOverhaul;
import de.busybeever.survivaloverhaul.tileentity.TileEntitySaltCooker;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;

public class SaltCooker extends Block{


public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

public SaltCooker() {
	super(Material.rock);
	setCreativeTab(SurvivalOverhaul.survivalTab);
	setUnlocalizedName("saltcooker");

	this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}

@Override
public IBlockState getStateForEntityRender(IBlockState state) {

	return getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
}

@Override
public IBlockState getStateFromMeta(int meta) {
	EnumFacing facing = EnumFacing.getFront(meta);

	if(facing.getAxis()==EnumFacing.Axis.Y) {
		facing=EnumFacing.NORTH;
	}

	return getDefaultState().withProperty(FACING, facing);
}

@Override
public int getMetaFromState(IBlockState state) {
	return ((EnumFacing) state.getValue(FACING)).getIndex();
}

@Override
protected BlockState createBlockState() {
	return new BlockState(this, new IProperty[]{FACING});
}




@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos,
		EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
		EntityLivingBase placer) {
	return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());


}

}

 

[nobbc]

  Reveal hidden contents


[/nobbc]

Posted

Ah. Thankyou. I will ty and say if it works! :)

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

Clarifying, would I need to remove all the script from my block class if I wanted to create a separate class for this one block. The way I have been setting up, all my blocks have been in one class.

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

Oh, okay. It is going to have a custom gui too, so i guess a separate class would be useful! I have the feeling that it is simply the model creator that I used that is giving me heck with the texture. What do you use?

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

My block is using a custom model made with Opl's model maker. I am worried that that itself, how it formatted the model in the script, might be making some texture issues for me. Also, in my attempt is move everything to one class- I have deleted the block. xD Trying to fix it right now.

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

Okay, I have atleast recreated the block entirely inside its own class- it appears in game... but guess what, still no texture. So, here is my new script:

(I have the funny feeling I have screwed something up miserably.)

 

package com.jemmerl.meimet.init;

import com.jemmerl.meimet.MeigmaMetallou;
import com.jemmerl.meimet.Reference;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class alloy_furnace extends Block{

public static Block alloy_furnace;

public static void register() {
GameRegistry.registerBlock(alloy_furnace, alloy_furnace.getUnlocalizedName().substring(5));
}

public static void registerRenders()
{
registerRender(alloy_furnace);
}

public static void init(){
	alloy_furnace = new Block(Material.rock).setUnlocalizedName("alloy_furnace").setCreativeTab(MeigmaMetallou.tabMeimetMisc);
}


public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

public alloy_furnace() {
	super(Material.rock);
	setCreativeTab(MeigmaMetallou.tabMeimetMisc);
	setUnlocalizedName("alloy_furnace");

	this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}

@Override
public IBlockState getStateForEntityRender(IBlockState state) {

	return getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
}

@Override
public IBlockState getStateFromMeta(int meta) {
	EnumFacing facing = EnumFacing.getFront(meta);

	if(facing.getAxis()==EnumFacing.Axis.Y) {
		facing=EnumFacing.NORTH;
	}

	return getDefaultState().withProperty(FACING, facing);
}

@Override
public int getMetaFromState(IBlockState state) {
	return ((EnumFacing) state.getValue(FACING)).getIndex();
}

@Override
protected BlockState createBlockState() {
	return new BlockState(this, new IProperty[]{FACING});
}




@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos,
		EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
		EntityLivingBase placer) {
	return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());


}

public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}

}


"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

I did. It recommended putting everything in one class... Therefore, the rest of my mod was built that way. It offered no explanation of why to do what it said, nor can I find any.

"Look, this thing has been, truly, my only companion in these last two months. Anytime you try to go outside- stick. Anytime Gregor woke up- stick. Anytime you tried to jump into the fireplace claiming it was your, uh birthright- STICK!"

 

-Aesling (and her stick); Thrilling Intent EP 11

Posted

The class of your block should be for your block only.

The registration of renderer should be in the clientproxy.

The registration of the block itself should be in your main mod class or a class that collects all your blocks sorted

There is no reason to keep a public static Block alloy_furnace in your class

Look up naming conventions for java, your class name is malformed

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • To prevent dependency errors, yes  
    • dynamictrees and dtneapolitan are the last mentioned mod - remove these
    • https://mclo.gs/9y5ciD2 anyone ever had this issue?  Internal exception illegal argument exception: unable to fit 3194354 into 3
    • Hi! I'm trying to add my custom models/textures renderer like this: public class PonyPlayerWrapperRenderer extends EntityRenderer<Player> { // wrapper class under my LivingEntityRenderer class implementation private final PonyPlayerRenderer innerRenderer; private final PonyPlayerRenderer innerSlimRenderer; public PonyPlayerWrapperRenderer(final EntityRendererProvider.Context context) { super(context); System.out.println("creating new PonyPlayerWrapperRenderer"); this.innerRenderer = new PonyPlayerRenderer(context, false); this.innerSlimRenderer = new PonyPlayerRenderer(context, true); } @Override public void render(final Player entity, final float yaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource bufferSource, final int packedLight) { System.out.println("PonyPlayerWrapperRenderer render: " + entity.toString()); if (entity instanceof AbstractClientPlayer clientPlayer) { if (clientPlayer.getModelName().contains("slim")) { innerSlimRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } else { innerRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } } } @Override public ResourceLocation getTextureLocation(final Player player) { System.out.println("PonyPlayerWrapperRenderer getTextureLocation"); if (player instanceof AbstractClientPlayer clientPlayer) { return clientPlayer.getSkinTextureLocation(); } System.out.println("player instanceof AbstractClientPlayer is false"); return getDefaultSkin(player.getUUID()); } } public class PonyPlayerRenderer extends LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> { private final PlayerModel<AbstractClientPlayer> earthModel; private final PlayerModel<AbstractClientPlayer> pegasusModel; private final PlayerModel<AbstractClientPlayer> unicornModel; public PonyPlayerRenderer(final EntityRendererProvider.Context context, final boolean slim) { super( context, slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)), 0.5f ); System.out.println("creating new PonyPlayerRenderer"); this.earthModel = slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); this.pegasusModel = new PegasusModel(context.bakeLayer(PegasusModel.LAYER_LOCATION)); this.unicornModel = new UnicornModel(context.bakeLayer(UnicornModel.LAYER_LOCATION)); } @Override public void render(final AbstractClientPlayer player, final float entityYaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource buffer, final int packedLight) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); this.model = switch (race) { case PEGASUS -> pegasusModel; case UNICORN -> unicornModel; case EARTH -> earthModel; }; super.render(player, entityYaw, partialTicks, poseStack, buffer, packedLight); } @Override public ResourceLocation getTextureLocation(final AbstractClientPlayer player) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); return switch (race) { case EARTH -> fromNamespaceAndPath(MODID, "textures/entity/earth_pony.png"); case PEGASUS -> fromNamespaceAndPath(MODID, "textures/entity/pegasus.png"); case UNICORN -> fromNamespaceAndPath(MODID, "textures/entity/unicorn.png"); }; } } @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { // mod bus render registration config @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onRegisterRenderers(final EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(EntityType.PLAYER, PonyPlayerWrapperRenderer::new); System.out.println("onRegisterRenderers end"); } } Method onRegisterRenderers() is called and I can see it being logged. But when I enter the world, my PonyWrapperRenderer render() method doesn't ever seem to be called. I also tried to put my renderer to EntityRenderDispatcher's playerRenderers via reflection: @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent event) { event.enqueueWork(() -> { try { final EntityRenderDispatcher dispatcher = Minecraft.getInstance().getEntityRenderDispatcher(); final Field renderersField = getEntityRenderDispatcherField("playerRenderers"); final Field itemInHandRenderer = getEntityRenderDispatcherField("itemInHandRenderer"); @SuppressWarnings("unchecked") final Map<String, EntityRenderer<? extends Player>> playerRenderers = (Map<String, EntityRenderer<? extends Player>>)renderersField.get(dispatcher); final PonyPlayerWrapperRenderer renderer = new PonyPlayerWrapperRenderer( new EntityRendererProvider.Context( dispatcher, Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getBlockRenderer(), (ItemInHandRenderer)itemInHandRenderer.get(dispatcher), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font ) ); playerRenderers.put("default", renderer); playerRenderers.put("slim", renderer); System.out.println("Player renderers replaced"); } catch (final Exception e) { throw new RuntimeException("Failed to replace player renderers", e); } }); } private static Field getEntityRenderDispatcherField(final String fieldName) throws NoSuchFieldException { final Field field = EntityRenderDispatcher.class.getDeclaredField(fieldName); field.setAccessible(true); return field; } } But I receive the error before Minecraft Client appears (RuntimeException: Failed to replace player renderers - from ClientRenderers onClientSetup() method - and its cause below): java.lang.IllegalArgumentException: No model for layer anotherlittlepony:earth_pony#main at net.minecraft.client.model.geom.EntityModelSet.bakeLayer(EntityModelSet.java:18) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRendererProvider$Context.bakeLayer(EntityRendererProvider.java:69) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerRenderer.<init>(PonyPlayerRenderer.java:32) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerWrapperRenderer.<init>(PonyPlayerWrapperRenderer.java:24) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.ClientRenderers.lambda$onClientSetup$0(ClientRenderers.java:79) ~[main/:?] {re:classloading} ... 33 more Problem appears when EntityRendererProvider context tries to bakeLayer with my model layer location: new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); // PonyPlayerRenderer.java:32 public class PonyModel extends PlayerModel<AbstractClientPlayer> { // the model class itself public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation( ResourceLocation.fromNamespaceAndPath(MODID, "earth_pony"), "main" ); public PonyModel(final ModelPart root) { super(root, false); } public static LayerDefinition createBodyLayer() { // some CubeListBuilder stuff for model appearance } } Textures PNGs are placed at: resources/assets/[my mod id]/textures/entity. My forge version is 1.20.1. Would appreciate any help.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.