Jump to content

Recommended Posts

Posted

Hello,

 

I created a block that is using the model from the chest, but now I have one question: How to set the texture for the particles that appears if you break a block to "planks_oak"?

I hope here someone can help me, because on minecraft.de they tried to help me, but nothing seems to work...

 

So this are my .json files:

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

 

models/block:

{
    "parent": "block/cube-all",
    "textures":
    {
    	"all": "minecraft:blocks/chest"
    }
}

 

models/item:

{
    "parent": "builtin/entity",
    "textures":
    {
    	"layer0": "minecraft:planks_oak"
    },
    "display":
    {
    	"thirdperson":
    	{
    		"rotation": [ 10, -45, 170 ],
    		"translation": [ 0, 1.5, -2.75 ],
    		"scale": [ 0.375, 0.375, 0.375 ]
    	}
    }
}

 

I never expected that I would ever have 3 problems at the same time at two different projects...  ;D (MC-Mod, my 2d game with a modding api)

 

 

Bektor

Developer of Primeval Forest.

Posted

It's because the block/cube_all model that you are using already has the particle texture defined.

block/cube_all:
{
    "parent": "block/cube",
    "textures": {
        "particle": "#all",
        "down": "#all",
        "up": "#all",
        "north": "#all",
        "east": "#all",
        "south": "#all",
        "west": "#all"
    }
}

 

Used block/cube instead and list all of the sides plus the particle texture, eg

{
    "parent": "block/cube",
    "textures": {
        "down": "minecraftbyexample:blocks/mbe01_block_simple_face0",
        "up": "minecraftbyexample:blocks/mbe01_block_simple_face1",
        "north": "minecraftbyexample:blocks/mbe01_block_simple_face2",
        "east": "minecraftbyexample:blocks/mbe01_block_simple_face5",
        "south": "minecraftbyexample:blocks/mbe01_block_simple_face3",
        "west": "minecraftbyexample:blocks/mbe01_block_simple_face4",
        "particle": "blocks/lapis_block"
    }
}

 

This link explains the background in a lot more detail:

http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-18.html

and also

http://minecraft.gamepedia.com/Block_models

 

-TGG

Posted

This will not work, too. :(

 

models/item:

{
    "parent": "builtin/entity",
    "textures":
    {
    	"layer0": "minecraft:planks_oak"
    },
    "display":
    {
    	"thirdperson":
    	{
    		"rotation": [ 10, -45, 170 ],
    		"translation": [ 0, 1.5, -2.75 ],
    		"scale": [ 0.375, 0.375, 0.375 ]
    	}
    }
}

 

models/block:

{
    "parent": "block/cube",
    "textures":
    {
        "down": "minecraft:blocks/chest",
        "up": "minecraft:blocks/chest",
        "north": "minecraft:blocks/chest",
        "east": "minecraft:blocks/chest",
        "south": "minecraft:blocks/chest",
        "west": "minecraft:blocks/chest",
        "particle": "blocks/planks_oak"
    }
}

 

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

Developer of Primeval Forest.

Posted

Hi

 

Well that's odd, I don't see an obvious problem.  Are you sure it's not working?  i.e. if you change particle to lapis blue, is your break block particles blue?

 

If not, I suggest a couple of things to try

First try a breakpoint in EntityDiggingFX to find out what texture your block is actually using

    protected EntityDiggingFX(World worldIn, double p_i46280_2_, double p_i46280_4_, double p_i46280_6_, double p_i46280_8_, double p_i46280_10_, double p_i46280_12_, IBlockState p_i46280_14_)
    {
        super(worldIn, p_i46280_2_, p_i46280_4_, p_i46280_6_, p_i46280_8_, p_i46280_10_, p_i46280_12_);
        this.field_174847_a = p_i46280_14_;
        this.func_180435_a(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(p_i46280_14_));   //<----  breakpoint here
        this.particleGravity = p_i46280_14_.getBlock().blockParticleGravity;
        this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
        this.particleScale /= 2.0F;
    }

If the block model is right but the texture is wrong, you will need to dig deeper into the loading of your model.

ModelBakery.bakeModel is where it looks for your texture in the parsed list of textures at this line

   private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
    {
        TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle")));   // here
        SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite);

 

You will need to add a conditional breakpoint (eg modelBlockIn.name.contains("bektor") == true) because this method is used by the vanilla blocks too and there are hundreds.

 

-TGG

 

Posted

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

 

Try changing your model name in your blockstate file. You are now referencing to minecraft's chest model, so "normal": { "model": "yourmodel_id_lowercased:block_model_file_name" }

 

Posted

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

 

Try changing your model name in your blockstate file. You are now referencing to minecraft's chest model, so "normal": { "model": "yourmodel_id_lowercased:block_model_file_name" }

 

Well, but I want to use the chest model from minecraft, because I'm not interested in creating a new chest model.

 

Hi

 

Well that's odd, I don't see an obvious problem.  Are you sure it's not working?  i.e. if you change particle to lapis blue, is your break block particles blue?

 

If not, I suggest a couple of things to try

First try a breakpoint in EntityDiggingFX to find out what texture your block is actually using

    protected EntityDiggingFX(World worldIn, double p_i46280_2_, double p_i46280_4_, double p_i46280_6_, double p_i46280_8_, double p_i46280_10_, double p_i46280_12_, IBlockState p_i46280_14_)
    {
        super(worldIn, p_i46280_2_, p_i46280_4_, p_i46280_6_, p_i46280_8_, p_i46280_10_, p_i46280_12_);
        this.field_174847_a = p_i46280_14_;
        this.func_180435_a(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(p_i46280_14_));   //<----  breakpoint here
        this.particleGravity = p_i46280_14_.getBlock().blockParticleGravity;
        this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
        this.particleScale /= 2.0F;
    }

If the block model is right but the texture is wrong, you will need to dig deeper into the loading of your model.

ModelBakery.bakeModel is where it looks for your texture in the parsed list of textures at this line

   private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
    {
        TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle")));   // here
        SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite);

 

You will need to add a conditional breakpoint (eg modelBlockIn.name.contains("bektor") == true) because this method is used by the vanilla blocks too and there are hundreds.

 

-TGG

 

No, my break block particles are not blue, they are still using the "missing texture" texture from minecraft.

 

Ok, how can I set a breakpoint in eclipse? And the model is correct, but the particles are wrong.

 

Thats the output from eclipse without loading a world:

 

[19:30:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[19:30:15] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[19:30:15] [main/WARN] [LaunchWrapper]: Tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker has already been visited -- skipping

[19:30:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker

[19:30:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[19:30:15] [main/INFO] [FML]: Forge Mod Loader version 8.0.14.1281 for Minecraft 1.8 loading

[19:30:15] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_71, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

[19:30:15] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[19:30:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker

[19:30:15] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[19:30:15] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[19:30:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[19:30:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[19:30:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[19:30:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[19:30:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[19:30:15] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[19:30:17] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[19:30:17] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[19:30:17] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[19:30:18] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[19:30:18] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[19:30:18] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[19:30:19] [Client thread/INFO]: Setting user: Player701

[19:30:21] [Client thread/INFO]: LWJGL Version: 2.9.1

[19:30:23] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[19:30:23] [Client thread/INFO] [FML]: MinecraftForge v11.14.0.1281 Initialized

[19:30:23] [Client thread/INFO] [FML]: Replaced 204 ore recipies

[19:30:23] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[19:30:23] [Client thread/INFO] [FML]: Searching F:\Patrick\ForgeVersions\PrimevalForest - 1.8\mods for mods

[19:30:26] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[19:30:27] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, primevalforest] at CLIENT

[19:30:27] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, primevalforest] at SERVER

[19:30:27] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Primeval Forest

[19:30:27] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[19:30:27] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[19:30:27] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[19:30:27] [Client thread/INFO] [FML]: Applying holder lookups

[19:30:27] [Client thread/INFO] [FML]: Holder lookups applied

[19:30:28] [sound Library Loader/INFO]: Starting up SoundSystem...

[19:30:28] [Thread-7/INFO]: Initializing LWJGL OpenAL

[19:30:28] [Thread-7/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[19:30:29] [Thread-7/INFO]: OpenAL initialized.

[19:30:29] [sound Library Loader/INFO]: Sound engine started

[19:30:36] [Client thread/WARN]: Unable to load variant: facing=east from primevalforest:lockedChest#facing=east

[19:30:36] [Client thread/WARN]: Unable to load variant: facing=south from primevalforest:lockedChest#facing=south

[19:30:36] [Client thread/WARN]: Unable to load variant: facing=north from primevalforest:lockedChest#facing=north

[19:30:36] [Client thread/WARN]: Unable to load variant: facing=west from primevalforest:lockedChest#facing=west

[19:30:37] [Client thread/INFO]: Created: 512x512 textures-atlas

[19:30:38] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[19:30:38] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Primeval Forest

[19:30:38] [Client thread/INFO]: SoundSystem shutting down...

[19:30:39] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[19:30:39] [sound Library Loader/INFO]: Starting up SoundSystem...

[19:30:39] [Thread-9/INFO]: Initializing LWJGL OpenAL

[19:30:39] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[19:30:39] [Thread-9/INFO]: OpenAL initialized.

[19:30:39] [sound Library Loader/INFO]: Sound engine started

[19:30:40] [Client thread/WARN]: Unable to load variant: facing=east from primevalforest:lockedChest#facing=east

[19:30:40] [Client thread/WARN]: Unable to load variant: facing=south from primevalforest:lockedChest#facing=south

[19:30:40] [Client thread/WARN]: Unable to load variant: facing=north from primevalforest:lockedChest#facing=north

[19:30:40] [Client thread/WARN]: Unable to load variant: facing=west from primevalforest:lockedChest#facing=west

[19:30:41] [Client thread/INFO]: Created: 512x512 textures-atlas

[19:30:53] [Client thread/INFO]: Stopping!

[19:30:53] [Client thread/INFO]: SoundSystem shutting down...

[19:30:53] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

 

 

So any idea?

Developer of Primeval Forest.

Posted

Hi

 

Is this the name of your chest?  If so, the problem appears to be that you haven't registered the models properly.

[19:30:40] [Client thread/WARN]: Unable to load variant: facing=east from primevalforest:lockedChest#facing=east

 

Show your block code and registration code?

 

You could try looking this example project for clues on how to properly register a block with variants

https://github.com/TheGreyGhost/MinecraftByExample

- see example 3 in particular

 

This link is very helpful on learning how to use the debugger, you'll wonder how you ever managed with out it...

http://www.vogella.com/tutorials/EclipseDebugging/article.html

 

-TGG

 

 

 

Posted

Ok.

 

Here is the code of the Client proxy:

 

@Override
public void registerTileEntityRendering() 
{
	ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLockedChest.class, new RenderTileEntityLockedChest());

	RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();

	// blocks
	renderItem.getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.locked_chest), 0, new ModelResourceLocation("minecraft:chest", "inventory"));
}

 

 

and the block code:

 

package minecraftplaye.primevalforest.common.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
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.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ILockableContainer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import minecraftplaye.primevalforest.PrimevalForest;
import minecraftplaye.primevalforest.common.configuration.PFConfigurationIDs;
import minecraftplaye.primevalforest.common.creativetab.ModCreativeTabs;
import minecraftplaye.primevalforest.common.lib.BlockDropHelper;
import minecraftplaye.primevalforest.common.lib.IBlock;
import minecraftplaye.primevalforest.common.tileentity.TileEntityLockedChest;
import minecraftplaye.primevalforest.common.utils.LanguageHandler;
import minecraftplaye.primevalforest.core.ModBlocks;

public class BlockLockedChest extends BlockContainer implements IBlock
{

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

public BlockLockedChest() 
{
	super(Material.wood);
	this.setHardness(2.5F);
	this.setStepSound(Block.soundTypeWood);
	this.setCreativeTab(ModCreativeTabs.PRIMEVAL);
	this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));

	this.setUnlocalizedName(getName());
	GameRegistry.registerBlock(this, getName());
}

@Override
public String getName()
{
	return "lockedChest";
}

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) 
{
	return new TileEntityLockedChest();
}

    /**
     * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
     * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
     */
@Override
    public boolean isOpaqueCube()
    {
        return false;
    }

@Override
    public boolean isFullCube()
    {
        return false;
    }

    /**
     * The type of render function that is called for this block
     */
@Override
@SideOnly(Side.CLIENT)
    public int getRenderType()
    {
        return 2;
    }

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

    /**
     * Called when the block is placed in the world.
     */
@Override
    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack itemStack)
    {
	if(worldIn.isRemote)
		return;

        EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite();
        state = state.withProperty(FACING, enumfacing);
        
        worldIn.setBlockState(pos, state, 3); //(x, y, z, metadata, 3);

	if(placer instanceof EntityPlayer)
	{
        	TileEntityLockedChest tileEntityLChest = (TileEntityLockedChest)worldIn.getTileEntity(pos);
        	
        	if(tileEntityLChest != null)
        		tileEntityLChest.setUUID((EntityPlayer)placer);
	}

    	if(itemStack.hasDisplayName())
    		((TileEntityLockedChest)worldIn.getTileEntity(pos)).setCustomName(itemStack.getDisplayName());
    }

    /**
     * Checks to see if its valid to put this block at the specified coordinates. Args: worldIn, pos
     */
@Override
    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
    {
	if(worldIn.getBlockState(pos.down()).getBlock() == Blocks.air)
		return false;
	if(worldIn.getBlockState(pos.up()).getBlock() != Blocks.air)
		return false;
	if(worldIn.getBlockState(pos.down()).getBlock() == ModBlocks.locked_chest)
		return false;
	if(worldIn.getBlockState(pos.up()).getBlock() == ModBlocks.locked_chest)
		return false;
	if(worldIn.getBlockState(pos.down()).getBlock().getMaterial().isLiquid())
		return false;
	if(!worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid())
		return false;

	return true;
    }

    /**
     * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
     * their own) Args: worldIn, pos, state, neighbor Block
     */
@Override
    public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
    {
	super.onNeighborBlockChange(worldIn, pos, state, neighborBlock);

	if(worldIn.isRemote)
		return;

	boolean flag = false;

	if(!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))
		flag = true;
	if(World.doesBlockHaveSolidTopSurface(worldIn, pos.up()))
		flag = true;

	if(flag)
		this.breakBlock(worldIn, pos, state);
    }

@Override
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntityLockedChest tileentitychest = (TileEntityLockedChest)worldIn.getTileEntity(pos);
        
        if (tileentitychest != null && tileentitychest instanceof IInventory)
        {
            BlockDropHelper.dropItemsAsStack(worldIn, pos, (IInventory) tileentitychest);
        	
            worldIn.updateComparatorOutputLevel(pos, this);
        }
        
        super.breakBlock(worldIn, pos, state);
    }

    /**
     * Called upon block activation (right click on the block.)
     */
@Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
	if(worldIn.isRemote)
		return true;
	else
	{
		ILockableContainer inventory = this.getInventory(worldIn, pos);
		TileEntityLockedChest tileEntityLChest = (TileEntityLockedChest)worldIn.getTileEntity(pos);

		if(inventory != null && !playerIn.isSneaking() && !playerIn.isSpectator() && tileEntityLChest != null)
		{
			if(tileEntityLChest.getUUID() == null || tileEntityLChest.getUUID().toString() == null 
					|| tileEntityLChest.getUUID().toString() == "")
			{
				tileEntityLChest.setUUID(playerIn);
				playerIn.openGui(PrimevalForest.instance, PFConfigurationIDs.gui_lChest_ID, worldIn, pos.getX(), pos.getY(), pos.getZ());
			}
			else if(tileEntityLChest.getUUID().toString().equals(playerIn.getGameProfile().getId().toString()))
			{
				if(tileEntityLChest.getName() == null || tileEntityLChest.getName() == "" 
						|| tileEntityLChest.getName() != playerIn.getGameProfile().getName())
					tileEntityLChest.setUUID(playerIn);

				playerIn.openGui(PrimevalForest.instance, PFConfigurationIDs.gui_lChest_ID, worldIn, pos.getX(), pos.getY(), pos.getZ());
			}
			else
				LanguageHandler.sendPlayerLocalizedMessage(playerIn, "primevalforest.blocks.locked", EnumChatFormatting.AQUA, tileEntityLChest.getName());
		}
	}

	return true;
    }

    /**
     * Gets the inventory of the chest at the specified coords, accounting for blocks or ocelots on top of the chest,
     * and double chests.
     */
    public ILockableContainer getInventory(World worldIn, BlockPos pos)
    {
    	TileEntity tileentity = worldIn.getTileEntity(pos);
    	
    	if(tileentity != null && tileentity instanceof TileEntityLockedChest)
    	{
        	Object object = (TileEntityLockedChest)tileentity;
        	
        	if(worldIn.isSideSolid(pos, EnumFacing.DOWN))
        		return null;
            else if (worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.isSideSolid(new BlockPos(pos.getX() - 1, pos.getY() + 1, pos.getZ()), EnumFacing.DOWN))
                return null;
            else if (worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.isSideSolid(new BlockPos(pos.getX() + 1, pos.getY() + 1, pos.getZ()), EnumFacing.DOWN))
                return null;
            else if (worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.isSideSolid(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ() - 1), EnumFacing.DOWN))
                return null;
            else if (worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.isSideSolid(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ() + 1), EnumFacing.DOWN))
                return null;
            else
                return (ILockableContainer)object;
    	}
    	else
    		return null;
    }

@Override
@SideOnly(Side.CLIENT)
public Item getItem(World worldIn, BlockPos pos)
{
	return Item.getItemFromBlock(ModBlocks.locked_chest);
}

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

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

        return this.getDefaultState().withProperty(FACING, enumfacing);
    }

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

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

 

 

(Don't forget, I have no model and texture created, all textures and models that this block is using are from the normal minecraft chest)

Developer of Primeval Forest.

Posted

Ah.  The problem appears to be that your blockstates is wrong.  It doesn't have the facing variants that it expects to see - you have given your block four facings but the blockstates file doesn't have any of them.

 

Did you look in the links I sent earlier?

 

You need a blockstates file something like

{
    "variants": {
           "facing=north": { "model": "minecraftbyexample:mbe03_block_variants_model_red"},
            "facing=east": { "model": "minecraftbyexample:mbe03_block_variants_model_red", "y": 90 },
           "facing=south": { "model": "minecraftbyexample:mbe03_block_variants_model_red", "y": 180 },
            "facing=west": { "model": "minecraftbyexample:mbe03_block_variants_model_red", "y": 270 },
    }
}

-TGG

Posted

Well, this doesn't help, too. The blockbreak particles are still not working and now I'm getting errors.

 

blockstates: (lockedChest.json)

{
    "variants": {
        "normal": { "model": "minecraft:chest" },
        "facing=north": { "model": "minecraft:chest"},
        "facing=east": { "model": "minecraft:chest", "y": 90 },
        "facing=south": { "model": "minecraft:chest", "y": 180 },
        "facing=west": { "model": "minecraft:chest", "y": 270 }
    }
}

 

and here the log from eclipse (because there is no error/crash log):

 

[17:37:33] [main/INFO] [GradleStart]: userProperties: {}

[17:37:33] [main/INFO] [GradleStart]: username: Player701

[17:37:33] [main/INFO] [GradleStart]: accessToken: FML

[17:37:33] [main/INFO] [GradleStart]: version: 1.6

[17:37:33] [main/INFO] [GradleStart]: Extra: [--tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker]

[17:37:33] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --username, Player701, --accessToken, {REDACTED}, --assetIndex, 1.8, --assetsDir, C:/Users/Patrick/.gradle/caches/minecraft/assets, --version, 1.6, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]

[17:37:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[17:37:33] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[17:37:33] [main/WARN] [LaunchWrapper]: Tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker has already been visited -- skipping

[17:37:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker

[17:37:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[17:37:33] [main/INFO] [FML]: Forge Mod Loader version 8.0.14.1281 for Minecraft 1.8 loading

[17:37:33] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_71, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

[17:37:33] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[17:37:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker

[17:37:33] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[17:37:33] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[17:37:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[17:37:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[17:37:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[17:37:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[17:37:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[17:37:33] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[17:37:35] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[17:37:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[17:37:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[17:37:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[17:37:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[17:37:36] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[17:37:36] [Client thread/INFO]: Setting user: Player701

[17:37:38] [Client thread/INFO]: LWJGL Version: 2.9.1

[17:37:39] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[17:37:39] [Client thread/INFO] [FML]: MinecraftForge v11.14.0.1281 Initialized

[17:37:39] [Client thread/INFO] [FML]: Replaced 204 ore recipies

[17:37:39] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[17:37:39] [Client thread/INFO] [FML]: Searching F:\Patrick\ForgeVersions\PrimevalForest - 1.8\mods for mods

[17:37:41] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[17:37:41] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, primevalforest] at CLIENT

[17:37:41] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, primevalforest] at SERVER

[17:37:41] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Primeval Forest

[17:37:41] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[17:37:41] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[17:37:41] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[17:37:41] [Client thread/INFO] [FML]: Applying holder lookups

[17:37:41] [Client thread/INFO] [FML]: Holder lookups applied

[17:37:41] [sound Library Loader/INFO]: Starting up SoundSystem...

[17:37:42] [Thread-7/INFO]: Initializing LWJGL OpenAL

[17:37:42] [Thread-7/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[17:37:42] [Thread-7/INFO]: OpenAL initialized.

[17:37:42] [sound Library Loader/INFO]: Sound engine started

[17:37:44] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=south'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:44] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=east'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:44] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=west'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:44] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=north'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:44] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=east

[17:37:44] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=north

[17:37:44] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=south

[17:37:44] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=west

[17:37:45] [Client thread/INFO]: Created: 512x512 textures-atlas

[17:37:45] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=south

[17:37:45] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=south

[17:37:45] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=east

[17:37:45] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=east

[17:37:45] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=west

[17:37:45] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=west

[17:37:45] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=north

[17:37:45] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=north

[17:37:46] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[17:37:46] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Primeval Forest

[17:37:46] [Client thread/INFO]: SoundSystem shutting down...

[17:37:46] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[17:37:46] [sound Library Loader/INFO]: Starting up SoundSystem...

[17:37:46] [Thread-9/INFO]: Initializing LWJGL OpenAL

[17:37:46] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[17:37:46] [Thread-9/INFO]: OpenAL initialized.

[17:37:47] [sound Library Loader/INFO]: Sound engine started

[17:37:48] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=south'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:727) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:484) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:48] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=east'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:727) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:484) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:48] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=west'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:727) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:484) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:48] [Client thread/WARN]: Unable to load block model: 'minecraft:block/chest' for variant: 'primevalforest:lockedChest#facing=north'

java.io.FileNotFoundException: minecraft:models/block/chest.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantModels(ModelBakery.java:210) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:104) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:727) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:484) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=east

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=north

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=south

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=west

[17:37:48] [Client thread/INFO]: Created: 512x512 textures-atlas

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=south

[17:37:48] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=south

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=east

[17:37:48] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=east

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=west

[17:37:48] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=west

[17:37:48] [Client thread/WARN]: Missing model for: primevalforest:lockedChest#facing=north

[17:37:48] [Client thread/WARN]: No weighted models for: primevalforest:lockedChest#facing=north

[17:38:20] [server thread/INFO]: Starting integrated minecraft server version 1.8

[17:38:20] [server thread/INFO]: Generating keypair

[17:38:20] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[17:38:21] [server thread/INFO] [FML]: Applying holder lookups

[17:38:21] [server thread/INFO] [FML]: Holder lookups applied

[17:38:21] [server thread/INFO] [FML]: Loading dimension 0 (Test-World) (net.minecraft.server.integrated.IntegratedServer@691b699)

[17:38:21] [server thread/INFO] [FML]: Loading dimension 1 (Test-World) (net.minecraft.server.integrated.IntegratedServer@691b699)

[17:38:21] [server thread/INFO] [FML]: Loading dimension -1 (Test-World) (net.minecraft.server.integrated.IntegratedServer@691b699)

[17:38:21] [server thread/INFO]: Preparing start region for level 0

[17:38:22] [server thread/INFO]: Changing view distance to 12, from 10

[17:38:22] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1

[17:38:22] [Netty Server IO #1/INFO] [FML]: Client protocol version 1

[17:38:22] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],primevalforest@@VERSION@,[email protected]

[17:38:22] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established

[17:38:22] [server thread/INFO] [FML]: [server thread] Server side modded connection established

[17:38:22] [server thread/INFO]: Player701[local:E:628b3e0b] logged in with entity id 143 at (-6.71423571777834, 65.0, 145.28236526067553)

[17:38:22] [server thread/INFO]: Player701 joined the game

[17:38:26] [Client thread/INFO]: Stopping!

[17:38:26] [Client thread/INFO]: SoundSystem shutting down...

[17:38:27] [server thread/INFO]: Stopping server

[17:38:27] [server thread/INFO]: Saving players

[17:38:27] [server thread/INFO]: Saving worlds

[17:38:27] [server thread/INFO]: Saving chunks for level 'Test-World'/Overworld

[17:38:27] [server thread/INFO]: Saving chunks for level 'Test-World'/Nether

[17:38:27] [server thread/INFO]: Saving chunks for level 'Test-World'/The End

[17:38:27] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[17:38:27] [Client Shutdown Thread/INFO]: Stopping server

[17:38:27] [Client Shutdown Thread/INFO]: Saving players

[17:38:27] [Client Shutdown Thread/INFO]: Saving worlds

[17:38:27] [Client Shutdown Thread/INFO]: Saving chunks for level 'Test-World'/Overworld

 

Developer of Primeval Forest.

Posted

Ah.

 

I just went to look for the vanilla chest model - there isn't one.  It's drawn using a different rendertype so it has no blockmodel like most other blocks do.  The TileEntitySpecialRenderer renders it instead, so the lid animation can be done properly.

 

--> if you want a block texture for the chest you'll need to make them yourself.  You can find the texture sheet in

("textures/entity/chest/normal.png");

 

-TGG

 

 

 

 

  • 2 weeks later...
Posted

Sorry, that it took so long to reply here, but I had not much time.

 

So, my own block is rendered by the TileEntitySpecialRenderer, too:

 

 

package minecraftplaye.primevalforest.client.render;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import minecraftplaye.primevalforest.common.blocks.BlockLockedChest;
import minecraftplaye.primevalforest.common.tileentity.TileEntityLockedChest;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderTileEntityLockedChest extends TileEntitySpecialRenderer
{

private static final ResourceLocation texture = new ResourceLocation("textures/entity/chest/normal.png");
    private ModelChest model = new ModelChest();
    
public RenderTileEntityLockedChest() 
{ }

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float scale, int unknown)
{
	if(tileentity instanceof TileEntityLockedChest)
	{
		TileEntityLockedChest tileEntityLockedChest = (TileEntityLockedChest) tileentity;

        int meta;

		if(!tileEntityLockedChest.hasWorldObj())
			meta = 0;
		else
		{
			Block block = tileEntityLockedChest.getBlockType();
			meta = tileEntityLockedChest.getBlockMetadata();

			if(block instanceof BlockLockedChest && meta == 0)
                meta = tileEntityLockedChest.getBlockMetadata();
		}

		ModelChest modelChest = this.model;

		this.bindTexture(texture);

		// The PushMatrix tells the renderer to "start" doing something.
		GL11.glPushMatrix();
		GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    		// This is setting the initial location.
    		GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
            GL11.glScalef(1.0F, -1.0F, -1.0F);
            GL11.glTranslatef(0.5F, 0.5F, 0.5F);
            
            short rotation = 0;
            
            if (meta == 2)
            	rotation = 180;
            if (meta == 3)
            	rotation = 0;
            if (meta == 4)
            	rotation = 90;
            if (meta == 5)
            	rotation = -90;
            
            GL11.glRotatef((float)rotation, 0.0F, 1.0F, 0.0F);
            GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
            float f1 = tileEntityLockedChest.prevLidAngle + (tileEntityLockedChest.lidAngle - tileEntityLockedChest.prevLidAngle) * scale;
            
            f1 = 1.0F - f1;
            f1 = 1.0F - f1 * f1 * f1;
            modelChest.chestLid.rotateAngleX = -(f1 * (float)Math.PI / 2.0F);
            modelChest.renderAll();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            // Tell it to stop rendering for both the PushMatrix's
            GL11.glPopMatrix();
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	}
}
}

 

 

And there I put the texture path to the path of Minecraft. (I tried it with: "textures/entity/chest/normal.png" and with "minecraft:textures/entity/chest/normal.png".)

 

  • Block Texture: works
  • Container Texture: works
  • 3D-Inventory-Rendering: works
  • Block break particle: does not work

 

So any idea what to do to fix it, because I'm no longer really interested in updating my mod to 1.8.... (I have better stuff to do then that, stuff that makes more fun, like working on the Beta for 1.7.10 and on my own small Game)

Developer of Primeval Forest.

Posted

public class MyBlock extends BlockContainer {
  public MyBlock() {
    this.setTextureName("put something here");
  }
}

 

Block break particles are based off the BLOCK's texture.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

public class MyBlock extends BlockContainer {
  public MyBlock() {
    this.setTextureName("put something here");
  }
}

 

Block break particles are based off the BLOCK's texture.

This is 1.8...

Maker of the Craft++ mod.

Posted

Oops, your right. I'm still pretty sure you need a block texture json to indicate the particle texture.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Sorry, that it took so long to reply here, but I had not much time.

So any idea what to do to fix it, because I'm no longer really interested in updating my mod to 1.8.... (I have better stuff to do then that, stuff that makes more fun, like working on the Beta for 1.7.10 and on my own small Game)

Vanilla's chest gets the break texture through a filthy kludge

BlockModelShapes.getTexture(IBlockState state)
            if (block == Blocks.wall_sign || block == Blocks.standing_sign || block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.standing_banner || block == Blocks.wall_banner)
            {
                return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/planks_oak");
            }
//.. etc...

 

You can't do that, so I think you need to make a block model for block/cube, give it a "particle": texture.  leave the other sides blank (create an empty texture for them). 

 

-TGG

 

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

    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
  • Topics

×
×
  • Create New...

Important Information

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