Jump to content

Warix

Forge Modder
  • Posts

    46
  • Joined

  • Last visited

Posts posted by Warix

  1. Hello, I have an armor, and it's special ability should be flying when you wear it, so i made a check in the entity update event and if you are wearing a full set, player.capabilities.allowFlying is set to true, and if you are not it's set to false except if you are in the creative mode. It works, but the problem is , it might make a conflict with other mods. If they want to set that to true, then my mod will set it to false because the player is not wearing the armor. Is there a solution for this , or I will have to remake vanilla flying?

  2. Hello , I started working on my mod after a few weeks break and now i updated forge and everything and now i have fps drop, screen is freezing every few seconds, and i don't know what's causing it, I tried removing all my events and it didnt help , but what helped is reducing view distance to 2 , when i set it to 8 it's dropping fps but on 16 it freezes. And i know it's probably not my pc because when i try it in vanilla i can play normally even on 32 chunks view distance. You can see my mod's source code here

  3. Ok, but i wasn't , i'm doing this from event and for all entities(including vanilla).

     

    	@SubscribeEvent
    public void EntityInteractEvent(EntityInteractEvent event) {
    
    	//Demons extract wand
    	if (event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == AkameItems.demons_extract_wand) {
    		if (event.target instanceof EntityLivingBase) {
    			EntityExtendedProperties.get((EntityLivingBase) event.target).setFrozen(true);
    			if(event.target instanceof EntityLiving)
    			{
    				event.target.getDataWatcher().updateObject(15, Byte.valueOf((byte)(1)));
    			}
    		}
    	}

     

  4. Hello i need to make vanilla entities not move when they have specific extended property on them. I tried with removing AI (cleared tasks and targetTasks lists) but that doesn't work for all ( e.g. bats have their own code for moving around). I was thinking of setting entity's position to fixed location from update entity event but that isn't good solution and its also acting weird.

  5. I tried like this:

     

    @SubscribeEvent

    public void LivingHurtEvent(LivingHurtEvent event)

    {

    if(EntityExtendedProperties.get(event.entityLiving).isFrozen())

    {

    WorldServer server = (WorldServer) event.entityLiving.worldObj;

    event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "dig.glass", 1, 1);

    server.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ+ 1, 0, 0, 0);

    event.entityLiving.setDead();

    }

    }

    }

     

    But it didn't work.

  6. Hello , when i try to summon particle it doesn't show up. I tried with different particles but none work, also i checked coordinates and they were ok. So i don't really understand what is problem here.

    Code where I spawn them:

     

    public class ForgeEvents

    {

    @SubscribeEvent

    public void LivingHurtEvent(LivingHurtEvent event)

    {

    if(EntityExtendedProperties.get(event.entityLiving).isFrozen())

    {

    event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "dig.glass", 1, 1);

    event.entityLiving.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ+ 1, 0, 0, 0);

    event.entityLiving.setDead();

    }

    }

    }

     

     

    I also tried from client side events and it didn't work there too. But sound works, so that code gets executed too.

  7. I'm still new to modding, so i don't really understand how world and client side work.How do i know which code run on which side ? Also from what i understood i have to send nbt data of entity that player start tracking to its client? I tried that and i don't know how to access that entity on client side.

    my packet code:

     

    package ga.warixmods.akamegakillmod;

     

    import io.netty.buffer.ByteBuf;

    import net.minecraft.client.Minecraft;

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.util.IThreadListener;

    import net.minecraft.world.WorldServer;

    import net.minecraftforge.fml.common.network.ByteBufUtils;

    import net.minecraftforge.fml.common.network.simpleimpl.IMessage;

    import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;

    import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

     

    public class SendPacket implements IMessage {

     

    private String text;

    private int num,recieved,id = 0;

    private NBTTagCompound nbt;

    public SendPacket() {}

     

    public SendPacket(String text)

    {

    this.text = text;

    this.recieved = 0;

    }

     

    public SendPacket(int num)

    {

    this.num = num;

    this.recieved = 1;

    }

     

    public SendPacket(NBTTagCompound nbt,int id) {

    this.nbt = nbt;

    this.id = id;

     

     

    }

     

    @Override

    public void fromBytes(ByteBuf buf) {

    switch(this.recieved)

    {

        case 0:

       

    this.text = ByteBufUtils.readUTF8String(buf);

    break;

        case 1:

       

    this.num = ByteBufUtils.readVarInt(buf, Integer.MAX_VALUE);

        break;

        case 2:

        this.nbt = ByteBufUtils.readTag(buf);

        this.id = ByteBufUtils.readVarInt(buf, Integer.MAX_VALUE);

    }

    }

     

    @Override

    public void toBytes(ByteBuf buf) {

    switch(this.recieved)

    {

        case 0:

       

    ByteBufUtils.writeUTF8String(buf, this.text);

    break;

        case 1:

       

    ByteBufUtils.writeVarInt(buf,this.num, Integer.MAX_VALUE);

        break;

        case 2:

        ByteBufUtils.writeTag(buf, this.nbt);

        ByteBufUtils.writeVarInt(buf, this.id, Integer.MAX_VALUE);

    }

    }

    public static class Handler implements IMessageHandler<SendPacket, IMessage>{

     

    @Override

    public IMessage onMessage(final SendPacket message, final MessageContext ctx)

    {

    IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.worldObj;

    IThreadListener mainThreadClient = Minecraft.getMinecraft();

    if(ctx.side.isServer())

    {

            mainThread.addScheduledTask(new Runnable()

            {

          @Override

          public void run()

            {

            //this is from other parts of mod

            switch(message.recieved)

            {

           

            case 0:

            String text = message.text;

            int num = message.num;

           

            String idS = text.substring(3, 4);

            int idI = Integer.parseInt(idS);

           

            text = text.substring(4);

            switch(idI)

            {

            case 0:

           

            ctx.getServerHandler().playerEntity.getHeldItem().getTagCompound().setInteger("id",Integer.parseInt(text));

            break;

            case 1:

           

            ctx.getServerHandler().playerEntity.getHeldItem().getTagCompound().setInteger("id", Integer.parseInt(text));

            break;

            case 2:

           

            ctx.getServerHandler().playerEntity.getHeldItem().getTagCompound().setInteger("idU",Integer.parseInt(text));

            break;

            case 3:

           

            ctx.getServerHandler().playerEntity.getHeldItem().getTagCompound().setInteger("id"+Integer.parseInt(text),0);

            break;

           

            }

            break;

            case 1:

            break;

            }

            }});

    }

    //and i guess i have to sync it here?

                            else

    {

    mainThreadClient.addScheduledTask(new Runnable()

            {

          @Override

          public void run()

            {

        EntityLivingBase target =

           

                    }

            });}

    return null;

    }

     

     

     

     

    }

    }

     

     

  8. I just changed what you said:

    IEEP:

     

    package ga.warixmods.akamegakillmod.events.extendedproperties;

     

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.world.World;

    import net.minecraftforge.common.IExtendedEntityProperties;

     

    public class EntityExtendedProperties implements IExtendedEntityProperties {

    protected EntityLivingBase theEntity;

    protected boolean isFrozen;

    public final static String IEEP_NAME = "AGKMEPEntity";

     

    public static EntityExtendedProperties get(EntityLivingBase entity)

    {

    return (EntityExtendedProperties) entity.getExtendedProperties(IEEP_NAME);

    }

     

    @Override

    public void saveNBTData(NBTTagCompound nbt)

    {

    NBTTagCompound data = new NBTTagCompound();

    data.setBoolean("isFrozen", this.isFrozen());

    nbt.setTag(IEEP_NAME, data);

    }

     

    @Override

    public void loadNBTData(NBTTagCompound nbt)

    NBTTagCompound data = nbt.getCompoundTag(IEEP_NAME);

    this.isFrozen = data.getBoolean("isFrozen");

    }

     

    @Override

    public void init(Entity entity, World world)

    {

    this.theEntity = (EntityLivingBase) entity;

    }

     

    public boolean isFrozen()

    {

    return this.isFrozen;

    }

     

    public void setFrozen(boolean state)

    {

    this.isFrozen = state;

    }

    }

     

    Rendering:

     

    package ga.warixmods.akamegakillmod.events;

     

    import org.lwjgl.opengl.GL11;

     

    import ga.warixmods.akamegakillmod.events.extendedproperties.EntityExtendedProperties;

    import net.minecraft.client.renderer.GlStateManager;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraftforge.client.event.RenderLivingEvent;

    import net.minecraftforge.common.MinecraftForge;

    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

     

    public class OnRenderEntityLiving {

     

    private boolean isFrozen;

     

    public OnRenderEntityLiving()

    {

    MinecraftForge.EVENT_BUS.register(this);

    }

    @SubscribeEvent

    public void RenderLivingEvent(RenderLivingEvent.Pre event)

    {

     

    EntityExtendedProperties props = EntityExtendedProperties.get((EntityLivingBase) event.entity);

    isFrozen = props.isFrozen();

    if(isFrozen)

    {

    GlStateManager.pushMatrix();

    GL11.glColor3f(1.2f, 1.0f, 0.8f);

    GlStateManager.popMatrix();

     

    }

     

    }

    }

     

     

     

    Setting data:

     

    package ga.warixmods.akamegakillmod.events;

    import ga.warixmods.akamegakillmod.entity.special.EntityRocketLauncher;

    import ga.warixmods.akamegakillmod.events.extendedproperties.EntityExtendedProperties;

    import ga.warixmods.akamegakillmod.init.AkameItems;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.potion.PotionEffect;

    import net.minecraft.world.World;

    import net.minecraftforge.common.MinecraftForge;

    import net.minecraftforge.event.entity.player.EntityInteractEvent;

    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

     

    public class FreezeEntity {

     

     

    public FreezeEntity()

    {

    MinecraftForge.EVENT_BUS.register(this);

    }

    @SubscribeEvent

        public void EntityInteractEvent(EntityInteractEvent event) {

    World worldIn = event.entityPlayer.worldObj;

     

    EntityPlayer playerIn = event.entityPlayer;

    Entity target = event.target;

     

     

    if(playerIn.getHeldItem() != null)

    {

     

     

     

    //freeze wand

    if(playerIn.getHeldItem().hasTagCompound() && event.entityPlayer.getHeldItem().getItem() == AkameItems.demons_extract_wand)

    {

    if( event.entityPlayer.getHeldItem().getTagCompound().hasKey("id") && event.entityPlayer.getHeldItem().getTagCompound().getInteger("id") == 3)

    {

     

     

    boolean is = false;

    boolean is2 = true;

    boolean isFrozen = false;

    if(target instanceof EntityLivingBase)

    {

    EntityExtendedProperties props = EntityExtendedProperties.get((EntityLivingBase) target);

    props.setFrozen(true);

     

    }

     

     

     

     

     

    }

    }

    }

     

    }

     

     

    }

     

       

     

     

     

     

    Registering on entity construction:

     

    package ga.warixmods.akamegakillmod.events;

     

    import ga.warixmods.akamegakillmod.events.extendedproperties.EntityExtendedProperties;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraftforge.common.MinecraftForge;

    import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;

    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

     

    public class OnEntityConstructing {

    public OnEntityConstructing()

    {

    MinecraftForge.EVENT_BUS.register(this);

    }

     

    @SubscribeEvent

    public void onEntityConstructing(EntityConstructing event) {

     

    if(event.entity instanceof EntityLivingBase)

    {

     

    event.entity.registerExtendedProperties("AGKMEPEntity", new EntityExtendedProperties());

     

     

    }

     

    }

    }

     

     

     

  9. IEEP:

     

    package ga.warixmods.akamegakillmod.events.extendedproperties;

     

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.world.World;

    import net.minecraftforge.common.IExtendedEntityProperties;

     

    public class EntityExtendedProperties implements IExtendedEntityProperties {

    protected EntityLiving theEntity;

    protected World theWorld;

    protected boolean isFrozen;

    public final static String extendedPropertiesName = "AGKM:EPEntity";

     

    @Override

    public void saveNBTData(NBTTagCompound parCompound) {

    NBTTagCompound compound = new NBTTagCompound();

    compound.setBoolean("AGKM:isFrozen", false);

     

    }

     

    public static EntityExtendedProperties get(EntityLiving living)

    {

    return (EntityExtendedProperties) living.getExtendedProperties(extendedPropertiesName);

    }

    @Override

    public void loadNBTData(NBTTagCompound compound) {

            this.isFrozen = compound.getBoolean("AGKM:isFrozen");

     

     

    }

     

    @Override

    public void init(Entity entity, World world) {

    theEntity = (EntityLiving) entity;

    theWorld = world;

     

    }

    public void setFrozen(boolean state)

    {

    this.isFrozen = state;

    }

    public boolean getFrozen()

    {

    return this.isFrozen;

    }

    }

     

     

    Rendering:

     

    package ga.warixmods.akamegakillmod.events;

     

    import org.lwjgl.opengl.GL11;

     

    import ga.warixmods.akamegakillmod.events.extendedproperties.EntityExtendedProperties;

    import net.minecraft.client.renderer.GlStateManager;

    import net.minecraft.client.renderer.OpenGlHelper;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.util.ResourceLocation;

    import net.minecraftforge.client.event.RenderLivingEvent;

    import net.minecraftforge.common.MinecraftForge;

    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

     

    public class OnRenderEntityLiving {

     

    private boolean isFrozen;

     

    public OnRenderEntityLiving()

    {

    MinecraftForge.EVENT_BUS.register(this);

    }

    @SubscribeEvent

    public void RenderLivingEvent(RenderLivingEvent.Pre event)

    {

     

    EntityExtendedProperties props = EntityExtendedProperties.get((EntityLiving) event.entity);

    isFrozen = props.getFrozen();

    if(isFrozen)

    {

    GlStateManager.pushMatrix();

    GL11.glColor3f(1.2f, 1.0f, 0.8f);

    GlStateManager.popMatrix();

     

    }

     

    }

    }

     

     

    Entity constructing:

     

    package ga.warixmods.akamegakillmod.events;

     

    import ga.warixmods.akamegakillmod.events.extendedproperties.EntityExtendedProperties;

    import net.minecraft.entity.EntityLiving;

    import net.minecraftforge.common.MinecraftForge;

    import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;

    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

     

    public class OnEntityConstructing {

    public OnEntityConstructing()

    {

    MinecraftForge.EVENT_BUS.register(this);

    }

     

    @SubscribeEvent

    public void onEntityConstructing(EntityConstructing event) {

     

    if(event.entity instanceof EntityLiving)

    {

     

    event.entity.registerExtendedProperties("AGKM:EPEntity", new EntityExtendedProperties());

     

     

    }

     

    }

    }

     

     

    Setting data:

     

    package ga.warixmods.akamegakillmod.events;

    import java.util.Random;

     

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozen;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenBat;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenBlaze;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenCaveSpider;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenChicken;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenCreeper;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenDragon;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenEnderMite;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenEnderman;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenGhast;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenGolem;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenGuardian;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenHorse;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenMagmaCube;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenMooshroom;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenOcelot;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenPig;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenPigZombie;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenRabbit;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenSheep;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenSilverfish;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenSkeleton;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenSlime;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenSpider;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenSquid;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenVillager;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenWitch;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenWither;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenWolf;

    import ga.warixmods.akamegakillmod.entity.frozen.EntityFrozenZombie;

    import ga.warixmods.akamegakillmod.entity.special.EntityRocketLauncher;

    import ga.warixmods.akamegakillmod.events.extendedproperties.EntityExtendedProperties;

    import ga.warixmods.akamegakillmod.init.AkameItems;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.entity.boss.EntityDragon;

    import net.minecraft.entity.boss.EntityWither;

    import net.minecraft.entity.monster.EntityBlaze;

    import net.minecraft.entity.monster.EntityCaveSpider;

    import net.minecraft.entity.monster.EntityCreeper;

    import net.minecraft.entity.monster.EntityEnderman;

    import net.minecraft.entity.monster.EntityEndermite;

    import net.minecraft.entity.monster.EntityGhast;

    import net.minecraft.entity.monster.EntityGolem;

    import net.minecraft.entity.monster.EntityGuardian;

    import net.minecraft.entity.monster.EntityMagmaCube;

    import net.minecraft.entity.monster.EntityPigZombie;

    import net.minecraft.entity.monster.EntitySilverfish;

    import net.minecraft.entity.monster.EntitySkeleton;

    import net.minecraft.entity.monster.EntitySlime;

    import net.minecraft.entity.monster.EntitySpider;

    import net.minecraft.entity.monster.EntityWitch;

    import net.minecraft.entity.monster.EntityZombie;

    import net.minecraft.entity.passive.EntityBat;

    import net.minecraft.entity.passive.EntityChicken;

    import net.minecraft.entity.passive.EntityCow;

    import net.minecraft.entity.passive.EntityHorse;

    import net.minecraft.entity.passive.EntityMooshroom;

    import net.minecraft.entity.passive.EntityOcelot;

    import net.minecraft.entity.passive.EntityPig;

    import net.minecraft.entity.passive.EntityRabbit;

    import net.minecraft.entity.passive.EntitySheep;

    import net.minecraft.entity.passive.EntitySquid;

    import net.minecraft.entity.passive.EntityVillager;

    import net.minecraft.entity.passive.EntityWolf;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.potion.PotionEffect;

    import net.minecraft.world.World;

    import net.minecraftforge.common.MinecraftForge;

    import net.minecraftforge.event.entity.player.EntityInteractEvent;

    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

     

    public class FreezeEntity {

     

     

    public FreezeEntity()

    {

    MinecraftForge.EVENT_BUS.register(this);

    }

    @SubscribeEvent

        public void EntityInteractEvent(EntityInteractEvent event) {

    World worldIn = event.entityPlayer.worldObj;

    EntityPlayer playerIn = event.entityPlayer;

    Entity target = event.target;

    Random rand = new Random();

     

    if(playerIn.getHeldItem() != null)

    {

     

     

     

    //freeze wand

    if(playerIn.getHeldItem().hasTagCompound() && event.entityPlayer.getHeldItem().getItem() == AkameItems.demons_extract_wand)

    {

    if( event.entityPlayer.getHeldItem().getTagCompound().hasKey("id") && event.entityPlayer.getHeldItem().getTagCompound().getInteger("id") == 3)

    {

    EntityFrozenChicken e = new EntityFrozenChicken(worldIn);

     

    boolean is = false;

    boolean is2 = true;

    boolean isFrozen = false;

    if(target instanceof EntityLiving)

    {

    EntityExtendedProperties props = EntityExtendedProperties.get((EntityLiving) target);

    props.setFrozen(true);

     

    }

     

     

    //lands of closed braces

     

     

    }

    }

    }

     

    }

     

     

    }

     

       

     

     

     

  10. Hello, i have rocket launcher and when i want it to shoot i made it to spawn entity, and that rocket launcher is riding entity, when that entity attacks something rocket launcher will spawn rocket. I made all that but now i need to make that rocket to go on entity that entity what rocket launcher is ridding is attacking. (basically if rocket launcher rides wolf and wolf starts to attack sheep , rocket will spawn where rocket launcher is) . I tried to move rocket with motionX and others, but i just can't get it right, I'm not sure if there are other simpler ways to attack with flying entity. Rocket is extending EntityFlying ( I can change it if there is easier way to do it).

  11. Hello, when i try to rotate part of model of entity for 90°, it rotates for about 15°  i think.

    i rotate it in model class.

    model code (before rotation):

     

    // Date: 9.6.2015 2:24:46 PM

    // Template version 1.1

    // Java generated by Techne

    // Keep in mind that you still need to fill in some blanks

    // - ZeuX

     

     

     

     

     

     

    package ga.warixmods.akamegakillmod.client.model;

     

    import net.minecraft.client.model.ModelBase;

    import net.minecraft.client.model.ModelRenderer;

    import net.minecraft.entity.Entity;

     

    public class ModelRocketLauncherRM extends ModelBase

    {

      //fields

        ModelRenderer head;

        ModelRenderer neck;

        ModelRenderer body;

     

      public ModelRocketLauncherRM()

      {

        textureWidth = 64;

        textureHeight = 32;

       

        head = new ModelRenderer(this, 0, 0);

        head.addBox(-3.5F, -5F, -3.5F, 7, 5, 7);

        head.setRotationPoint(-0.5F, 20F, -0.5F);

        head.setTextureSize(64, 32);

        head.mirror = true;

        setRotation(head, 0F, 0F, 0F);

        neck = new ModelRenderer(this, 28, 8);

        neck.addBox(0F, 0F, 0F, 1, 3, 1);

        neck.setRotationPoint(-1F, 20F, -1F);

        neck.setTextureSize(64, 32);

        neck.mirror = true;

        setRotation(neck, 0F, 0F, 0F);

        body = new ModelRenderer(this, 28, 0);

        body.addBox(0F, 0F, 0F, 7, 1, 7);

        body.setRotationPoint(-4F, 23F, -4F);

        body.setTextureSize(64, 32);

        body.mirror = true;

        setRotation(body, 0F, 0F, 0F);

      }

     

      public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

      {

        super.render(entity, f, f1, f2, f3, f4, f5);

        setRotationAngles(entity,f, f1, f2, f3, f4, f5);

        head.render(f5);

        neck.render(f5);

        body.render(f5);

      }

     

      private void setRotation(ModelRenderer model, float x, float y, float z)

      {

        model.rotateAngleX = x;

        model.rotateAngleY = y;

        model.rotateAngleZ = z;

      }

     

      public void setRotationAngles(Entity entity,float f, float f1, float f2, float f3, float f4, float f5)

      {

        super.setRotationAngles(f, f1, f2, f3, f4, f5,entity);

      }

     

    }

     

     

    Model code with rotation:

     

    // Date: 9.6.2015 2:24:46 PM

    // Template version 1.1

    // Java generated by Techne

    // Keep in mind that you still need to fill in some blanks

    // - ZeuX

     

     

     

     

     

     

    package ga.warixmods.akamegakillmod.client.model;

     

    import net.minecraft.client.model.ModelBase;

    import net.minecraft.client.model.ModelRenderer;

    import net.minecraft.entity.Entity;

     

    public class ModelRocketLauncherRM extends ModelBase

    {

      //fields

        ModelRenderer head;

        ModelRenderer neck;

        ModelRenderer body;

     

      public ModelRocketLauncherRM()

      {

        textureWidth = 64;

        textureHeight = 32;

       

        head = new ModelRenderer(this, 0, 0);

        head.addBox(-3.5F, -5F, -3.5F, 7, 5, 7);

        head.setRotationPoint(-0.5F, 20F, -0.5F);

        head.setTextureSize(64, 32);

        head.mirror = true;

        setRotation(head, 0F, 90F, 0F);

        neck = new ModelRenderer(this, 28, 8);

        neck.addBox(0F, 0F, 0F, 1, 3, 1);

        neck.setRotationPoint(-1F, 20F, -1F);

        neck.setTextureSize(64, 32);

        neck.mirror = true;

        setRotation(neck, 0F, 0F, 0F);

        body = new ModelRenderer(this, 28, 0);

        body.addBox(0F, 0F, 0F, 7, 1, 7);

        body.setRotationPoint(-4F, 23F, -4F);

        body.setTextureSize(64, 32);

        body.mirror = true;

        setRotation(body, 0F, 0F, 0F);

      }

     

      public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

      {

        super.render(entity, f, f1, f2, f3, f4, f5);

        setRotationAngles(entity,f, f1, f2, f3, f4, f5);

        head.render(f5);

        neck.render(f5);

        body.render(f5);

      }

     

      private void setRotation(ModelRenderer model, float x, float y, float z)

      {

        model.rotateAngleX = x;

        model.rotateAngleY = y;

        model.rotateAngleZ = z;

      }

     

      public void setRotationAngles(Entity entity,float f, float f1, float f2, float f3, float f4, float f5)

      {

        super.setRotationAngles(f, f1, f2, f3, f4, f5,entity);

      }

     

    }

     

     

    Render code:

     

    package ga.warixmods.akamegakillmod.client.renderer.entity;

     

    import ga.warixmods.akamegakillmod.client.model.ModelRocketLauncherRM;

    import ga.warixmods.akamegakillmod.entity.special.EntityRocketLauncher;

    import net.minecraft.client.model.ModelBase;

    import net.minecraft.client.model.ModelCow;

    import net.minecraft.client.model.ModelRenderer;

    import net.minecraft.client.renderer.GlStateManager;

    import net.minecraft.client.renderer.entity.Render;

    import net.minecraft.client.renderer.entity.RenderManager;

    import net.minecraft.entity.Entity;

    import net.minecraft.util.ResourceLocation;

     

    public class RenderRocketLauncher extends Render{

     

     

    public RenderRocketLauncher(RenderManager rendermanagerIn) {

    super(rendermanagerIn);

    // TODO Auto-generated constructor stub

    }

    protected ModelBase modelRocketLauncher = new ModelRocketLauncherRM();

     

     

    @Override

    protected ResourceLocation getEntityTexture(Entity entity) {

    // TODO Auto-generated method stub

    return new ResourceLocation("agkm:textures/entity/rocket_launcher.png");

    }

     

    public void doRender(Entity boat, double p_180552_2_, double p_180552_4_, double p_180552_6_, float p_180552_8_, float p_180552_9_)

        {

            GlStateManager.pushMatrix();

            GlStateManager.translate((float)p_180552_2_, (float)p_180552_4_ + 0.25F, (float)p_180552_6_);

           

            this.bindEntityTexture(boat);

           

           

            this.modelRocketLauncher.render(boat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

            GlStateManager.popMatrix();

            super.doRender(boat, p_180552_2_, p_180552_4_, p_180552_6_, p_180552_8_, p_180552_9_);

        }

    }

     

     

    Before rotation:

    width=800 height=449http://orig03.deviantart.net/50f2/f/2015/249/0/4/2015_09_06_17_20_14_by_warix3-d98l8dn.png[/img]

    After rotation:

    width=800 height=449http://orig08.deviantart.net/19cf/f/2015/249/a/9/2015_09_06_17_18_59_by_warix3-d98l8el.png[/img]

×
×
  • Create New...

Important Information

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