mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Bugfixes
This commit is contained in:
parent
0ec8ea68e8
commit
c75218e966
@ -1,5 +1,7 @@
|
||||
package net.citizensnpcs.nms.v1_13_R2.entity.nonliving;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
|
||||
@ -7,6 +9,8 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftFishHook;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController;
|
||||
@ -14,8 +18,11 @@ import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.EntityFishingHook;
|
||||
import net.minecraft.server.v1_13_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_13_R2.World;
|
||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||
|
||||
public class FishingHookController extends MobEntityController {
|
||||
public FishingHookController() {
|
||||
@ -35,7 +42,9 @@ public class FishingHookController extends MobEntityController {
|
||||
}
|
||||
|
||||
public EntityFishingHookNPC(World world, NPC npc) {
|
||||
super(world, null);
|
||||
super(world, new EntityPlayer(world.getServer().getServer(), (WorldServer) world,
|
||||
new GameProfile(UUID.randomUUID(), "dummyfishhook"), new PlayerInteractManager(world)) {
|
||||
});
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.citizensnpcs.nms.v1_14_R1.entity.nonliving;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
@ -7,16 +9,24 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftFishHook;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_14_R1.Entity;
|
||||
import net.minecraft.server.v1_14_R1.EntityFishingHook;
|
||||
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||
import net.minecraft.server.v1_14_R1.Items;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_14_R1.World;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
|
||||
public class FishingHookController extends MobEntityController {
|
||||
public FishingHookController() {
|
||||
@ -36,7 +46,10 @@ public class FishingHookController extends MobEntityController {
|
||||
}
|
||||
|
||||
public EntityFishingHookNPC(EntityTypes<? extends EntityFishingHook> types, World world, NPC npc) {
|
||||
super(null, world, 0, 0); // TODO this is totally broken
|
||||
super(new EntityPlayer(world.getServer().getServer(), (WorldServer) world,
|
||||
new GameProfile(UUID.randomUUID(), "dummyfishhook"),
|
||||
new PlayerInteractManager((WorldServer) world)) {
|
||||
}, world, 0, 0);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@ -90,9 +103,21 @@ public class FishingHookController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double h(Entity entity) {
|
||||
// distance check in k()
|
||||
if (entity == this.owner) {
|
||||
return 0D;
|
||||
}
|
||||
return super.h(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
this.owner.setHealth(20F);
|
||||
this.owner.dead = false;
|
||||
this.owner.inventory.setCarried(new ItemStack(Items.FISHING_ROD, 1));
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -205,5 +205,6 @@ public class CustomEntityRegistry extends RegistryBlocks {
|
||||
minecraftClassMap.put(EntityTypes.ZOMBIE_VILLAGER, EntityZombieVillager.class);
|
||||
minecraftClassMap.put(EntityTypes.PHANTOM, EntityPhantom.class);
|
||||
minecraftClassMap.put(EntityTypes.RAVAGER, EntityRavager.class);
|
||||
minecraftClassMap.put(EntityTypes.FISHING_BOBBER, EntityFishingHook.class);
|
||||
}
|
||||
}
|
@ -824,7 +824,7 @@ public class NMSImpl implements NMSBridge {
|
||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||
EntityTypes<?> type = ENTITY_REGISTRY.findType(search);
|
||||
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
||||
if (key == null)
|
||||
if (key == null || type == null)
|
||||
continue;
|
||||
CITIZENS_ENTITY_TYPES.put(clazz, type);
|
||||
int code = ENTITY_REGISTRY.a(type);
|
||||
|
@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_14_R1.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.BoundingBox;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_14_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_14_R1.ControllerMove;
|
||||
@ -37,8 +36,7 @@ public class PlayerControllerMove extends ControllerMove {
|
||||
this.a.bd = 0F;
|
||||
if (this.f) {
|
||||
this.f = false;
|
||||
BoundingBox bb = NMSBoundingBox.wrap(this.a.getBoundingBox());
|
||||
int i = MathHelper.floor(bb.minY + 0.5D);
|
||||
int i = MathHelper.floor(this.a.getBoundingBox().minY + 0.5D);
|
||||
double d0 = this.b - this.a.locX;
|
||||
double d1 = this.d - this.a.locZ;
|
||||
double d2 = this.c - i;
|
||||
|
Loading…
Reference in New Issue
Block a user