Jump to content

Recommended Posts

Posted

In a mod I have been developing with a friend, I've made a decorative block that uses the same shape and such as a cake - however, it has this error that when it is placed, surrounding its bottom is a pixel-wide gap that shows the Void (or at least I assume it's the void). 

  Reveal hidden contents
 

Yet the block's model and all seems to be accurate, since it can be walked on appropriately without jumping, and fits what si visually seen. 

 

At any rate, here's the codestuffs for it-

BlockDogBowl.java

package slvr.LupineMod.blocks;

import java.util.Random;

import javax.annotation.Nullable;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import slvr.LupineMod.Reference;

public class BlockDogBowl extends Block {

	public BlockDogBowl() {
		super(Material.wood);
		setUnlocalizedName(Reference.ModBlocks.DOG_BOWL.getUnlocalizedName());
		setRegistryName(Reference.ModBlocks.DOG_BOWL.getRegistryName());
		this.setCreativeTab(CreativeTabs.tabDecorations);
		this.setHardness(2.0F);
		this.setStepSound(soundTypeWood);
		this.setResistance(10.0F);
	}
	
	public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
    {
		setBlockBounds(1.0F / 16.0F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.5F, 1.0F - 0.0625F);
    }
	
	@SideOnly(Side.CLIENT)
    public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos)
    {
		return this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos));
    }
    public boolean isFullCube(IBlockState state)
    {
        return false;
    }

    /**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }

}

 

ModBlocks.java

package slvr.LupineMod.init;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;
import slvr.LupineMod.blocks.BlockDogBowl;

public class ModBlocks {
	
	public static Block dog_bowl;

	public static void init() {
		dog_bowl = new BlockDogBowl();
	}
	
	public static void register() {
		GameRegistry.registerBlock(dog_bowl);
	}
	
	public static void registerRenders() {
		registerRender(dog_bowl);
	}
	
	private static void registerBlock (Block block) {
		//GameRegistry.registerBlock(block);
		ItemBlock item = new ItemBlock(block);
		item.setRegistryName(block.getRegistryName());
		GameRegistry.registerItem(item);
	}
	
	private static void registerRender(Block block) {
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
	}
}

ClientProxy.java

package slvr.LupineMod.proxy;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import slvr.LupineMod.entities.*;
import slvr.LupineMod.init.ModBlocks;
import slvr.LupineMod.init.ModItems;

public class ClientProxy implements CommonProxy{
	
	@Override
	public void preInit(){
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityAfricanWildDog.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityRedWolf.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityCoyote.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityNetherhound.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityGermanShepherd.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityGoldenRetriever.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityPitBull.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityDingo.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityArcticWolf.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityEndWolf.class);
        ClientProxy.registerRenderForVariedWolf(slvr.LupineMod.entities.EntityNewGuineaSingingDog.class);
	}
	public void init(){
		ModItems.registerRenders();
		ModBlocks.registerRenders();

		
	}
	
	private static void registerRenderForVariedWolf(Class c){
		RenderingRegistry.registerEntityRenderingHandler(c, new IRenderFactory<EntityVariedWolf>()
		{
	     @Override
	     public Render<? super EntityVariedWolf> createRenderFor(RenderManager manager){
	    	 return new RenderVariedWolf(manager);
	     }
		});
	}
	

}

 

ItemDogBowl.json (blockstates folder)

{
    "variants": {
        "normal": { "model": "slupinemod:dog_bowl" }
    }
}

 

dog_bowl.json (models/block folder)

{
    "textures": {
        "particle": "blocks/planks_big_oak",
        "bottom": "blocks/planks_big_oak",
        "top": "slupinemod:blocks/dog_bowl_top",
        "side": "blocks/planks_big_oak"
    },
    "elements": [
        {   "from": [ 1, 0, 1 ],
            "to": [ 15, 8, 15 ],
            "faces": {
                "down":  { "uv": [ 1, 1, 15, 15 ], "texture": "#bottom", "cullface": "down" },
                "up":    { "uv": [ 1, 1, 15, 15 ], "texture": "#top" },
                "north": { "uv": [ 1, 8, 15, 16 ], "texture": "#side" },
                "south": { "uv": [ 1, 8, 15, 16 ], "texture": "#side" },
                "west":  { "uv": [ 1, 8, 15, 16 ], "texture": "#side" },
                "east":  { "uv": [ 1, 8, 15, 16 ], "texture": "#side" }
            }
        }
    ]
}

 

Any idea what could be causing this? It is certainly no game-breaking bug but it is annoying.

Posted

Try overriding Block#getBlockLayer to return BlockRenderLayer.CUTOUT or BlockRenderLayer.CUTOUT_MIPPED.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

....you will also need to override isFullCube and isOpaqueCube and return false.

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 (edited)
  On 4/11/2017 at 2:42 AM, Draco18s said:

....you will also need to override isFullCube and isOpaqueCube and return false.

Expand  
 
 

Which he already does in his BlockDogBowl, though not with @Override, which he really should do.

Edited by larsgerrits

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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

    • I've been attempting to trouble shoot performance issues with this version of forge - I've been getting 10 - 14 FPS on a fresh install while the same settings on vanilla will net me ~ 250 FPS  I've tried setting ram to 2, 4, 6, 8, 16 GB, making sure that the GPU is being used - although i cant confirm other than the F3 screen - I've cleared out my .Minecraft folder and done a fresh install of forge multiple times, I even reinstalled Java 17 - from what i read this is the recommended for this version of MC, - Graphics drivers are fully up to date and I've tried it on both studio and game ready drivers. I have a spark report but I dont know what to do with it https://spark.lucko.me/BrrJ5vzX6k Would love some help for this as Ive spent three days on this
    • One fateful day, my life took an unexpected turn when I received a phone call that would change everything. The voice on the other end claimed to be from my bank, delivering alarming news: my account had been frozen due to suspicious activity. Panic surged through me as I listened, my heart racing at the thought of losing my hard-earned savings. At that moment, I had about 130,000 USD in my bank, equivalent to around 2 BTC. The caller spoke with such authority and urgency that I felt compelled to act immediately. They insisted that the only way to protect my funds was to transfer Bitcoin BTC to them for "safekeeping. In my fear and confusion, I believed I was making a wise decision to secure my finances. Without fully grasping the implications, I complied and transferred the equivalent of my savings in Bitcoin, convinced I was safeguarding my money. It wasn’t until later that the reality of my situation hit me like a ton of bricks. I had been duped, and the weight of my mistake was unbearable. Shame and disbelief washed over me as I realized how easily I had been manipulated. How could I have let this happen? The feeling of vulnerability was overwhelming, and I was left grappling with the consequences of my actions. I learned about a recovery expert named RAPID DIGITAL RECOVERY. Desperate to reclaim what I had lost, I reached out for help. RAPID DIGITAL RECOVERY was knowledgeable and reassuring, explaining that there was a chance to trace the Bitcoin I had sent. With their expertise, they tracked the stolen funds to a peer-to-peer (P2P) exchanger based in the United Kingdom. This revelation sparked a glimmer of hope within me, a sense that perhaps justice could be served. RAPID DIGITAL RECOVERY collaborated with Action Fraud, the UK's national reporting center for fraud and cybercrime, to take decisive action against the scammers. Knowing that law enforcement was involved provided me with a sense of relief. The thought that the culprits behind my suffering could be brought to justice was comforting. In an incredible turn of events, RAPID DIGITAL RECOVERY successfully recovered all my funds, restoring my faith in the possibility of justice and recovery.
    • My game crashed in 1.12.2 here is the crash log https://pastebin.com/6MYu4mGy
    • I created a Modpack Forge in 1.20.1 for my friend and I. There are 135 mods including "Essential". I was able to play an 8 hour session without problem but when I relaunch my world, I crashed when I opened the menu of the game "ESC" or after about 15 minutes of session. I can't find the source of the problem. Latest.log and Debug.log : https://paste.ee/p/B0npvlRw
    • Hello! Faced with the same problem. Can you please describe in more detail how you rewrote the toNetwork and fromNetwork methods?
  • Topics

×
×
  • Create New...

Important Information

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