mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
6 more
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 24 May 2019 02:39:25 -0500
|
||||
Subject: [PATCH] Signs editable on right click
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockSign.java b/src/main/java/net/minecraft/world/level/block/BlockSign.java
|
||||
index 6b461080439dd9ce5b8d34b79d446558bbd5c1f1..19f4403b9f1142c71e7b2c7c0fd5a78027d4ffe4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockSign.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockSign.java
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.world.EnumHand;
|
||||
import net.minecraft.world.EnumInteractionResult;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.ItemDye;
|
||||
+import net.minecraft.world.item.ItemSign;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GeneratorAccess;
|
||||
import net.minecraft.world.level.IBlockAccess;
|
||||
@@ -80,6 +81,17 @@ public abstract class BlockSign extends BlockTileEntity implements IBlockWaterlo
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - right click to open sign editor
|
||||
+ if (world.purpurConfig.signRightClickEdit && itemstack.getItem() instanceof ItemSign &&
|
||||
+ !entityhuman.isSneaking() && entityhuman.abilities.mayBuild &&
|
||||
+ entityhuman.getBukkitEntity().hasPermission("purpur.sign.edit")) {
|
||||
+ tileentitysign.isEditable = true;
|
||||
+ tileentitysign.a(entityhuman);
|
||||
+ entityhuman.openSign(tileentitysign);
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return tileentitysign.b(entityhuman) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
index 7f78f388584899b13ff983f0dc37c679bfb1507e..96d0524482281f8570464962c0fd5319199440d7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
@@ -132,6 +132,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
||||
return this.isEditable;
|
||||
}
|
||||
|
||||
+ public void setEditor(EntityHuman entityhuman) { a(entityhuman); } // Purpur - OBFHELPER
|
||||
public void a(EntityHuman entityhuman) {
|
||||
// Paper start
|
||||
//this.c = entityhuman;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index bab91f0416f31a8273593bb7725658674eb41621..ea95a4116371d58eb36be51093af7f0fa28e3dfd 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -109,6 +109,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean signRightClickEdit = false;
|
||||
+ private void signSettings() {
|
||||
+ signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
||||
+ }
|
||||
+
|
||||
public boolean turtleEggsBreakFromExpOrbs = true;
|
||||
public boolean turtleEggsBreakFromItems = true;
|
||||
public boolean turtleEggsBreakFromMinecarts = true;
|
||||
@@ -1,84 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 6 Jun 2019 17:40:30 -0500
|
||||
Subject: [PATCH] Signs allow color codes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index e06c324d38f1be72a90aa75b96d471b96123ba56..615d4d43b8112a7b101792aebf952b0361be70d5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -1425,6 +1425,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
@Override
|
||||
public void openSign(TileEntitySign tileentitysign) {
|
||||
+ if (world.purpurConfig.signAllowColors) this.playerConnection.sendPacket(tileentitysign.getTranslatedUpdatePacket()); // Purpur
|
||||
tileentitysign.a((EntityHuman) this);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
index 293b2c187b813c2cf7204f12eec768fd2e92a233..0bfd2c062afcfc73ff21c69a30f63529502817f7 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -3005,6 +3005,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
+ // Purpur start
|
||||
+ if (worldserver.purpurConfig.signAllowColors) {
|
||||
+ final org.bukkit.entity.Player bukkitPlayer = player.getBukkitEntity();
|
||||
+ if (bukkitPlayer.hasPermission("purpur.sign.color")) currentLine = currentLine.replaceAll("(?i)&([0-9a-fr])", "\u00a7$1");
|
||||
+ if (bukkitPlayer.hasPermission("purpur.sign.style")) currentLine = currentLine.replaceAll("(?i)&([l-or])", "\u00a7$1");
|
||||
+ if (bukkitPlayer.hasPermission("purpur.sign.magic")) currentLine = currentLine.replaceAll("(?i)&([kr])", "\u00a7$1");
|
||||
+ lines.add(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(currentLine));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterAllowedChatCharacters(currentLine))); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
}
|
||||
SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
index 96d0524482281f8570464962c0fd5319199440d7..a87a2fa507dc3bd6d9979db5868e7ef6ea1eddbd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
+import io.papermc.paper.adventure.PaperAdventure; // Purpur
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.commands.CommandListenerWrapper;
|
||||
import net.minecraft.commands.ICommandListener;
|
||||
@@ -112,6 +113,18 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
||||
this.g[i] = null;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public PacketPlayOutTileEntityData getTranslatedUpdatePacket() {
|
||||
+ NBTTagCompound nbt = save(new NBTTagCompound());
|
||||
+ for (int i = 0; i < 4; ++i) {
|
||||
+ String line = PaperAdventure.LEGACY_AMPERSAND.serialize(PaperAdventure.asAdventure(lines[i]));
|
||||
+ nbt.setString("Text" + (i + 1), net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(net.kyori.adventure.text.Component.text(line)));
|
||||
+ }
|
||||
+ nbt.setString("PurpurEditor", "true");
|
||||
+ return new PacketPlayOutTileEntityData(position, 9, nbt);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public PacketPlayOutTileEntityData getUpdatePacket() {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index ea95a4116371d58eb36be51093af7f0fa28e3dfd..b67f87f38d0ff99ff62d2103ecc737317a435102 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -109,8 +109,10 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean signAllowColors = false;
|
||||
public boolean signRightClickEdit = false;
|
||||
private void signSettings() {
|
||||
+ signAllowColors = getBoolean("blocks.sign.allow-colors", signAllowColors);
|
||||
signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 21 Jun 2019 14:37:10 -0500
|
||||
Subject: [PATCH] Allow soil to moisten from water directly under it
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockSoil.java b/src/main/java/net/minecraft/world/level/block/BlockSoil.java
|
||||
index 3bedb1c6a0f221c7b40ee0a50f676e8b05bd37a7..2bbaa2fb426869223a9b2f07406496c1b0daff3f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockSoil.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockSoil.java
|
||||
@@ -139,19 +139,14 @@ public class BlockSoil extends Block {
|
||||
}
|
||||
|
||||
private static boolean a(IWorldReader iworldreader, BlockPosition blockposition) {
|
||||
- Iterator iterator = BlockPosition.a(blockposition.b(-4, 0, -4), blockposition.b(4, 1, 4)).iterator();
|
||||
-
|
||||
- BlockPosition blockposition1;
|
||||
-
|
||||
- do {
|
||||
- if (!iterator.hasNext()) {
|
||||
- return false;
|
||||
+ // Purpur start
|
||||
+ for (BlockPosition position : BlockPosition.a(blockposition.b(-4, 0, -4), blockposition.b(4, 1, 4))) {
|
||||
+ if (iworldreader.getFluid(position).a(TagsFluid.WATER)) {
|
||||
+ return true;
|
||||
}
|
||||
-
|
||||
- blockposition1 = (BlockPosition) iterator.next();
|
||||
- } while (!iworldreader.getFluid(blockposition1).a((Tag) TagsFluid.WATER));
|
||||
-
|
||||
- return true;
|
||||
+ }
|
||||
+ return ((WorldServer) iworldreader).purpurConfig.farmlandGetsMoistFromBelow && iworldreader.getFluid(blockposition.shift(EnumDirection.DOWN)).a(TagsFluid.WATER);
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index b67f87f38d0ff99ff62d2103ecc737317a435102..2e4a928a3e88fb3d961d9530695cd7154321c79b 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -109,6 +109,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean farmlandGetsMoistFromBelow = false;
|
||||
+ private void farmlandSettings() {
|
||||
+ farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
+ }
|
||||
+
|
||||
public boolean signAllowColors = false;
|
||||
public boolean signRightClickEdit = false;
|
||||
private void signSettings() {
|
||||
@@ -1,275 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 29 Jun 2019 02:32:40 -0500
|
||||
Subject: [PATCH] Minecart settings and WASD controls
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java
|
||||
index 4abc87b7e737bc652e84f76a508ab85501d1556f..85b3515feb67a1232d65c0421bb8a08a25090e07 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPosition.java
|
||||
@@ -42,6 +42,12 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
private static final int m = 38;
|
||||
// Paper end
|
||||
|
||||
+ // Purpur start
|
||||
+ public BlockPosition(net.minecraft.world.entity.Entity entity) {
|
||||
+ super(entity.locX(), entity.locY(), entity.locZ());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public BlockPosition(int i, int j, int k) {
|
||||
super(i, j, k);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index 615d4d43b8112a7b101792aebf952b0361be70d5..e209133b8ae35324c51ed7c8b2703bc1adfd5bf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -963,6 +963,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
+ if (damagesource == DamageSource.FALL && getRootVehicle() instanceof net.minecraft.world.entity.vehicle.EntityMinecartAbstract && world.purpurConfig.minecartControllable && !world.purpurConfig.minecartControllableFallDamage) return false; // Purpur
|
||||
boolean flag = this.server.j() && this.canPvP() && "fall".equals(damagesource.translationIndex);
|
||||
|
||||
if (!flag && isSpawnInvulnerable() && damagesource != DamageSource.OUT_OF_WORLD) { // Purpur
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 0a948395a3ef9d472925175b36a6b66082002909..14be521b1019b58508268c21cb1d3cc806e75d17 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -193,9 +193,9 @@ public abstract class EntityLiving extends Entity {
|
||||
protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER
|
||||
public float lastDamage;
|
||||
public boolean jumping; // Paper protected -> public
|
||||
- public float aR;
|
||||
- public float aS;
|
||||
- public float aT;
|
||||
+ public float aR; public float getStrafe() { return aR; } public void setStrafe(float strafe) { aR = strafe; } // Purpur - OBFHELPER
|
||||
+ public float aS; public float getVertical() { return aS; } public void setVertical(float vertical) { aS = vertical; } // Purpur - OBFHELPER
|
||||
+ public float aT; public float getForward() { return aT; } public void setForward(float forward) { aT = forward; } // Purpur - OBFHELPER
|
||||
protected int aU;
|
||||
protected double aV;
|
||||
protected double aW;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
index 75a88ab5d5b0fdb98ea8d61bb6b82049b21101f3..7b49544210d087f5006a83c2a0d5c47c785c567f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
@@ -105,11 +105,13 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
|
||||
private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
|
||||
public double maxSpeed = 0.4D;
|
||||
+ public double storedMaxSpeed; // Purpur
|
||||
// CraftBukkit end
|
||||
|
||||
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.i = true;
|
||||
+ if (world != null) maxSpeed = storedMaxSpeed = world.purpurConfig.minecartMaxSpeed; // Purpur
|
||||
}
|
||||
|
||||
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world, double d0, double d1, double d2) {
|
||||
@@ -315,6 +317,12 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ // Purpur start
|
||||
+ if (storedMaxSpeed != world.purpurConfig.minecartMaxSpeed) {
|
||||
+ maxSpeed = storedMaxSpeed = world.purpurConfig.minecartMaxSpeed;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX();
|
||||
double prevY = this.locY();
|
||||
@@ -484,16 +492,62 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
|
||||
public void a(int i, int j, int k, boolean flag) {}
|
||||
|
||||
+ // Purpur start
|
||||
+ private Double lastSpeed;
|
||||
+
|
||||
+ public double getControllableSpeed() {
|
||||
+ BlockPosition position = new BlockPosition(this);
|
||||
+ Block block = world.getType(position).getBlock();
|
||||
+ if (!block.getMaterial().isSolid()) {
|
||||
+ block = world.getType(position.shift(EnumDirection.DOWN)).getBlock();
|
||||
+ }
|
||||
+ Double speed = world.purpurConfig.minecartControllableBlockSpeeds.get(block);
|
||||
+ if (!block.getMaterial().isSolid()) {
|
||||
+ speed = lastSpeed;
|
||||
+ } else if (speed == null) {
|
||||
+ speed = world.purpurConfig.minecartControllableBaseSpeed;
|
||||
+ }
|
||||
+ return lastSpeed = speed;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
protected void h() {
|
||||
double d0 = this.getMaxSpeed();
|
||||
Vec3D vec3d = this.getMot();
|
||||
|
||||
this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0));
|
||||
+
|
||||
+ // Purpur start
|
||||
+ if (world.purpurConfig.minecartControllable && !isInWater() && !isInLava() && !passengers.isEmpty()) {
|
||||
+ Entity passenger = passengers.get(0);
|
||||
+ if (passenger instanceof EntityHuman) {
|
||||
+ EntityHuman entityhuman = (EntityHuman) passenger;
|
||||
+ if (entityhuman.jumping && this.onGround) {
|
||||
+ setMot(new Vec3D(getMot().x, world.purpurConfig.minecartControllableHopBoost, getMot().z));
|
||||
+ }
|
||||
+ if (entityhuman.getForward() != 0.0F) {
|
||||
+ Vector velocity = entityhuman.getBukkitEntity().getEyeLocation().getDirection().normalize().multiply(getControllableSpeed());
|
||||
+ if (entityhuman.getForward() < 0.0) {
|
||||
+ velocity.multiply(-0.5);
|
||||
+ }
|
||||
+ setMot(new Vec3D(velocity.getX(), getMot().y, velocity.getZ()));
|
||||
+ }
|
||||
+ this.yaw = passenger.yaw - 90;
|
||||
+ setStepHeight(world.purpurConfig.minecartControllableStepHeight);
|
||||
+ } else {
|
||||
+ setStepHeight(0.0F);
|
||||
+ }
|
||||
+ } else {
|
||||
+ setStepHeight(0.0F);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
if (this.onGround) {
|
||||
// CraftBukkit start - replace magic numbers with our variables
|
||||
this.setMot(new Vec3D(this.getMot().x * this.derailedX, this.getMot().y * this.derailedY, this.getMot().z * this.derailedZ));
|
||||
// CraftBukkit end
|
||||
}
|
||||
+ else if (world.purpurConfig.minecartControllable) setMot(new Vec3D(getMot().x * derailedX, getMot().y, getMot().z * derailedZ)); // Purpur
|
||||
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
if (!this.onGround) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemMinecart.java b/src/main/java/net/minecraft/world/item/ItemMinecart.java
|
||||
index 527f3ed664854cdd938c34f00a064bc2f77148cc..1a1de9491a50e9e746e714fcb35633c22674f042 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemMinecart.java
|
||||
@@ -121,8 +121,10 @@ public class ItemMinecart extends Item {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
if (!iblockdata.a((Tag) TagsBlock.RAILS)) {
|
||||
- return EnumInteractionResult.FAIL;
|
||||
- } else {
|
||||
+ // Purpur start - place minecarts anywhere
|
||||
+ if (!world.purpurConfig.minecartPlaceAnywhere) return EnumInteractionResult.FAIL;
|
||||
+ if (iblockdata.getMaterial().isSolid()) blockposition = blockposition.shift(itemactioncontext.getClickedFace());
|
||||
+ } //else { // Purpur end - place minecarts anywhere
|
||||
ItemStack itemstack = itemactioncontext.getItemStack();
|
||||
|
||||
if (!world.isClientSide) {
|
||||
@@ -149,6 +151,6 @@ public class ItemMinecart extends Item {
|
||||
|
||||
itemstack.subtract(1);
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
- }
|
||||
+ //} // Purpur - place minecarts anywhere
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 7279893d599351785652279c8827fe0efbd72f12..cfdc602947548970b3fde00dd9fddf4e82c28841 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -83,6 +83,7 @@ public class Block extends BlockBase implements IMaterial {
|
||||
return timing;
|
||||
}
|
||||
// Paper end
|
||||
+ public net.minecraft.world.level.material.Material getMaterial() { return material; } // Purpur - OBFHELPER
|
||||
@Nullable
|
||||
private String name;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 2e4a928a3e88fb3d961d9530695cd7154321c79b..ee4b36f1aad78bcd7e9cc45acb4ca5b957d0d5c5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1,13 +1,18 @@
|
||||
package net.pl3x.purpur;
|
||||
|
||||
import net.minecraft.core.IRegistry;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+import java.util.HashMap;
|
||||
import java.util.List;
|
||||
+import java.util.Map;
|
||||
+
|
||||
import static net.pl3x.purpur.PurpurConfig.log;
|
||||
|
||||
public class PurpurWorldConfig {
|
||||
@@ -68,6 +73,68 @@ public class PurpurWorldConfig {
|
||||
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
||||
}
|
||||
|
||||
+ public double minecartMaxSpeed = 0.4D;
|
||||
+ public boolean minecartPlaceAnywhere = false;
|
||||
+ public boolean minecartControllable = false;
|
||||
+ public float minecartControllableStepHeight = 1.0F;
|
||||
+ public double minecartControllableHopBoost = 0.5D;
|
||||
+ public boolean minecartControllableFallDamage = true;
|
||||
+ public double minecartControllableBaseSpeed = 0.1D;
|
||||
+ public Map<Block, Double> minecartControllableBlockSpeeds = new HashMap<>();
|
||||
+ private void minecartSettings() {
|
||||
+ if (PurpurConfig.version < 12) {
|
||||
+ boolean oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.place-anywhere", minecartPlaceAnywhere);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.place-anywhere", null);
|
||||
+ set("gameplay-mechanics.minecart.place-anywhere", oldBool);
|
||||
+ oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.enabled", minecartControllable);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.enabled", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.enabled", oldBool);
|
||||
+ double oldDouble = getDouble("gameplay-mechanics.controllable-minecarts.step-height", minecartControllableStepHeight);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.step-height", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.step-height", oldDouble);
|
||||
+ oldDouble = getDouble("gameplay-mechanics.controllable-minecarts.hop-boost", minecartControllableHopBoost);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.hop-boost", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.hop-boost", oldDouble);
|
||||
+ oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.fall-damage", minecartControllableFallDamage);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.fall-damage", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.fall-damage", oldBool);
|
||||
+ oldDouble = getDouble("gameplay-mechanics.controllable-minecarts.base-speed", minecartControllableBaseSpeed);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.base-speed", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.base-speed", oldDouble);
|
||||
+ ConfigurationSection section = getConfigurationSection("gameplay-mechanics.controllable-minecarts.block-speed");
|
||||
+ if (section != null) {
|
||||
+ for (String key : section.getKeys(false)) {
|
||||
+ if ("grass-block".equals(key)) key = "grass_block"; // oopsie
|
||||
+ oldDouble = section.getDouble(key, minecartControllableBaseSpeed);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.block-speed." + key, null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.block-speed." + key, oldDouble);
|
||||
+ }
|
||||
+ set("gameplay-mechanics.controllable-minecarts.block-speed", null);
|
||||
+ }
|
||||
+ set("gameplay-mechanics.controllable-minecarts", null);
|
||||
+ }
|
||||
+
|
||||
+ minecartMaxSpeed = getDouble("gameplay-mechanics.minecart.max-speed", minecartMaxSpeed);
|
||||
+ minecartPlaceAnywhere = getBoolean("gameplay-mechanics.minecart.place-anywhere", minecartPlaceAnywhere);
|
||||
+ minecartControllable = getBoolean("gameplay-mechanics.minecart.controllable.enabled", minecartControllable);
|
||||
+ minecartControllableStepHeight = (float) getDouble("gameplay-mechanics.minecart.controllable.step-height", minecartControllableStepHeight);
|
||||
+ minecartControllableHopBoost = getDouble("gameplay-mechanics.minecart.controllable.hop-boost", minecartControllableHopBoost);
|
||||
+ minecartControllableFallDamage = getBoolean("gameplay-mechanics.minecart.controllable.fall-damage", minecartControllableFallDamage);
|
||||
+ minecartControllableBaseSpeed = getDouble("gameplay-mechanics.minecart.controllable.base-speed", minecartControllableBaseSpeed);
|
||||
+ ConfigurationSection section = getConfigurationSection("gameplay-mechanics.minecart.controllable.block-speed");
|
||||
+ if (section != null) {
|
||||
+ for (String key : section.getKeys(false)) {
|
||||
+ Block block = IRegistry.BLOCK.get(new MinecraftKey(key));
|
||||
+ if (block != Blocks.AIR) {
|
||||
+ minecartControllableBlockSpeeds.put(block, section.getDouble(key, minecartControllableBaseSpeed));
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ set("gameplay-mechanics.minecart.controllable.block-speed.grass_block", 0.3D);
|
||||
+ set("gameplay-mechanics.minecart.controllable.block-speed.stone", 0.5D);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean idleTimeoutKick = true;
|
||||
public boolean idleTimeoutTickNearbyEntities = true;
|
||||
public boolean idleTimeoutCountAsSleeping = false;
|
||||
@@ -4,21 +4,21 @@ Date: Sat, 24 Aug 2019 14:42:54 -0500
|
||||
Subject: [PATCH] Ender dragon always drop full exp
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
index c296fcf80c2f3f210fa020416973ec8d5db541ba..58b9ace88793d1f661b16db1b43433484a697936 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -613,7 +613,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index c98202092752a9015aaf95bd1471135b88e84425..682b532967a501e21df93c28c4ee4b59eed073a7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -633,7 +633,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
short short0 = 500;
|
||||
|
||||
- if (this.bF != null && !this.bF.isPreviouslyKilled()) {
|
||||
+ if (getEnderDragonBattle() != null && (world.purpurConfig.enderDragonAlwaysDropsFullExp || !getEnderDragonBattle().isPreviouslyKilled())) { // Purpur
|
||||
- if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
|
||||
+ if (this.dragonFight != null && (level.purpurConfig.enderDragonAlwaysDropsFullExp || !this.dragonFight.hasPreviouslyKilledDragon())) {
|
||||
short0 = 12000;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index fa01ef3c0cc723acaaf348066cddf91f1deb3c72..bab91f0416f31a8273593bb7725658674eb41621 100644
|
||||
index d04981114fa2bce174441558b4d1c7c43ae2ea34..33aedbee4508ced806c8b72b91a6d8b4a04a4b76 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -142,6 +142,11 @@ public class PurpurWorldConfig {
|
||||
52
patches/server/0043-Signs-editable-on-right-click.patch
Normal file
52
patches/server/0043-Signs-editable-on-right-click.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 24 May 2019 02:39:25 -0500
|
||||
Subject: [PATCH] Signs editable on right click
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
index 1844ea93f8cea420f01937f85ed17c0ec1bb8bf0..9e80ba8970cad91ea22ac701f76e1413551a591f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.item.DyeItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
+import net.minecraft.world.item.SignItem;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
@@ -108,6 +109,17 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - right click to open sign editor
|
||||
+ if (world.purpurConfig.signRightClickEdit && itemStack.getItem() instanceof SignItem &&
|
||||
+ !player.isCrouching() && player.getAbilities().mayBuild &&
|
||||
+ player.getBukkitEntity().hasPermission("purpur.sign.edit")) {
|
||||
+ signBlockEntity.setEditable(true);
|
||||
+ signBlockEntity.setAllowedPlayerEditor(player.getUUID());
|
||||
+ player.openTextEdit(signBlockEntity);
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return signBlockEntity.executeClickCommands((ServerPlayer)player) ? InteractionResult.SUCCESS : InteractionResult.PASS;
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 33aedbee4508ced806c8b72b91a6d8b4a04a4b76..26f5a224c7441a96ba4d4bd86eff4cdb100c28e6 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -109,6 +109,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean signRightClickEdit = false;
|
||||
+ private void signSettings() {
|
||||
+ signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
||||
+ }
|
||||
+
|
||||
public boolean turtleEggsBreakFromExpOrbs = true;
|
||||
public boolean turtleEggsBreakFromItems = true;
|
||||
public boolean turtleEggsBreakFromMinecarts = true;
|
||||
93
patches/server/0044-Signs-allow-color-codes.patch
Normal file
93
patches/server/0044-Signs-allow-color-codes.patch
Normal file
@@ -0,0 +1,93 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 6 Jun 2019 17:40:30 -0500
|
||||
Subject: [PATCH] Signs allow color codes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 02965cc9ca344cd9673ed3361f7c28b829a2d97b..869bfb88d3d93a9601d97a1b03ead5969bbfd283 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1425,6 +1425,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void openTextEdit(SignBlockEntity sign) {
|
||||
+ if (level.purpurConfig.signAllowColors) this.connection.send(sign.getTranslatedUpdatePacket(textFilteringEnabled)); // Purpur
|
||||
sign.setAllowedPlayerEditor(this.getUUID());
|
||||
this.connection.send(new ClientboundBlockUpdatePacket(this.level, sign.getBlockPos()));
|
||||
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 7255ce0b4d3e424b05542abcc35300a30e39687e..6680877abd9f0a6a66c6916dfaa899444fa6b52b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2999,9 +2999,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}
|
||||
// Paper end
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
|
||||
+ String filtered = currentLine.getFiltered();
|
||||
+ if (worldserver.purpurConfig.signAllowColors) {
|
||||
+ if (player.hasPermission("purpur.sign.color")) filtered = filtered.replaceAll("(?i)&([0-9a-fr])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.style")) filtered = filtered.replaceAll("(?i)&([l-or])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.magic")) filtered = filtered.replaceAll("(?i)&([kr])", "\u00a7$1");
|
||||
+ }
|
||||
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(filtered)));
|
||||
} else {
|
||||
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw())));
|
||||
+ String raw = currentLine.getRaw();
|
||||
+ if (worldserver.purpurConfig.signAllowColors) {
|
||||
+ if (player.hasPermission("purpur.sign.color")) raw = raw.replaceAll("(?i)&([0-9a-fr])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.style")) raw = raw.replaceAll("(?i)&([l-or])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.magic")) raw = raw.replaceAll("(?i)&([kr])", "\u00a7$1");
|
||||
+ }
|
||||
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(raw)));
|
||||
}
|
||||
}
|
||||
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.cserver.getPlayer(this.player), lines);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
index 9b5d11ece006d7aa893360a84ba652c666517ac1..3373c21f90eb08e2bfbb71bc348d085aad77de77 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
@@ -4,6 +4,8 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
import net.minecraft.commands.CommandSource;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -180,6 +182,18 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
return filtered ? this.filteredMessages : this.messages;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public ClientboundBlockEntityDataPacket getTranslatedUpdatePacket(boolean filtered) {
|
||||
+ CompoundTag nbt = save(new CompoundTag());
|
||||
+ for (int i = 0; i < 4; ++i) {
|
||||
+ String line = PaperAdventure.LEGACY_AMPERSAND.serialize(PaperAdventure.asAdventure(getMessages(filtered)[i]));
|
||||
+ nbt.putString("Text" + (i + 1), net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(net.kyori.adventure.text.Component.text(line)));
|
||||
+ }
|
||||
+ nbt.putString("PurpurEditor", "true");
|
||||
+ return new ClientboundBlockEntityDataPacket(worldPosition, 9, nbt);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public ClientboundBlockEntityDataPacket getUpdatePacket() {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 26f5a224c7441a96ba4d4bd86eff4cdb100c28e6..3a9efffb7579665e7360bfcaf4ba390aca3201cb 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -109,8 +109,10 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean signAllowColors = false;
|
||||
public boolean signRightClickEdit = false;
|
||||
private void signSettings() {
|
||||
+ signAllowColors = getBoolean("blocks.sign.allow-colors", signAllowColors);
|
||||
signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 21 Jun 2019 14:37:10 -0500
|
||||
Subject: [PATCH] Allow soil to moisten from water directly under it
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index aa1ba8b74ab70b6cede99e4853ac0203f388ab06..97e5cb4fd9f97c0bfa9d66c0ceac84e134f1053f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -139,19 +139,14 @@ public class FarmBlock extends Block {
|
||||
}
|
||||
|
||||
private static boolean isNearWater(LevelReader world, BlockPos pos) {
|
||||
- Iterator iterator = BlockPos.betweenClosed(pos.offset(-4, 0, -4), pos.offset(4, 1, 4)).iterator();
|
||||
-
|
||||
- BlockPos blockposition1;
|
||||
-
|
||||
- do {
|
||||
- if (!iterator.hasNext()) {
|
||||
- return false;
|
||||
+ // Purpur start
|
||||
+ for (BlockPos position : BlockPos.betweenClosed(pos.offset(-4, 0, -4), pos.offset(4, 1, 4))) {
|
||||
+ if (world.getFluidState(position).is(FluidTags.WATER)) {
|
||||
+ return true;
|
||||
}
|
||||
-
|
||||
- blockposition1 = (BlockPos) iterator.next();
|
||||
- } while (!world.getFluidState(blockposition1).is((Tag) FluidTags.WATER));
|
||||
-
|
||||
- return true;
|
||||
+ }
|
||||
+ return ((ServerLevel) world).purpurConfig.farmlandGetsMoistFromBelow && world.getFluidState(pos.relative(Direction.DOWN)).is(FluidTags.WATER);
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 3a9efffb7579665e7360bfcaf4ba390aca3201cb..42cf3dc7185408964e226c1fa41e4587c785e045 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -109,6 +109,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean farmlandGetsMoistFromBelow = false;
|
||||
+ private void farmlandSettings() {
|
||||
+ farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
+ }
|
||||
+
|
||||
public boolean signAllowColors = false;
|
||||
public boolean signRightClickEdit = false;
|
||||
private void signSettings() {
|
||||
255
patches/server/0046-Minecart-settings-and-WASD-controls.patch
Normal file
255
patches/server/0046-Minecart-settings-and-WASD-controls.patch
Normal file
@@ -0,0 +1,255 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 29 Jun 2019 02:32:40 -0500
|
||||
Subject: [PATCH] Minecart settings and WASD controls
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index 22ea0da3836b61bb018ae974d2b8c7546b9528d6..dea8abfd8443702e138823bd536aaac2c3395d6f 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -41,6 +41,12 @@ public class BlockPos extends Vec3i {
|
||||
private static final int X_OFFSET = 38;
|
||||
// Paper end
|
||||
|
||||
+ // Purpur start
|
||||
+ public BlockPos(net.minecraft.world.entity.Entity entity) {
|
||||
+ super(entity.getX(), entity.getY(), entity.getZ());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public BlockPos(int x, int y, int z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 869bfb88d3d93a9601d97a1b03ead5969bbfd283..a8f1aa81ec02deb75efef820508ec4be79545be8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -952,6 +952,7 @@ public class ServerPlayer extends Player {
|
||||
if (this.isInvulnerableTo(source)) {
|
||||
return false;
|
||||
} else {
|
||||
+ if (source == DamageSource.FALL && getRootVehicle() instanceof net.minecraft.world.entity.vehicle.AbstractMinecart && level.purpurConfig.minecartControllable && !level.purpurConfig.minecartControllableFallDamage) return false; // Purpur
|
||||
boolean flag = this.server.isDedicatedServer() && this.isPvpAllowed() && "fall".equals(source.msgId);
|
||||
|
||||
if (!flag && isSpawnInvulnerable() && source != DamageSource.OUT_OF_WORLD) { // Purpur
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
index 309bafd257d4932cfd69c2c212b32306938cd234..1e3077a22d9d3d26356b865001dcce81c9c1d7e5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -110,11 +110,13 @@ public abstract class AbstractMinecart extends Entity {
|
||||
private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
|
||||
private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
|
||||
public double maxSpeed = 0.4D;
|
||||
+ public double storedMaxSpeed; // Purpur
|
||||
// CraftBukkit end
|
||||
|
||||
protected AbstractMinecart(EntityType<?> type, Level world) {
|
||||
super(type, world);
|
||||
this.blocksBuilding = true;
|
||||
+ if (world != null) maxSpeed = storedMaxSpeed = world.purpurConfig.minecartMaxSpeed; // Purpur
|
||||
}
|
||||
|
||||
protected AbstractMinecart(EntityType<?> type, Level world, double x, double y, double z) {
|
||||
@@ -327,6 +329,12 @@ public abstract class AbstractMinecart extends Entity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ // Purpur start
|
||||
+ if (storedMaxSpeed != level.purpurConfig.minecartMaxSpeed) {
|
||||
+ maxSpeed = storedMaxSpeed = level.purpurConfig.minecartMaxSpeed;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
// CraftBukkit start
|
||||
double prevX = this.getX();
|
||||
double prevY = this.getY();
|
||||
@@ -490,16 +498,62 @@ public abstract class AbstractMinecart extends Entity {
|
||||
|
||||
public void activateMinecart(int x, int y, int z, boolean powered) {}
|
||||
|
||||
+ // Purpur start
|
||||
+ private Double lastSpeed;
|
||||
+
|
||||
+ public double getControllableSpeed() {
|
||||
+ BlockPos pos = new BlockPos(this);
|
||||
+ Block block = level.getBlockState(pos).getBlock();
|
||||
+ if (!block.material.isSolid()) {
|
||||
+ block = level.getBlockState(pos.relative(Direction.DOWN)).getBlock();
|
||||
+ }
|
||||
+ Double speed = level.purpurConfig.minecartControllableBlockSpeeds.get(block);
|
||||
+ if (!block.material.isSolid()) {
|
||||
+ speed = lastSpeed;
|
||||
+ } else if (speed == null) {
|
||||
+ speed = level.purpurConfig.minecartControllableBaseSpeed;
|
||||
+ }
|
||||
+ return lastSpeed = speed;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
protected void comeOffTrack() {
|
||||
double d0 = this.getMaxSpeed();
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
|
||||
this.setDeltaMovement(Mth.clamp(vec3d.x, -d0, d0), vec3d.y, Mth.clamp(vec3d.z, -d0, d0));
|
||||
+
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.minecartControllable && !isInWater() && !isInLava() && !passengers.isEmpty()) {
|
||||
+ Entity passenger = passengers.get(0);
|
||||
+ if (passenger instanceof Player) {
|
||||
+ Player player = (Player) passenger;
|
||||
+ if (player.jumping && this.onGround) {
|
||||
+ setDeltaMovement(new Vec3(getDeltaMovement().x, level.purpurConfig.minecartControllableHopBoost, getDeltaMovement().z));
|
||||
+ }
|
||||
+ if (player.zza != 0.0F) {
|
||||
+ Vector velocity = player.getBukkitEntity().getEyeLocation().getDirection().normalize().multiply(getControllableSpeed());
|
||||
+ if (player.zza < 0.0) {
|
||||
+ velocity.multiply(-0.5);
|
||||
+ }
|
||||
+ setDeltaMovement(new Vec3(velocity.getX(), getDeltaMovement().y, velocity.getZ()));
|
||||
+ }
|
||||
+ this.setYRot(passenger.getYRot() - 90);
|
||||
+ maxUpStep = level.purpurConfig.minecartControllableStepHeight;
|
||||
+ } else {
|
||||
+ maxUpStep = 0.0F;
|
||||
+ }
|
||||
+ } else {
|
||||
+ maxUpStep = 0.0F;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
if (this.onGround) {
|
||||
// CraftBukkit start - replace magic numbers with our variables
|
||||
this.setDeltaMovement(new Vec3(this.getDeltaMovement().x * this.derailedX, this.getDeltaMovement().y * this.derailedY, this.getDeltaMovement().z * this.derailedZ));
|
||||
// CraftBukkit end
|
||||
}
|
||||
+ else if (level.purpurConfig.minecartControllable) setDeltaMovement(new Vec3(getDeltaMovement().x * derailedX, getDeltaMovement().y, getDeltaMovement().z * derailedZ)); // Purpur
|
||||
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
if (!this.onGround) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/MinecartItem.java b/src/main/java/net/minecraft/world/item/MinecartItem.java
|
||||
index 9ea3837acc315e5c57f28c63c356efd633f1e6cf..e8b76b67f972c2f44e7611434246a822d549a129 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/MinecartItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/MinecartItem.java
|
||||
@@ -123,8 +123,9 @@ public class MinecartItem extends Item {
|
||||
BlockState iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
if (!iblockdata.is((Tag) BlockTags.RAILS)) {
|
||||
- return InteractionResult.FAIL;
|
||||
- } else {
|
||||
+ if (!world.purpurConfig.minecartPlaceAnywhere) return InteractionResult.FAIL;
|
||||
+ if (iblockdata.getMaterial().isSolid()) blockposition = blockposition.relative(context.getClickedFace());
|
||||
+ } // else { // Purpur - place minecarts anywhere
|
||||
ItemStack itemstack = context.getItemInHand();
|
||||
|
||||
if (!world.isClientSide) {
|
||||
@@ -152,6 +153,6 @@ public class MinecartItem extends Item {
|
||||
|
||||
itemstack.shrink(1);
|
||||
return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
- }
|
||||
+ // } // Purpur - place minecarts anywhere
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 933448659367b5f0b323bd91992fc9b59314b8a1..572e5f32a3c5aaffcec31da0cff9151efea252ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -70,7 +70,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
public abstract class BlockBehaviour {
|
||||
|
||||
protected static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
|
||||
- protected final Material material;
|
||||
+ public final Material material; // Purpur - protected -> public
|
||||
protected final boolean hasCollision;
|
||||
protected final float explosionResistance;
|
||||
protected final boolean isRandomlyTicking;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 42cf3dc7185408964e226c1fa41e4587c785e045..c63e46ae34a937a3ba5d1dc19afca256e306a224 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -4,10 +4,15 @@ import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+import java.util.HashMap;
|
||||
import java.util.List;
|
||||
+import java.util.Map;
|
||||
+
|
||||
import static net.pl3x.purpur.PurpurConfig.log;
|
||||
|
||||
public class PurpurWorldConfig {
|
||||
@@ -68,6 +73,68 @@ public class PurpurWorldConfig {
|
||||
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
||||
}
|
||||
|
||||
+ public double minecartMaxSpeed = 0.4D;
|
||||
+ public boolean minecartPlaceAnywhere = false;
|
||||
+ public boolean minecartControllable = false;
|
||||
+ public float minecartControllableStepHeight = 1.0F;
|
||||
+ public double minecartControllableHopBoost = 0.5D;
|
||||
+ public boolean minecartControllableFallDamage = true;
|
||||
+ public double minecartControllableBaseSpeed = 0.1D;
|
||||
+ public Map<Block, Double> minecartControllableBlockSpeeds = new HashMap<>();
|
||||
+ private void minecartSettings() {
|
||||
+ if (PurpurConfig.version < 12) {
|
||||
+ boolean oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.place-anywhere", minecartPlaceAnywhere);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.place-anywhere", null);
|
||||
+ set("gameplay-mechanics.minecart.place-anywhere", oldBool);
|
||||
+ oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.enabled", minecartControllable);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.enabled", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.enabled", oldBool);
|
||||
+ double oldDouble = getDouble("gameplay-mechanics.controllable-minecarts.step-height", minecartControllableStepHeight);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.step-height", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.step-height", oldDouble);
|
||||
+ oldDouble = getDouble("gameplay-mechanics.controllable-minecarts.hop-boost", minecartControllableHopBoost);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.hop-boost", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.hop-boost", oldDouble);
|
||||
+ oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.fall-damage", minecartControllableFallDamage);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.fall-damage", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.fall-damage", oldBool);
|
||||
+ oldDouble = getDouble("gameplay-mechanics.controllable-minecarts.base-speed", minecartControllableBaseSpeed);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.base-speed", null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.base-speed", oldDouble);
|
||||
+ ConfigurationSection section = getConfigurationSection("gameplay-mechanics.controllable-minecarts.block-speed");
|
||||
+ if (section != null) {
|
||||
+ for (String key : section.getKeys(false)) {
|
||||
+ if ("grass-block".equals(key)) key = "grass_block"; // oopsie
|
||||
+ oldDouble = section.getDouble(key, minecartControllableBaseSpeed);
|
||||
+ set("gameplay-mechanics.controllable-minecarts.block-speed." + key, null);
|
||||
+ set("gameplay-mechanics.minecart.controllable.block-speed." + key, oldDouble);
|
||||
+ }
|
||||
+ set("gameplay-mechanics.controllable-minecarts.block-speed", null);
|
||||
+ }
|
||||
+ set("gameplay-mechanics.controllable-minecarts", null);
|
||||
+ }
|
||||
+
|
||||
+ minecartMaxSpeed = getDouble("gameplay-mechanics.minecart.max-speed", minecartMaxSpeed);
|
||||
+ minecartPlaceAnywhere = getBoolean("gameplay-mechanics.minecart.place-anywhere", minecartPlaceAnywhere);
|
||||
+ minecartControllable = getBoolean("gameplay-mechanics.minecart.controllable.enabled", minecartControllable);
|
||||
+ minecartControllableStepHeight = (float) getDouble("gameplay-mechanics.minecart.controllable.step-height", minecartControllableStepHeight);
|
||||
+ minecartControllableHopBoost = getDouble("gameplay-mechanics.minecart.controllable.hop-boost", minecartControllableHopBoost);
|
||||
+ minecartControllableFallDamage = getBoolean("gameplay-mechanics.minecart.controllable.fall-damage", minecartControllableFallDamage);
|
||||
+ minecartControllableBaseSpeed = getDouble("gameplay-mechanics.minecart.controllable.base-speed", minecartControllableBaseSpeed);
|
||||
+ ConfigurationSection section = getConfigurationSection("gameplay-mechanics.minecart.controllable.block-speed");
|
||||
+ if (section != null) {
|
||||
+ for (String key : section.getKeys(false)) {
|
||||
+ Block block = Registry.BLOCK.get(new ResourceLocation(key));
|
||||
+ if (block != Blocks.AIR) {
|
||||
+ minecartControllableBlockSpeeds.put(block, section.getDouble(key, minecartControllableBaseSpeed));
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ set("gameplay-mechanics.minecart.controllable.block-speed.grass_block", 0.3D);
|
||||
+ set("gameplay-mechanics.minecart.controllable.block-speed.stone", 0.5D);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean idleTimeoutKick = true;
|
||||
public boolean idleTimeoutTickNearbyEntities = true;
|
||||
public boolean idleTimeoutCountAsSleeping = false;
|
||||
@@ -4,23 +4,23 @@ Date: Wed, 3 Jul 2019 23:58:31 -0500
|
||||
Subject: [PATCH] Disable loot drops on death by cramming
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 14be521b1019b58508268c21cb1d3cc806e75d17..a108c2fa6c4146eba0784f912c3cfa498b86a1e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -1595,8 +1595,10 @@ public abstract class EntityLiving extends Entity {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 3c40cec55a1195f81ce453eaebe9487e140297ae..3cf3a6ba7bec27ce2ae9b294b0676fdc6c9e38b6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1700,8 +1700,10 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
this.dropInventory(); // CraftBukkit - from below
|
||||
if (this.cW() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
+ if (!(damagesource == DamageSource.CRAMMING && world.purpurConfig.disableDropsOnCrammingDeath)) { // Purpur
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
this.dropEquipment(); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
+ if (!(source == DamageSource.CRAMMING && level.purpurConfig.disableDropsOnCrammingDeath)) { // Purpur
|
||||
this.dropFromLootTable(source, flag);
|
||||
this.dropCustomDeathLoot(source, i, flag);
|
||||
+ } // Purpur
|
||||
}
|
||||
// CraftBukkit start - Call death event
|
||||
org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index ee4b36f1aad78bcd7e9cc45acb4ca5b957d0d5c5..e2f49196642a325ac24f9245d5576547f20a044f 100644
|
||||
index c63e46ae34a937a3ba5d1dc19afca256e306a224..ecca777f038f90f5f731777dde2e6cfd39af9bb7 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -146,6 +146,11 @@ public class PurpurWorldConfig {
|
||||
Reference in New Issue
Block a user