Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package aurum.survival;
- import java.lang.reflect.Field;
- import java.util.List;
- import net.minecraft.server.*;
- import org.bukkit.Bukkit;
- import org.bukkit.craftbukkit.CraftServer;
- import org.bukkit.craftbukkit.entity.CraftIronGolem;
- import org.bukkit.plugin.Plugin;
- /**
- * @author Tim Cancy
- */
- public class AngryIronGolem extends net.minecraft.server.EntityIronGolem {
- private AurumSurvival plugin;
- @SuppressWarnings("unchecked")
- public AngryIronGolem(World world) {
- super(world);
- Plugin pluginAurum = Bukkit.getPluginManager().getPlugin("Aurum Survival");
- if (pluginAurum == null || !(pluginAurum instanceof AurumSurvival)) {
- this.world.removeEntity(this);
- return;
- }
- this.plugin = (AurumSurvival) pluginAurum;
- this.bukkitEntity = new CraftIronGolem((CraftServer) this.plugin.getServer(), this);
- try {
- Field navigation = EntityLiving.class.getDeclaredField("navigation");
- navigation.setAccessible(true);
- navigation.set(this, new AurumSurvivalNavigation(this.plugin, this, this.world, 16.0f));
- } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- }
- try {
- Field goala = this.goalSelector.getClass().getDeclaredField("a");
- goala.setAccessible(true);
- ((List<PathfinderGoal>) goala.get(this.goalSelector)).clear();
- Field targeta = this.targetSelector.getClass().getDeclaredField("a");
- targeta.setAccessible(true);
- ((List<PathfinderGoal>) targeta.get(this.targetSelector)).clear();
- this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 0.25F, true));
- this.goalSelector.a(2, new PathfinderGoalMoveTowardsTarget(this, 0.22F, 32.0F));
- this.goalSelector.a(3, new PathfinderGoalMoveThroughVillage(this, 0.16F, true));
- this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 0.16F));
- this.goalSelector.a(5, new PathfinderGoalOfferFlower(this));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 0.16F));
- this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
- this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
- this.targetSelector.a(1, new PathfinderGoalDefendVillage(this));
- this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, 16.0F, 0, false, true));
- } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- }
- }
- public void anger() {
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, false, true));
- }
- public void rose(boolean bool) {
- super.e(bool);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement