Add some basic spotless formatting rules.

This commit is contained in:
modmuss50 2022-12-18 12:10:22 +00:00
parent d2e4b92984
commit 4c037bd80b
127 changed files with 590 additions and 654 deletions

View file

@ -31,13 +31,11 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

View file

@ -37,7 +37,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.joml.Matrix4f;
import org.lwjgl.opengl.GL12;

View file

@ -55,7 +55,7 @@ public class RebornFluidRenderManager implements SimpleSynchronousResourceReload
private static void setupFluidRenderer(RebornFluid fluid) {
// Done lazy as we want to ensure we get the sprite at the correct time,
// but also don't want to be making these calls every time its required.
// but also don't want to be making these calls every time its required.
TemporaryLazy<Sprite[]> sprites = new TemporaryLazy<>(() -> {
FluidSettings fluidSettings = fluid.getFluidSettings();
return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())};

View file

@ -30,7 +30,6 @@ import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluid;
@ -77,7 +76,7 @@ public class RenderUtil {
}
public static void renderGuiTank(FluidInstance fluid, FluidValue capacity, FluidValue amount, double x, double y, double zLevel,
double width, double height) {
double width, double height) {
if (fluid == null || fluid.getFluid() == null || fluid.getAmount().lessThanOrEqual(FluidValue.EMPTY)) {
return;
}

View file

@ -171,14 +171,14 @@ public class FluidConfigPopupElement extends ElementBase {
}
public void drawState(GuiBase<?> gui,
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
MatrixStack matrixStack = new MatrixStack();
matrixStack.push();

View file

@ -177,14 +177,14 @@ public class SlotConfigPopupElement extends ElementBase {
}
public void drawState(GuiBase<?> gui,
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
MatrixStack matrixStack = new MatrixStack();
matrixStack.push();

View file

@ -108,15 +108,15 @@ public class Sprite implements ISprite {
}
public record Button(Sprite normal,
Sprite hovered) {
Sprite hovered) {
}
public record ToggleButton(Sprite normal,
Sprite hovered,
Sprite pressed) {
Sprite hovered,
Sprite pressed) {
}
public record CheckBox(Sprite normal,
Sprite ticked) {
Sprite ticked) {
}
}

View file

@ -25,11 +25,9 @@
package reborncore.client.gui.builder.widget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import reborncore.common.misc.TriConsumer;
import java.util.function.Supplier;
public class GuiButtonExtended extends ButtonWidget {

View file

@ -570,7 +570,7 @@ public class GuiBuilder {
* @param layer {@link GuiBase.Layer} The layer to draw on
*/
public void drawMultiEnergyBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, long energyStored, long maxEnergyStored, int mouseX,
int mouseY, int buttonID, GuiBase.Layer layer) {
int mouseY, int buttonID, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return;
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();

View file

@ -32,10 +32,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -92,12 +89,12 @@ public class RebornCore implements ModInitializer {
BlockWrenchEventHandler.setup();
/*
This is a generic multiblock tick handler. If you are using this code on your
own, you will need to register this with the Forge TickRegistry on both the
client AND server sides. Note that different types of ticks run on different
parts of the system. CLIENT ticks only run on the client, at the start/end of
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded.
This is a generic multiblock tick handler. If you are using this code on your
own, you will need to register this with the Forge TickRegistry on both the
client AND server sides. Note that different types of ticks run on different
parts of the system. CLIENT ticks only run on the client, at the start/end of
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded.
*/
ServerTickEvents.START_WORLD_TICK.register(MultiblockRegistry::tickStart);

View file

@ -45,7 +45,6 @@ import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.registry.Registry;
import net.minecraft.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.IdentifiedPacket;

View file

@ -151,9 +151,9 @@ public class SlotConfiguration implements NBTSerializable {
sideMap = new HashMap<>();
read(tagCompound);
Validate.isTrue(Arrays.stream(Direction.values())
.map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull),
"sideMap failed to load from nbt"
.map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull),
"sideMap failed to load from nbt"
);
}

View file

@ -35,7 +35,6 @@ import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider;

View file

@ -41,7 +41,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector;

View file

@ -32,7 +32,6 @@ import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import java.util.Map;

View file

@ -38,7 +38,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.Lazy;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.container.ItemFluidInfo;
import java.util.ArrayList;

View file

@ -37,7 +37,6 @@ import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import java.util.Collections;

View file

@ -35,7 +35,6 @@ import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import org.apache.commons.lang3.Validate;

View file

@ -32,7 +32,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtOps;
import net.minecraft.registry.Registries;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RecipeUtils;
import reborncore.common.crafting.ingredient.IngredientFactory;

View file

@ -28,7 +28,6 @@ import com.google.gson.JsonObject;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import org.jetbrains.annotations.NotNull;

View file

@ -44,7 +44,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;

View file

@ -30,7 +30,6 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.FluidValue;
import reborncore.common.util.NBTSerializable;

View file

@ -26,5 +26,5 @@ package reborncore.common.misc;
@FunctionalInterface
public interface TriConsumer<A, B, C> {
void accept(A a, B b, C c);
void accept(A a, B b, C c);
}

View file

@ -43,7 +43,7 @@ import java.util.Set;
public abstract class IMultiblockPart extends BlockEntity {
public static final int INVALID_DISTANCE = Integer.MAX_VALUE;
public IMultiblockPart(BlockEntityType<?> type, BlockPos pos, BlockState state) {
public IMultiblockPart(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
@ -99,7 +99,7 @@ public abstract class IMultiblockPart extends BlockEntity {
* @see #onDetached(MultiblockControllerBase)
*/
public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize,
int newControllerSize);
int newControllerSize);
// Multiblock fuse/split helper methods. Here there be dragons.

View file

@ -30,7 +30,6 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import reborncore.common.blockentity.FluidConfiguration;

View file

@ -55,7 +55,7 @@ public class ServerBoundPackets {
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
// We update the block to allow pipes that are connecting to detect the update and change their
// connection status if needed
// connection status if needed
World world = legacyMachineBase.getWorld();
BlockState blockState = world.getBlockState(legacyMachineBase.getPos());
world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock());

View file

@ -288,7 +288,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
* @return {@code long} Energy stored in block entity
*/
public long getEnergy() {
return getStored();
return getStored();
}
/**

View file

@ -104,7 +104,7 @@ public class RecipeCrafter implements IUpgradeHandler {
};
public RecipeCrafter(RebornRecipeType<?> recipeType, BlockEntity blockEntity, int inputs, int outputs, RebornInventory<?> inventory,
int[] inputSlots, int[] outputSlots) {
int[] inputSlots, int[] outputSlots) {
this.recipeType = recipeType;
this.blockEntity = blockEntity;
if (blockEntity instanceof PowerAcceptorBlockEntity powerAcceptor) {
@ -368,7 +368,7 @@ public class RecipeCrafter implements IUpgradeHandler {
}
// Test with a stack with the max stack size as some independents will check the stack size.
// A bit of a hack but should work.
// A bit of a hack but should work.
ItemStack largeStack = stack.copy();
largeStack.setCount(largeStack.getMaxCount());
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {

View file

@ -71,8 +71,8 @@ public class BuiltScreenHandler extends ScreenHandler {
private final MachineBaseBlockEntity blockEntity;
public BuiltScreenHandler(int syncID, final String name, final Predicate<PlayerEntity> canInteract,
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> blockEntitySlotRange, MachineBaseBlockEntity blockEntity) {
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> blockEntitySlotRange, MachineBaseBlockEntity blockEntity) {
super(null, syncID);
this.name = name;

View file

@ -96,7 +96,7 @@ public class BlockEntityScreenHandlerBuilder {
}
public BlockEntityScreenHandlerBuilder filterSlot(final int index, final int x, final int y,
final Predicate<ItemStack> filter) {
final Predicate<ItemStack> filter) {
this.parent.slots.add(new FilteredSlot(this.inventory, index, x, y).setFilter(filter));
return this;
}

View file

@ -102,7 +102,7 @@ public final class PlayerScreenHandlerBuilder {
}
private PlayerArmorScreenHandlerBuilder armor(final int index, final int xStart, final int yStart,
final EquipmentSlot slotType, final Identifier sprite) {
final EquipmentSlot slotType, final Identifier sprite) {
this.parent.parent.slots.add(new SpriteSlot(this.parent.player, index, xStart, yStart, sprite, 1)
.setFilter(stack -> {
if (stack.getItem() instanceof ArmorItem) {

View file

@ -103,8 +103,8 @@ public class InventoryItem extends InventoryBase {
@Override
public void setStack(int slot,
@NotNull
ItemStack stack) {
@NotNull
ItemStack stack) {
setSlotData(slot, stack.writeNbt(new NbtCompound()));
}
@ -120,8 +120,8 @@ public class InventoryItem extends InventoryBase {
}
public int getStackLimit(int slot,
@NotNull
ItemStack stack) {
@NotNull
ItemStack stack) {
return Math.min(getSlotLimit(slot), stack.getMaxCount());
}

View file

@ -50,7 +50,7 @@ import java.util.function.Predicate;
public class ItemUtils {
public static boolean isItemEqual(final ItemStack a, final ItemStack b,
final boolean matchNBT) {
final boolean matchNBT) {
if (a.isEmpty() || b.isEmpty()) {
return false;
}
@ -61,7 +61,7 @@ public class ItemUtils {
}
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,
boolean useTags) {
boolean useTags) {
if (a.isEmpty() && b.isEmpty()) {
return true;
}
@ -103,7 +103,7 @@ public class ItemUtils {
//TODO tags
public static boolean isInputEqual(Object input, ItemStack other, boolean matchNBT,
boolean useTags) {
boolean useTags) {
if (input instanceof ItemStack) {
return isItemEqual((ItemStack) input, other, matchNBT, useTags);
} else if (input instanceof String) {
@ -171,12 +171,12 @@ public class ItemUtils {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.energyError")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
), true);
}
stack.getOrCreateNbt().putBoolean("isActive", false);
@ -196,23 +196,23 @@ public class ItemUtils {
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
), true);
}
} else {
stack.getOrCreateNbt().putBoolean("isActive", false);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
), true);
}
}
}

View file

@ -34,7 +34,6 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

View file

@ -31,7 +31,6 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import java.lang.reflect.Type;

View file

@ -29,7 +29,6 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

View file

@ -106,6 +106,10 @@ allprojects {
spotless {
java {
licenseHeaderFile(file("HEADER"))
removeUnusedImports()
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
}
}
@ -113,6 +117,9 @@ allprojects {
spotless {
groovy {
licenseHeaderFile(file("HEADER"))
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
}

View file

@ -24,7 +24,6 @@
package techreborn;
import com.mojang.datafixers.util.Pair;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
@ -36,7 +35,6 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.Baker;
import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.client.texture.Sprite;
@ -50,7 +48,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.Nullable;
import reborncore.client.ClientJumpEvent;
import reborncore.client.gui.builder.GuiBase;
@ -81,7 +78,6 @@ import techreborn.items.tool.industrial.NanosaberItem;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;

View file

@ -26,7 +26,6 @@ package techreborn.client;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreens;

View file

@ -25,7 +25,6 @@
package techreborn.client.compat.rei.fluidgenerator;
import com.google.common.collect.Lists;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.ClientHelper;
import me.shedaniel.rei.api.client.gui.Renderer;

View file

@ -44,7 +44,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import reborncore.api.IListInfoProvider;
import reborncore.common.BaseBlockEntityProvider;
import techreborn.blocks.cable.CableBlock;

View file

@ -54,9 +54,9 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
addDrawableChild(ButtonWidget.builder(Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))
.position(x + 10, y + 70)
.size(155, 20)
.build());
.position(x + 10, y + 70)
.size(155, 20)
.build());
}
@Override

View file

@ -94,5 +94,3 @@ public class GuiManual extends Screen {
super.render(matrixStack, mouseX, mouseY, partialTicks);
}
}

View file

@ -49,8 +49,8 @@ import techreborn.datagen.worldgen.TRWorldGenProvider
class TechRebornDataGen implements DataGeneratorEntrypoint {
@Override
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
@Override
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
def pack = fabricDataGenerator.createPack()
def add = { FabricDataGenerator.Pack.RegistryDependentFactory factory ->
@ -61,7 +61,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
add TRPointOfInterestTagProvider::new
add TRBlockTagProvider::new
// tags before all else, very important!!
// tags before all else, very important!!
add SmeltingRecipesProvider::new
add CraftingRecipesProvider::new
@ -78,7 +78,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
add BlockLootTableProvider::new
add TRWorldGenProvider::new
}
}
@Override
String getEffectiveModId() {

View file

@ -43,74 +43,74 @@ import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
protected Consumer<RecipeJsonProvider> exporter
TechRebornRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output)
}
protected Consumer<RecipeJsonProvider> exporter
TechRebornRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output)
}
@Override
final void generate(Consumer<RecipeJsonProvider> exporter) {
this.exporter = exporter
generateRecipes()
}
@Override
final void generate(Consumer<RecipeJsonProvider> exporter) {
this.exporter = exporter
generateRecipes()
}
abstract void generateRecipes()
abstract void generateRecipes()
static Ingredient createIngredient(def input) {
if (input instanceof Ingredient) {
if (input instanceof Ingredient) {
return input
}
if (input instanceof ItemConvertible) {
return Ingredient.ofItems(input)
} else if (input instanceof TagKey) {
return Ingredient.fromTag(input)
}
return Ingredient.ofItems(input)
} else if (input instanceof TagKey) {
return Ingredient.fromTag(input)
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static String getCriterionName(def input) {
if (input instanceof ItemConvertible) {
return hasItem(input)
} else if (input instanceof TagKey) {
return "has_tag_" + input.id().toUnderscoreSeparatedString()
}
static String getCriterionName(def input) {
if (input instanceof ItemConvertible) {
return hasItem(input)
} else if (input instanceof TagKey) {
return "has_tag_" + input.id().toUnderscoreSeparatedString()
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static CriterionConditions getCriterionConditions(def input) {
if (input instanceof ItemConvertible) {
return conditionsFromItem(input)
} else if (input instanceof TagKey) {
return conditionsFromTag(input)
}
static CriterionConditions getCriterionConditions(def input) {
if (input instanceof ItemConvertible) {
return conditionsFromItem(input)
} else if (input instanceof TagKey) {
return conditionsFromTag(input)
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static String getInputPath(def input) {
if (input instanceof ItemConvertible) {
return getItemPath(input)
} else if (input instanceof TagKey) {
return input.id().toString().replace(":", "_")
}
throw new IllegalArgumentException()
}
static String getName(def input) {
if (input instanceof ItemConvertible) {
static String getInputPath(def input) {
if (input instanceof ItemConvertible) {
return getItemPath(input)
} else if (input instanceof TagKey) {
String name = input.id().toString()
if (name.contains(":"))
name = name.substring(name.indexOf(":")+1)
return name
}
} else if (input instanceof TagKey) {
return input.id().toString().replace(":", "_")
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static String getName(def input) {
if (input instanceof ItemConvertible) {
return getItemPath(input)
} else if (input instanceof TagKey) {
String name = input.id().toString()
if (name.contains(":"))
name = name.substring(name.indexOf(":")+1)
return name
}
throw new IllegalArgumentException()
}
static String getNamePart1(def input) {
String name
@ -160,9 +160,9 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
}
@Override
protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
}
protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
}
@Override
public String getName() {

View file

@ -83,104 +83,104 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
offerWallRecipe(block.asTag(), block.getWallBlock(), "crafting_table/storage_block/")
offerWallRecipeStonecutter(block.asTag(), block.getWallBlock(), "crafting_table/storage_block/")
}
generateToolRecipes()
generateArmorRecipes()
generateToolRecipes()
generateArmorRecipes()
}
def generateToolRecipes() {
// add axes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_AXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_AXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_AXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_AXE
].each { material, axe ->
offerAxeRecipe(material, axe, "crafting_table/tool/")
}
// add hoes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HOE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HOE,
(TRContent.Gems.RUBY) : TRContent.RUBY_HOE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HOE
].each { material, hoe ->
offerHoeRecipe(material, hoe, "crafting_table/tool/")
}
// add pickaxes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_PICKAXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_PICKAXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_PICKAXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_PICKAXE
].each { material, pickaxe ->
offerPickaxeRecipe(material, pickaxe, "crafting_table/tool/")
}
// add shovels
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SPADE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SPADE,
(TRContent.Gems.RUBY) : TRContent.RUBY_SPADE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SPADE
].each { material, shovel ->
offerShovelRecipe(material, shovel, "crafting_table/tool/", "spade")
}
// add swords
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SWORD,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SWORD,
(TRContent.Gems.RUBY) : TRContent.RUBY_SWORD,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SWORD
].each { material, sword ->
offerSwordRecipe(material, sword, "crafting_table/tool/")
}
}
def generateToolRecipes() {
// add axes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_AXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_AXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_AXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_AXE
].each { material, axe ->
offerAxeRecipe(material, axe, "crafting_table/tool/")
}
// add hoes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HOE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HOE,
(TRContent.Gems.RUBY) : TRContent.RUBY_HOE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HOE
].each { material, hoe ->
offerHoeRecipe(material, hoe, "crafting_table/tool/")
}
// add pickaxes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_PICKAXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_PICKAXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_PICKAXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_PICKAXE
].each { material, pickaxe ->
offerPickaxeRecipe(material, pickaxe, "crafting_table/tool/")
}
// add shovels
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SPADE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SPADE,
(TRContent.Gems.RUBY) : TRContent.RUBY_SPADE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SPADE
].each { material, shovel ->
offerShovelRecipe(material, shovel, "crafting_table/tool/", "spade")
}
// add swords
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SWORD,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SWORD,
(TRContent.Gems.RUBY) : TRContent.RUBY_SWORD,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SWORD
].each { material, sword ->
offerSwordRecipe(material, sword, "crafting_table/tool/")
}
}
def generateArmorRecipes() {
// add boots
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_BOOTS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_BOOTS,
(TRContent.Gems.RUBY) : TRContent.RUBY_BOOTS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_BOOTS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_BOOTS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_BOOTS
].each { material, boots ->
offerBootsRecipe(material, boots, "crafting_table/armor/")
}
// add chestplate
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_CHESTPLATE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_CHESTPLATE,
(TRContent.Gems.RUBY) : TRContent.RUBY_CHESTPLATE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_CHESTPLATE,
(TRContent.Ingots.SILVER) : TRContent.SILVER_CHESTPLATE,
(TRContent.Ingots.STEEL) : TRContent.STEEL_CHESTPLATE
].each { material, chestplate ->
offerChestplateRecipe(material, chestplate, "crafting_table/armor/")
}
// add helmets
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HELMET,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HELMET,
(TRContent.Gems.RUBY) : TRContent.RUBY_HELMET,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HELMET,
(TRContent.Ingots.SILVER) : TRContent.SILVER_HELMET,
(TRContent.Ingots.STEEL) : TRContent.STEEL_HELMET
].each { material, helmet ->
offerHelmetRecipe(material, helmet, "crafting_table/armor/")
}
// add leggings
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_LEGGINGS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_LEGGINGS,
(TRContent.Gems.RUBY) : TRContent.RUBY_LEGGINGS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_LEGGINGS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_LEGGINGS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_LEGGINGS
].each { material, leggings ->
offerLeggingsRecipe(material, leggings, "crafting_table/armor/")
}
}
def generateArmorRecipes() {
// add boots
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_BOOTS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_BOOTS,
(TRContent.Gems.RUBY) : TRContent.RUBY_BOOTS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_BOOTS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_BOOTS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_BOOTS
].each { material, boots ->
offerBootsRecipe(material, boots, "crafting_table/armor/")
}
// add chestplate
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_CHESTPLATE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_CHESTPLATE,
(TRContent.Gems.RUBY) : TRContent.RUBY_CHESTPLATE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_CHESTPLATE,
(TRContent.Ingots.SILVER) : TRContent.SILVER_CHESTPLATE,
(TRContent.Ingots.STEEL) : TRContent.STEEL_CHESTPLATE
].each { material, chestplate ->
offerChestplateRecipe(material, chestplate, "crafting_table/armor/")
}
// add helmets
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HELMET,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HELMET,
(TRContent.Gems.RUBY) : TRContent.RUBY_HELMET,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HELMET,
(TRContent.Ingots.SILVER) : TRContent.SILVER_HELMET,
(TRContent.Ingots.STEEL) : TRContent.STEEL_HELMET
].each { material, helmet ->
offerHelmetRecipe(material, helmet, "crafting_table/armor/")
}
// add leggings
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_LEGGINGS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_LEGGINGS,
(TRContent.Gems.RUBY) : TRContent.RUBY_LEGGINGS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_LEGGINGS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_LEGGINGS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_LEGGINGS
].each { material, leggings ->
offerLeggingsRecipe(material, leggings, "crafting_table/armor/")
}
}
def static recipeNameString(String prefix, def input, def output, String source = null, String result = null) {
StringBuilder s = new StringBuilder()
@ -196,37 +196,37 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
return s.toString()
}
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null, RecipeCategory category = RecipeCategory.MISC) {
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null, RecipeCategory category = RecipeCategory.MISC) {
new ShapelessRecipeJsonBuilder(category, output, outputSize).input(createIngredient(input), inputSize)
.criterion(getCriterionName(input), getCriterionConditions(input))
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
}
.criterion(getCriterionName(input), getCriterionConditions(input))
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
}
def static materialTypeString(String prefix, def material, String type, Function<?, String> modifier) {
StringBuilder s = new StringBuilder()
s.append(prefix)
s.append(modifier.apply(material))
s.append('_')
s.append(type)
return s.toString()
}
def static materialTypeString(String prefix, def material, String type, Function<?, String> modifier) {
StringBuilder s = new StringBuilder()
s.append(prefix)
s.append(modifier.apply(material))
s.append('_')
s.append(type)
return s.toString()
}
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
return new ShapedRecipeJsonBuilder(category, output, outputAmount)
.input(character, createIngredient(input))
.criterion(getCriterionName(input), getCriterionConditions(input))
}
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
return new ShapedRecipeJsonBuilder(category, output, outputAmount)
.input(character, createIngredient(input))
.criterion(getCriterionName(input), getCriterionConditions(input))
}
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false, RecipeCategory category = RecipeCategory.MISC) {
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(category, output)
.input(char1, createIngredient(input1))
.input(char2, createIngredient(input2))
if (crit1)
factory = factory.criterion(getCriterionName(input1), getCriterionConditions(input1))
if (crit2)
factory = factory.criterion(getCriterionName(input2), getCriterionConditions(input2))
return factory
}
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false, RecipeCategory category = RecipeCategory.MISC) {
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(category, output)
.input(char1, createIngredient(input1))
.input(char2, createIngredient(input2))
if (crit1)
factory = factory.criterion(getCriterionName(input1), getCriterionConditions(input1))
if (crit2)
factory = factory.criterion(getCriterionName(input2), getCriterionConditions(input2))
return factory
}
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
return new SingleItemRecipeJsonBuilder(category, RecipeSerializer.STONECUTTING, createIngredient(input), output, outputAmount)
@ -269,80 +269,80 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, "wall", TechRebornRecipesProvider::getName) + "_stonecutter"))
}
def offerAxeRecipe(def material, ItemConvertible output, prefix = "", String type = "axe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern("X#")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerAxeRecipe(def material, ItemConvertible output, prefix = "", String type = "axe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern("X#")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHoeRecipe(def material, ItemConvertible output, prefix = "", String type = "hoe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern(" #")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHoeRecipe(def material, ItemConvertible output, prefix = "", String type = "hoe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern(" #")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerPickaxeRecipe(def material, ItemConvertible output, prefix = "", String type = "pickaxe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XXX")
.pattern(" # ")
.pattern(" # ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerPickaxeRecipe(def material, ItemConvertible output, prefix = "", String type = "pickaxe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XXX")
.pattern(" # ")
.pattern(" # ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerShovelRecipe(def material, ItemConvertible output, prefix = "", String type = "shovel") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("#")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerShovelRecipe(def material, ItemConvertible output, prefix = "", String type = "shovel") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("#")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerSwordRecipe(def material, ItemConvertible output, prefix = "", String type = "sword") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("X")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerSwordRecipe(def material, ItemConvertible output, prefix = "", String type = "sword") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("X")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerBootsRecipe(def material, ItemConvertible output, prefix = "", String type = "boots") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerBootsRecipe(def material, ItemConvertible output, prefix = "", String type = "boots") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerChestplateRecipe(def material, ItemConvertible output, prefix = "", String type = "chestplate") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("XXX")
.pattern("XXX")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerChestplateRecipe(def material, ItemConvertible output, prefix = "", String type = "chestplate") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("XXX")
.pattern("XXX")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHelmetRecipe(def material, ItemConvertible output, prefix = "", String type = "helmet") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHelmetRecipe(def material, ItemConvertible output, prefix = "", String type = "helmet") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerLeggingsRecipe(def material, ItemConvertible output, prefix = "", String type = "leggings") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerLeggingsRecipe(def material, ItemConvertible output, prefix = "", String type = "leggings") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
}

View file

@ -35,7 +35,7 @@ import java.util.concurrent.CompletableFuture
class AssemblingMachineRecipesProvider extends TechRebornRecipesProvider {
AssemblingMachineRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
AssemblingMachineRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture)
}

View file

@ -122,7 +122,7 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
Items.MILK_BUCKET,
Items.LAVA_BUCKET,
Items.POWDER_SNOW_BUCKET,
Items.WATER_BUCKET
Items.WATER_BUCKET
].each {bucket ->
offerExtractorRecipe {
ingredients bucket
@ -138,7 +138,7 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
Items.EXPERIENCE_BOTTLE,
Items.HONEY_BOTTLE,
Items.LINGERING_POTION,
Items.POTION,
Items.POTION,
Items.SPLASH_POTION
].each {bottle ->
offerExtractorRecipe {

View file

@ -40,84 +40,84 @@ import java.nio.file.Paths
import java.util.List
class OreDistributionVisualiser {
private static final Color[] colors = new Color[] {
Color.black,
Color.red,
Color.pink,
Color.orange,
Color.yellow,
Color.green,
Color.magenta,
Color.cyan,
Color.blue
}
private static final Color[] colors = new Color[] {
Color.black,
Color.red,
Color.pink,
Color.orange,
Color.yellow,
Color.green,
Color.magenta,
Color.cyan,
Color.blue
}
static void main(String[] args) {
// Start the game up enough
SharedConstants.createGameVersion()
Bootstrap.initialize()
static void main(String[] args) {
// Start the game up enough
SharedConstants.createGameVersion()
Bootstrap.initialize()
generateOreDistributionVisualization()
}
generateOreDistributionVisualization()
}
static void generateOreDistributionVisualization() throws IOException {
def heightContext = new FixedHeightContext(-64, 360)
static void generateOreDistributionVisualization() throws IOException {
def heightContext = new FixedHeightContext(-64, 360)
BufferedImage bi = new BufferedImage(450, 220, BufferedImage.TYPE_INT_ARGB)
Graphics2D png = bi.createGraphics()
Font font = new Font("TimesRoman", Font.BOLD, 20)
png.setFont(font)
BufferedImage bi = new BufferedImage(450, 220, BufferedImage.TYPE_INT_ARGB)
Graphics2D png = bi.createGraphics()
Font font = new Font("TimesRoman", Font.BOLD, 20)
png.setFont(font)
png.setPaint(Color.black)
// Draw 0
png.drawLine(0, -heightContext.minY, (overworldOres().size() * 10) + 20, -heightContext.minY)
png.setPaint(Color.black)
// Draw 0
png.drawLine(0, -heightContext.minY, (overworldOres().size() * 10) + 20, -heightContext.minY)
png.setPaint(Color.blue)
// Draw ground
png.drawLine(0, -heightContext.minY + 64, (overworldOres().size() * 10) + 20, -heightContext.minY + 64)
png.setPaint(Color.blue)
// Draw ground
png.drawLine(0, -heightContext.minY + 64, (overworldOres().size() * 10) + 20, -heightContext.minY + 64)
int c = 1
for (OreDistribution value : overworldOres()) {
png.setPaint(colors[c])
int c = 1
for (OreDistribution value : overworldOres()) {
png.setPaint(colors[c])
def yMin = value.minOffset.getY(heightContext) + -heightContext.minY
def yMax = -heightContext.minY + value.maxY
def yMin = value.minOffset.getY(heightContext) + -heightContext.minY
def yMax = -heightContext.minY + value.maxY
png.fill3DRect(c * 10, yMin, 10, yMax - yMin, true)
png.fill3DRect(c * 10, yMin, 10, yMax - yMin, true)
png.drawString(value.name() + "(%d -> %d)".formatted(value.minOffset.getY(heightContext), value.maxY), 190, 25 * c)
png.drawString(value.name() + "(%d -> %d)".formatted(value.minOffset.getY(heightContext), value.maxY), 190, 25 * c)
c += 1
}
c += 1
}
ImageIO.write(bi, "PNG", Paths.get("ore_distribution.png").toFile())
}
ImageIO.write(bi, "PNG", Paths.get("ore_distribution.png").toFile())
}
private static List<OreDistribution> overworldOres() {
return Arrays.stream(OreDistribution.values())
.filter(ore -> ore.dimension == TargetDimension.OVERWORLD)
.toList()
}
private static List<OreDistribution> overworldOres() {
return Arrays.stream(OreDistribution.values())
.filter(ore -> ore.dimension == TargetDimension.OVERWORLD)
.toList()
}
private static class FixedHeightContext extends HeightContext {
final int minY
final int height
private static class FixedHeightContext extends HeightContext {
final int minY
final int height
FixedHeightContext(int minY, int height) {
super(new DebugChunkGenerator(BuiltinRegistries.BIOME), EmptyBlockView.INSTANCE)
FixedHeightContext(int minY, int height) {
super(new DebugChunkGenerator(BuiltinRegistries.BIOME), EmptyBlockView.INSTANCE)
this.minY = minY
this.height = height
}
this.minY = minY
this.height = height
}
@Override
int getMinY() {
return minY
}
@Override
int getMinY() {
return minY
}
@Override
int getHeight() {
return height
}
}
@Override
int getHeight() {
return height
}
}
}

View file

@ -37,9 +37,9 @@ import java.lang.reflect.Method
*/
@Slf4j
abstract class TRGameTest implements FabricGameTest {
@Override
void invokeTestMethod(TestContext context, Method method) {
try {
@Override
void invokeTestMethod(TestContext context, Method method) {
try {
method.invoke(this, new TRTestContext(context))
} catch (TRGameTestException gameTestException) {
log.error("Test ${method.name} failed with message ${gameTestException.message}", gameTestException.cause)
@ -49,7 +49,7 @@ abstract class TRGameTest implements FabricGameTest {
log.error("Test ${method.name} failed", throwable)
throw throwable
}
}
}
static class TRGameTestException extends AssertionError {
TRGameTestException(String message, Throwable cause) {

View file

@ -32,28 +32,28 @@ import reborncore.common.blockentity.MachineBaseBlockEntity
import techreborn.init.TRContent
class TRTestContext extends TestContext {
TRTestContext(TestContext parentContext) {
//noinspection GroovyAccessibility
super(parentContext.test)
}
TRTestContext(TestContext parentContext) {
//noinspection GroovyAccessibility
super(parentContext.test)
}
/**
* Place a machine with a creative solar panel
*/
def poweredMachine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 2, 0)
setBlockState(machinePos, machine.block)
setBlockState(machinePos.down(), TRContent.SolarPanels.CREATIVE.block)
/**
* Place a machine with a creative solar panel
*/
def poweredMachine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 2, 0)
setBlockState(machinePos, machine.block)
setBlockState(machinePos.down(), TRContent.SolarPanels.CREATIVE.block)
waitAndRun(5) {
try {
new MachineContext(machinePos).with(machineContextClosure)
} catch (e) {
e.printStackTrace()
throw e
}
}
}
waitAndRun(5) {
try {
new MachineContext(machinePos).with(machineContextClosure)
} catch (e) {
e.printStackTrace()
throw e
}
}
}
def machine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 1, 0)
@ -69,59 +69,59 @@ class TRTestContext extends TestContext {
}
}
class MachineContext {
final BlockPos machinePos
class MachineContext {
final BlockPos machinePos
MachineContext(BlockPos machinePos) {
this.machinePos = machinePos
}
MachineContext(BlockPos machinePos) {
this.machinePos = machinePos
}
def input(ItemConvertible item, int slot = -1) {
this.input(new ItemStack(item), slot)
}
def input(ItemConvertible item, int slot = -1) {
this.input(new ItemStack(item), slot)
}
def input(ItemStack stack, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first input slot
slot = blockEntity.crafter.inputSlots[0]
}
def input(ItemStack stack, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first input slot
slot = blockEntity.crafter.inputSlots[0]
}
blockEntity.inventory.setStack(slot, stack)
}
blockEntity.inventory.setStack(slot, stack)
}
def expectOutput(ItemConvertible item, int ticks, int slot = -1) {
expectOutput(new ItemStack(item), ticks, slot)
}
def expectOutput(ItemConvertible item, int ticks, int slot = -1) {
expectOutput(new ItemStack(item), ticks, slot)
}
def expectOutput(ItemStack stack, int ticks, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first output slot
slot = blockEntity.crafter.outputSlots[0]
}
def expectOutput(ItemStack stack, int ticks, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first output slot
slot = blockEntity.crafter.outputSlots[0]
}
addFinalTaskWithDuration(ticks) {
if (!blockEntity.inventory.getStack(slot).isItemEqual(stack)) {
throwGameTestException("Failed to find $stack in slot $slot")
}
}
}
addFinalTaskWithDuration(ticks) {
if (!blockEntity.inventory.getStack(slot).isItemEqual(stack)) {
throwGameTestException("Failed to find $stack in slot $slot")
}
}
}
def withUpgrades(TRContent.Upgrades upgrade, int count = -1) {
count = (count != -1 ? count : blockEntity.getUpgradeSlotCount()) -1
def withUpgrades(TRContent.Upgrades upgrade, int count = -1) {
count = (count != -1 ? count : blockEntity.getUpgradeSlotCount()) -1
(0..count).each {
blockEntity.upgradeInventory.setStack(it, new ItemStack(upgrade))
}
}
(0..count).each {
blockEntity.upgradeInventory.setStack(it, new ItemStack(upgrade))
}
}
MachineBaseBlockEntity getBlockEntity() {
def be = getBlockEntity(machinePos)
def be = getBlockEntity(machinePos)
if (!be) {
throwPositionedException("Failed to get machine block entity", machinePos)
}
if (!be) {
throwPositionedException("Failed to get machine block entity", machinePos)
}
return be as MachineBaseBlockEntity
}
}
return be as MachineBaseBlockEntity
}
}
}

View file

@ -31,17 +31,17 @@ import techreborn.test.TRGameTest
import techreborn.test.TRTestContext
class GrinderTest extends TRGameTest {
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150)
def testGrind2OCs(TRTestContext context) {
/**
* Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks
*/
context.poweredMachine(TRContent.Machine.GRINDER) {
input(Items.COAL)
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150)
def testGrind2OCs(TRTestContext context) {
/**
* Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks
*/
context.poweredMachine(TRContent.Machine.GRINDER) {
input(Items.COAL)
withUpgrades(TRContent.Upgrades.OVERCLOCKER, 2)
withUpgrades(TRContent.Upgrades.OVERCLOCKER, 2)
expectOutput(TRContent.Dusts.COAL, 116)
}
}
expectOutput(TRContent.Dusts.COAL, 116)
}
}
}

View file

@ -33,18 +33,18 @@ import techreborn.test.TRGameTest
import techreborn.test.TRTestContext
class IronAlloyFurnaceTest extends TRGameTest {
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronAlloyFurnaceElectrumAlloyIngot(TRTestContext context) {
/**
* Test that the Iron Alloy Furnace smelts a gold ingot and a silver ingot into an electrum alloy ingot in 200
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronAlloyFurnaceElectrumAlloyIngot(TRTestContext context) {
/**
* Test that the Iron Alloy Furnace smelts a gold ingot and a silver ingot into an electrum alloy ingot in 200
* Verifies: Issue #2850
*/
context.machine(TRContent.Machine.IRON_ALLOY_FURNACE) {
*/
context.machine(TRContent.Machine.IRON_ALLOY_FURNACE) {
input(Items.COAL_BLOCK, IronAlloyFurnaceBlockEntity.FUEL_SLOT)
input(Items.GOLD_INGOT, IronAlloyFurnaceBlockEntity.INPUT_SLOT_1)
input(TRContent.Ingots.SILVER, IronAlloyFurnaceBlockEntity.INPUT_SLOT_2)
input(Items.GOLD_INGOT, IronAlloyFurnaceBlockEntity.INPUT_SLOT_1)
input(TRContent.Ingots.SILVER, IronAlloyFurnaceBlockEntity.INPUT_SLOT_2)
expectOutput(TRContent.Ingots.ELECTRUM, (int) (200 / TechRebornConfig.cookingScale), IronAlloyFurnaceBlockEntity.OUTPUT_SLOT)
}
}
expectOutput(TRContent.Ingots.ELECTRUM, (int) (200 / TechRebornConfig.cookingScale), IronAlloyFurnaceBlockEntity.OUTPUT_SLOT)
}
}
}

View file

@ -48,17 +48,17 @@ class IronFurnaceTest extends TRGameTest {
}
}
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronFurnaceSmeltRawIronBlock(TRTestContext context) {
/**
* Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronFurnaceSmeltRawIronBlock(TRTestContext context) {
/**
* Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200
* Verifies: Issue #2850
*/
context.machine(TRContent.Machine.IRON_FURNACE) {
*/
context.machine(TRContent.Machine.IRON_FURNACE) {
input(Items.COAL_BLOCK, IronFurnaceBlockEntity.FUEL_SLOT)
input(Items.RAW_IRON_BLOCK, IronFurnaceBlockEntity.INPUT_SLOT)
input(Items.RAW_IRON_BLOCK, IronFurnaceBlockEntity.INPUT_SLOT)
expectOutput(Items.IRON_BLOCK, (int) (1500 / TechRebornConfig.cookingScale), IronFurnaceBlockEntity.OUTPUT_SLOT)
}
}
expectOutput(Items.IRON_BLOCK, (int) (1500 / TechRebornConfig.cookingScale), IronFurnaceBlockEntity.OUTPUT_SLOT)
}
}
}

View file

@ -29,7 +29,7 @@ import net.minecraft.fluid.Fluid;
import reborncore.common.fluid.FluidUtils;
public record FluidGeneratorRecipe(Fluid fluid, int energyPerMb,
EFluidGenerator generatorType) {
EFluidGenerator generatorType) {
public int getEnergyPerBucket() {
return energyPerMb * 1000;

View file

@ -35,9 +35,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

View file

@ -133,7 +133,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
}
protected boolean tryAddingEnergy(int amount) {
if (getFreeSpace() > 0) {
if (getFreeSpace() > 0) {
addEnergy(amount);
return true;
}

View file

@ -121,8 +121,8 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
// Ok, we are actively generating power, but check for a few conditions that would restrict
// the generation to minimal production...
if (!world.getDimension().hasSkyLight() || // No light source in dimension (e.g. nether or end)
(skyAngle > 0.25 && skyAngle < 0.75) || // Light source is below horizon
(world.isRaining() || world.isThundering())) { // Weather is present
(skyAngle > 0.25 && skyAngle < 0.75) || // Light source is below horizon
(world.isRaining() || world.isThundering())) { // Weather is present
return getPanel().generationRateN;
}

View file

@ -62,9 +62,9 @@ public class AlarmBlockEntity extends BlockEntity
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("techreborn.message.alarm")
.formatted(Formatting.GRAY)
.append(" Alarm ")
.append(String.valueOf(selectedSound)), true);
.formatted(Formatting.GRAY)
.append(" Alarm ")
.append(String.valueOf(selectedSound)), true);
}
}

View file

@ -62,7 +62,7 @@ public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implemen
.fill(0, 2, 0, 3, 3, 3, advanced);
}
// IContainerProvider
// IContainerProvider
@Override
public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) {
return new ScreenHandlerBuilder("vacuumfreezer").player(player.getInventory()).inventory().hotbar().addInventory()

View file

@ -30,7 +30,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import reborncore.api.blockentity.IUpgrade;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.screen.BuiltScreenHandlerProvider;

View file

@ -57,7 +57,7 @@ public class BlockFusionCoil extends Block {
@SuppressWarnings("deprecation")
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) {
Hand hand, BlockHitResult hitResult) {
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
if (tool.isEmpty()) return ActionResult.PASS;

View file

@ -49,7 +49,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) {
Hand hand, BlockHitResult hitResult) {
final FusionControlComputerBlockEntity blockEntityFusionControlComputer = (FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos);
if (!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())) {
List<BlockPos> coils = Torus.generate(blockEntityFusionControlComputer.getPos(), blockEntityFusionControlComputer.size);

View file

@ -123,12 +123,12 @@ public class PlayerDetectorBlock extends BlockMachineBase {
if (playerIn instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("techreborn.message.detects")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.literal(StringUtils.toFirstCapital(newType.asString()))
.formatted(color)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.literal(StringUtils.toFirstCapital(newType.asString()))
.formatted(color)
), true);
}
if (getGui() != null && !playerIn.isSneaking()) {

View file

@ -128,7 +128,7 @@ public class BlockRubberLog extends PillarBlock {
@SuppressWarnings("deprecation")
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) {
Hand hand, BlockHitResult hitResult) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
if (stack.isEmpty()) {
return ActionResult.PASS;

View file

@ -72,7 +72,7 @@ public abstract class BlockTransformer extends BaseBlockEntityProvider {
// BaseTileBlock
@Override
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
ItemStack stack) {
super.onPlaced(worldIn, pos, state, placer, stack);
Direction facing = placer.getHorizontalFacing().getOpposite();
if (placer.getPitch() < -50) {

View file

@ -72,7 +72,7 @@ public enum TRArmorMaterials implements ArmorMaterial {
private final String name;
TRArmorMaterials(int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterialIn) {
SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterialIn) {
this.maxDamageFactor = maxDamageFactor;
this.damageReductionAmountArray = damageReductionAmountArray;
this.enchantability = enchantability;
@ -84,7 +84,7 @@ public enum TRArmorMaterials implements ArmorMaterial {
}
TRArmorMaterials(int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterialIn) {
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterialIn) {
this(maxDamageFactor, damageReductionAmountArray, enchantability, soundEvent, toughness, 0.0F, repairMaterialIn);
}

View file

@ -68,7 +68,7 @@ public enum TRToolTier implements ToolMaterial {
private final Lazy<Ingredient> repairMaterial;
TRToolTier(int miningLevel, int itemDurability, float miningSpeed, float attackDamage,
int enchantability, Supplier<Ingredient> repairMaterialIn) {
int enchantability, Supplier<Ingredient> repairMaterialIn) {
this.miningLevel = miningLevel;
this.itemDurability = itemDurability;
this.miningSpeed = miningSpeed;

View file

@ -66,16 +66,16 @@ public class FrequencyTransmitterItem extends Item {
if (context.getPlayer() instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("techreborn.message.setTo")
.append(Text.literal(" X:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
.append(" ")
.append(Text.translatable("techreborn.message.in").formatted(Formatting.GRAY))
.append(" ")
.append(Text.literal(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)), true);
.append(Text.literal(" X:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
.append(" ")
.append(Text.translatable("techreborn.message.in").formatted(Formatting.GRAY))
.append(" ")
.append(Text.literal(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)), true);
}
return ActionResult.SUCCESS;
@ -97,12 +97,12 @@ public class FrequencyTransmitterItem extends Item {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("techreborn.message.coordsHaveBeen")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("techreborn.message.cleared")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("techreborn.message.cleared")
.formatted(Formatting.GOLD)
), true);
}
}

View file

@ -48,11 +48,11 @@ public class GpsItem extends Item {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
BlockPos pos = player.getBlockPos();
serverPlayerEntity.sendMessage(Text.literal(" X:").formatted(Formatting.GRAY)
.append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD)), true);
.append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD)), true);
return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}
return new TypedActionResult<>(ActionResult.PASS, stack);

View file

@ -33,7 +33,6 @@ import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.util.WorldUtils;
import techreborn.TechReborn;
import techreborn.init.ModRecipes;
import java.util.List;

View file

@ -31,7 +31,6 @@ import org.jetbrains.annotations.Nullable;
import reborncore.api.blockentity.IUpgrade;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.recipes.IUpgradeHandler;
import techreborn.TechReborn;
public class UpgradeItem extends Item implements IUpgrade {

View file

@ -29,14 +29,11 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.utils.InitUtils;
public class BatpackItem extends ArmorItem implements RcEnergyItem {

View file

@ -27,18 +27,14 @@ package techreborn.items.armor;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import reborncore.api.items.ArmorBlockEntityTicker;
import reborncore.api.items.ArmorRemoveHandler;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRArmorMaterials;
import techreborn.utils.InitUtils;
public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, ArmorBlockEntityTicker, ArmorRemoveHandler {

View file

@ -30,14 +30,11 @@ import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.*;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.utils.InitUtils;
import techreborn.utils.ToolsUtil;
public class JackhammerItem extends PickaxeItem implements RcEnergyItem {

View file

@ -40,7 +40,6 @@ import net.minecraft.util.Formatting;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.util.WorldUtils;
import techreborn.TechReborn;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blocks.cable.CableBlock;
import techreborn.init.TRContent;

View file

@ -25,15 +25,11 @@
package techreborn.items.tool.basic;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.TechRebornConfig;
import techreborn.utils.InitUtils;
/**
* Created by modmuss50 on 05/11/2016.

View file

@ -29,24 +29,20 @@ import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.init.TRToolMaterials;
import techreborn.items.tool.DrillItem;
import techreborn.items.tool.MiningLevel;
import techreborn.utils.InitUtils;
import techreborn.utils.ToolsUtil;
import java.util.List;

View file

@ -29,25 +29,21 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.Items;
import net.minecraft.item.MiningToolItem;
import net.minecraft.util.ActionResult;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import reborncore.common.util.TorchHelper;
import techreborn.TechReborn;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.init.TRToolMaterials;
import techreborn.items.tool.MiningLevel;
import techreborn.utils.InitUtils;
public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
public final int maxCharge = TechRebornConfig.omniToolCharge;

View file

@ -29,7 +29,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
public class TRHoeItem extends HoeItem {

View file

@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterial;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
public class TRSpadeItem extends ShovelItem {

View file

@ -24,22 +24,18 @@
package techreborn.utils;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.MapColor;
import net.minecraft.block.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import reborncore.RebornRegistry;
import reborncore.common.powerSystem.RcEnergyItem;
import techreborn.TechReborn;
public class InitUtils {

View file

@ -31,7 +31,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import reborncore.api.events.ItemCraftCallback;
import reborncore.common.powerSystem.RcEnergyItem;
import techreborn.TechReborn;

View file

@ -32,7 +32,6 @@ import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;

View file

@ -30,7 +30,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.gen.HeightContext;