Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10] [DERAILED] Using A Vanilla Item
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
averysumner

[1.10] [DERAILED] Using A Vanilla Item

By averysumner, June 30, 2016 in Modder Support

  • Start new topic

Recommended Posts

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted June 30, 2016

So, I want to make slimeballs throwable. I have a class and everything for throwables that works, only problem is I only know how to turn my custom items into throwables. Can someone tell me how to turn a vanilla item into a throwable without breaking other mods?

 

-Avery


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

The_Fireplace    11

The_Fireplace

The_Fireplace    11

  • Creeper Killer
  • The_Fireplace
  • Forge Modder
  • 11
  • 241 posts
Posted June 30, 2016

Use PlayerInteractEvent.RightClickItem


If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Share this post


Link to post
Share on other sites

Choonster    1651

Choonster

Choonster    1651

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1651
  • 5100 posts
Posted June 30, 2016

Subscribe to

PlayerInteractEvent.RightClickItem

and do the following:

  • Check if the item is a slimeball
  • Decrement the stack size
  • If the stack size is 0, set the player's held item to
    null

    and call

    ForgeEventFactory#onPlayerDestroyItem

    to fire

    PlayerDestroyItemEvent

    .

  • Spawn your entity
  • Cancel the event to prevent
    Item#onItemRightClick

    and other handlers from being called

 

Note that even if you cancel the event, processing will still continue to the other hand until this PR is merged and you set the result to

EnumActionResult.SUCCESS

.


Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

Still not getting it to work even with everything you said, heres the code:

package com.averysumner.randomstuff;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ThrowableSlimeball {

@SubscribeEvent
public void playerRightClickSlime(PlayerInteractEvent.RightClickItem e){
	if (e.getEntityPlayer().getHeldItemMainhand().getItem() == Items.SLIME_BALL) {
        ItemStack playerHeld = e.getEntityPlayer().getHeldItemMainhand();
        
		System.out.println("Slime right clicked!");
		if (!e.getEntityPlayer().capabilities.isCreativeMode)
        {
            --e.getEntityPlayer().getHeldItemMainhand().stackSize;
        }
        
		if (e.getEntityPlayer().getHeldItemMainhand().stackSize == 0) {
			playerHeld = null;
			ForgeEventFactory.onPlayerDestroyItem(e.getEntityPlayer(), e.getEntityPlayer().getHeldItemMainhand(), e.getEntityPlayer().getActiveHand());
		}

		e.getWorld().playSound((EntityPlayer)null, e.getEntityPlayer().posX, e.getEntityPlayer().posY, e.getEntityPlayer().posZ, SoundEvents.ENTITY_SLIME_SQUISH, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!e.getWorld().isRemote)
        {
            EntitySnowball entitysnowball = new EntitySnowball(e.getWorld(), e.getEntityPlayer());
            entitysnowball.setHeadingFromThrower(e.getEntityPlayer(), e.getEntityPlayer().rotationPitch, e.getEntityPlayer().rotationYaw, 0.0F, 1.5F, 1.0F);
            e.getWorld().spawnEntityInWorld(entitysnowball);
        }
        e.setCanceled(true);
	}

}
}

Btw, I am just spawning snowballs atm to test it.


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

diesieben07    7694

diesieben07

diesieben07    7694

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7694
  • 56353 posts
Posted July 1, 2016

Why are you extending Item? Where do you register your event handler?

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

itemRand wont work if it is not extending item. Besides that, there is no reason.


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

I'm an idiot. I didn't register the EventHandler. Thanks!


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

coolAlias    746

coolAlias

coolAlias    746

  • Reality Controller
  • coolAlias
  • Members
  • 746
  • 2805 posts
Posted July 1, 2016

itemRand wont work if it is not extending item. Besides that, there is no reason.

You don't have to use itemRand - you can make a new Random and store it in your event-handling class as a class member, then use that with impunity anywhere you would have used itemRand.


width=228 height=100http://i.imgur.com/NdrFdld.png[/img]

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

I got everything working, besides rendering my slimeball entity. When I use "RenderingRegistry.registerEntityRenderingHandler" I get @Deprecated, even if I use the factory version.


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

The_Fireplace    11

The_Fireplace

The_Fireplace    11

  • Creeper Killer
  • The_Fireplace
  • Forge Modder
  • 11
  • 241 posts
Posted July 1, 2016

I got everything working, besides rendering my slimeball entity. When I use "RenderingRegistry.registerEntityRenderingHandler" I get @Deprecated, even if I use the factory version.

Take a look at how my rendering is handled at

https://bitbucket.org/The_Fireplace/fires-random-things/src/master/src/main/java/the_fireplace/frt/client/ClientProxy.java

It isn't a big change from how you're doing it now, it just needs an extra class, the render factory. Unless something has changed again in 1.10, this way of doing it isn't deprecated.


If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

Everything is working besides the texture. Also, if I get in front of the hitbox, it pushes me forwards as I shoot. Heres the code for my renderer, my render factory, and my entity class, can you tell me what's wrong?: Renderer

package com.averysumner.randomstuff;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderProjectile extends Render {

    protected final Item itr;
    private final RenderItem ri;
    private ResourceLocation itemTexture;

    public RenderProjectile(RenderManager rm, Item projectile) {
        super(rm);
        this.itr = projectile;
        this.ri = Minecraft.getMinecraft().getRenderItem();
    }

    public RenderProjectile(RenderManager rm, Item projectile, ResourceLocation texture) {
        super(rm);
        this.itr = projectile;
        this.ri = Minecraft.getMinecraft().getRenderItem();
        this.itemTexture = texture;
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity entity) {
        if (this.itr == Items.SLIME_BALL)
            return new ResourceLocation("minecraft:items/slimeball");
        else if (this.itemTexture != null)
            return itemTexture;
        else
            return new ResourceLocation("minecraft:items/coal");
    }

    @Override
    public void doRender(Entity entity, double x, double y, double z, float f, float partialTicks) {
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y, (float) z);
        GlStateManager.enableRescaleNormal();
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.ri.renderItem(new ItemStack(this.itr), ItemCameraTransforms.TransformType.GROUND);
        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, f, partialTicks);
    }
}

RenderFactory

package com.averysumner.randomstuff;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class ProjectileRenderFactory implements IRenderFactory<EntitySlimeball> {

    private Item projectile;
    private ResourceLocation location;

    public ProjectileRenderFactory(Item item){
        projectile=item;
    }

    public ProjectileRenderFactory(Item item, ResourceLocation loc){
        projectile=item;
        location=loc;
    }

    @Override
    public Render<? super EntitySlimeball> createRenderFor(RenderManager manager) {
        if(location != null)
            return new RenderProjectile(manager, projectile, location);
        else
            return new RenderProjectile(manager, projectile);
    }
}

Entity

package com.averysumner.randomstuff;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

public class EntitySlimeball extends EntityThrowable
{
    public EntitySlimeball(World worldIn)
    {
        super(worldIn);
    }

    public EntitySlimeball(World worldIn, EntityLivingBase throwerIn)
    {
        super(worldIn, throwerIn);
    }

    public EntitySlimeball(World worldIn, double x, double y, double z)
    {
        super(worldIn, x, y, z);
    }

    public static void func_189662_a(DataFixer p_189662_0_)
    {
        EntityThrowable.func_189661_a(p_189662_0_, "Slimeball");
    }

    /**
     * Called when this EntityThrowable hits a block or entity.
     */
    protected void onImpact(RayTraceResult result)
    {
        if (result.entityHit != null)
        {
            int i = 0;

            if (result.entityHit instanceof EntityBlaze)
            {
                i = 3;
            }

            result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
        }

        for (int j = 0; j < 8; ++j)
        {
            this.worldObj.spawnParticle(EnumParticleTypes.SLIME, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
        }

        if (!this.worldObj.isRemote)
        {
            this.setDead();
        }
    }
}


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

The_Fireplace    11

The_Fireplace

The_Fireplace    11

  • Creeper Killer
  • The_Fireplace
  • Forge Modder
  • 11
  • 241 posts
Posted July 1, 2016

Everything is working besides the texture. Also, if I get in front of the hitbox, it pushes me forwards as I shoot. Heres the code for my renderer, my render factory, and my entity class, can you tell me what's wrong?: Renderer

package com.averysumner.randomstuff;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderProjectile extends Render {

    protected final Item itr;
    private final RenderItem ri;
    private ResourceLocation itemTexture;

    public RenderProjectile(RenderManager rm, Item projectile) {
        super(rm);
        this.itr = projectile;
        this.ri = Minecraft.getMinecraft().getRenderItem();
    }

    public RenderProjectile(RenderManager rm, Item projectile, ResourceLocation texture) {
        super(rm);
        this.itr = projectile;
        this.ri = Minecraft.getMinecraft().getRenderItem();
        this.itemTexture = texture;
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity entity) {
        if (this.itr == Items.SLIME_BALL)
            return new ResourceLocation("minecraft:items/slimeball");
        else if (this.itemTexture != null)
            return itemTexture;
        else
            return new ResourceLocation("minecraft:items/coal");
    }

    @Override
    public void doRender(Entity entity, double x, double y, double z, float f, float partialTicks) {
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y, (float) z);
        GlStateManager.enableRescaleNormal();
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.ri.renderItem(new ItemStack(this.itr), ItemCameraTransforms.TransformType.GROUND);
        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, f, partialTicks);
    }
}

RenderFactory

package com.averysumner.randomstuff;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class ProjectileRenderFactory implements IRenderFactory<EntitySlimeball> {

    private Item projectile;
    private ResourceLocation location;

    public ProjectileRenderFactory(Item item){
        projectile=item;
    }

    public ProjectileRenderFactory(Item item, ResourceLocation loc){
        projectile=item;
        location=loc;
    }

    @Override
    public Render<? super EntitySlimeball> createRenderFor(RenderManager manager) {
        if(location != null)
            return new RenderProjectile(manager, projectile, location);
        else
            return new RenderProjectile(manager, projectile);
    }
}

Entity

package com.averysumner.randomstuff;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

public class EntitySlimeball extends EntityThrowable
{
    public EntitySlimeball(World worldIn)
    {
        super(worldIn);
    }

    public EntitySlimeball(World worldIn, EntityLivingBase throwerIn)
    {
        super(worldIn, throwerIn);
    }

    public EntitySlimeball(World worldIn, double x, double y, double z)
    {
        super(worldIn, x, y, z);
    }

    public static void func_189662_a(DataFixer p_189662_0_)
    {
        EntityThrowable.func_189661_a(p_189662_0_, "Slimeball");
    }

    /**
     * Called when this EntityThrowable hits a block or entity.
     */
    protected void onImpact(RayTraceResult result)
    {
        if (result.entityHit != null)
        {
            int i = 0;

            if (result.entityHit instanceof EntityBlaze)
            {
                i = 3;
            }

            result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
        }

        for (int j = 0; j < 8; ++j)
        {
            this.worldObj.spawnParticle(EnumParticleTypes.SLIME, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
        }

        if (!this.worldObj.isRemote)
        {
            this.setDead();
        }
    }
}

I need to see the code where you register it to know what the problem is. Also, this code over complicates things a bit, I didn't expect you to make an almost exact copy of the more complex of my two projectile rendering classes. My code there is designed for multiple projectiles to use the same class.

 

Here is a simpler example, which better suits your purpose, that you can use if you want something to copy, paste, and edit, though I strongly suggest you look in to it and make sure you understand what all of it does.

My renderprojectile:

https://bitbucket.org/The_Fireplace/fires-random-things/src/master/src/main/java/the_fireplace/frt/client/renderers/RenderPigderPearl.java

My Render factory:

https://bitbucket.org/The_Fireplace/fires-random-things/src/master/src/main/java/the_fireplace/frt/client/renderers/PigderPearlRenderFactory.java

And how I registered this is on line 31 of the ClientProxy class I linked you to before.

 

Edit: as for the entity pushing you, I am too tired to look in to it right now. I suggest you start a new thread about it, we have already derailed this one enough.


If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

Entity/Render Registry:

package com.averysumner.randomstuff;

import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.init.Biomes;
import net.minecraft.init.Items;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class ModEntities {

public static int id = 0;
public static int index;

public static Entity brownbear;
public static Entity slimeball;

public static void registerEntities()
{
	registerModEntity(EntityBrownBear.class, "brownbear", 0x228717, 0xE2F048);
	registerModProjectile(EntitySlimeball.class, "slimeball");

}

public static void registerRenders() {
	RenderingRegistry.registerEntityRenderingHandler(EntitySlimeball.class, new ProjectileRenderFactory(Items.SLIME_BALL));
}

@SuppressWarnings({ "rawtypes", "unchecked" })
public static void registerModEntity(Class entityClass, String name, int primaryColor, int secondaryColor)
{
        EntityRegistry.registerModEntity(entityClass, name, ++id, RandomStuff.instance, 80, 3, false);
        EntityRegistry.registerEgg(entityClass, primaryColor, secondaryColor);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.FOREST);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.BIRCH_FOREST);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.BIRCH_FOREST_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.EXTREME_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.EXTREME_HILLS_EDGE);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.EXTREME_HILLS_WITH_TREES);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.FOREST_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_BIRCH_FOREST);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_BIRCH_FOREST_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_EXTREME_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_EXTREME_HILLS_WITH_TREES);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_FOREST);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_PLAINS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_REDWOOD_TAIGA);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_REDWOOD_TAIGA_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.MUTATED_FOREST);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.PLAINS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.REDWOOD_TAIGA);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.REDWOOD_TAIGA_HILLS);
        EntityRegistry.addSpawn(entityClass, 6, 1, 5, EnumCreatureType.CREATURE, Biomes.ROOFED_FOREST);
        System.out.println("Registering Entity " + name + " with ID " + id);
}

@SuppressWarnings({ "rawtypes", "unchecked"})
public static void registerModProjectile(Class entityClass, String name){
	EntityRegistry.registerModEntity(entityClass, name, id, RandomStuff.instance, 64, 10, true);
        System.out.println("Registering Projectile " + name + " with ID " + id);
}
}

ClientProxy:

package com.averysumner.randomstuff;

import net.minecraft.util.datafix.DataFixer;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {

    @Override
    public void preInit(FMLPreInitializationEvent e) {
        super.preInit(e);
        ModItems.init();
        ModEntities.registerEntities();
        ModEntities.registerRenders();
    }

    @Override
    public void init(FMLInitializationEvent e) {
    	super.init(e);
    }

    @Override
    public void postInit(FMLPostInitializationEvent e) {
        super.postInit(e);
    }
}


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites

averysumner    0

averysumner

averysumner    0

  • Tree Puncher
  • averysumner
  • Members
  • 0
  • 33 posts
Posted July 1, 2016

Hey fireplace, I made it a lot more simple by modifying your simpler render class, but I still get no textures. I posted my registry in an older post.


There are 10 types of people in this world. Those who know binary and those who don't.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      [1.16.4] Block entity invlaid

      By diesieben07 · Posted 9 minutes ago

      This field must not be static. Please learn what static means and why it is not appropriate here.
    • BeardlessBrady
      [1.16.4] Copying file from assets to config folder

      By BeardlessBrady · Posted 13 minutes ago

      I am trying to create a resource pack on mod load. I have everything but creating the default assets, Is there a way to grab an asset file and copy it to the config folder without going through the jar and copy/pasting it?
    • IntentScarab
      [1.16.4] Block entity invlaid

      By IntentScarab · Posted 18 minutes ago

      Sweet, made those changes now, thank you   https://github.com/RhysGrabany/Experienced Here you go, the changes I've made rn are under the tile_passing branch
    • diesieben07
      [1.16.4] Block entity invlaid

      By diesieben07 · Posted 27 minutes ago

      Yes. A good reminder is to make DeferredReigster fields private.   Hm, looks alright on first glance. Please post a Git repo of your mod.
    • IntentScarab
      [1.16.4] Block entity invlaid

      By IntentScarab · Posted 30 minutes ago

      So I should delete the DeferredRegisters in the Registration class and just keep them separate in their respective classes? So ModItems gets the DeferrefRegister and so on? I did notice that when I changed in ModTiles from the DeferredRegister in Registration to the specific class DefReg it actually registered, so that explains something to me.   This is my ExperienceBlockTile constructor and the getTier method that returns the Tile:   public ExperienceBlockTile(ExperienceBlock.Tier tier) { super(getTier(tier)); inputContents = ExperienceBlockContents.createForTileEntity(INPUT_SLOTS, this::canPlayerAccessInventory, this::markDirty); outputContents = ExperienceBlockContents.createForTileEntity(OUTPUT_SLOTS, this::canPlayerAccessInventory, this::markDirty); expBarContents = ExperienceBlockContents.createForTileEntity(EXP_BAR_SLOT, this::canPlayerAccessInventory, this::markDirty); } public static TileEntityType<ExperienceBlockTile> getTier(ExperienceBlock.Tier tier){ switch (tier){ case SMALL: return ModTiles.EXPERIENCE_BLOCK_SMALL.get(); case MEDIUM: return ModTiles.EXPERIENCE_BLOCK_MEDIUM.get(); case LARGE: return ModTiles.EXPERIENCE_BLOCK_LARGE.get(); case CREATIVE: return ModTiles.EXPERIENCE_BLOCK_CREATIVE.get(); default: throw new IllegalArgumentException("Unkown tier: " + tier); } }  
  • Topics

    • IntentScarab
      5
      [1.16.4] Block entity invlaid

      By IntentScarab
      Started 47 minutes ago

    • BeardlessBrady
      0
      [1.16.4] Copying file from assets to config folder

      By BeardlessBrady
      Started 13 minutes ago

    • ISenseHostility
      10
      [1.16.5] Couldn't parse loot modifier error

      By ISenseHostility
      Started 17 hours ago

    • NorthWestWind
      3
      [UNSOLVED][1.16.5] Make item render like bow in thirdperson

      By NorthWestWind
      Started Yesterday at 02:49 PM

    • RobinCirex
      2
      [1.16] Overwrite player

      By RobinCirex
      Started 17 hours ago

  • Who's Online (See full list)

    • 343432443
    • diesieben07
    • filips
    • Seika85
    • BeardlessBrady
    • IntentScarab
    • Pingubro
    • Leronus
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10] [DERAILED] Using A Vanilla Item
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community