This commit is contained in:
gnembon committed 2022-04-06 22:16:05 +02:00
1 parent fca98c7b37
commit 812d361af2
26 files changed
+74 -51

No files matched your search

+4 -4
View File
@@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=22w13a minecraft_version=22w14a
loader_version=0.13.3 loader_version=0.13.3
fabric_version=0.49.4+1.19 fabric_version=0.49.4+1.19
@@ -17,12 +17,12 @@ org.gradle.jvmargs=-Xmx1G
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates # This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = 1.18:1.18.2 release-curse-versions = Minecraft 1.19:1.19-Snapshot
# Whether or not to build another branch on release # Whether or not to build another branch on release
release-extra-branch = true release-extra-branch = false
# The name of the second branch to release # The name of the second branch to release
release-extra-branch-name = future release-extra-branch-name = future
# The "name" or id of the Curseforge version for the secondary branch # The "name" or id of the Curseforge version for the secondary branch
# This is needed because CF uses too vague names for snapshots # This is needed because CF uses too vague names for snapshots
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-extra-curse-version = 1.19-Snapshot release-extra-curse-version = Minecraft 1.19:1.19-Snapshot
@@ -2,10 +2,11 @@ package carpet.fakes;
import java.util.Random; import java.util.Random;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public interface CoralFeatureInterface public interface CoralFeatureInterface
{ {
boolean growSpecific(Level worldIn, Random random, BlockPos pos, BlockState blockUnder); boolean growSpecific(Level worldIn, RandomSource random, BlockPos pos, BlockState blockUnder);
} }
@@ -24,6 +24,7 @@ import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BiomeTags; import net.minecraft.tags.BiomeTags;
import net.minecraft.util.RandomSource;
import net.minecraft.util.valueproviders.ConstantInt; import net.minecraft.util.valueproviders.ConstantInt;
import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
@@ -354,7 +355,7 @@ public class FeatureGenerator
{ {
return false; return false;
} }
Random rand = new Random(world.getRandom().nextInt()); RandomSource rand = RandomSource.create(world.getRandom().nextInt());
int j = pos.getX() >> 4; int j = pos.getX() >> 4;
int k = pos.getZ() >> 4; int k = pos.getZ() >> 4;
long chId = ChunkPos.asLong(j, k); long chId = ChunkPos.asLong(j, k);
@@ -6,6 +6,8 @@ import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@@ -230,7 +232,7 @@ public class OptimizedExplosion
if (damagesTerrain) if (damagesTerrain)
{ {
ObjectArrayList<Pair<ItemStack, BlockPos>> objectArrayList = new ObjectArrayList<>(); ObjectArrayList<Pair<ItemStack, BlockPos>> objectArrayList = new ObjectArrayList<>();
Collections.shuffle(e.getToBlow(), world.random); Util.shuffle(e.getToBlow(), world.random);
for (BlockPos blockpos : e.getToBlow()) for (BlockPos blockpos : e.getToBlow())
{ {
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -14,9 +15,9 @@ public class AbstractArrow_extremeMixin
// calculates damage // calculates damage
@Redirect(method = "setEnchantmentEffectsFromEntity", expect = 1, at = @At( @Redirect(method = "setEnchantmentEffectsFromEntity", expect = 1, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian2(Random random) private double nextGauBian2(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import java.util.Random; import java.util.Random;
@@ -43,7 +44,7 @@ public class BarrierBlock_updateSuppressionBlockMixin extends Block {
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
BlockPos posAbove = pos.above(); BlockPos posAbove = pos.above();
BlockState stateAbove = world.getBlockState(posAbove); BlockState stateAbove = world.getBlockState(posAbove);
if (stateAbove.is(Blocks.ACTIVATOR_RAIL) && !stateAbove.getValue(PoweredRailBlock.POWERED)) { if (stateAbove.is(Blocks.ACTIVATOR_RAIL) && !stateAbove.getValue(PoweredRailBlock.POWERED)) {
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -12,9 +13,9 @@ public class BlazeAttackGoal_extremeMixin
{ {
@Redirect(method = "tick()V", expect = 2, at = @At( @Redirect(method = "tick()V", expect = 2, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -14,9 +15,9 @@ public class Blaze_extremeMixin
// unused actually // unused actually
@Redirect(method = "customServerAiStep", expect = 1, at = @At( @Redirect(method = "customServerAiStep", expect = 1, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class Containers_extremeMixin
{ {
@Redirect(method = "dropItemStack(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/item/ItemStack;)V", expect = 3, at = @At( @Redirect(method = "dropItemStack(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/item/ItemStack;)V", expect = 3, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private static double nextGauBian(Random random) private static double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -8,6 +8,7 @@ import net.minecraft.core.Registry;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseCoralPlantTypeBlock; import net.minecraft.world.level.block.BaseCoralPlantTypeBlock;
@@ -38,12 +39,12 @@ public abstract class CoralFanBlock_renewableCoralMixin implements BonemealableB
&& var1.getFluidState(var2.above()).is(FluidTags.WATER); && var1.getFluidState(var2.above()).is(FluidTags.WATER);
} }
public boolean isBonemealSuccess(Level var1, Random var2, BlockPos var3, BlockState var4) public boolean isBonemealSuccess(Level var1, RandomSource var2, BlockPos var3, BlockState var4)
{ {
return (double)var1.random.nextFloat() < 0.15D; return (double)var1.random.nextFloat() < 0.15D;
} }
public void performBonemeal(ServerLevel worldIn, Random random, BlockPos pos, BlockState blockUnder) public void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
{ {
CoralFeature coral; CoralFeature coral;
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.fakes.CoralFeatureInterface; import carpet.fakes.CoralFeatureInterface;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -15,10 +16,10 @@ import net.minecraft.world.level.levelgen.feature.CoralFeature;
public abstract class CoralFeature_renewableCoralMixin implements CoralFeatureInterface public abstract class CoralFeature_renewableCoralMixin implements CoralFeatureInterface
{ {
@Shadow protected abstract boolean placeFeature(LevelAccessor var1, Random var2, BlockPos var3, BlockState var4); @Shadow protected abstract boolean placeFeature(LevelAccessor var1, RandomSource var2, BlockPos var3, BlockState var4);
@Override @Override
public boolean growSpecific(Level worldIn, Random random, BlockPos pos, BlockState blockUnder) public boolean growSpecific(Level worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
{ {
return placeFeature(worldIn, random, pos, blockUnder); return placeFeature(worldIn, random, pos, blockUnder);
} }
@@ -4,6 +4,7 @@ import carpet.CarpetSettings;
import carpet.fakes.CoralFeatureInterface; import carpet.fakes.CoralFeatureInterface;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import java.util.Random; import java.util.Random;
@@ -40,12 +41,12 @@ public abstract class CoralPlantBlock_renewableCoralMixin implements Bonemealabl
&& var1.getFluidState(var2.above()).is(FluidTags.WATER); && var1.getFluidState(var2.above()).is(FluidTags.WATER);
} }
public boolean isBonemealSuccess(Level var1, Random var2, BlockPos var3, BlockState var4) public boolean isBonemealSuccess(Level var1, RandomSource var2, BlockPos var3, BlockState var4)
{ {
return (double)var1.random.nextFloat() < 0.15D; return (double)var1.random.nextFloat() < 0.15D;
} }
public void performBonemeal(ServerLevel worldIn, Random random, BlockPos pos, BlockState blockUnder) public void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
{ {
CoralFeature coral; CoralFeature coral;
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class DefaultDispenseItemBehavior_extremeBehavioursMixin
{ {
@Redirect(method = "spawnItem", expect = 3, at = @At( @Redirect(method = "spawnItem", expect = 3, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private static double nextGauBian(Random random) private static double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,5 +1,6 @@
package carpet.mixins; package carpet.mixins;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Accessor;
@@ -21,7 +22,7 @@ public interface ExplosionAccessor {
Level getLevel(); Level getLevel();
@Accessor @Accessor
Random getRandom(); RandomSource getRandom();
@Accessor @Accessor
double getX(); double getX();
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class FireworkRocketEntity_extremeMixin
{ {
@Redirect(method = "<init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/item/ItemStack;)V", expect = 2, at = @At( @Redirect(method = "<init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/item/ItemStack;)V", expect = 2, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class FishingHook_extremeMixin
{ {
@Redirect(method = "<init>(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V", expect =3, at = @At( @Redirect(method = "<init>(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V", expect =3, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class Mob_extremeMixin
{ {
@Redirect(method = "finalizeSpawn", expect = 1, at = @At( @Redirect(method = "finalizeSpawn", expect = 1, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class Projectile_extremeMixin
{ {
@Redirect(method = "shoot", expect = 3, at = @At( //TODO make sure it's correct after mojmap @Redirect(method = "shoot", expect = 3, at = @At( //TODO make sure it's correct after mojmap
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@@ -22,9 +23,9 @@ import net.minecraft.world.level.block.state.BlockState;
public abstract class SaplingBlock_desertShrubsMixin public abstract class SaplingBlock_desertShrubsMixin
{ {
@Inject(method = "advanceTree", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, @Inject(method = "advanceTree", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
target = "Lnet/minecraft/world/level/block/grower/AbstractTreeGrower;growTree(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Ljava/util/Random;)Z"), target = "Lnet/minecraft/world/level/block/grower/AbstractTreeGrower;growTree(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/util/RandomSource;)Z"),
cancellable = true) cancellable = true)
private void onGenerate(ServerLevel level, BlockPos pos, BlockState blockState, Random random, CallbackInfo ci) private void onGenerate(ServerLevel level, BlockPos pos, BlockState blockState, RandomSource random, CallbackInfo ci)
{ {
if (CarpetSettings.desertShrubs && level.getBiome(pos).is(BiomeTags.HAS_DESERT_PYRAMID) && !nearWater(level, pos)) if (CarpetSettings.desertShrubs && level.getBiome(pos).is(BiomeTags.HAS_DESERT_PYRAMID) && !nearWater(level, pos))
{ {
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.utils.RandomTools; import carpet.utils.RandomTools;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,9 +14,9 @@ public class SkeletonTrapGoal_extremeMixin
{ {
@Redirect(method = "tick", expect = 2, at = @At( @Redirect(method = "tick", expect = 2, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextGaussian()D" target = "Lnet/minecraft/util/RandomSource;nextGaussian()D"
)) ))
private double nextGauBian(Random random) private double nextGauBian(RandomSource random)
{ {
return RandomTools.nextGauBian(random); return RandomTools.nextGauBian(random);
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -17,15 +18,15 @@ public abstract class StructureBlockEntity_fillUpdatesMixin
{ {
@Redirect(method = "Lnet/minecraft/world/level/block/entity/StructureBlockEntity;loadStructure(Lnet/minecraft/server/level/ServerLevel;ZLnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;)Z", at = @At( @Redirect(method = "Lnet/minecraft/world/level/block/entity/StructureBlockEntity;loadStructure(Lnet/minecraft/server/level/ServerLevel;ZLnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;)Z", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;placeInWorld(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/Random;I)Z" target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;placeInWorld(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Lnet/minecraft/util/RandomSource;I)Z"
)) ))
private boolean onStructurePlacen(StructureTemplate structure, ServerLevelAccessor serverWorldAccess, BlockPos pos, BlockPos blockPos, StructurePlaceSettings placementData, Random random, int i) private boolean onStructurePlacen(StructureTemplate structure, ServerLevelAccessor serverWorldAccess, BlockPos pos, BlockPos blockPos, StructurePlaceSettings placementData, RandomSource random, int i)
{ {
if(!CarpetSettings.fillUpdates) if(!CarpetSettings.fillUpdates)
CarpetSettings.impendingFillSkipUpdates.set(true); CarpetSettings.impendingFillSkipUpdates.set(true);
try try
{ {
return structure.placeInWorld(serverWorldAccess, pos, blockPos, placementData, random, i); // serverWorldAccess, pos, placementData, random); return structure.placeInWorld(serverWorldAccess, pos, blockPos, placementData, random, i);
} }
finally finally
{ {
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(StructureTemplate.class) @Mixin(StructureTemplate.class)
public class StructureTemplate_fillUpdatesMixin public class StructureTemplate_fillUpdatesMixin
{ {
@Redirect( method = "placeInWorld(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/Random;I)Z", at = @At( @Redirect( method = "placeInWorld", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/level/ServerLevelAccessor;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" target = "Lnet/minecraft/world/level/ServerLevelAccessor;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
)) ))
@@ -23,7 +23,7 @@ public class StructureTemplate_fillUpdatesMixin
serverWorldAccess.blockUpdated(pos, block); serverWorldAccess.blockUpdated(pos, block);
} }
@Redirect(method = "placeInWorld(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/Random;I)Z", at = @At( @Redirect(method = "placeInWorld", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;getKnownShape()Z" target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;getKnownShape()Z"
)) ))
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -14,9 +15,9 @@ public class WitherBoss_extremeMixin
{ {
@Redirect(method = "performRangedAttack(ILnet/minecraft/world/entity/LivingEntity;)V", at = @At( @Redirect(method = "performRangedAttack(ILnet/minecraft/world/entity/LivingEntity;)V", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Random;nextFloat()F") target = "Lnet/minecraft/util/RandomSource;nextFloat()F")
) )
private float nextFloatAmplfied(Random random) private float nextFloatAmplfied(RandomSource random)
{ {
if (CarpetSettings.extremeBehaviours) return random.nextFloat()/100; if (CarpetSettings.extremeBehaviours) return random.nextFloat()/100;
return random.nextFloat(); return random.nextFloat();
@@ -164,10 +164,11 @@ public class Auxiliary {
Vec3 vec = locator.vec; Vec3 vec = locator.vec;
double d0 = Math.pow(volume > 1.0F ? (double)(volume * 16.0F) : 16.0D, 2.0D); double d0 = Math.pow(volume > 1.0F ? (double)(volume * 16.0F) : 16.0D, 2.0D);
int count = 0; int count = 0;
long seed = cc.s.getLevel().getRandom().nextLong();
for (ServerPlayer player : cc.s.getLevel().getPlayers( (p) -> p.distanceToSqr(vec) < d0)) for (ServerPlayer player : cc.s.getLevel().getPlayers( (p) -> p.distanceToSqr(vec) < d0))
{ {
count++; count++;
player.connection.send(new ClientboundCustomSoundPacket(soundName, mixer, vec, volume, pitch)); player.connection.send(new ClientboundCustomSoundPacket(soundName, mixer, vec, volume, pitch, seed));
} }
return new NumericValue(count); return new NumericValue(count);
}); });
@@ -39,6 +39,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@@ -716,7 +717,7 @@ public class ShapeDispatcher
{ {
ParticleOptions particle = replacementParticle(); ParticleOptions particle = replacementParticle();
int partno = Math.min(1000,20*subdivisions); int partno = Math.min(1000,20*subdivisions);
Random rand = p.level.getRandom(); RandomSource rand = p.level.getRandom();
ServerLevel world = p.getLevel(); ServerLevel world = p.getLevel();
Vec3 ccenter = relativiseRender(world, center, 0 ); Vec3 ccenter = relativiseRender(world, center, 0 );
@@ -794,7 +795,7 @@ public class ShapeDispatcher
{ {
ParticleOptions particle = replacementParticle(); ParticleOptions particle = replacementParticle();
int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height))); int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height)));
Random rand = p.level.getRandom(); RandomSource rand = p.level.getRandom();
ServerLevel world = p.getLevel(); ServerLevel world = p.getLevel();
Vec3 ccenter = relativiseRender(world, center, 0 ); Vec3 ccenter = relativiseRender(world, center, 0 );
@@ -1312,7 +1313,7 @@ public class ShapeDispatcher
int pcount = 0; int pcount = 0;
if (distance < 100) if (distance < 100)
{ {
Random rand = players.get(0).level.random; RandomSource rand = players.get(0).level.random;
int particles = (int)(distance/density)+1; int particles = (int)(distance/density)+1;
Vec3 towards = to.subtract(from); Vec3 towards = to.subtract(from);
for (int i = 0; i < particles; i++) for (int i = 0; i < particles; i++)
+2 -3
View File
@@ -1,12 +1,11 @@
package carpet.utils; package carpet.utils;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.util.RandomSource;
import java.util.Random;
public class RandomTools public class RandomTools
{ {
public static double nextGauBian(Random random) public static double nextGauBian(RandomSource random)
{ {
if (CarpetSettings.extremeBehaviours) if (CarpetSettings.extremeBehaviours)
{ {