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.

Woodgolem25

Members
  • Joined

  • Last visited

  1. Hey thanks for the tip but I've never used a NBT, heard of it though. Would it be OK if I got a skeleton of the method? Thanks if not anyway though. Also to you and shield thanks for informing me on static variables.
  2. Here is the code package com.opitems.mob; import com.opitems.main.ArmorRegistry; import com.opitems.main.ItemRegistry; import com.opitems.main.ToolRegistry; import com.sun.javafx.scene.text.HitInfo; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.monster.EntityMob; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.common.ForgeModContainer; public class opWarriorBoss extends EntityMob{ public opWarriorBoss(World world) { super(world); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); } public static double damage = 160.0; public void changeDamage(){ if(damage < 300.0D && hitByEntity(getLastAttacker())){ damage++; } } protected void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(3000.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(damage); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(64.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.5D); } protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { switch(this.rand.nextInt(3)){ case 0: this.dropItem(ToolRegistry.opSword, 1); break; case 1: this.dropItem(ToolRegistry.opSword2, 1); break; case 2: this.dropItem(ToolRegistry.opSword2, 1); } } protected void dropRareDrop(int p_70600_1_) { switch (this.rand.nextInt(3)) { case 0: this.dropItem(Items.nether_star, 5); break; case 1: this.dropItem(ArmorRegistry.opChestplate, 1); break; case 2: this.dropItem(ItemRegistry.opGem, 10); } } protected void addRandomArmor() { super.addRandomArmor(); if (this.rand.nextFloat() < (this.worldObj.difficultySetting == EnumDifficulty.HARD ? 0.05F : 0.01F)) { int i = this.rand.nextInt(3); if (i == 0) { this.setCurrentItemOrArmor(0, new ItemStack(ToolRegistry.opSword)); } else { this.setCurrentItemOrArmor(0, new ItemStack(ToolRegistry.opShovel)); } } } }
  3. So I am making an Entity(Monster) and when I try to change his damage automatically it doesn't work to well. I go into my mob file MonsterName.java and above the attributes code protected void applyEntityAttributes(){} I put some automatic damage changer using if statements but when I run it with no errors my entity stops working and doesn,t show up in game. is there another area I am suppose to put it?

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.