
Looke81
Members-
Posts
250 -
Joined
-
Last visited
Everything posted by Looke81
-
Wow I feel like an entrepreneur on dragons den whose been offered deals from everyone (its a TV show if you don't get reference). So il go for Failender first. yes but were do you suppose I get itemSlot from? As I only have the slot of the new item and itemstack will call them both. (looking into other two solutions thankyou very much just give me some time)
-
Probably should have opened with this but wanted to try on my own. Okay so i was trying to see if I could make an item "bounce around" the players inventory by making it move to random slots. I was going to do this by getting a random slot. If that slot had nothing in it (== null) I would copy the item into that slot (this is were we are). Then I would delete the item that was copied from. If the slot did have an item in it I was planning on switching the two items slots. I hope this helps.
-
oh so i guess: EntityPlayer player= (EntityPlayer) entity; already checks if the entity is an entityplayer i didn't know that thanks. Also right yea just use the original index course. The "old item" is the item that i have copied from and the new item is the new item made by: slot.inventory.setInventorySlotContents(index, itemstack); Edit: and I want to delete the old item to move the item.
-
Easiest way to do this is just give you my code. package com.looke81.Tat.items; import java.util.ArrayList; import java.util.List; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import com.looke81.Tat.Tat; public class EnergyIngot extends Item { public EnergyIngot() { this.setCreativeTab(Tat.TatTab); } private Random random = new Random(); public void onUpdate(ItemStack itemstack, World worldIn, Entity entity, int itemSlot, boolean isSelected) { EntityPlayer player= (EntityPlayer) entity; if(entity instanceof EntityPlayer){ List stacks = player.inventoryContainer.inventoryItemStacks; List slots = player.inventoryContainer.inventorySlots; int index = random.nextInt(slots.size()); Slot slot= (Slot) slots.get(index); ItemStack stack= (ItemStack) stacks.get(index); if(stack == null && slot != null){ slot.inventory.setInventorySlotContents(slot.slotNumber, itemstack); } } } } Yes I know this is kinda crazy but don't worry i'm not planning on doing it every tick this is just for test purposes. What I am trying to do is delete the old item that the new one was copied from. Thanks for your help so far.
-
last bump
-
?
-
Thanks got that fixed Canceling the event stops the rendering competently. All I want to do is rotate the current model. I would rather not start from scratch. Can I just rotate the model instead?
-
Thanks for some reason its crashing now when I press F5. Crash log: http://pastebin.com/nUNwFzT2 code: @SubscribeEvent public void RenderPlayerEvent(net.minecraftforge.client.event.RenderPlayerEvent.Pre event){ if (event.entityPlayer.getHeldItem().equals(new ItemStack(Items.apple))){ event.setCanceled(true); } }
-
Ok thanks. Seems like ive hit another snag i'm trying to cancel the event if an item is held and it isn't working for some reason tho. @SubscribeEvent public void RenderPlayerEvent(net.minecraftforge.client.event.RenderPlayerEvent.Pre event){ if (event.entityPlayer.getHeldItem().equals(Items.apple)){ event.setCanceled(true); } }
-
So what I would like to achieve is to render the player much like the elytra do in 1.9 without the wings and moving legs. So with the player lying flat but pitched to were the player is looking like this. https://media.giphy.com/media/N1JYS2CFfjW9O/giphy.gif I have never messed with rendering the player and I'm not sure how to go about this so any help would be appreciated.
-
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
AND THAT FIXED IT NO NEED TO REPLY. I feel dumb now. -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
So I actually spawn it on impact of another entity and it is registered in my init method. Entity that spawns the entity: package com.looke81.biowarfare.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityGrenadeToxic extends EntityThrowable { public EntityGrenadeToxic(World p_i1776_1_) { super(p_i1776_1_); } public EntityGrenadeToxic(World world, EntityLivingBase entity) { super(world, entity); } @Override protected void onImpact(MovingObjectPosition movingobjectposition) { for(int i = 0; i < 10;i++){} if(!this.worldObj.isRemote){ EntityGrenadeEffectToxic entitygrenadeeffecttoxic = new EntityGrenadeEffectToxic(this.worldObj); entitygrenadeeffecttoxic.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); this.worldObj.spawnEntityInWorld(entitygrenadeeffecttoxic); this.setDead(); } } } Entity registration: @Mod.EventHandler public void init(FMLInitializationEvent event) { BioWarfareEntity.registerEntity(); } Entity registration class: package com.looke81.biowarfare.entity; import java.util.Random; import net.minecraftforge.fml.common.registry.EntityRegistry; import com.looke81.biowarfare.Reference; public class BioWarfareEntity { public static void mainRegistry() { registerEntity(); } public static void registerEntity() { createEntity(EntityGrenadeToxic.class, "GrenadeToxic"); createEntity(EntityGrenadeInvertedVision.class, "GrenadeInvertedVision"); createEntity(EntityGrenadeBlurredVision.class, "GrenadeBlurredVision"); createEntity(EntityGrenadeXPDrain.class, "GrenadeXPDrain"); createEntity(EntityGrenadeRooted.class, "GrenadeRooted"); createEntity(EntityGrenadeBlurredVision.class, "GrenadeBlurredVision"); createEntity(EntityGrenadeEffectToxic.class, "GrenadeEffectToxic"); createEntity(EntityGrenadeEffectInvertedVision.class, "GrenadeEffectInvertedVision"); createEntity(EntityGrenadeEffectBlurredVision.class, "GrenadeEffectBlurredVision"); createEntity(EntityGrenadeEffectXPDrain.class, "GrenadeEffectXPDrain"); createEntity(EntityGrenadeEffectRooted.class, "GrenadeEffectRooted"); createEntity(EntityGrenadeEffectDiarrhea.class, "GrenadeEffectDiarrhea"); createEntity(EntityStaff.class, "Staff"); createEntity(EntityMissile.class, "Missile"); } public static void createEntity(Class entityClass, String entityName) { Random randomGenerator = new Random(); int randomId = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId ); EntityRegistry.registerModEntity(entityClass, entityName, randomId, Reference.MOD_ID, 64, 1, true); } } Also yes I did just realize that two of the methods im using have become depreciated I will fix that now. -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
-which is why I add it to a list of entitys that can be entitylivingbase -well i thought that was the first thing I did but apparently not yeah its not being called but why? @Override public void onUpdate() { super.onUpdate(); counter++; if(this.worldObj.isRemote){ if (counter == 5) { for (int x = 0; x < 11; x++) { for (int y = 0; y < 11; y++) { for (int z = 0; z < 11; z++) { this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + x, this.posY + y, this.posZ + z, 0, 0, 0, 0); this.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, this.posX + x - 0.5, this.posY + y - 0.5, this.posZ + z - 0.5, 0, 255, 0, 0); System.out.println("being called?"); counter = 0; } } } } } World entityWorld = getEntityWorld(); List nearEntities = entityWorld.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().expand(10.0D, 10.0D, 10.0D)); List<Entity> outerEntities = new ArrayList<Entity>(); outerEntities.addAll(nearEntities); for (Entity outerEntity : outerEntities) { if (outerEntity instanceof EntityLivingBase) { ((EntityLivingBase) outerEntity).addPotionEffect(new PotionEffect(BioWarfarePotionRegistry.Toxic.id, 20, 30)); } } if (this.ticksExisted == 500) { this.setDead(); } } -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
-ok isremote is now enclosing the counter and for-loop -guess so -umm doesn't work means that it doesn't apply the effect to the entitys. Particles are still not spawning tho so idk -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
-Okay thanks I am now using isremote -Is using isremote like this fixing that now? @Override public void onUpdate() { super.onUpdate(); counter++; if (counter == 5) { for (int x = 0; x < 11; x++) { for (int y = 0; y < 11; y++) { for (int z = 0; z < 11; z++) { if(this.worldObj.isRemote){ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + x, this.posY + y, this.posZ + z, 0, 0, 0, 0); this.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, this.posX + x - 0.5, this.posY + y - 0.5, this.posZ + z - 0.5, 0, 255, 0, 0); counter = 0; } } } } } -I see what you mean but will that be that big of an issue and obviously i ignore half of it because you can apply a potion effect to a non entitylivingbase. -Because this doesn't work for some reason... World entityWorld = getEntityWorld(); List<Entity> nearEntities = entityWorld.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().expand(10.0D, 10.0D, 10.0D)); for (Entity nearEntitie : nearEntities) { if (nearEntities instanceof EntityLivingBase) { ((EntityLivingBase) nearEntities).addPotionEffect(new PotionEffect(BioWarfarePotionRegistry.Toxic.id, 20, 30)); } } -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
Is that better now? (still not working) Also my getEntitiesWithinAABBExcludingEntity is not related to the particles and works fine for me, would you suggest I do it differently? package com.looke81.biowarfare.entity; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.looke81.biowarfare.init.BioWarfarePotionRegistry; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityGrenadeEffectToxic extends Entity { public EntityGrenadeEffectToxic(World p_i1738_1_) { super(p_i1738_1_); } public int counter; @SideOnly(Side.CLIENT) @Override public void onUpdate() { super.onUpdate(); counter++; if (counter == 5) { for (int x = 0; x < 11; x++) { for (int y = 0; y < 11; y++) { for (int z = 0; z < 11; z++) { this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + x, this.posY + y, this.posZ + z, 0, 0, 0, 0); this.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, this.posX + x - 0.5, this.posY + y - 0.5, this.posZ + z - 0.5, 0, 255, 0, 0); counter = 0; } } } } World entityWorld = getEntityWorld(); List nearEntities = entityWorld.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().expand(10.0D, 10.0D, 10.0D)); List<Entity> outerEntities = new ArrayList<Entity>(); outerEntities.addAll(nearEntities); for (Entity outerEntity : outerEntities) { if (outerEntity instanceof EntityLivingBase) { ((EntityLivingBase) outerEntity).addPotionEffect(new PotionEffect(BioWarfarePotionRegistry.Toxic.id, 20, 30)); } } if (this.ticksExisted == 500) { this.setDead(); } } @Override protected void entityInit() { } @Override protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { } @Override protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { } } -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
I did i changed the method I was using but I get your point il just give you the whole class. package com.looke81.biowarfare.entity; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.looke81.biowarfare.init.BioWarfarePotionRegistry; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityGrenadeEffectToxic extends Entity { public EntityGrenadeEffectToxic(World p_i1738_1_) { super(p_i1738_1_); } public static int counter; public void onUpdate() { counter++; if (counter == 5) { for (int x = 0; x < 11; x++) { for (int y = 0; y < 11; y++) { for (int z = 0; z < 11; z++) { this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL,false, this.posX + x, this.posY + y, this.posZ + z, 0, 0, 0, 0); this.worldObj.spawnParticle(EnumParticleTypes.REDSTONE,false, this.posX + x - 0.5, this.posY + y - 0.5, this.posZ + z - 0.5, 0, 255, 0, 0); counter = 0; } } } } World entityWorld = getEntityWorld(); List nearEntities = entityWorld.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().expand(10.0D, 10.0D, 10.0D)); List<Entity> outerEntities = new ArrayList<Entity>(); outerEntities.addAll(nearEntities); for (Entity outerEntity : outerEntities) { if (outerEntity instanceof EntityLivingBase) { ((EntityLivingBase) outerEntity).addPotionEffect(new PotionEffect(BioWarfarePotionRegistry.Toxic.id, 20, 30)); } } if (this.ticksExisted == 500) { this.setDead(); } } @Override protected void entityInit() { } @Override protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { } @Override protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { } } -
[1.8.8][SOLVED]my world.spawnParticle not working?
Looke81 replied to Looke81's topic in Modder Support
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL,false, this.posX + x, this.posY + y, this.posZ + z, 0, 0, 0, 0); this.worldObj.spawnParticle(EnumParticleTypes.REDSTONE,false, this.posX + x - 0.5, this.posY + y - 0.5, this.posZ + z - 0.5, 0, 255, 0, 0); I also tried isremote and sideonly.