Skip to content

Commit

Permalink
Villager-Fields - Barrier-Particle
Browse files Browse the repository at this point in the history
Fixed:
- Villager-Fields updated
- Fixed the Barrier-Particle
  • Loading branch information
Jakllp committed Dec 1, 2021
1 parent 3953809 commit 7e0d1a8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> ITEM_CRACK = new Compat<String>()
Expand Down Expand Up @@ -117,4 +118,9 @@ public class ParticleCompat {
.v("1.8", new int[]{152})
.v("1.13", "redstone_block")
.search();

public static Compat<Object> BARRIER_BLOCK_DATA = new Compat<>()
.d(166)
.v("1.13", "barrier")
.search();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 7e0d1a8

Please sign in to comment.