Implement new metadata

This commit is contained in:
fullwall 2021-11-28 00:09:30 +08:00
parent 3da3cc2ae8
commit 8f341ccaf2
10 changed files with 9 additions and 92 deletions

View File

@ -36,7 +36,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -71,7 +70,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) { public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
} }
return super.a(entityhuman, enumhand, itemstack); return super.a(entityhuman, enumhand, itemstack);
@ -163,10 +162,6 @@ public class VillagerController extends MobEntityController {
return npc; return npc;
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -210,10 +205,6 @@ public class VillagerController extends MobEntityController {
super.onLightningStrike(entitylightning); super.onLightningStrike(entitylightning);
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
} }
public static class VillagerNPC extends CraftVillager implements NPCHolder { public static class VillagerNPC extends CraftVillager implements NPCHolder {

View File

@ -38,7 +38,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -73,7 +72,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) { public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(entityhuman); List<MerchantRecipe> list = getOffers(entityhuman);
if (list != null) { if (list != null) {
@ -169,10 +168,6 @@ public class VillagerController extends MobEntityController {
return npc; return npc;
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -216,10 +211,6 @@ public class VillagerController extends MobEntityController {
super.onLightningStrike(entitylightning); super.onLightningStrike(entitylightning);
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
} }
public static class VillagerNPC extends CraftVillager implements NPCHolder { public static class VillagerNPC extends CraftVillager implements NPCHolder {

View File

@ -39,7 +39,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -74,7 +73,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) { public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(entityhuman); List<MerchantRecipe> list = getOffers(entityhuman);
if (list != null) { if (list != null) {
@ -172,10 +171,6 @@ public class VillagerController extends MobEntityController {
return npc; return npc;
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -219,10 +214,6 @@ public class VillagerController extends MobEntityController {
super.onLightningStrike(entitylightning); super.onLightningStrike(entitylightning);
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
} }
public static class VillagerNPC extends CraftVillager implements NPCHolder { public static class VillagerNPC extends CraftVillager implements NPCHolder {

View File

@ -42,7 +42,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -77,7 +76,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) { public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(entityhuman); List<MerchantRecipe> list = getOffers(entityhuman);
if (list != null) { if (list != null) {
@ -182,10 +181,6 @@ public class VillagerController extends MobEntityController {
} }
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -222,10 +217,6 @@ public class VillagerController extends MobEntityController {
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
@Override @Override
public boolean z_() { public boolean z_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -48,7 +48,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private TreeMap<?, ?> behaviorMap; private TreeMap<?, ?> behaviorMap;
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
private BehaviorController<EntityVillager> previousBehaviorController; private BehaviorController<EntityVillager> previousBehaviorController;
@ -85,7 +84,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) { public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(); List<MerchantRecipe> list = getOffers();
if (list != null) { if (list != null) {
@ -191,10 +190,6 @@ public class VillagerController extends MobEntityController {
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isClimbing() { public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -249,10 +244,6 @@ public class VillagerController extends MobEntityController {
super.onLightningStrike(entitylightning); super.onLightningStrike(entitylightning);
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
} }
public static class VillagerNPC extends CraftVillager implements NPCHolder { public static class VillagerNPC extends CraftVillager implements NPCHolder {

View File

@ -46,7 +46,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
@ -83,7 +82,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) { public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(); List<MerchantRecipe> list = getOffers();
if (list != null) { if (list != null) {
@ -190,10 +189,6 @@ public class VillagerController extends MobEntityController {
} }
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isClimbing() { public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -241,10 +236,6 @@ public class VillagerController extends MobEntityController {
super.onLightningStrike(entitylightning); super.onLightningStrike(entitylightning);
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
} }
public static class VillagerNPC extends CraftVillager implements NPCHolder { public static class VillagerNPC extends CraftVillager implements NPCHolder {

View File

@ -49,7 +49,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
@ -86,7 +85,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) { public EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(); List<MerchantRecipe> list = getOffers();
if (list != null) { if (list != null) {
@ -193,10 +192,6 @@ public class VillagerController extends MobEntityController {
} }
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isClimbing() { public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -244,10 +239,6 @@ public class VillagerController extends MobEntityController {
super.onLightningStrike(server, entitylightning); super.onLightningStrike(server, entitylightning);
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
} }
public static class VillagerNPC extends CraftVillager implements ForwardingNPCHolder { public static class VillagerNPC extends CraftVillager implements ForwardingNPCHolder {

View File

@ -46,7 +46,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends Villager implements NPCHolder { public static class EntityVillagerNPC extends Villager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
@ -145,10 +144,6 @@ public class VillagerController extends MobEntityController {
return npc; return npc;
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -173,7 +168,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public InteractionResult mobInteract(Player entityhuman, InteractionHand enumhand) { public InteractionResult mobInteract(Player entityhuman, InteractionHand enumhand) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
MerchantOffers list = getOffers(); MerchantOffers list = getOffers();
if (list != null) { if (list != null) {
@ -227,10 +222,6 @@ public class VillagerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
@Override @Override
public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) { public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) {
if (npc == null) { if (npc == null) {

View File

@ -16,7 +16,6 @@ import net.minecraft.world.entity.monster.Slime;
public class PlayerMoveControl extends MoveControl { public class PlayerMoveControl extends MoveControl {
protected LivingEntity entity; protected LivingEntity entity;
private int jumpTicks; private int jumpTicks;
private int keepMovingTicks;
protected boolean moving; protected boolean moving;
protected double speed; protected double speed;
protected double tx; protected double tx;
@ -91,7 +90,6 @@ public class PlayerMoveControl extends MoveControl {
this.tz = d2; this.tz = d2;
this.speed = d3; this.speed = d3;
this.moving = true; this.moving = true;
this.keepMovingTicks = 1;
} }
private boolean shouldJump() { private boolean shouldJump() {

View File

@ -33,7 +33,6 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private boolean blockTrades = true;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -68,7 +67,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
if (npc != null && blockTrades) { if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
} }
return super.a(entityhuman); return super.a(entityhuman);
@ -183,10 +182,6 @@ public class VillagerController extends MobEntityController {
return npc; return npc;
} }
public boolean isBlockingTrades() {
return blockTrades;
}
@Override @Override
public boolean k_() { public boolean k_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -203,10 +198,6 @@ public class VillagerController extends MobEntityController {
} }
} }
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
@Override @Override
protected String z() { protected String z() {
return NMSImpl.getSoundEffect(npc, super.z(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.z(), NPC.AMBIENT_SOUND_METADATA);