Skip to content

Commit

Permalink
First pass at 1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Sep 20, 2013
1 parent c9ff275 commit 80f0018
Show file tree
Hide file tree
Showing 49 changed files with 457 additions and 454 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/citizensnpcs/Citizens.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,5 +430,5 @@ private boolean suggestClosestModifier(CommandSender sender, String command, Str
return false;
}

private static final String COMPATIBLE_MC_VERSION = "1.6.2";
private static final String COMPATIBLE_MC_VERSION = "1.6.4";
}
7 changes: 4 additions & 3 deletions src/main/java/net/citizensnpcs/editor/SheepEquipper.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Dye;

public class SheepEquipper implements Equipper {
@Override
Expand All @@ -21,10 +22,10 @@ public void equip(Player equipper, NPC toEquip) {
Messaging.sendTr(equipper, toEquip.getTrait(Sheared.class).toggle() ? Messages.SHEARED_SET
: Messages.SHEARED_STOPPED, toEquip.getName());
} else if (hand.getType() == Material.INK_SACK) {
if (sheep.getColor() == DyeColor.getByWoolData((byte) (15 - hand.getData().getData())))
Dye dye = (Dye) hand.getData();
if (sheep.getColor() == dye.getColor())
return;

DyeColor color = DyeColor.getByWoolData((byte) (15 - hand.getData().getData()));
DyeColor color = dye.getColor();
toEquip.getTrait(WoolColor.class).setColor(color);
Messaging.sendTr(equipper, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED, toEquip.getName(), color.name()
.toLowerCase().replace("_", " "));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/citizensnpcs/npc/CitizensNPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_6_R2.EntityLiving;
import net.minecraft.server.v1_6_R3.EntityLiving;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/citizensnpcs/npc/MobEntityController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_6_R2.EntityLiving;
import net.minecraft.server.v1_6_R2.World;
import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R3.World;

import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
import org.bukkit.entity.LivingEntity;

import com.google.common.collect.Maps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.citizensnpcs.api.astar.pathfinder.VectorNode;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_6_R2.EntityLiving;
import net.minecraft.server.v1_6_R3.EntityLiving;

import org.bukkit.Location;
import org.bukkit.util.Vector;
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/net/citizensnpcs/npc/ai/BlockBreaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter;
import net.citizensnpcs.api.ai.tree.BehaviorStatus;
import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.server.v1_6_R2.Block;
import net.minecraft.server.v1_6_R2.Enchantment;
import net.minecraft.server.v1_6_R2.EnchantmentManager;
import net.minecraft.server.v1_6_R2.EntityLiving;
import net.minecraft.server.v1_6_R2.EntityPlayer;
import net.minecraft.server.v1_6_R2.ItemStack;
import net.minecraft.server.v1_6_R2.Material;
import net.minecraft.server.v1_6_R2.MobEffectList;

import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack;
import net.minecraft.server.v1_6_R3.Block;
import net.minecraft.server.v1_6_R3.Enchantment;
import net.minecraft.server.v1_6_R3.EnchantmentManager;
import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R3.EntityPlayer;
import net.minecraft.server.v1_6_R3.ItemStack;
import net.minecraft.server.v1_6_R3.Material;
import net.minecraft.server.v1_6_R3.MobEffectList;

import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

Expand All @@ -39,7 +39,7 @@ private double distanceSquared() {
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
}

private net.minecraft.server.v1_6_R2.ItemStack getCurrentItem() {
private net.minecraft.server.v1_6_R3.ItemStack getCurrentItem() {
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) : entity.getEquipment(0);
}

Expand Down Expand Up @@ -174,8 +174,6 @@ private double radiusSquared() {
}
}

private static final Configuration EMPTY = new Configuration();

public static BlockBreaker create(LivingEntity entity, org.bukkit.block.Block target) {
return createWithConfiguration(entity, target, EMPTY);
}
Expand All @@ -184,4 +182,6 @@ public static BlockBreaker createWithConfiguration(LivingEntity entity, org.bukk
Configuration config) {
return new BlockBreaker(entity, target, config);
}

private static final Configuration EMPTY = new Configuration();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_6_R2.EntityLiving;
import net.minecraft.server.v1_6_R2.Navigation;
import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R3.Navigation;

import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;

public class MCNavigationStrategy extends AbstractPathStrategy {
private final Navigation navigation;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.PlayerAnimation;
import net.citizensnpcs.util.nms.PlayerNavigation;
import net.minecraft.server.v1_6_R2.AttributeInstance;
import net.minecraft.server.v1_6_R2.Entity;
import net.minecraft.server.v1_6_R2.EntityLiving;
import net.minecraft.server.v1_6_R2.EntityPlayer;
import net.minecraft.server.v1_6_R2.Navigation;
import net.minecraft.server.v1_6_R2.PathEntity;
import net.minecraft.server.v1_6_R3.AttributeInstance;
import net.minecraft.server.v1_6_R3.Entity;
import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R3.EntityPlayer;
import net.minecraft.server.v1_6_R3.Navigation;
import net.minecraft.server.v1_6_R3.PathEntity;

import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;

public class MCTargetStrategy implements PathStrategy, EntityTarget {
Expand Down
37 changes: 19 additions & 18 deletions src/main/java/net/citizensnpcs/npc/entity/BatController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_6_R2.EntityBat;
import net.minecraft.server.v1_6_R2.World;
import net.minecraft.server.v1_6_R3.EntityBat;
import net.minecraft.server.v1_6_R3.World;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_6_R2.CraftServer;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftBat;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftBat;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.Bat;
import org.bukkit.util.Vector;

Expand Down Expand Up @@ -57,16 +57,6 @@ public EntityBatNPC(World world, NPC npc) {
}
}

@Override
public void bh() {
if (npc == null)
super.bh();
else {
NMS.updateAI(this);
npc.update();
}
}

@Override
public boolean bH() {
if (npc == null) {
Expand All @@ -76,13 +66,23 @@ public boolean bH() {
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.bH();
if (super.bH()) {
a(true, false); // clearLeash with client update
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}

@Override
public void collide(net.minecraft.server.v1_6_R2.Entity entity) {
public void bi() {
if (npc == null) {
super.bi();
} else {
NMS.updateAI(this);
npc.update();
}
}

@Override
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Expand Down Expand Up @@ -127,8 +127,9 @@ public NPC getNPC() {
@Override
public void l_() {
super.l_();
if (npc != null)
if (npc != null) {
npc.update();
}
}

public void setFlying(boolean flying) {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/net/citizensnpcs/npc/entity/BlazeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_6_R2.EntityBlaze;
import net.minecraft.server.v1_6_R2.World;
import net.minecraft.server.v1_6_R3.EntityBlaze;
import net.minecraft.server.v1_6_R3.World;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_6_R2.CraftServer;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.Blaze;
import org.bukkit.util.Vector;

Expand Down Expand Up @@ -64,23 +64,23 @@ public boolean bH() {
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.bH();
if (super.bH()) {
a(true, false); // clearLeash with client update
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}

@Override
public void bk() {
public void bl() {
if (npc != null) {
NMS.updateAI(this);
npc.update();
} else {
super.bk();
super.bl();
}
}

@Override
public void collide(net.minecraft.server.v1_6_R2.Entity entity) {
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_6_R2.EntityCaveSpider;
import net.minecraft.server.v1_6_R2.World;
import net.minecraft.server.v1_6_R3.EntityCaveSpider;
import net.minecraft.server.v1_6_R3.World;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_6_R2.CraftServer;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.CaveSpider;
import org.bukkit.util.Vector;

Expand Down Expand Up @@ -57,13 +57,6 @@ public EntityCaveSpiderNPC(World world, NPC npc) {
}
}

@Override
public void bh() {
super.bh();
if (npc != null)
npc.update();
}

@Override
public boolean bH() {
if (npc == null)
Expand All @@ -72,23 +65,30 @@ public boolean bH() {
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.bH();
if (super.bH()) {
a(true, false); // clearLeash with client update
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}

@Override
public void bk() {
public void bi() {
super.bi();
if (npc != null)
npc.update();
}

@Override
public void bl() {
if (npc == null)
super.bk();
super.bl();
else {
NMS.updateAI(this);
npc.update();
}
}

@Override
public void collide(net.minecraft.server.v1_6_R2.Entity entity) {
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/net/citizensnpcs/npc/entity/ChickenController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_6_R2.EntityChicken;
import net.minecraft.server.v1_6_R2.World;
import net.minecraft.server.v1_6_R3.EntityChicken;
import net.minecraft.server.v1_6_R3.World;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_6_R2.CraftServer;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.Chicken;
import org.bukkit.util.Vector;

Expand Down Expand Up @@ -57,8 +57,8 @@ public EntityChickenNPC(World world, NPC npc) {
}

@Override
public void bh() {
super.bh();
public void bi() {
super.bi();
if (npc != null)
npc.update();
}
Expand All @@ -71,13 +71,13 @@ public boolean bH() {
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.bH();
if (super.bH()) {
a(true, false); // clearLeash with client update
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}

@Override
public void collide(net.minecraft.server.v1_6_R2.Entity entity) {
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Expand Down
Loading

0 comments on commit 80f0018

Please sign in to comment.