mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
Fix #788
This commit is contained in:
parent
3f6dd484af
commit
4164107c09
@ -1,7 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 22 Nov 2020 20:13:27 -0600
|
||||
Subject: [PATCH] Kelp weeping and twisting vines configurable max growth age
|
||||
Subject: [PATCH] Kelp, cave, weeping, and twisting vines configurable max
|
||||
growth age
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
||||
@ -21,9 +22,18 @@ index 4940e101250874111e9c55aeb5b87b28602246f0..1963831ccef0ea1e2ee519c8b3a53d24
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
||||
index 4d1e1cf4c541793492a02681087a6242e7977acd..7e776115872873b13af4352791ef23630c10f3ae 100644
|
||||
index 4d1e1cf4c541793492a02681087a6242e7977acd..5f4a37d350dc6db2531cf5f9cfe91545cc5cacbb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
||||
@@ -30,7 +30,7 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(LevelAccessor world) {
|
||||
- return (BlockState) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, world.getRandom().nextInt(25));
|
||||
+ return (BlockState) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, world.getRandom().nextInt(getMaxGrowthAge(world.getMinecraftWorld()))); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,6 +38,8 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
||||
return (Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25;
|
||||
}
|
||||
@ -59,79 +69,55 @@ index 4d1e1cf4c541793492a02681087a6242e7977acd..7e776115872873b13af4352791ef2363
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/KelpBlock.java b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
|
||||
index bc66fa91ec3e13431d5d9b6e17935cab73066be7..171eeab0c395af77725f3e62ef9594a1c22f381f 100644
|
||||
index bc66fa91ec3e13431d5d9b6e17935cab73066be7..6776ca3340f710cea4bf90b610def9e51051cf75 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/KelpBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
@@ -64,4 +65,11 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta
|
||||
@@ -64,4 +64,11 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getSource(false);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
|
||||
+ return world.purpurConfig.kelpMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
|
||||
index 6866605c7ef5361b21130a19a59c3fa3660dfb19..e8fe6959b96e4f4669adffd8b56f4f3204721a7e 100644
|
||||
index 6866605c7ef5361b21130a19a59c3fa3660dfb19..c3f42d587de584406ebb6a68d9529c0410a6554d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
+import net.minecraft.server.level.ServerLevel; // Purpur
|
||||
|
||||
public class TwistingVinesBlock extends GrowingPlantHeadBlock {
|
||||
public static final VoxelShape SHAPE = Block.box(4.0D, 0.0D, 4.0D, 12.0D, 15.0D, 12.0D);
|
||||
@@ -27,4 +28,11 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock {
|
||||
@@ -27,4 +27,11 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock {
|
||||
protected boolean canGrowInto(BlockState state) {
|
||||
return NetherVines.isValidGrowthState(state);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
|
||||
+ return world.purpurConfig.twistingVinesMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
|
||||
index e5c135ec059746b75fe58516809584221285cdbe..b09ccc493c7503aa99a64d760b5bc769aa62095b 100644
|
||||
index e5c135ec059746b75fe58516809584221285cdbe..0f4af88d7cd2c2dc69820078de40be544c8263be 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
+import net.minecraft.server.level.ServerLevel; // Purpur
|
||||
|
||||
public class WeepingVinesBlock extends GrowingPlantHeadBlock {
|
||||
protected static final VoxelShape SHAPE = Block.box(4.0D, 9.0D, 4.0D, 12.0D, 16.0D, 12.0D);
|
||||
@@ -27,4 +28,11 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock {
|
||||
@@ -27,4 +27,11 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock {
|
||||
protected boolean canGrowInto(BlockState state) {
|
||||
return NetherVines.isValidGrowthState(state);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
|
||||
+ return world.purpurConfig.weepingVinesMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 566fe203c4b788c316b8c893621579c4dae65f5b..4c087a6ed8032636f27b815f1350feeb092a75e2 100644
|
||||
index 407cdadb54eee58a415504c2219829054b40204a..c0c95fdc9b58c6df2c9bf5b43fc132f53336aa00 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -786,6 +786,11 @@ public class PurpurWorldConfig {
|
Loading…
Reference in New Issue
Block a user