Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.staticjava;
- import net.minecraft.server.v1_7_R4.*;
- import org.bukkit.craftbukkit.v1_7_R4.util.UnsafeList;
- import java.lang.reflect.Field;
- /**
- * Created by StaticJava.
- */
- public class CustomEntityVillager extends EntityVillager {
- public CustomEntityVillager(World world) {
- super(world);
- try {
- Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
- bField.setAccessible(true);
- Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
- cField.setAccessible(true);
- bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
- bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
- cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
- cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
- } catch (Exception e){
- e.printStackTrace();
- }
- this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
- this.getAttributeInstance(GenericAttributes.maxHealth).setValue(Double.MAX_VALUE);
- this.getAttributeInstance(GenericAttributes.b).setValue(0);
- this.getAttributeInstance(GenericAttributes.c).setValue(Double.MAX_VALUE);
- this.getAttributeInstance(GenericAttributes.d).setValue(0);
- }
- @Override
- public EntityAgeable createChild(EntityAgeable entityAgeable) {
- return null;
- }
- @Override
- public void move(double d0, double d1, double d2){
- }
- @Override
- public boolean damageEntity(DamageSource damagesource, float f) {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement