22w14a
This commit is contained in:
1 parent
fca98c7b37
commit
812d361af2
26 files changed
+74
-51
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -14,9 +15,9 @@ public class AbstractArrow_extremeMixin
|
||||
// calculates damage
|
||||
@Redirect(method = "setEnchantmentEffectsFromEntity", expect = 1, at = @At(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -43,7 +44,7 @@ public class BarrierBlock_updateSuppressionBlockMixin extends Block {
|
||||
}
|
||||
|
||||
@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();
|
||||
BlockState stateAbove = world.getBlockState(posAbove);
|
||||
if (stateAbove.is(Blocks.ACTIVATOR_RAIL) && !stateAbove.getValue(PoweredRailBlock.POWERED)) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -12,9 +13,9 @@ public class BlazeAttackGoal_extremeMixin
|
||||
{
|
||||
@Redirect(method = "tick()V", expect = 2, at = @At(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -14,9 +15,9 @@ public class Blaze_extremeMixin
|
||||
// unused actually
|
||||
@Redirect(method = "customServerAiStep", expect = 1, at = @At(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.core.Registry;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void performBonemeal(ServerLevel worldIn, Random random, BlockPos pos, BlockState blockUnder)
|
||||
public void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
|
||||
{
|
||||
|
||||
CoralFeature coral;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.CoralFeatureInterface;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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
|
||||
{
|
||||
|
||||
@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
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import carpet.CarpetSettings;
|
||||
import carpet.fakes.CoralFeatureInterface;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -40,12 +41,12 @@ public abstract class CoralPlantBlock_renewableCoralMixin implements Bonemealabl
|
||||
&& 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;
|
||||
}
|
||||
|
||||
public void performBonemeal(ServerLevel worldIn, Random random, BlockPos pos, BlockState blockUnder)
|
||||
public void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
|
||||
{
|
||||
|
||||
CoralFeature coral;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -13,9 +14,9 @@ public class DefaultDispenseItemBehavior_extremeBehavioursMixin
|
||||
{
|
||||
@Redirect(method = "spawnItem", expect = 3, at = @At(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@@ -21,7 +22,7 @@ public interface ExplosionAccessor {
|
||||
Level getLevel();
|
||||
|
||||
@Accessor
|
||||
Random getRandom();
|
||||
RandomSource getRandom();
|
||||
|
||||
@Accessor
|
||||
double getX();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -13,9 +14,9 @@ public class Mob_extremeMixin
|
||||
{
|
||||
@Redirect(method = "finalizeSpawn", expect = 1, at = @At(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -22,9 +23,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
public abstract class SaplingBlock_desertShrubsMixin
|
||||
{
|
||||
@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)
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.utils.RandomTools;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -13,9 +14,9 @@ public class SkeletonTrapGoal_extremeMixin
|
||||
{
|
||||
@Redirect(method = "tick", expect = 2, at = @At(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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(
|
||||
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)
|
||||
CarpetSettings.impendingFillSkipUpdates.set(true);
|
||||
try
|
||||
{
|
||||
return structure.placeInWorld(serverWorldAccess, pos, blockPos, placementData, random, i); // serverWorldAccess, pos, placementData, random);
|
||||
return structure.placeInWorld(serverWorldAccess, pos, blockPos, placementData, random, i);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@Mixin(StructureTemplate.class)
|
||||
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",
|
||||
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);
|
||||
}
|
||||
|
||||
@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",
|
||||
target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;getKnownShape()Z"
|
||||
))
|
||||
|
||||
@@ -2,6 +2,7 @@ package carpet.mixins;
|
||||
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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(
|
||||
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;
|
||||
return random.nextFloat();
|
||||
|
||||
Reference in new issue
Block a user