Skip to content

Commit

Permalink
22w14a
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Apr 6, 2022
1 parent fca98c7 commit 812d361
Show file tree
Hide file tree
Showing 26 changed files with 74 additions and 51 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html
minecraft_version=22w13a
minecraft_version=22w14a
loader_version=0.13.3
fabric_version=0.49.4+1.19

Expand All @@ -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)
# 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]
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
release-extra-branch = true
release-extra-branch = false
# The name of the second branch to release
release-extra-branch-name = future
# The "name" or id of the Curseforge version for the secondary branch
# 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]
release-extra-curse-version = 1.19-Snapshot
release-extra-curse-version = Minecraft 1.19:1.19-Snapshot
3 changes: 2 additions & 1 deletion src/main/java/carpet/fakes/CoralFeatureInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;

public interface CoralFeatureInterface
{
boolean growSpecific(Level worldIn, Random random, BlockPos pos, BlockState blockUnder);
boolean growSpecific(Level worldIn, RandomSource random, BlockPos pos, BlockState blockUnder);
}
3 changes: 2 additions & 1 deletion src/main/java/carpet/helpers/FeatureGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BiomeTags;
import net.minecraft.util.RandomSource;
import net.minecraft.util.valueproviders.ConstantInt;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.biome.Biome;
Expand Down Expand Up @@ -354,7 +355,7 @@ public static boolean plopAnywhere(Structure structure, ServerLevel world, Block
{
return false;
}
Random rand = new Random(world.getRandom().nextInt());
RandomSource rand = RandomSource.create(world.getRandom().nextInt());
int j = pos.getX() >> 4;
int k = pos.getZ() >> 4;
long chId = ChunkPos.asLong(j, k);
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/carpet/helpers/OptimizedExplosion.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
Expand Down Expand Up @@ -230,7 +232,7 @@ public static void doExplosionB(Explosion e, boolean spawnParticles)
if (damagesTerrain)
{
ObjectArrayList<Pair<ItemStack, BlockPos>> objectArrayList = new ObjectArrayList<>();
Collections.shuffle(e.getToBlow(), world.random);
Util.shuffle(e.getToBlow(), world.random);

for (BlockPos blockpos : e.getToBlow())
{
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/AbstractArrow_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -43,7 +44,7 @@ public void neighborChanged(BlockState state, Level world, BlockPos pos, Block b
}

@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)) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/BlazeAttackGoal_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/Blaze_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/Containers_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -38,12 +39,12 @@ public boolean isValidBonemealTarget(BlockGetter var1, BlockPos var2, BlockState
&& 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -15,10 +16,10 @@
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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;
Expand Down Expand Up @@ -40,12 +41,12 @@ public boolean isValidBonemealTarget(BlockGetter var1, BlockPos var2, BlockState
&& 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/carpet/mixins/ExplosionAccessor.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -21,7 +22,7 @@ public interface ExplosionAccessor {
Level getLevel();

@Accessor
Random getRandom();
RandomSource getRandom();

@Accessor
double getX();
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/FishingHook_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/Mob_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/mixins/Projectile_extremeMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -22,9 +23,9 @@
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))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
Loading

0 comments on commit 812d361

Please sign in to comment.