Jump to content

FireIsH0t

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by FireIsH0t

  1. Don't get me wrong im new to coding java but it should override a method
  2. package net.arsenalnetwork.arsenalmod.client.entities; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.Mod; public class Zombies extends EntityZombie { //Constructor public Zombies(World worldIn) { super(worldIn); } @Override public void onLivingUpdate() { if (this.world.isDaytime() && !this.world.isRemote && !this.isChild() && this.shouldBurnInDay()) { float f = this.getBrightness(); if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canSeeSky(new BlockPos(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ))) { boolean flag = true; ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (!itemstack.isEmpty()) { if (itemstack.isItemStackDamageable()) { itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2)); if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) { this.renderBrokenItemStack(itemstack); this.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY); } } flag = false; } if (flag) { this.setFire(8); } } } super.onLivingUpdate(); } @Override protected boolean shouldBurnInDay() { return false; } }
  3. tried this but didnt work
  4. package net.arsenalnetwork.arsenalmod.client.entities; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class Zombies extends EntityZombie { //Constructor public Zombies(World worldIn) { super(worldIn); } public void onLivingUpdate() { if (this.world.isDaytime() && !this.world.isRemote && !this.isChild() && this.shouldBurnInDay()) { float f = this.getBrightness(); if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canSeeSky(new BlockPos(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ))) { boolean flag = true; ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (!itemstack.isEmpty()) { if (itemstack.isItemStackDamageable()) { itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2)); if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) { this.renderBrokenItemStack(itemstack); this.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY); } } flag = false; } if (flag) { this.setFire(8); } } } super.onLivingUpdate(); } protected boolean shouldBurnInDay() { return false; } }
  5. Crap if (event.getEntity() instanceof EntityZombie) { event.getEntity(new Zombies(zombieDoNotBurnInDaylight(event)); ignore that Idk what i was doing
  6. Hello, im trying to make a event where entity zombies do not die in daylight or get any effects. EventHandler Class: package net.arsenalnetwork.arsenalmod.handlers; import net.arsenalnetwork.arsenalmod.client.entities.Zombies; import net.arsenalnetwork.arsenalmod.client.gui.ArsenalMainMenu; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import java.util.Arrays; @Mod.EventBusSubscriber(modid = "arsenalmod", value = Side.CLIENT) public class EventHandler { @SubscribeEvent public static void zombieDoNotBurnInDaylight(LivingEvent.LivingUpdateEvent event) { if (event.getEntity() instanceof EntityZombie) { event.getEntity(new Zombies(zombieDoNotBurnInDaylight(event)); } } }
×
×
  • Create New...

Important Information

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