mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-22 09:07:56 +01:00
* fix: backport of #3177 1.8 backport may not work well because no DataWatcher for fuse in that version, and we can't support it as it is really an old version. It is just a theoretical fix. * fix: leave fuse ticks very long in MC 1.8 fix
This commit is contained in:
parent
080bf9ce3d
commit
695baf4481
@ -93,9 +93,15 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void m() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.m();
|
||||
|
@ -52,9 +52,15 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return NMS.shouldBroadcastToPlayer(npc, () -> super.a(player));
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void A_() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.A_();
|
||||
|
@ -53,9 +53,15 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return NMS.shouldBroadcastToPlayer(npc, () -> super.a(player));
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void B_() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.B_();
|
||||
|
@ -112,9 +112,15 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return Util.callPistonPushEvent(npc) ? EnumPistonReaction.IGNORE : super.getPushReaction();
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -111,9 +111,15 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return Util.callPistonPushEvent(npc) ? EnumPistonReaction.IGNORE : super.getPushReaction();
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -112,9 +112,15 @@ public class TNTPrimedController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -112,10 +112,16 @@ public class TNTPrimedController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||
setFuseTicks(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
} else {
|
||||
super.tick();
|
||||
}
|
||||
|
@ -107,9 +107,16 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return npc == null ? super.save(save) : false;
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
// DataWatcher refuses to mark dirty if we don't give different values
|
||||
setFuse(Integer.MAX_VALUE - 1);
|
||||
setFuse(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -116,9 +116,16 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
// DataWatcher refuses to mark dirty if we don't give different values
|
||||
setFuse(Integer.MAX_VALUE - 1);
|
||||
setFuse(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -116,9 +116,16 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
// DataWatcher refuses to mark dirty if we don't give different values
|
||||
setFuse(Integer.MAX_VALUE - 1);
|
||||
setFuse(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -106,9 +106,16 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||
@Override
|
||||
public void tick() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
// DataWatcher refuses to mark dirty if we don't give different values
|
||||
setFuse(Integer.MAX_VALUE - 1);
|
||||
setFuse(Integer.MAX_VALUE);
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.citizensnpcs.nms.v1_8_R3.entity.nonliving;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateEntityNBT;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
@ -40,6 +42,7 @@ public class TNTPrimedController extends MobEntityController {
|
||||
public EntityTNTPrimedNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
this.fuseTicks = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,9 +96,16 @@ public class TNTPrimedController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
private int fuseRenewalDelay = 9;
|
||||
@Override
|
||||
public void t_() {
|
||||
if (npc != null) {
|
||||
if (fuseRenewalDelay-- <= 0) {
|
||||
final NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
e(nbtTagCompound); // dump the entity NBT so let client update it as we don't have DataWatcher for fuse in this MC version
|
||||
((WorldServer) getWorld()).getTracker().a(this, new PacketPlayOutUpdateEntityNBT(getId(), nbtTagCompound));
|
||||
fuseRenewalDelay = 9;
|
||||
}
|
||||
npc.update();
|
||||
} else {
|
||||
super.t_();
|
||||
|
Loading…
Reference in New Issue
Block a user