1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
@@ -83,6 +_,15 @@
|
||||
@@ -79,6 +_,15 @@
|
||||
private Leashable.LeashData leashData;
|
||||
private final Supplier<Item> dropItem;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public AbstractBoat(EntityType<? extends AbstractBoat> entityType, Level level, Supplier<Item> dropItem) {
|
||||
super(entityType, level);
|
||||
this.dropItem = dropItem;
|
||||
@@ -124,7 +_,7 @@
|
||||
@@ -120,7 +_,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,7 +25,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,11 +_,30 @@
|
||||
@@ -175,11 +_,30 @@
|
||||
|
||||
@Override
|
||||
public void push(Entity entity) {
|
||||
@@ -56,7 +56,7 @@
|
||||
super.push(entity);
|
||||
}
|
||||
}
|
||||
@@ -283,6 +_,18 @@
|
||||
@@ -246,6 +_,18 @@
|
||||
this.setDeltaMovement(Vec3.ZERO);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
this.applyEffectsFromBlocks();
|
||||
this.applyEffectsFromBlocks();
|
||||
this.tickBubbleColumn();
|
||||
@@ -598,7 +_,7 @@
|
||||
@@ -548,7 +_,7 @@
|
||||
this.waterLevel = this.getY(1.0);
|
||||
double d2 = this.getWaterLevelAbove() - this.getBbHeight() + 0.101;
|
||||
if (this.level().noCollision(this, this.getBoundingBox().move(0.0, d2 - this.getY(), 0.0))) {
|
||||
@@ -84,17 +84,12 @@
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.0, 1.0));
|
||||
this.lastYd = 0.0;
|
||||
}
|
||||
@@ -762,11 +_,18 @@
|
||||
@@ -711,12 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(reason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) {
|
||||
+ // CraftBukkit end
|
||||
- public void remove(Entity.RemovalReason reason) {
|
||||
+ public void remove(Entity.RemovalReason reason, @Nullable org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) { // CraftBukkit - add Bukkit remove cause
|
||||
if (!this.level().isClientSide && reason.shouldDestroy() && this.isLeashed()) {
|
||||
this.dropLeash();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||
@@ -66,11 +_,18 @@
|
||||
@@ -65,12 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(reason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
- public void remove(Entity.RemovalReason reason) {
|
||||
+ public void remove(Entity.RemovalReason reason, @Nullable org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { // CraftBukkit - add Bukkit remove cause
|
||||
if (!this.level().isClientSide && reason.shouldDestroy()) {
|
||||
Containers.dropContents(this.level(), this, this);
|
||||
}
|
||||
@@ -78,7 +73,7 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ public @Nullable org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
+ return entity instanceof final org.bukkit.inventory.InventoryHolder inventoryHolder ? inventoryHolder : null;
|
||||
+ }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -74,6 +_,17 @@
|
||||
map.put(RailShape.NORTH_WEST, Pair.of(unitVec3i2, unitVec3i));
|
||||
map.put(RailShape.NORTH_EAST, Pair.of(unitVec3i2, unitVec3i1));
|
||||
});
|
||||
@@ -94,6 +_,17 @@
|
||||
}
|
||||
)
|
||||
);
|
||||
+ // CraftBukkit start
|
||||
+ public boolean slowWhenEmpty = true;
|
||||
+ private double derailedX = 0.5;
|
||||
@@ -12,13 +12,13 @@
|
||||
+ private double flyingX = 0.95;
|
||||
+ private double flyingY = 0.95;
|
||||
+ private double flyingZ = 0.95;
|
||||
+ public Double maxSpeed;
|
||||
+ public @Nullable Double maxSpeed;
|
||||
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected AbstractMinecart(EntityType<?> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -134,11 +_,19 @@
|
||||
@@ -153,11 +_,19 @@
|
||||
|
||||
@Override
|
||||
public boolean canCollideWith(Entity entity) {
|
||||
@@ -29,7 +29,7 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ return collisionEvent.callEvent();
|
||||
+ // Paper end - fix VehicleEntityCollisionEvent not called when colliding with player
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -239,6 +_,14 @@
|
||||
@@ -258,6 +_,14 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -55,7 +55,7 @@
|
||||
if (this.getHurtTime() > 0) {
|
||||
this.setHurtTime(this.getHurtTime() - 1);
|
||||
}
|
||||
@@ -248,8 +_,20 @@
|
||||
@@ -267,8 +_,20 @@
|
||||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -76,8 +76,8 @@
|
||||
+ // CraftBukkit end
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
@@ -360,12 +_,16 @@
|
||||
this.lavaIgnite();
|
||||
@@ -350,12 +_,16 @@
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
this.setDeltaMovement(Mth.clamp(deltaMovement.x, -maxSpeed, maxSpeed), deltaMovement.y, Mth.clamp(deltaMovement.z, -maxSpeed, maxSpeed));
|
||||
if (this.onGround()) {
|
||||
@@ -96,24 +96,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +_,16 @@
|
||||
|
||||
this.flipped = compound.getBoolean("FlippedRotation");
|
||||
this.firstTick = compound.getBoolean("HasTicked");
|
||||
@@ -457,6 +_,15 @@
|
||||
this.setDisplayOffset(compound.getIntOr("DisplayOffset", this.getDefaultDisplayOffset()));
|
||||
this.flipped = compound.getBooleanOr("FlippedRotation", false);
|
||||
this.firstTick = compound.getBooleanOr("HasTicked", false);
|
||||
+ // Paper start - Friction API
|
||||
+ if (compound.contains("Paper.FrictionState")) {
|
||||
+ String fs = compound.getString("Paper.FrictionState");
|
||||
+ compound.getString("Paper.FrictionState").ifPresent(frictionState -> {
|
||||
+ try {
|
||||
+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs);
|
||||
+ this.frictionState = net.kyori.adventure.util.TriState.valueOf(frictionState);
|
||||
+ } catch (Exception ignored) {
|
||||
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this);
|
||||
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state {} for {}", frictionState, this);
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ // Paper end - Friction API
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -481,13 +_,27 @@
|
||||
@@ -472,13 +_,27 @@
|
||||
|
||||
compound.putBoolean("FlippedRotation", this.flipped);
|
||||
compound.putBoolean("HasTicked", this.firstTick);
|
||||
@@ -141,7 +140,7 @@
|
||||
double d = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = d * d + d1 * d1;
|
||||
@@ -602,4 +_,28 @@
|
||||
@@ -587,4 +_,26 @@
|
||||
public boolean isFurnace() {
|
||||
return false;
|
||||
}
|
||||
@@ -167,6 +166,4 @@
|
||||
+ this.derailedZ = derailed.getZ();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ public net.minecraft.world.item.Item publicGetDropItem() { return getDropItem(); } // Paper - api to get boat and minecart material - expose public drop item
|
||||
}
|
||||
|
||||
@@ -13,17 +13,12 @@
|
||||
|
||||
protected AbstractMinecartContainer(EntityType<?> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -72,11 +_,18 @@
|
||||
@@ -71,12 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(reason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end - add Bukkit remove cause
|
||||
- public void remove(Entity.RemovalReason reason) {
|
||||
+ public void remove(Entity.RemovalReason reason, @Nullable org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { // CraftBukkit - add Bukkit remove cause
|
||||
if (!this.level().isClientSide && reason.shouldDestroy()) {
|
||||
Containers.dropContents(this.level(), this, this);
|
||||
}
|
||||
@@ -33,7 +28,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,4 +_,50 @@
|
||||
@@ -164,4 +_,56 @@
|
||||
public void clearItemStacks() {
|
||||
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
||||
}
|
||||
@@ -49,23 +44,28 @@
|
||||
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
|
||||
+ private int maxStack = MAX_STACK;
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<net.minecraft.world.item.ItemStack> getContents() {
|
||||
+ return this.itemStacks;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
|
||||
+ this.transaction.add(player);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
|
||||
+ this.transaction.remove(player);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
+ return this.transaction;
|
||||
+ }
|
||||
+
|
||||
+ public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ @Override
|
||||
+ public @Nullable org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ return this.getBukkitEntity() instanceof final org.bukkit.inventory.InventoryHolder inventoryHolder ? inventoryHolder : null;
|
||||
+ }
|
||||
+
|
||||
@@ -74,6 +74,7 @@
|
||||
+ return this.maxStack;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ this.maxStack = size;
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
@@ -62,22 +_,26 @@
|
||||
@@ -60,12 +_,12 @@
|
||||
default void addChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
|
||||
if (this.getContainerLootTable() != null) {
|
||||
tag.putString("LootTable", this.getContainerLootTable().location().toString());
|
||||
@@ -15,24 +15,21 @@
|
||||
}
|
||||
|
||||
default void readChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
|
||||
this.clearItemStacks();
|
||||
if (tag.contains("LootTable", 8)) {
|
||||
- this.setContainerLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(tag.getString("LootTable"))));
|
||||
+ this.setContainerLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(tag.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
|
||||
+ // Paper start - LootTable API
|
||||
+ if (this.getContainerLootTable() != null) {
|
||||
+ this.lootableData().loadNbt(tag);
|
||||
+ }
|
||||
+ // Paper end - LootTable API
|
||||
this.setContainerLootTableSeed(tag.getLong("LootTableSeed"));
|
||||
- } else {
|
||||
- ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry);
|
||||
@@ -73,7 +_,12 @@
|
||||
ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null);
|
||||
this.setContainerLootTable(resourceKey);
|
||||
this.setContainerLootTableSeed(tag.getLongOr("LootTableSeed", 0L));
|
||||
- if (resourceKey == null) {
|
||||
+ // Paper start - LootTable API
|
||||
+ if (this.getContainerLootTable() != null) {
|
||||
+ this.lootableData().loadNbt(tag);
|
||||
+ }
|
||||
+ // Paper end - LootTable API
|
||||
+ if (true || resourceKey == null) { // Paper - always read the items, table may still remain
|
||||
ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry);
|
||||
}
|
||||
+ ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry); // Paper - always read the items, table may still remain
|
||||
}
|
||||
|
||||
default void chestVehicleDestroyed(DamageSource damageSource, ServerLevel level, Entity entity) {
|
||||
@@ -91,19 +_,27 @@
|
||||
@@ -89,19 +_,27 @@
|
||||
}
|
||||
|
||||
default InteractionResult interactWithContainerVehicle(Player player) {
|
||||
@@ -63,7 +60,7 @@
|
||||
LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position());
|
||||
if (player != null) {
|
||||
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
|
||||
@@ -173,4 +_,14 @@
|
||||
@@ -171,4 +_,14 @@
|
||||
default boolean isChestVehicleStillValid(Player player) {
|
||||
return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0);
|
||||
}
|
||||
@@ -74,7 +71,7 @@
|
||||
+ }
|
||||
+
|
||||
+ default com.destroystokyo.paper.loottable.PaperLootableInventory getLootableInventory() {
|
||||
+ return ((com.destroystokyo.paper.loottable.PaperLootableInventory) ((net.minecraft.world.entity.Entity) this).getBukkitEntity());
|
||||
+ return ((com.destroystokyo.paper.loottable.PaperLootableInventory) ((Entity) this).getBukkitEntity());
|
||||
+ }
|
||||
+ // Paper end - LootTable API
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/MinecartTNT.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/MinecartTNT.java
|
||||
@@ -33,6 +_,7 @@
|
||||
@@ -38,6 +_,7 @@
|
||||
public int fuse = -1;
|
||||
public float explosionPowerBase = 4.0F;
|
||||
public float explosionSpeedFactor = 1.0F;
|
||||
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
+ public boolean isIncendiary = false; // CraftBukkit
|
||||
|
||||
public MinecartTNT(EntityType<? extends MinecartTNT> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -47,6 +_,12 @@
|
||||
@@ -52,6 +_,12 @@
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.fuse > 0) {
|
||||
@@ -21,36 +21,39 @@
|
||||
this.fuse--;
|
||||
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5, this.getZ(), 0.0, 0.0, 0.0);
|
||||
} else if (this.fuse == 0) {
|
||||
@@ -101,6 +_,17 @@
|
||||
protected void explode(@Nullable DamageSource damageSource, double radiusModifier) {
|
||||
@@ -107,6 +_,17 @@
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
double min = Math.min(Math.sqrt(radiusModifier), 5.0);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent(
|
||||
+ this.getBukkitEntity(),
|
||||
+ (float) (this.explosionPowerBase + this.explosionSpeedFactor * this.random.nextDouble() * 1.5 * min),
|
||||
+ this.isIncendiary
|
||||
+ );
|
||||
+ if (!event.callEvent()) {
|
||||
+ this.fuse = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
serverLevel.explode(
|
||||
this,
|
||||
damageSource,
|
||||
@@ -108,11 +_,11 @@
|
||||
this.getX(),
|
||||
this.getY(),
|
||||
this.getZ(),
|
||||
- (float)(this.explosionPowerBase + this.explosionSpeedFactor * this.random.nextDouble() * 1.5 * min),
|
||||
- false,
|
||||
+ event.getRadius(), // CraftBukkit - explosion prime event
|
||||
+ event.getFire(), // CraftBukkit - explosion prime event
|
||||
Level.ExplosionInteraction.TNT
|
||||
);
|
||||
- this.discard();
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
if (serverLevel.getGameRules().getBoolean(GameRules.RULE_TNT_EXPLODES)) {
|
||||
double min = Math.min(Math.sqrt(radiusModifier), 5.0);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent(
|
||||
+ this.getBukkitEntity(),
|
||||
+ (float) (this.explosionPowerBase + this.explosionSpeedFactor * this.random.nextDouble() * 1.5 * min),
|
||||
+ this.isIncendiary
|
||||
+ );
|
||||
+ if (!event.callEvent()) {
|
||||
+ this.fuse = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
serverLevel.explode(
|
||||
this,
|
||||
damageSource,
|
||||
@@ -114,13 +_,13 @@
|
||||
this.getX(),
|
||||
this.getY(),
|
||||
this.getZ(),
|
||||
- (float)(this.explosionPowerBase + this.explosionSpeedFactor * this.random.nextDouble() * 1.5 * min),
|
||||
- false,
|
||||
+ event.getRadius(), // CraftBukkit - explosion prime event
|
||||
+ event.getFire(), // CraftBukkit - explosion prime event
|
||||
Level.ExplosionInteraction.TNT
|
||||
);
|
||||
- this.discard();
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
} else if (this.isPrimed()) {
|
||||
- this.discard();
|
||||
+ this.discard(null); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ Double maxSpeed = this.minecart.maxSpeed;
|
||||
+ if (maxSpeed != null) {
|
||||
+ return (this.minecart.isInWater() ? maxSpeed / 2.0D : maxSpeed);
|
||||
+ return this.minecart.isInWater() ? maxSpeed / 2.0D : maxSpeed;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return level.getGameRules().getInt(GameRules.RULE_MINECART_MAX_SPEED) * (this.minecart.isInWater() ? 0.5 : 1.0) / 20.0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java
|
||||
@@ -414,8 +_,22 @@
|
||||
@@ -378,8 +_,22 @@
|
||||
&& !(entity instanceof AbstractMinecart)
|
||||
&& !this.minecart.isVehicle()
|
||||
&& !entity.isPassenger()) {
|
||||
@@ -23,7 +23,7 @@
|
||||
entity.push(this.minecart);
|
||||
}
|
||||
}
|
||||
@@ -423,6 +_,12 @@
|
||||
@@ -387,6 +_,12 @@
|
||||
} else {
|
||||
for (Entity entity1 : this.level().getEntities(this.minecart, aabb)) {
|
||||
if (!this.minecart.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof AbstractMinecart) {
|
||||
@@ -36,14 +36,14 @@
|
||||
entity1.push(this.minecart);
|
||||
}
|
||||
}
|
||||
@@ -443,11 +_,18 @@
|
||||
@@ -409,11 +_,18 @@
|
||||
|
||||
@Override
|
||||
public double getMaxSpeed(ServerLevel level) {
|
||||
+ // CraftBukkit start
|
||||
+ Double maxSpeed = this.minecart.maxSpeed;
|
||||
+ if (maxSpeed != null) {
|
||||
+ return (this.minecart.isInWater() ? maxSpeed / 2.0D : maxSpeed);
|
||||
+ return this.minecart.isInWater() ? maxSpeed / 2.0D : maxSpeed;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return this.minecart.isInWater() ? 0.2 : 0.4;
|
||||
|
||||
Reference in New Issue
Block a user