Update deps and mappings.

This commit is contained in:
modmuss50 2022-05-21 19:00:33 +01:00
parent b0ddb4cc95
commit 0ba85b37cc
22 changed files with 108 additions and 110 deletions

View file

@ -15,12 +15,12 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView; import net.minecraft.world.BlockRenderView;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.blockentity.MultiblockWriter;
import java.util.Random; import net.minecraft.util.math.random.Random;
import java.util.function.BiPredicate; import java.util.function.BiPredicate;
/** /**
@ -47,7 +47,7 @@ record HologramRenderer(BlockRenderView view, MatrixStack matrix, VertexConsumer
} else { } else {
matrix.translate(-0.5, -0.5, -0.5); matrix.translate(-0.5, -0.5, -0.5);
VertexConsumer consumer = vertexConsumerProvider.getBuffer(RenderLayers.getBlockLayer(state)); VertexConsumer consumer = vertexConsumerProvider.getBuffer(RenderLayers.getBlockLayer(state));
blockRenderManager.renderBlock(state, OUT_OF_WORLD_POS, view, matrix, consumer, false, AbstractRandom.create()); blockRenderManager.renderBlock(state, OUT_OF_WORLD_POS, view, matrix, consumer, false, Random.create());
} }
matrix.pop(); matrix.pop();

View file

@ -29,10 +29,10 @@ import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.SuggestionProvider;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.command.argument.EntityArgumentType;
import net.minecraft.command.argument.ItemStackArgumentType; import net.minecraft.command.argument.ItemStackArgumentType;
@ -72,10 +72,10 @@ public class RebornCoreCommands {
CommandSource.suggestMatching(FabricLoader.getInstance().getAllMods().stream().map(modContainer -> modContainer.getMetadata().getId()), builder); CommandSource.suggestMatching(FabricLoader.getInstance().getAllMods().stream().map(modContainer -> modContainer.getMetadata().getId()), builder);
public static void setup() { public static void setup() {
CommandRegistrationCallback.EVENT.register(((dispatcher, isDedicated) -> RebornCoreCommands.addCommands(dispatcher))); CommandRegistrationCallback.EVENT.register((RebornCoreCommands::addCommands));
} }
private static void addCommands(CommandDispatcher<ServerCommandSource> dispatcher) { private static void addCommands(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess, CommandManager.RegistrationEnvironment environment) {
dispatcher.register( dispatcher.register(
literal("reborncore") literal("reborncore")
@ -108,14 +108,13 @@ public class RebornCoreCommands {
.executes(RebornCoreCommands::renderMod) .executes(RebornCoreCommands::renderMod)
) )
) )
// TODO 1.19: Waiting on https://github.com/FabricMC/fabric/pull/2227 .then(
// .then( literal("item")
// literal("item") .then(
// .then( argument("item", ItemStackArgumentType.itemStack(registryAccess))
// argument("item", ItemStackArgumentType.itemStack()) .executes(RebornCoreCommands::itemRenderer)
// .executes(RebornCoreCommands::itemRenderer) )
// ) )
// )
.then( .then(
literal("hand") literal("hand")
.executes(RebornCoreCommands::handRenderer) .executes(RebornCoreCommands::handRenderer)

View file

@ -3,11 +3,10 @@ package reborncore.common.util;
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOffer;
import net.minecraft.village.TradeOffers; import net.minecraft.village.TradeOffers;
import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerProfession;
@ -15,7 +14,6 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Arrays; import java.util.Arrays;
import java.util.Random;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public final class TradeUtils { public final class TradeUtils {
@ -57,7 +55,7 @@ public final class TradeUtils {
@Nullable @Nullable
@Override @Override
public TradeOffer create(Entity entity, AbstractRandom random) { public TradeOffer create(Entity entity, Random random) {
return copy(offer); return copy(offer);
} }
}; };

View file

@ -34,7 +34,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import net.minecraft.util.math.random.Random;
/** /**
* Created by Mark on 13/03/2016. * Created by Mark on 13/03/2016.
@ -59,7 +59,7 @@ public class WorldUtils {
public static void dropItem(ItemStack itemStack, World world, BlockPos pos) { public static void dropItem(ItemStack itemStack, World world, BlockPos pos) {
Random rand = new Random(); Random rand = Random.create();
float dX = rand.nextFloat() * 0.8F + 0.1F; float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F; float dY = rand.nextFloat() * 0.8F + 0.1F;

View file

@ -21,8 +21,11 @@
] ]
}, },
"mixins": [ "mixins": [
"reborncore.client.mixins.json", "reborncore.common.mixins.json",
"reborncore.common.mixins.json" {
"config": "reborncore.client.mixins.json",
"environment": "client"
}
], ],
"depends": { "depends": {
"fabricloader": ">=0.14.6", "fabricloader": ">=0.14.6",

View file

@ -208,11 +208,13 @@ dependencies {
include project(":RebornCore") include project(":RebornCore")
// Blocked on https://github.com/shedaniel/RoughlyEnoughItems/issues/856 optionalDependency "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
disabledOptionalDependency "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
disabledOptionalDependency "com.github.emilyploszaj:trinkets:${project.trinkets_version}" disabledOptionalDependency "com.github.emilyploszaj:trinkets:${project.trinkets_version}"
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}" disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"
// REI's deps depend on the deprecated command module.
modRuntimeOnly "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fapi_version}"
// Use groovy for datagen/gametest, if you are copying this you prob dont want it. // Use groovy for datagen/gametest, if you are copying this you prob dont want it.
gametestImplementation 'org.apache.groovy:groovy:4.0.1' gametestImplementation 'org.apache.groovy:groovy:4.0.1'
datagenImplementation 'org.apache.groovy:groovy:4.0.1' datagenImplementation 'org.apache.groovy:groovy:4.0.1'

View file

@ -7,12 +7,12 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.19-pre1 minecraft_version=1.19-pre1
yarn_version=1.19-pre1+build.1 yarn_version=1.19-pre1+build.7
loader_version=0.14.6 loader_version=0.14.6
fapi_version=0.52.4+1.19 fapi_version=0.53.1+1.19
# Dependencies # Dependencies
energy_version=2.2.0 energy_version=2.2.0
rei_version=9.0.458 rei_version=9.0.462
trinkets_version=3.0.2 trinkets_version=3.0.2
dashloader_version=2.0 dashloader_version=2.0

View file

@ -46,7 +46,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView; import net.minecraft.world.BlockRenderView;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.client.RenderUtil; import reborncore.client.RenderUtil;
@ -66,7 +66,7 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
public abstract ModelIdentifier getFluidModel(); public abstract ModelIdentifier getFluidModel();
@Override @Override
public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) { public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
Fluid fluid = Fluids.EMPTY; Fluid fluid = Fluids.EMPTY;
if (stack.getItem() instanceof ItemFluidInfo fluidInfo) { if (stack.getItem() instanceof ItemFluidInfo fluidInfo) {
fluid = fluidInfo.getFluid(stack); fluid = fluidInfo.getFluid(stack);
@ -106,12 +106,12 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
} }
@Override @Override
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) { public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
} }
@Override @Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, AbstractRandom random) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, Random random) {
return Collections.emptyList(); return Collections.emptyList();
} }

View file

@ -32,7 +32,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.ModelIdentifier; import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import techreborn.TechReborn; import techreborn.TechReborn;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -45,7 +45,7 @@ public class DynamicCellBakedModel extends BaseDynamicFluidBakedModel {
private static final ModelIdentifier CELL_GLASS = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory"); private static final ModelIdentifier CELL_GLASS = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory");
@Override @Override
public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) { public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
super.emitItemQuads(stack, randomSupplier, context); super.emitItemQuads(stack, randomSupplier, context);
BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager(); BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager();

View file

@ -34,11 +34,11 @@ import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import techreborn.blockentity.cable.CableBlockEntity; import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blocks.cable.CableBlock; import techreborn.blocks.cable.CableBlock;
import java.util.Random; import net.minecraft.util.math.random.Random;
public class CableCoverRenderer implements BlockEntityRenderer<CableBlockEntity> { public class CableCoverRenderer implements BlockEntityRenderer<CableBlockEntity> {
@ -57,7 +57,7 @@ public class CableCoverRenderer implements BlockEntityRenderer<CableBlockEntity>
final BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager(); final BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();
BlockState coverState = blockEntity.getCover() != null ? blockEntity.getCover() : Blocks.OAK_PLANKS.getDefaultState(); BlockState coverState = blockEntity.getCover() != null ? blockEntity.getCover() : Blocks.OAK_PLANKS.getDefaultState();
VertexConsumer consumer = vertexConsumers.getBuffer(RenderLayers.getBlockLayer(coverState)); VertexConsumer consumer = vertexConsumers.getBuffer(RenderLayers.getBlockLayer(coverState));
blockRenderManager.renderBlock(coverState, blockEntity.getPos(), blockEntity.getWorld(), matrices, consumer, true, AbstractRandom.create()); blockRenderManager.renderBlock(coverState, blockEntity.getPos(), blockEntity.getWorld(), matrices, consumer, true, Random.create());
} }
} }

View file

@ -30,13 +30,12 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.blockentity.GuiType; import techreborn.blockentity.GuiType;
import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity; import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity;
import techreborn.blocks.GenericMachineBlock; import techreborn.blocks.GenericMachineBlock;
import java.util.Random;
public class IronAlloyFurnaceBlock extends GenericMachineBlock { public class IronAlloyFurnaceBlock extends GenericMachineBlock {
public IronAlloyFurnaceBlock() { public IronAlloyFurnaceBlock() {
@ -44,6 +43,7 @@ public class IronAlloyFurnaceBlock extends GenericMachineBlock {
} }
// Block // Block
@Override
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (!isActive(stateIn)) { if (!isActive(stateIn)) {
return; return;

View file

@ -30,13 +30,12 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.blockentity.GuiType; import techreborn.blockentity.GuiType;
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
import techreborn.blocks.GenericMachineBlock; import techreborn.blocks.GenericMachineBlock;
import java.util.Random;
public class IronFurnaceBlock extends GenericMachineBlock { public class IronFurnaceBlock extends GenericMachineBlock {
public IronFurnaceBlock() { public IronFurnaceBlock() {
@ -44,6 +43,7 @@ public class IronFurnaceBlock extends GenericMachineBlock {
} }
// Block // Block
@Override
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (!isActive(stateIn)) { if (!isActive(stateIn)) {
return; return;

View file

@ -43,7 +43,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.common.util.WorldUtils; import reborncore.common.util.WorldUtils;
@ -54,7 +54,7 @@ import techreborn.init.TRContent;
import techreborn.items.tool.TreeTapItem; import techreborn.items.tool.TreeTapItem;
import techreborn.items.tool.basic.ElectricTreetapItem; import techreborn.items.tool.basic.ElectricTreetapItem;
import java.util.Random; import net.minecraft.util.math.random.Random;
/** /**
* Created by modmuss50 on 19/02/2016. * Created by modmuss50 on 19/02/2016.
@ -112,7 +112,7 @@ public class BlockRubberLog extends PillarBlock {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, AbstractRandom random) { public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
super.randomTick(state, worldIn, pos, random); super.randomTick(state, worldIn, pos, random);
if (state.get(AXIS) != Direction.Axis.Y) return; if (state.get(AXIS) != Direction.Axis.Y) return;
if (!state.get(SHOULD_SAP)) return; if (!state.get(SHOULD_SAP)) return;

View file

@ -46,7 +46,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.items.DynamicCellItem; import techreborn.items.DynamicCellItem;
import java.util.List; import java.util.List;
import java.util.Random; import net.minecraft.util.math.random.Random;
/** /**
* Created by drcrazy on 10-Jan-20 for TechReborn-1.15. * Created by drcrazy on 10-Jan-20 for TechReborn-1.15.
@ -58,7 +58,7 @@ public class TRDispenserBehavior {
DispenserBlock.registerBehavior(TRContent.SCRAP_BOX, new ItemDispenserBehavior() { DispenserBlock.registerBehavior(TRContent.SCRAP_BOX, new ItemDispenserBehavior() {
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(pointer.getWorld()); List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(pointer.getWorld());
int random = new Random().nextInt(scrapboxRecipeList.size()); int random = Random.create().nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0).copy(); ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0).copy();
stack.split(1); stack.split(1);

View file

@ -27,7 +27,7 @@ package techreborn.init.template;
import com.mojang.brigadier.Command; import com.mojang.brigadier.Command;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -46,7 +46,7 @@ import static net.minecraft.server.command.CommandManager.literal;
public class TechRebornTemplates { public class TechRebornTemplates {
public static void init() { public static void init() {
CommandRegistrationCallback.EVENT.register((dispatcher, b) -> dispatcher.register( CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(
literal("techreborn") literal("techreborn")
.then(literal("template") .then(literal("template")
.requires(source -> source.hasPermissionLevel(3)) .requires(source -> source.hasPermissionLevel(3))

View file

@ -38,7 +38,7 @@ import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.utils.InitUtils; import techreborn.utils.InitUtils;
import java.util.Random; import net.minecraft.util.math.random.Random;
public class ChainsawItem extends AxeItem implements RcEnergyItem { public class ChainsawItem extends AxeItem implements RcEnergyItem {
@ -72,8 +72,7 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
// MiningToolItem // MiningToolItem
@Override @Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) { public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random(); if (worldIn.getRandom().nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
tryUseEnergy(stack, cost); tryUseEnergy(stack, cost);
} }
return true; return true;

View file

@ -40,7 +40,7 @@ import techreborn.TechReborn;
import techreborn.utils.InitUtils; import techreborn.utils.InitUtils;
import techreborn.utils.ToolsUtil; import techreborn.utils.ToolsUtil;
import java.util.Random; import net.minecraft.util.math.random.Random;
public class JackhammerItem extends PickaxeItem implements RcEnergyItem { public class JackhammerItem extends PickaxeItem implements RcEnergyItem {
public final int maxCharge; public final int maxCharge;
@ -85,8 +85,7 @@ public class JackhammerItem extends PickaxeItem implements RcEnergyItem {
// MiningToolItem // MiningToolItem
@Override @Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) { public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random(); if (worldIn.getRandom().nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
tryUseEnergy(stack, cost); tryUseEnergy(stack, cost);
} }
return true; return true;

View file

@ -41,7 +41,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRToolMaterials; import techreborn.init.TRToolMaterials;
import java.util.Random; import net.minecraft.util.math.random.Random;
public class RockCutterItem extends PickaxeItem implements RcEnergyItem { public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
@ -72,8 +72,7 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
// MiningToolItem // MiningToolItem
@Override @Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) { public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random(); if (worldIn.getRandom().nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
tryUseEnergy(stack, cost); tryUseEnergy(stack, cost);
} }
return true; return true;

View file

@ -41,7 +41,7 @@ import reborncore.common.powerSystem.RcEnergyItem;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import net.minecraft.util.math.random.Random;
import java.util.Set; import java.util.Set;
/** /**
@ -56,8 +56,7 @@ public class ToolsUtil {
if (blockState.getHardness(world, pos) == -1.0F) { if (blockState.getHardness(world, pos) == -1.0F) {
return; return;
} }
Random rand = new Random(); if (world.getRandom().nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, tool) + 1) == 0) {
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, tool) + 1) == 0) {
if (!((RcEnergyItem) tool.getItem()).tryUseEnergy(tool, cost)) { if (!((RcEnergyItem) tool.getItem()).tryUseEnergy(tool, cost)) {
return; return;
} }

View file

@ -25,18 +25,18 @@
package techreborn.world; package techreborn.world;
import net.minecraft.block.sapling.SaplingGenerator; import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.util.math.random.AbstractRandom; import net.minecraft.util.math.random.Random;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.RegistryEntry; import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Random; import net.minecraft.util.math.random.Random;
public class RubberSaplingGenerator extends SaplingGenerator { public class RubberSaplingGenerator extends SaplingGenerator {
@Nullable @Nullable
@Override @Override
protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(AbstractRandom random, boolean bees) { protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(Random random, boolean bees) {
return WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, WorldGenerator.RUBBER_TREE_FEATURE); return WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, WorldGenerator.RUBBER_TREE_FEATURE);
} }
} }

View file

@ -37,7 +37,7 @@ import net.minecraft.world.gen.treedecorator.TreeDecoratorType;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Random; import net.minecraft.util.math.random.Random;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
public class RubberTreeSpikeDecorator extends TreeDecorator { public class RubberTreeSpikeDecorator extends TreeDecorator {

View file

@ -19,7 +19,7 @@
"client": [ "client": [
"techreborn.TechRebornClient" "techreborn.TechRebornClient"
], ],
"rei": [ "rei_client": [
"techreborn.client.compat.rei.ReiPlugin" "techreborn.client.compat.rei.ReiPlugin"
] ]
}, },