From 7e0d1a81d6adeda817373cc09b8041a2b0a74596 Mon Sep 17 00:00:00 2001 From: Jakllp <57708725+Jakllp@users.noreply.github.com> Date: Wed, 1 Dec 2021 09:26:36 +0100 Subject: [PATCH] Villager-Fields - Barrier-Particle Fixed: - Villager-Fields updated - Fixed the Barrier-Particle --- .../de/Keyle/MyPet/api/compat/ParticleCompat.java | 6 ++++++ .../MyPet/compat/v1_17_R1/entity/EntityMyPet.java | 1 - .../MyPet/compat/v1_18_R1/entity/EntityMyPet.java | 2 +- .../v1_18_R1/services/EntityConverterService.java | 15 ++++++++------- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/API/src/main/java/de/Keyle/MyPet/api/compat/ParticleCompat.java b/modules/API/src/main/java/de/Keyle/MyPet/api/compat/ParticleCompat.java index f438f2ae7c..db13602e39 100644 --- a/modules/API/src/main/java/de/Keyle/MyPet/api/compat/ParticleCompat.java +++ b/modules/API/src/main/java/de/Keyle/MyPet/api/compat/ParticleCompat.java @@ -39,6 +39,7 @@ public class ParticleCompat { .d("spell") .v("1.8", "BARRIER") .v("1.13", "barrier") + .v("1.18", "block_marker") .search(); public static Compat ITEM_CRACK = new Compat() @@ -117,4 +118,9 @@ public class ParticleCompat { .v("1.8", new int[]{152}) .v("1.13", "redstone_block") .search(); + + public static Compat BARRIER_BLOCK_DATA = new Compat<>() + .d(166) + .v("1.13", "barrier") + .search(); } diff --git a/modules/v1_17_R1/src/main/java/de/Keyle/MyPet/compat/v1_17_R1/entity/EntityMyPet.java b/modules/v1_17_R1/src/main/java/de/Keyle/MyPet/compat/v1_17_R1/entity/EntityMyPet.java index 63ad9f6b3e..fa8f1ba73d 100644 --- a/modules/v1_17_R1/src/main/java/de/Keyle/MyPet/compat/v1_17_R1/entity/EntityMyPet.java +++ b/modules/v1_17_R1/src/main/java/de/Keyle/MyPet/compat/v1_17_R1/entity/EntityMyPet.java @@ -1367,7 +1367,6 @@ public void travel(Vec3 vec3d) { && ((EntityMyDolphin)this).canDolphinjump) { this.setDeltaMovement(this.getDeltaMovement().x(), ascendSpeed*4, this.getDeltaMovement().z()); ((EntityMyDolphin)this).canDolphinjump = false; - Bukkit.getConsoleSender().sendMessage("DolphinJumping"); } } else { flyCheckCounter = 0; diff --git a/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/entity/EntityMyPet.java b/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/entity/EntityMyPet.java index 87b68fee60..dcc42ea3fb 100644 --- a/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/entity/EntityMyPet.java +++ b/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/entity/EntityMyPet.java @@ -663,7 +663,7 @@ public void onLivingUpdate() { } } if (sitPathfinder.isSitting() && sitCounter-- <= 0) { - MyPetApi.getPlatformHelper().playParticleEffect(getOwner().getPlayer(), this.getBukkitEntity().getLocation().add(0, getEyeHeight() + 1, 0), ParticleCompat.BARRIER.get(), 0F, 0F, 0F, 5F, 1, 32); + MyPetApi.getPlatformHelper().playParticleEffect(getOwner().getPlayer(), this.getBukkitEntity().getLocation().add(0, getEyeHeight() + 1, 0), ParticleCompat.BARRIER.get(), 0F, 0F, 0F, 5F, 1, 32, ParticleCompat.BARRIER_BLOCK_DATA); sitCounter = 60; } Player p = myPet.getOwner().getPlayer(); diff --git a/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/services/EntityConverterService.java b/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/services/EntityConverterService.java index 1bf054a33d..a577456f3a 100644 --- a/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/services/EntityConverterService.java +++ b/modules/v1_18_R1/src/main/java/de/Keyle/MyPet/compat/v1_18_R1/services/EntityConverterService.java @@ -275,27 +275,28 @@ public void convertEntity(MyPet myPet, LivingEntity normalEntity) { } if (villagerTag.containsKey("FoodLevel")) { byte foodLevel = villagerTag.getAs("FoodLevel", TagByte.class).getByteData(); - ReflectionUtil.setFieldValue("cn", entityVillager, foodLevel); // Field: foodLevel + ReflectionUtil.setFieldValue("cq", entityVillager, foodLevel); // Field: foodLevel } if (villagerTag.containsKey("Gossips")) { TagList inventoryTag = villagerTag.get("Gossips"); ListTag vanillaNBT = (ListTag) ItemStackNBTConverter.compoundToVanillaCompound(inventoryTag); - ((GossipContainer) ReflectionUtil.getFieldValue(net.minecraft.world.entity.npc.Villager.class, entityVillager, "co")) //Field: gossips - .update(new Dynamic<>(NbtOps.INSTANCE, vanillaNBT)); + //This might be useful for later/following versions + //((GossipContainer) ReflectionUtil.getFieldValue(net.minecraft.world.entity.npc.Villager.class, entityVillager, "cr")) //Field: gossips + entityVillager.getGossips().update(new Dynamic<>(NbtOps.INSTANCE, vanillaNBT)); } if (villagerTag.containsKey("LastRestock")) { long lastRestock = villagerTag.getAs("LastRestock", TagLong.class).getLongData(); - ReflectionUtil.setFieldValue("cs", entityVillager, lastRestock); //Field: lastRestockGameTime + ReflectionUtil.setFieldValue("cv", entityVillager, lastRestock); //Field: lastRestockGameTime } if (villagerTag.containsKey("LastGossipDecay")) { long lastGossipDecay = villagerTag.getAs("LastGossipDecay", TagLong.class).getLongData(); - ReflectionUtil.setFieldValue("cq", entityVillager, lastGossipDecay); //Field: lastGossipDecayTime + ReflectionUtil.setFieldValue("ct", entityVillager, lastGossipDecay); //Field: lastGossipDecayTime } if (villagerTag.containsKey("RestocksToday")) { int restocksToday = villagerTag.getAs("RestocksToday", TagInt.class).getIntData(); - ReflectionUtil.setFieldValue("ct", entityVillager, restocksToday); //Field: numberOfRestocksToday + ReflectionUtil.setFieldValue("cw", entityVillager, restocksToday); //Field: numberOfRestocksToday } - ReflectionUtil.setFieldValue("cv", entityVillager, true); // Field: AssignProfessionWhenSpawned + ReflectionUtil.setFieldValue("cy", entityVillager, true); // Field: AssignProfessionWhenSpawned } catch (Exception e) { e.printStackTrace(); }