Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Entity Class

 

 

package com.kitsu.medievalcraft.entity;

 

import com.kitsu.medievalcraft.item.ModItems;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.monster.EntityBlaze;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntityThrowable;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.util.DamageSource;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.world.World;

 

public class EntityShit extends EntityThrowable {

 

 

 

public EntityShit(World world)

    {

        super(world);

    }

 

    public EntityShit(World world, EntityLivingBase entity)

    {

        super(world, entity);

    }

   

    @SideOnly(Side.CLIENT)

    public EntityShit(World world, double x, double y, double z)

    {

        super(world, x, y, z);

    }

 

 

   

@Override

protected void onImpact(MovingObjectPosition object) {

 

if (object.entityHit != null) {

 

float impactDamage = 1.0F;

 

 

 

object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), impactDamage);

}

 

 

        if (!this.worldObj.isRemote)

        {

            this.setDead();

            this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(ModItems.itemShit)));

        }

 

}

 

@Override

    public void onUpdate()

    {

        super.onUpdate();

    }

 

}

 

 

 

Item Class

 

package com.kitsu.medievalcraft.item;

 

import com.kitsu.medievalcraft.CustomTab;

import com.kitsu.medievalcraft.Main;

import com.kitsu.medievalcraft.entity.EntityShit;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntitySnowball;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

 

public class ItemShit extends Item {

 

private String name = "itemShit";

 

public ItemShit() {

 

setUnlocalizedName("itemShit");

setCreativeTab(CustomTab.MedievalCraftTab);

setTextureName(Main.MODID + ":itemShit");

GameRegistry.registerItem(this, name);

 

}

 

  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)

    {

 

            --stack.stackSize;

 

 

      world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

 

        if (!world.isRemote)

        {

            world.spawnEntityInWorld(new EntityShit(world, player));

        }

 

        return stack;

    }

 

}

 

 

 

Entity Registry in Main

 

 

        public void preInit(FMLPreInitializationEvent e) {

                this.proxy.preInit(e);

                CustomTab.MedievalTab();

                EntityRegistry.registerModEntity(EntityShit.class, "itemShit", 1, this, 64, 10, true);

        ModItems.init();

        ModBlocks.init();

        ModCrafting.init();

               

        }

 

 

Everything about the Item works except i get a white cube while the item is being thrown. While in the players inventory and while on the ground it renders as the item.

 

Thanks in advance

  • Author

You'll need a Renderer for your Entity.

 

I have this in my Common Proxy class as well

 

public class CommonProxy {

 

    public void registerRenderer() {

    RenderingRegistry.registerEntityRenderingHandler(EntityShit.class, new RenderSnowball(ModItems.itemShit));

    }

 

not sure if thats right.  Are you saying I need a rendering class?

Post your entire main class. It doesn't look like you are registering the renderer.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

Post your entire main class. It doesn't look like you are registering the renderer.

 

You were right, I uncommented the register renderer and added this.proxy.registerRenderer(); to my main and now its working.

 

Thank You all very much =)

Also you should register Renderers in the ClientProxy...

If you don't have this, your mod will crash on a Dedicated Server...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.