first pass on 1.16.2 - no world gen

This commit is contained in:
modmuss50 2020-07-29 19:42:39 +01:00
parent ec1ae17134
commit 6e0fc6af61
49 changed files with 139 additions and 138 deletions

View file

@ -10,7 +10,7 @@ buildscript {
}
}
dependencies {
classpath "net.fabricmc:fabric-loom:0.4-SNAPSHOT"
classpath "net.fabricmc:fabric-loom:0.5-SNAPSHOT"
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
classpath 'de.undercouch:gradle-download-task:3.4.3'
}
@ -73,14 +73,14 @@ configurations.all {
}
dependencies {
minecraft "com.mojang:minecraft:1.16.1"
mappings "net.fabricmc:yarn:1.16.1+build.1:v2"
minecraft "com.mojang:minecraft:1.16.2-pre1"
mappings "net.fabricmc:yarn:1.16.2-pre1+build.1:v2"
modImplementation "net.fabricmc:fabric-loader:0.9.0+build.204"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:0.16.0+build.384-1.16.1"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.16.1+build.387-1.16"
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.10.2")
disabledOptionalDependency ("me.shedaniel:RoughlyEnoughItems:4.10.2")
disabledOptionalDependency ('io.github.cottonmc:LibCD:2.4.1+1.15.2')
disabledOptionalDependency ('com.github.emilyploszaj:trinkets:2.6.0')
@ -90,8 +90,6 @@ dependencies {
}
include rcVersion
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
modApi 'teamreborn:energy:0.1.0'
}

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -69,7 +69,7 @@ import techreborn.items.armor.BatpackItem;
import techreborn.items.tool.ChainsawItem;
import techreborn.items.tool.industrial.NanosaberItem;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

View file

@ -24,7 +24,7 @@
package techreborn.api.generator;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
public enum EFluidGenerator {
THERMAL("TechReborn.ThermalGenerator"),
@ -33,14 +33,14 @@ public enum EFluidGenerator {
SEMIFLUID("TechReborn.SemifluidGenerator"),
PLASMA("TechReborn.PlasmaGenerator");
@Nonnull
@NotNull
private final String recipeID;
EFluidGenerator(@Nonnull String recipeID) {
EFluidGenerator(@NotNull String recipeID) {
this.recipeID = recipeID;
}
@Nonnull
@NotNull
public String getRecipeID() {
return recipeID;
}

View file

@ -48,7 +48,7 @@ import reborncore.common.util.serialization.SerializationUtil;
import techreborn.blockentity.machine.GenericMachineBlockEntity;
import techreborn.init.ModRecipes;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;

View file

@ -45,7 +45,7 @@ import techreborn.api.generator.FluidGeneratorRecipeList;
import techreborn.api.generator.GeneratorRecipeHelper;
import techreborn.utils.FluidUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider {

View file

@ -44,7 +44,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider, BuiltScreenHandlerProvider {
@ -63,7 +63,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
super(TRBlockEntities.SOLID_FUEL_GENEREATOR);
}
public static int getItemBurnTime(@Nonnull ItemStack stack) {
public static int getItemBurnTime(@NotNull ItemStack stack) {
if (stack.isEmpty()) {
return 0;
}

View file

@ -37,7 +37,7 @@ import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
import techreborn.init.TRBlockEntities;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class DrainBlockEntity extends MachineBaseBlockEntity {

View file

@ -44,7 +44,7 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
/**
* @author drcrazy

View file

@ -45,7 +45,7 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider {

View file

@ -45,7 +45,7 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider {

View file

@ -51,7 +51,7 @@ import techreborn.init.ModSounds;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View file

@ -49,7 +49,7 @@ import techreborn.init.ModRecipes;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -66,7 +66,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
public RebornInventory<RollingMachineBlockEntity> inventory = new RebornInventory<>(12, "RollingMachineBlockEntity", 64, this);
public boolean isRunning;
public int tickTime;
@Nonnull
@NotNull
public ItemStack currentRecipeOutput;
public RollingMachineRecipe currentRecipe;
private final int outputSlot;

View file

@ -46,7 +46,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IToolDrop, InventoryProvider, BuiltScreenHandlerProvider {

View file

@ -30,7 +30,7 @@ import net.minecraft.world.PersistentState;
import net.minecraft.world.World;
import reborncore.common.util.NBTSerializable;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
public class IDSUManager extends PersistentState {
@ -41,7 +41,7 @@ public class IDSUManager extends PersistentState {
super(KEY);
}
@Nonnull
@NotNull
public static IDSUPlayer getPlayer(World world, String uuid) {
return get(world).getPlayer(uuid);
}
@ -53,7 +53,7 @@ public class IDSUManager extends PersistentState {
private final HashMap<String, IDSUPlayer> playerHashMap = new HashMap<>();
@Nonnull
@NotNull
public IDSUPlayer getPlayer(String uuid) {
return playerHashMap.computeIfAbsent(uuid, s -> new IDSUPlayer());
}
@ -82,7 +82,7 @@ public class IDSUManager extends PersistentState {
read(compoundTag);
}
@Nonnull
@NotNull
@Override
public CompoundTag write() {
CompoundTag tag = new CompoundTag();
@ -91,7 +91,7 @@ public class IDSUManager extends PersistentState {
}
@Override
public void read(@Nonnull CompoundTag tag) {
public void read(@NotNull CompoundTag tag) {
energy = tag.getDouble("energy");
}

View file

@ -48,7 +48,7 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider {
@ -164,7 +164,7 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
.sync(tank).addInventory().create(this, syncID);
}
@Nonnull
@NotNull
@Override
public Tank getTank() {
return tank;

View file

@ -48,7 +48,7 @@ import reborncore.common.util.WorldUtils;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider {

View file

@ -61,7 +61,7 @@ import techreborn.init.ModSounds;
import techreborn.init.TRContent;
import techreborn.utils.damageSources.ElectrialShockSource;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;

View file

@ -47,7 +47,7 @@ import net.minecraft.world.World;
import reborncore.api.ToolManager;
import techreborn.init.ModSounds;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class BlockFusionCoil extends Block {
@ -80,9 +80,9 @@ public class BlockFusionCoil extends Block {
@Environment(EnvType.CLIENT)
@Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip,
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip,
TooltipContext flagIn) {
super.buildTooltip(stack, worldIn, tooltip, flagIn);
super.appendTooltip(stack, worldIn, tooltip, flagIn);
// TODO: Translate
tooltip.add(new LiteralText("Right click Fusion Control computer to auto place"));
}

View file

@ -48,7 +48,7 @@ import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.util.WrenchUtils;
import techreborn.blockentity.lighting.LampBlockEntity;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class BlockLamp extends BaseBlockEntityProvider {

View file

@ -51,7 +51,7 @@ import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.util.WrenchUtils;
import techreborn.blockentity.machine.misc.AlarmBlockEntity;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class BlockAlarm extends BaseBlockEntityProvider {
@ -161,7 +161,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
@Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TranslatableText("techreborn.tooltip.alarm").formatted(Formatting.GRAY));
}

View file

@ -73,7 +73,7 @@ import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.client.gui.*;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

View file

@ -74,7 +74,7 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
.collect(Collectors.toList());
matrixStack.push();
renderTooltip(matrixStack, list, mouseX, mouseY);
method_30901(matrixStack, list, mouseX, mouseY);
matrixStack.pop();
}
}
@ -97,7 +97,7 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
.collect(Collectors.toList());
RenderSystem.pushMatrix();
renderTooltip(matrixStack, list, mouseX - getGuiLeft(), mouseY - getGuiTop());
method_30901(matrixStack, list, mouseX - getGuiLeft(), mouseY - getGuiTop());
RenderSystem.popMatrix();
}
}

View file

@ -93,7 +93,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
List<Text> list = new ArrayList<>();
list.add(new LiteralText(message));
renderTooltip(matrixStack, list, mouseX, mouseY);
method_30901(matrixStack, list, mouseX, mouseY);
GlStateManager.disableLighting();
GlStateManager.color4f(1, 1, 1, 1);

View file

@ -87,10 +87,10 @@ public class GuiManual extends Screen {
int centerX = (width / 2) - guiWidth / 2;
int centerY = (height / 2) - guiHeight / 2;
drawTexture(matrixStack, centerX, centerY, 0, 0, guiWidth, guiHeight);
textRenderer.draw(matrixStack, text1, ((width / 2) - textRenderer.getWidth(text1) / 2), centerY + 40, 4210752);
textRenderer.draw(matrixStack, text2, ((width / 2) - textRenderer.getWidth(text2) / 2), centerY + 90, 4210752);
textRenderer.method_30883(matrixStack, text1, ((width / 2) - textRenderer.getWidth(text1) / 2), centerY + 40, 4210752);
textRenderer.method_30883(matrixStack, text2, ((width / 2) - textRenderer.getWidth(text2) / 2), centerY + 90, 4210752);
if (TechRebornConfig.allowManualRefund) {
textRenderer.draw(matrixStack, text3, ((width / 2) - textRenderer.getWidth(text3) / 2), centerY + 140, 4210752);
textRenderer.method_30883(matrixStack, text3, ((width / 2) - textRenderer.getWidth(text3) / 2), centerY + 140, 4210752);
}
super.render(matrixStack, mouseX, mouseY, partialTicks);
}

View file

@ -66,19 +66,19 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
int storedAmount = storageEntity.storedAmount;
if (storedAmount == 0 && !storageEntity.isLocked()) {
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else {
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.store"), 10, 20, 4210752);
textRenderer.draw(matrixStack, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.storage.store"), 10, 20, 4210752);
textRenderer.method_30883(matrixStack, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.amount"), 10, 50, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.storage.amount"), 10, 50, 4210752);
textRenderer.draw(matrixStack, String.valueOf(storedAmount), 10, 60, 4210752);
String percentFilled = String.valueOf((int) ((double) storedAmount / (double) storageEntity.getMaxCapacity() * 100));
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
}
}

View file

@ -64,20 +64,20 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
FluidInstance fluid = tankEntity.getTank().getFluidInstance();
if (fluid.isEmpty()) {
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else {
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.type"), 10, 20, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.tank.type"), 10, 20, 4210752);
textRenderer.draw(matrixStack, FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.amount"), 10, 50, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.tank.amount"), 10, 50, 4210752);
textRenderer.draw(matrixStack, fluid.getAmount().toString(), 10, 60, 4210752);
String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getCapacity().getRawValue() * 100));
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
textRenderer.method_30883(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
}
}

View file

@ -49,7 +49,7 @@ import net.minecraft.world.BlockRenderView;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.util.Color;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Random;

View file

@ -36,7 +36,7 @@ import net.minecraft.util.math.MathHelper;
import techreborn.entities.EntityNukePrimed;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
/**
* Created by Mark on 13/03/2016.
@ -69,7 +69,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
matrixStack.translate(-0.5D, -0.5D, 0.5D);
TntMinecartEntityRenderer.method_23190(TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuseTimer() / 5 % 2 == 0);
TntMinecartEntityRenderer.renderFlashingBlock(TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuseTimer() / 5 % 2 == 0);
matrixStack.pop();
super.render(entity, f, g, matrixStack, vertexConsumerProvider, i);
}

View file

@ -71,9 +71,9 @@ public class TRRecipeParser {
return new FluidIngredient(fluid, Optional.empty(), amount);
} else if (in.indexOf('#') == 0) {
Identifier id = new Identifier(in.substring(1));
Tag<Item> itemTag = ItemTags.getContainer().get(id);
Tag<Item> itemTag = ItemTags.getTagGroup().getTag(id);
if (itemTag == null) throw new CDSyntaxError("Failed to get item tag for input: " + in);
return new TagIngredient(id, ItemTags.getContainer().get(id), amount);
return new TagIngredient(id, ItemTags.getTagGroup().getTag(id), amount);
} else {
ItemStack stack;
Optional<CompoundTag> tag = Optional.empty();

View file

@ -81,7 +81,7 @@ import techreborn.items.armor.QuantumSuitItem;
import techreborn.items.tool.MiningLevel;
import techreborn.utils.InitUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Stream;

View file

@ -64,7 +64,7 @@ import techreborn.TechReborn;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
/**
* Created by modmuss50 on 17/05/2016.

View file

@ -45,7 +45,7 @@ import reborncore.common.util.ChatUtils;
import techreborn.TechReborn;
import techreborn.utils.MessageIDs;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Optional;

View file

@ -40,8 +40,8 @@ import reborncore.common.recipes.IUpgradeHandler;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class UpgradeItem extends Item implements IUpgrade {
@ -57,10 +57,10 @@ public class UpgradeItem extends Item implements IUpgrade {
@Override
public void process(
@Nonnull MachineBaseBlockEntity blockEntity,
@NotNull MachineBaseBlockEntity blockEntity,
@Nullable
IUpgradeHandler handler,
@Nonnull
@NotNull
ItemStack stack) {
behavior.process(blockEntity, handler, stack);
}

View file

@ -45,7 +45,7 @@ import techreborn.TechReborn;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blocks.cable.CableBlock;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class PaintingToolItem extends Item {

View file

@ -47,7 +47,7 @@ import techreborn.items.tool.MiningLevel;
import techreborn.utils.MessageIDs;
import techreborn.utils.ToolsUtil;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Set;

View file

@ -50,7 +50,7 @@ import techreborn.utils.MessageIDs;
import techreborn.utils.TagUtils;
import techreborn.utils.ToolsUtil;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;

View file

@ -52,7 +52,7 @@ import techreborn.utils.InitUtils;
import techreborn.utils.MessageIDs;
import techreborn.utils.ToolsUtil;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class IndustrialDrillItem extends DrillItem {

View file

@ -53,7 +53,7 @@ import techreborn.items.tool.MiningLevel;
import techreborn.utils.MessageIDs;
import techreborn.utils.ToolsUtil;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Set;

View file

@ -56,7 +56,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.utils.MessageIDs;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {

View file

@ -52,7 +52,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class OmniToolItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {

View file

@ -37,13 +37,13 @@ import reborncore.common.fluid.container.GenericFluidContainer;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.mixin.common.AccessorFluidBlock;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
public class FluidUtils {
@Nonnull
@NotNull
public static Fluid fluidFromBlock(Block block) {
if (block instanceof AccessorFluidBlock) {
return ((AccessorFluidBlock) block).getFluid();
@ -133,11 +133,11 @@ public class FluidUtils {
return true;
}
public static boolean fluidEquals(@Nonnull Fluid fluid, @Nonnull Fluid fluid1) {
public static boolean fluidEquals(@NotNull Fluid fluid, @NotNull Fluid fluid1) {
return fluid == fluid1;
}
public static FluidInstance getFluidStackInContainer(@Nonnull ItemStack invStack) {
public static FluidInstance getFluidStackInContainer(@NotNull ItemStack invStack) {
return null;
}

View file

@ -30,12 +30,12 @@ import net.minecraft.recipe.RecipeType;
import net.minecraft.world.World;
import techreborn.items.DynamicCellItem;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
public class RecipeUtils {
@Nonnull
@NotNull
public static ItemStack getEmptyCell(int stackSize) {
return DynamicCellItem.getEmptyCell(stackSize);
}

View file

@ -28,7 +28,8 @@ import net.minecraft.block.Block;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagContainer;
import net.minecraft.tag.TagGroup;
import net.minecraft.tag.TagGroupLoader;
import net.minecraft.world.World;
public class TagUtils {
@ -37,15 +38,15 @@ public class TagUtils {
return tag.contains(type);
}
public static TagContainer<Block> getAllBlockTags(World world) {
return world.getTagManager().blocks();
public static TagGroup<Block> getAllBlockTags(World world) {
return world.getTagManager().getBlocks();
}
public static TagContainer<Item> getAllItemTags(World world) {
return world.getTagManager().items();
public static TagGroup<Item> getAllItemTags(World world) {
return world.getTagManager().getItems();
}
public static TagContainer<Fluid> getAllFluidTags(World world) {
return world.getTagManager().fluids();
public static TagGroup<Fluid> getAllFluidTags(World world) {
return world.getTagManager().getFluids();
}
}

View file

@ -39,7 +39,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import team.reborn.energy.Energy;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.HashSet;
import java.util.Random;

View file

@ -28,7 +28,7 @@ import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.Random;
public class RubberSaplingGenerator extends SaplingGenerator {

View file

@ -7,6 +7,7 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.DecoratorContext;
import java.util.Random;
import java.util.stream.IntStream;
@ -20,7 +21,7 @@ public class RubberTreeDecorator extends Decorator<ChanceDecoratorConfig> {
}
@Override
public Stream<BlockPos> getPositions(WorldAccess world, ChunkGenerator generator, Random random, ChanceDecoratorConfig config, BlockPos pos) {
public Stream<BlockPos> getPositions(DecoratorContext context, Random random, ChanceDecoratorConfig config, BlockPos pos) {
// Generate tree clusters randomly
if (random.nextInt(config.chance) == 0) {
// Generate 4 - 8 trees
@ -28,7 +29,7 @@ public class RubberTreeDecorator extends Decorator<ChanceDecoratorConfig> {
return IntStream.range(0, treeCount).mapToObj((i) -> {
int x = random.nextInt(16) + pos.getX();
int z = random.nextInt(16) + pos.getZ();
int y = world.getTopY(Heightmap.Type.MOTION_BLOCKING, x, z);
int y = context.getTopY(Heightmap.Type.MOTION_BLOCKING, x, z);
return new BlockPos(x, y, z);
});
}

View file

@ -29,6 +29,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ModifiableTestableWorld;
import net.minecraft.world.gen.UniformIntDistribution;
import net.minecraft.world.gen.feature.TreeFeature;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
@ -49,8 +50,8 @@ public class RubberTreeFeature extends TreeFeature {
public static class FoliagePlacer extends BlobFoliagePlacer {
public FoliagePlacer(int radius, int randomRadius, int offset, int randomOffset, int height) {
super(radius, randomRadius, offset, randomOffset, height);
public FoliagePlacer(UniformIntDistribution uniformIntDistribution, UniformIntDistribution uniformIntDistribution2, int height) {
super(uniformIntDistribution, uniformIntDistribution2, height);
}
@Override

View file

@ -24,27 +24,25 @@
package techreborn.world;
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
import net.minecraft.block.Blocks;
import net.minecraft.structure.rule.BlockStateMatchRuleTest;
import net.minecraft.structure.rule.RuleTest;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.UniformIntDistribution;
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;
import reborncore.common.world.CustomOreFeature;
import reborncore.common.world.CustomOreFeatureConfig;
import techreborn.blocks.misc.BlockRubberLog;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
@ -52,6 +50,7 @@ import techreborn.init.TRContent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
* @author drcrazy
@ -60,25 +59,25 @@ public class WorldGenerator {
public static Feature<TreeFeatureConfig> RUBBER_TREE_FEATURE;
public static RubberTreeDecorator RUBBER_TREE_DECORATOR;
public static TreeFeatureConfig RUBBER_TREE_CONFIG;
private static final RuleTest END_STONE = new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState());
private static final List<Biome> checkedBiomes = new ArrayList<>();
public static void initBiomeFeatures() {
setupTrees();
for (Biome biome : Registry.BIOME) {
addToBiome(biome);
}
//Handles modded biomes
RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> addToBiome(biome));
//
// for (Biome biome : Registry.BIOME) {
// addToBiome(biome);
// }
//
// //Handles modded biomes
// RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> addToBiome(biome));
}
private static void setupTrees() {
RUBBER_TREE_FEATURE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(TreeFeatureConfig.CODEC));
RUBBER_TREE_DECORATOR = Registry.register(Registry.DECORATOR, new Identifier("techreborn:rubber_tree"), new RubberTreeDecorator(ChanceDecoratorConfig.field_24980));
RUBBER_TREE_DECORATOR = Registry.register(Registry.DECORATOR, new Identifier("techreborn:rubber_tree"), new RubberTreeDecorator(ChanceDecoratorConfig.CODEC));
WeightedBlockStateProvider logProvider = new WeightedBlockStateProvider();
logProvider.addState(TRContent.RUBBER_LOG.getDefaultState(), 10);
@ -94,7 +93,7 @@ public class WorldGenerator {
RUBBER_TREE_CONFIG = new TreeFeatureConfig.Builder(
logProvider,
new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()),
new RubberTreeFeature.FoliagePlacer(2, 0, 0, 0, 3),
new RubberTreeFeature.FoliagePlacer(UniformIntDistribution.of(2, 0), UniformIntDistribution.of(0, 0), 3),
new StraightTrunkPlacer(TechRebornConfig.rubberTreeBaseHeight, 3, 0),
new TwoLayersFeatureSize(1, 0, 1)
).build();
@ -109,60 +108,60 @@ public class WorldGenerator {
if (biome.getCategory() == Category.NETHER) {
if (TechRebornConfig.enableCinnabarOre) {
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.CINNABAR);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_NETHER, TRContent.Ores.CINNABAR);
}
if (TechRebornConfig.enablePyriteOre) {
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.PYRITE);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_NETHER, TRContent.Ores.PYRITE);
}
if (TechRebornConfig.enableSphaleriteOre) {
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.SPHALERITE);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_NETHER, TRContent.Ores.SPHALERITE);
}
} else if (biome.getCategory() == Category.THEEND) {
if (TechRebornConfig.enablePeridotOre) {
addEndOre(biome, TRContent.Ores.PERIDOT);
addOre(biome, END_STONE, TRContent.Ores.PERIDOT);
}
if (TechRebornConfig.enableSheldoniteOre) {
addEndOre(biome, TRContent.Ores.SHELDONITE);
addOre(biome, END_STONE, TRContent.Ores.SHELDONITE);
}
if (TechRebornConfig.enableSodaliteOre) {
addEndOre(biome, TRContent.Ores.SODALITE);
addOre(biome, END_STONE, TRContent.Ores.SODALITE);
}
if (TechRebornConfig.enableTungstenOre) {
addEndOre(biome, TRContent.Ores.TUNGSTEN);
addOre(biome, END_STONE, TRContent.Ores.TUNGSTEN);
}
} else {
if (TechRebornConfig.enableBauxiteOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.BAUXITE);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.BAUXITE);
}
if (TechRebornConfig.enableCopperOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.COPPER);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.COPPER);
}
if (TechRebornConfig.enableGalenaOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.GALENA);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.GALENA);
}
if (TechRebornConfig.enableIridiumOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.IRIDIUM);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.IRIDIUM);
}
if (TechRebornConfig.enableLeadOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.LEAD);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.LEAD);
}
if (TechRebornConfig.enableRubyOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.RUBY);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.RUBY);
}
if (TechRebornConfig.enableSapphireOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SAPPHIRE);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.SAPPHIRE);
}
if (TechRebornConfig.enableSilverOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SILVER);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.SILVER);
}
if (TechRebornConfig.enableTinOre) {
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.TIN);
addOre(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.TIN);
}
if (biome.getCategory() == Category.FOREST || biome.getCategory() == Category.TAIGA || biome.getCategory() == Category.SWAMP) {
biome.addFeature(GenerationStep.Feature.VEGETAL_DECORATION,
addFeature(biome, GenerationStep.Feature.VEGETAL_DECORATION,
RUBBER_TREE_FEATURE.configure(RUBBER_TREE_CONFIG)
.createDecoratedFeature(RUBBER_TREE_DECORATOR
.decorate(RUBBER_TREE_DECORATOR
.configure(new ChanceDecoratorConfig(biome.getCategory() == Category.SWAMP ? TechRebornConfig.rubberTreeChance / 3 : TechRebornConfig.rubberTreeChance))
)
);
@ -170,15 +169,16 @@ public class WorldGenerator {
}
}
private static void addOre(Biome biome, Target canReplaceIn, TRContent.Ores ore) {
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE.configure(
new OreFeatureConfig(canReplaceIn, ore.block.getDefaultState(), ore.veinSize)).createDecoratedFeature(Decorator.COUNT_RANGE.configure(
new RangeDecoratorConfig(ore.veinsPerChunk, ore.minY, ore.minY, ore.maxY))));
private static void addOre(Biome biome, RuleTest ruleTest, TRContent.Ores ore) {
addFeature(biome,
GenerationStep.Feature.UNDERGROUND_ORES,
Feature.ORE.configure(
new OreFeatureConfig(ruleTest, ore.block.getDefaultState(), ore.veinSize)
).method_30377(ore.veinsPerChunk)
);
}
private static void addEndOre(Biome biome, TRContent.Ores ore) {
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, CustomOreFeature.CUSTOM_ORE_FEATURE.configure(
new CustomOreFeatureConfig(blockState -> blockState.getBlock() == Blocks.END_STONE, ore.block.getDefaultState(), ore.veinSize)).createDecoratedFeature(Decorator.COUNT_RANGE.configure(
new RangeDecoratorConfig(ore.veinsPerChunk, ore.minY, ore.minY, ore.maxY))));
private static void addFeature(Biome biome, GenerationStep.Feature feature, ConfiguredFeature<?, ?> configuredFeature) {
// Nope
}
}