mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-21 18:15:51 +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;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void m() {
|
public void m() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.m();
|
super.m();
|
||||||
|
@ -52,9 +52,15 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return NMS.shouldBroadcastToPlayer(npc, () -> super.a(player));
|
return NMS.shouldBroadcastToPlayer(npc, () -> super.a(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void A_() {
|
public void A_() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.A_();
|
super.A_();
|
||||||
|
@ -53,9 +53,15 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return NMS.shouldBroadcastToPlayer(npc, () -> super.a(player));
|
return NMS.shouldBroadcastToPlayer(npc, () -> super.a(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void B_() {
|
public void B_() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.B_();
|
super.B_();
|
||||||
|
@ -112,9 +112,15 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return Util.callPistonPushEvent(npc) ? EnumPistonReaction.IGNORE : super.getPushReaction();
|
return Util.callPistonPushEvent(npc) ? EnumPistonReaction.IGNORE : super.getPushReaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -111,9 +111,15 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return Util.callPistonPushEvent(npc) ? EnumPistonReaction.IGNORE : super.getPushReaction();
|
return Util.callPistonPushEvent(npc) ? EnumPistonReaction.IGNORE : super.getPushReaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -112,9 +112,15 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -112,10 +112,16 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
npc.update();
|
npc.update();
|
||||||
|
if (fuseRenewalDelay-- <= 0) {
|
||||||
|
setFuseTicks(Integer.MAX_VALUE - 1);
|
||||||
|
setFuseTicks(Integer.MAX_VALUE);
|
||||||
|
fuseRenewalDelay = 9;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,16 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
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();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -116,9 +116,16 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
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();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -116,9 +116,16 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
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();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -106,9 +106,16 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9; // give client some time to make the animation look vanilla-like
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (npc != null) {
|
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();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package net.citizensnpcs.nms.v1_8_R3.entity.nonliving;
|
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.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
@ -40,6 +42,7 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
public EntityTNTPrimedNPC(World world, NPC npc) {
|
public EntityTNTPrimedNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
this.npc = (CitizensNPC) npc;
|
this.npc = (CitizensNPC) npc;
|
||||||
|
this.fuseTicks = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -93,9 +96,16 @@ public class TNTPrimedController extends MobEntityController {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fuseRenewalDelay = 9;
|
||||||
@Override
|
@Override
|
||||||
public void t_() {
|
public void t_() {
|
||||||
if (npc != null) {
|
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();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.t_();
|
super.t_();
|
||||||
|
Loading…
Reference in New Issue
Block a user