mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
#1159: Add missing API for explosive minecarts
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
c48c822440
commit
ad8f95c3df
2 changed files with 53 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||||
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||||
@@ -23,6 +23,10 @@
|
@@ -23,10 +23,14 @@
|
||||||
import net.minecraft.world.level.block.state.IBlockData;
|
import net.minecraft.world.level.block.state.IBlockData;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
|
|
||||||
|
@ -11,6 +11,20 @@
|
||||||
public class EntityMinecartTNT extends EntityMinecartAbstract {
|
public class EntityMinecartTNT extends EntityMinecartAbstract {
|
||||||
|
|
||||||
private static final byte EVENT_PRIME = 10;
|
private static final byte EVENT_PRIME = 10;
|
||||||
|
- private int fuse = -1;
|
||||||
|
+ public int fuse = -1;
|
||||||
|
|
||||||
|
public EntityMinecartTNT(EntityTypes<? extends EntityMinecartTNT> entitytypes, World world) {
|
||||||
|
super(entitytypes, world);
|
||||||
|
@@ -103,7 +107,7 @@
|
||||||
|
return Items.TNT_MINECART;
|
||||||
|
}
|
||||||
|
|
||||||
|
- protected void explode(double d0) {
|
||||||
|
+ public void explode(double d0) {
|
||||||
|
this.explode((DamageSource) null, d0);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -115,7 +119,15 @@
|
@@ -115,7 +119,15 @@
|
||||||
d1 = 5.0D;
|
d1 = 5.0D;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.world.entity.vehicle.EntityMinecartTNT;
|
import net.minecraft.world.entity.vehicle.EntityMinecartTNT;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
@ -10,6 +11,43 @@ final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFuseTicks(int ticks) {
|
||||||
|
getHandle().fuse = ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFuseTicks() {
|
||||||
|
return getHandle().getFuse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ignite() {
|
||||||
|
getHandle().primeFuse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIgnited() {
|
||||||
|
return getHandle().isPrimed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explode() {
|
||||||
|
getHandle().explode(getHandle().getDeltaMovement().horizontalDistanceSqr());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explode(double power) {
|
||||||
|
Preconditions.checkArgument(0 <= power && power <= 5, "Power must be in range [0, 5] (got %s)", power);
|
||||||
|
|
||||||
|
getHandle().explode(power);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityMinecartTNT getHandle() {
|
||||||
|
return (EntityMinecartTNT) super.getHandle();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftMinecartTNT";
|
return "CraftMinecartTNT";
|
||||||
|
|
Loading…
Reference in a new issue