Merge branch '1.18' into recipe_serde

# Conflicts:
#	RebornCore/src/main/java/reborncore/common/crafting/RebornRecipeType.java
#	src/datagen/groovy/techreborn/datagen/recipes/smelting/SmeltingRecipesProvider.groovy
This commit is contained in:
modmuss50 2022-01-20 18:51:48 +00:00
commit 8863ea30b3
454 changed files with 3884 additions and 1302 deletions

2
.gitignore vendored
View file

@ -24,7 +24,7 @@ changelog.txt
/logs/
/classes/
/src/main/resources/package-lock.json
/src/generated
/src/main/generated
/RebornCore/.gradle
/RebornCore/build

View file

@ -17,7 +17,7 @@ curseforge {
id = "237903"
changelog = ENV.CHANGELOG ?: "No changelog provided"
releaseType = ENV.RELEASE_CHANNEL ?: "release"
addGameVersion "1.18"
addGameVersion "1.18.1"
addGameVersion "Fabric"
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))

View file

@ -27,21 +27,23 @@ package reborncore;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.event.world.WorldTickCallback;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import reborncore.api.ToolManager;
import reborncore.api.blockentity.UnloadHandler;
import reborncore.common.RebornCoreCommands;
import reborncore.common.RebornCoreConfig;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.chunkloading.ChunkLoaderManager;
import reborncore.common.config.Configuration;
import reborncore.common.crafting.ingredient.IngredientManager;
import reborncore.common.fluid.RebornFluidManager;
import reborncore.common.misc.ModSounds;
import reborncore.common.misc.RebornCoreTags;
import reborncore.common.multiblock.MultiblockRegistry;
@ -63,7 +65,7 @@ public class RebornCore implements ModInitializer {
public static final String MOD_VERSION = "@MODVERSION@";
public static final String WEB_URL = "https://files.modmuss50.me/";
public static final Logger LOGGER = LogManager.getFormatterLogger(MOD_ID);
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static File configDir;
public static boolean LOADED = false;
@ -107,7 +109,6 @@ public class RebornCore implements ModInitializer {
ServerBoundPackets.init();
IngredientManager.setup();
RebornFluidManager.setupBucketMap();
RebornCoreCommands.setup();
@ -119,6 +120,9 @@ public class RebornCore implements ModInitializer {
if (blockEntity instanceof UnloadHandler) ((UnloadHandler) blockEntity).onUnload();
});
ServerWorldEvents.LOAD.register((server, world) -> ChunkLoaderManager.get(world).onServerWorldLoad(world));
ServerTickEvents.START_WORLD_TICK.register(world -> ChunkLoaderManager.get(world).onServerWorldTick(world));
FluidStorage.SIDED.registerFallback((world, pos, state, be, direction) -> {
if (be instanceof MachineBaseBlockEntity machineBase) {
return machineBase.getTank();

View file

@ -26,10 +26,9 @@ package reborncore.client.gui.builder.widget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text;
import org.apache.logging.log4j.util.TriConsumer;
import reborncore.common.misc.TriConsumer;
public class GuiButtonExtended extends GuiButtonSimple {
public class GuiButtonExtended extends ButtonWidget {
private TriConsumer<GuiButtonExtended, Double, Double> clickHandler;
@ -51,6 +50,6 @@ public class GuiButtonExtended extends GuiButtonSimple {
if (clickHandler != null) {
clickHandler.accept(this, mouseX, mouseY);
}
super.onClick(mouseY, mouseY);
super.onClick(mouseX, mouseY);
}
}

View file

@ -28,10 +28,19 @@ import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text;
public class GuiButtonSimple extends ButtonWidget {
/**
* @deprecated Please use {@link ButtonWidget}
*/
@Deprecated
public GuiButtonSimple(int x, int y, Text buttonText, ButtonWidget.PressAction pressAction) {
super(x, y, 20, 200, buttonText, pressAction);
}
/**
* @deprecated Please use {@link ButtonWidget}
*/
@Deprecated
public GuiButtonSimple(int x, int y, int widthIn, int heightIn, Text buttonText, ButtonWidget.PressAction pressAction) {
super(x, y, widthIn, heightIn, buttonText, pressAction);
}

View file

@ -26,7 +26,6 @@ package reborncore.client.gui.guibuilder;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
@ -52,12 +51,11 @@ import reborncore.api.IListInfoProvider;
import reborncore.client.RenderUtil;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.GuiTab;
import reborncore.common.fluid.FluidUtil;
import reborncore.common.fluid.FluidUtils;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PowerSystem.EnergySystem;
import reborncore.common.util.FluidTextHelper;
import reborncore.common.util.StringUtils;
import java.util.ArrayList;
@ -682,7 +680,7 @@ public class GuiBuilder {
new LiteralText(String.format("%s / %s", amount, maxCapacity))
.formatted(Formatting.GOLD)
.append(SPACE_TEXT)
.append(FluidUtil.getFluidName(fluid))
.append(FluidUtils.getFluidName(fluid))
);
}

View file

@ -26,9 +26,6 @@ package reborncore.client.screen.builder;
import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.inventory.CraftingInventory;
@ -49,7 +46,7 @@ import reborncore.client.gui.slots.SlotOutput;
import reborncore.client.screen.builder.slot.FilteredSlot;
import reborncore.client.screen.builder.slot.UpgradeSlot;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.fluid.FluidUtils;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import team.reborn.energy.api.EnergyStorageUtil;
@ -114,8 +111,7 @@ public class BlockEntityScreenHandlerBuilder {
}
public BlockEntityScreenHandlerBuilder fluidSlot(final int index, final int x, final int y) {
this.parent.slots.add(new FilteredSlot(this.inventory, index, x, y).setFilter(
stack -> stack.getItem() instanceof ItemFluidInfo));
this.parent.slots.add(new FilteredSlot(this.inventory, index, x, y).setFilter(FluidUtils::isContainer));
return this;
}

View file

@ -37,8 +37,8 @@ import net.minecraft.screen.slot.Slot;
import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.NetworkManager;
@ -54,7 +54,7 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
public class BuiltScreenHandler extends ScreenHandler {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LoggerFactory.getLogger(BuiltScreenHandler.class);
private final String name;

View file

@ -28,15 +28,12 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
import net.fabricmc.fabric.api.transfer.v1.storage.StorageUtil;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import reborncore.common.fluid.FluidUtil;
import reborncore.common.util.NBTSerializable;
import reborncore.common.util.Tank;
import java.util.ArrayList;
import java.util.Arrays;

View file

@ -56,7 +56,7 @@ import reborncore.api.blockentity.IUpgrade;
import reborncore.api.blockentity.IUpgradeable;
import reborncore.common.BaseBlockEntityProvider;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.fluid.FluidUtil;
import reborncore.common.fluid.FluidUtils;
import reborncore.common.util.ItemHandlerUtils;
import reborncore.common.util.Tank;
import reborncore.common.util.WrenchUtils;
@ -187,7 +187,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
if (blockEntity instanceof MachineBaseBlockEntity) {
Tank tank = ((MachineBaseBlockEntity) blockEntity).getTank();
if (tank != null && FluidUtil.interactWithFluidHandler(playerIn, hand, tank)) {
if (tank != null && FluidUtils.interactWithFluidHandler(playerIn, hand, tank)) {
return ActionResult.SUCCESS;
}
}

View file

@ -27,6 +27,7 @@ package reborncore.common.chunkloading;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtOps;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ChunkTicketType;
@ -70,7 +71,7 @@ public class ChunkLoaderManager extends PersistentState {
chunkLoaderManager.loadedChunks.clear();
List<LoadedChunk> chunks = CODEC.parse(NbtOps.INSTANCE, tag.getCompound("loadedchunks"))
List<LoadedChunk> chunks = CODEC.parse(NbtOps.INSTANCE, tag.getList("loadedchunks", NbtElement.COMPOUND_TYPE))
.result()
.orElse(Collections.emptyList());
@ -123,8 +124,7 @@ public class ChunkLoaderManager extends PersistentState {
LoadedChunk loadedChunk = new LoadedChunk(chunkPos, getWorldName(world), player, chunkLoader);
loadedChunks.add(loadedChunk);
final ServerChunkManager serverChunkManager = ((ServerWorld) world).getChunkManager();
serverChunkManager.addTicket(ChunkLoaderManager.CHUNK_LOADER, loadedChunk.getChunk(), RADIUS, loadedChunk.getChunk());
loadChunk((ServerWorld) world, loadedChunk);
markDirty();
}
@ -148,6 +148,16 @@ public class ChunkLoaderManager extends PersistentState {
markDirty();
}
public void onServerWorldLoad(ServerWorld world) {
loadedChunks.forEach(loadedChunk -> loadChunk(world, loadedChunk));
}
public void onServerWorldTick(ServerWorld world) {
if (!loadedChunks.isEmpty()) {
world.resetIdleTimeout();
}
}
public static Identifier getWorldName(World world){
return world.getRegistryKey().getValue();
}
@ -172,6 +182,11 @@ public class ChunkLoaderManager extends PersistentState {
NetworkManager.sendToPlayer(ClientBoundPackets.createPacketSyncLoadedChunks(chunks), serverPlayerEntity);
}
private void loadChunk(ServerWorld world, LoadedChunk loadedChunk) {
ChunkPos chunkPos = loadedChunk.getChunk();
world.getChunkManager().addTicket(ChunkLoaderManager.CHUNK_LOADER, chunkPos, RADIUS, chunkPos);
}
public static class LoadedChunk {
public static Codec<ChunkPos> CHUNK_POS_CODEC = RecordCodecBuilder.create(instance ->

View file

@ -1,140 +0,0 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.crafting;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.tag.ItemTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.SimpleRegistry;
import org.apache.commons.lang3.Validate;
import java.util.HashMap;
import java.util.function.Function;
public final class ConditionManager {
private static final HashMap<Identifier, RecipeCondition<?>> RECIPE_CONDITIONS = new HashMap<>();
private static final HashMap<Identifier, Class<?>> RECIPE_CONDITION_TYPES = new HashMap<>();
static {
//Only loads the recipe in a development env
register("development", Boolean.class, (bool) -> bool == FabricLoader.getInstance().isDevelopmentEnvironment());
//Only loads the recipe when the item is registered
register("item", Identifier.class, (id) -> registryContains(Registry.ITEM, id));
//Only loads the recipe when the fluid is registered
register("fluid", Identifier.class, (id) -> registryContains(Registry.FLUID, id));
//Only loads the recipe when the tag is loaded
register("tag", Identifier.class, s -> ItemTags.getTagGroup().getTags().containsKey(s));
//Only load the recipe if the provided mod is loaded
register("mod", String.class, s -> FabricLoader.getInstance().isModLoaded(s));
//Never load, just pass whatever in as the string
register("never", String.class, s -> false);
}
private static boolean registryContains(SimpleRegistry<?> registry, Identifier ident) {
return registry.containsId(ident);
}
public static <T> void register(String name, Class<T> type, RecipeCondition<T> recipeCondition){
register(new Identifier("reborncore", name), type, recipeCondition);
}
public static <T> void register(Identifier identifier, Class<T> type, RecipeCondition<T> recipeCondition){
Validate.isTrue(!RECIPE_CONDITIONS.containsKey(identifier), "Recipe condition already registered");
RECIPE_CONDITIONS.put(identifier, recipeCondition);
RECIPE_CONDITION_TYPES.put(identifier, type);
}
public static RecipeCondition<?> getRecipeCondition(Identifier identifier){
RecipeCondition<?> condition = RECIPE_CONDITIONS.get(identifier);
if(condition == null){
throw new UnsupportedOperationException("Could not find recipe condition for " + identifier.toString());
}
return condition;
}
public static boolean shouldLoadRecipe(JsonObject jsonObject){
if(!jsonObject.has("conditions")) return true;
return jsonObject.get("conditions").getAsJsonObject().entrySet().stream()
.allMatch(entry -> shouldLoad(entry.getKey(), entry.getValue()));
}
public static boolean shouldLoad(String ident, JsonElement jsonElement){
Identifier identifier = parseIdent(ident);
RecipeCondition<?> recipeCondition = getRecipeCondition(identifier);
Class<?> type = RECIPE_CONDITION_TYPES.get(identifier);
return shouldLoad(type, jsonElement, recipeCondition);
}
@SuppressWarnings("unchecked")
private static boolean shouldLoad(Class type, JsonElement jsonElement, RecipeCondition recipeCondition){
Object val = TypeHelper.getValue(type, jsonElement);
return recipeCondition.shouldLoad(val);
}
private static Identifier parseIdent(String string) {
if(string.contains(":")){
return new Identifier(string);
}
return new Identifier("reborncore", string);
}
@FunctionalInterface
public interface RecipeCondition<T> {
boolean shouldLoad(T t);
}
private static class TypeHelper {
private static final HashMap<Class<?>, Function<JsonElement, ?>> FUNCTIONS = new HashMap<>();
static {
register(String.class, JsonElement::getAsString);
register(Boolean.class, JsonElement::getAsBoolean);
register(Identifier.class, element -> new Identifier(element.getAsString()));
}
private static <T> void register(Class<T> type, Function<JsonElement, T> function){
Validate.isTrue(!FUNCTIONS.containsKey(type), "Function for this class is already registered");
FUNCTIONS.put(type, function);
}
public static <T> T getValue(Class<T> type, JsonElement jsonElement){
Validate.isTrue(FUNCTIONS.containsKey(type), "Function for this class could not be found");
//noinspection unchecked
return (T) FUNCTIONS.get(type).apply(jsonElement);
}
}
}

View file

@ -52,10 +52,6 @@ public record RebornRecipeType<R extends RebornRecipe>(
try {
R recipe = newRecipe(json, recipeId);
if (!ConditionManager.shouldLoadRecipe(json)) {
return recipeSerde.createDummy(this, recipeId);
}
return recipe;
} catch (Throwable t) {
RebornCore.LOGGER.error("Failed to read recipe: " + recipeId, t);

View file

@ -1,64 +0,0 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.fluid;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.registry.Registry;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
public class FluidUtil {
@Deprecated
public static FluidInstance getFluidHandler(ItemStack stack) {
return null;
}
@Deprecated
public static boolean interactWithFluidHandler(PlayerEntity playerIn, Hand hand, Tank tank) {
return false;
}
@Deprecated
public static ItemStack getFilledBucket(FluidInstance stack) {
return null;
}
public static String getFluidName(@NotNull FluidInstance fluidInstance) {
// TODO: use FluidVariantRendering
return getFluidName(fluidInstance.getFluid());
}
public static String getFluidName(@NotNull Fluid fluid) {
return StringUtils.capitalize(Registry.FLUID.getId(fluid).getPath());
}
}

View file

@ -0,0 +1,188 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.fluid;
import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
import net.fabricmc.fabric.api.transfer.v1.storage.StorageUtil;
import net.fabricmc.fabric.api.transfer.v1.storage.base.FilteringStorage;
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage;
import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction;
import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
import net.minecraft.block.Block;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.registry.Registry;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
import reborncore.mixin.common.AccessorFluidBlock;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class FluidUtils {
@NotNull
public static Fluid fluidFromBlock(Block block) {
if (block instanceof AccessorFluidBlock) {
return ((AccessorFluidBlock) block).getFluid();
}
return Fluids.EMPTY;
}
public static List<Fluid> getAllFluids() {
return Registry.FLUID.stream().collect(Collectors.toList());
}
public static boolean drainContainers(Tank tank, Inventory inventory, int inputSlot, int outputSlot) {
return drainContainers(tank, inventory, inputSlot, outputSlot, false);
}
public static boolean drainContainers(Tank tank, Inventory inventory, int inputSlot, int outputSlot, boolean voidFluid) {
Storage<FluidVariant> itemStorage = getItemFluidStorage(inventory, inputSlot, outputSlot);
if (voidFluid) {
// Just extract as much as we can
try (Transaction tx = Transaction.openOuter()) {
boolean didSomething = false;
for (var view : itemStorage.iterable(tx)) {
if (view.isResourceBlank()) continue;
didSomething = didSomething | view.extract(view.getResource(), Long.MAX_VALUE, tx) > 0;
}
tx.commit();
return didSomething;
}
} else {
return StorageUtil.move(itemStorage, tank, fv -> true, Long.MAX_VALUE, null) > 0;
}
}
public static boolean fillContainers(Tank source, Inventory inventory, int inputSlot, int outputSlot) {
return StorageUtil.move(
source,
getItemFluidStorage(inventory, inputSlot, outputSlot),
fv -> true,
Long.MAX_VALUE,
null
) > 0;
}
private static Storage<FluidVariant> getItemFluidStorage(Inventory inventory, int inputSlot, int outputSlot) {
var invWrapper = InventoryStorage.of(inventory, null);
var input = invWrapper.getSlot(inputSlot);
var output = invWrapper.getSlot(outputSlot);
var context = new ContainerItemContext() {
@Override
public SingleSlotStorage<ItemVariant> getMainSlot() {
return input;
}
@Override
public long insertOverflow(ItemVariant itemVariant, long maxAmount, TransactionContext transactionContext) {
return output.insert(itemVariant, maxAmount, transactionContext);
}
@Override
public long insert(ItemVariant itemVariant, long maxAmount, TransactionContext transaction) {
// Don't allow insertion in the input slot
return insertOverflow(itemVariant, maxAmount, transaction);
}
@Override
public List<SingleSlotStorage<ItemVariant>> getAdditionalSlots() {
return List.of();
}
};
var storage = context.find(FluidStorage.ITEM);
return storage != null ? storage : Storage.empty();
}
public static boolean fluidEquals(@NotNull Fluid fluid, @NotNull Fluid fluid1) {
return fluid == fluid1;
}
public static boolean isContainer(ItemStack stack) {
return ContainerItemContext.withInitial(stack).find(FluidStorage.ITEM) != null;
}
public static boolean isContainerEmpty(ItemStack stack) {
var fluidStorage = ContainerItemContext.withInitial(stack).find(FluidStorage.ITEM);
if (fluidStorage == null) return false;
// Use current transaction in case this check is nested in a transfer operation.
try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) {
for (var view : fluidStorage.iterable(tx)) {
if (!view.isResourceBlank() && view.getAmount() > 0) {
return false;
}
}
}
return true;
}
public static boolean containsMatchingFluid(ItemStack stack, Predicate<Fluid> predicate) {
var fluidStorage = ContainerItemContext.withInitial(stack).find(FluidStorage.ITEM);
if (fluidStorage == null) return false;
// Use current transaction in case this check is nested in a transfer operation.
try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) {
for (var view : fluidStorage.iterable(tx)) {
if (!view.isResourceBlank() && view.getAmount() > 0 && predicate.test(view.getResource().getFluid())) {
return true;
}
}
}
return false;
}
@Deprecated
public static boolean interactWithFluidHandler(PlayerEntity playerIn, Hand hand, Tank tank) {
// TODO
return false;
}
public static String getFluidName(@NotNull FluidInstance fluidInstance) {
// TODO: use FluidVariantRendering
return getFluidName(fluidInstance.getFluid());
}
public static String getFluidName(@NotNull Fluid fluid) {
return StringUtils.capitalize(Registry.FLUID.getId(fluid).getPath());
}
}

View file

@ -24,49 +24,21 @@
package reborncore.common.fluid;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.Lazy;
import net.minecraft.util.registry.Registry;
import reborncore.common.fluid.container.ItemFluidInfo;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
public class RebornFluidManager {
private static final HashMap<Identifier, RebornFluid> fluids = new HashMap<>();
private static Lazy<Map<Fluid, BucketItem>> bucketMap;
public static void register(RebornFluid rebornFluid, Identifier identifier) {
fluids.put(identifier, rebornFluid);
Registry.register(Registry.FLUID, identifier, rebornFluid);
}
public static void setupBucketMap() {
bucketMap = new Lazy<>(() -> {
Map<Fluid, BucketItem> map = new HashMap<>();
Registry.ITEM.stream().filter(item -> item instanceof BucketItem).forEach(item -> {
BucketItem bucketItem = (BucketItem) item;
//We can be sure of this as we add this via a mixin
ItemFluidInfo fluidInfo = (ItemFluidInfo) bucketItem;
Fluid fluid = fluidInfo.getFluid(new ItemStack(item));
if (!map.containsKey(fluid)) {
map.put(fluid, bucketItem);
}
});
return map;
});
}
public static Map<Fluid, BucketItem> getBucketMap() {
return bucketMap.get();
}
public static HashMap<Identifier, RebornFluid> getFluids() {
return fluids;
}

View file

@ -22,21 +22,9 @@
* SOFTWARE.
*/
package reborncore.client.gui.slots;
package reborncore.common.misc;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import reborncore.common.fluid.FluidUtil;
public class SlotFluid extends BaseSlot {
public SlotFluid(Inventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
}
@Override
public boolean canInsert(ItemStack stack) {
return FluidUtil.getFluidHandler(stack) != null;
}
@FunctionalInterface
public interface TriConsumer<A, B, C> {
void accept(A a, B b, C c);
}

View file

@ -225,9 +225,7 @@ public class MultiblockWorldRegistry {
}
if (newMaster == null) {
RebornCore.LOGGER.fatal(
String.format("Multiblock system checked a merge pool of size %d, found no master candidates. This should never happen.",
mergePool.size()));
RebornCore.LOGGER.error("Multiblock system checked a merge pool of size %d, found no master candidates. This should never happen., {}", mergePool.size());
} else {
// Merge all the other machines into the master machine,
// then unregister them
@ -282,8 +280,7 @@ public class MultiblockWorldRegistry {
// potentially dead.
// Validate that they are empty/dead, then unregister them.
if (!controller.isEmpty()) {
RebornCore.LOGGER.fatal(
"Found a non-empty controller. Forcing it to shed its blocks and die. This should never happen!");
RebornCore.LOGGER.error("Found a non-empty controller. Forcing it to shed its blocks and die. This should never happen!");
detachedParts.addAll(controller.detachAllBlocks());
}

View file

@ -37,8 +37,8 @@ import net.minecraft.screen.ScreenHandler;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import reborncore.RebornCore;
import reborncore.client.ClientChunkManager;
import reborncore.client.screen.builder.BuiltScreenHandler;
@ -46,13 +46,12 @@ import reborncore.common.blockentity.FluidConfiguration;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blockentity.SlotConfiguration;
import reborncore.common.chunkloading.ChunkLoaderManager;
import reborncore.common.util.WorldUtils;
import java.util.List;
@Environment(EnvType.CLIENT)
public class ClientBoundPacketHandlers {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LoggerFactory.getLogger(ClientBoundPacketHandlers.class);
public static void init() {
NetworkManager.registerClientBoundHandler(new Identifier("reborncore", "custom_description"), (client, handler, packetBuffer, responseSender) -> {

View file

@ -1,5 +1,10 @@
package reborncore.common.powerSystem;
import net.fabricmc.fabric.api.item.v1.FabricItem;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import reborncore.common.util.ItemUtils;
import team.reborn.energy.api.base.SimpleBatteryItem;
/**
@ -10,7 +15,7 @@ import team.reborn.energy.api.base.SimpleBatteryItem;
* </ul>
* TODO: consider moving this functionality to the energy API?
*/
public interface RcEnergyItem extends SimpleBatteryItem {
public interface RcEnergyItem extends SimpleBatteryItem, FabricItem {
long getEnergyCapacity();
/**
@ -25,4 +30,14 @@ public interface RcEnergyItem extends SimpleBatteryItem {
default long getEnergyMaxOutput() {
return getTier().getMaxOutput();
}
@Override
default boolean allowNbtUpdateAnimation(PlayerEntity player, Hand hand, ItemStack oldStack, ItemStack newStack) {
return !ItemUtils.isEqualIgnoreEnergy(oldStack, newStack);
}
@Override
default boolean allowContinuingBlockBreaking(PlayerEntity player, ItemStack oldStack, ItemStack newStack) {
return ItemUtils.isEqualIgnoreEnergy(oldStack, newStack);
}
}

View file

@ -38,6 +38,7 @@ import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.recipes.IRecipeInput;
import team.reborn.energy.api.EnergyStorage;
import team.reborn.energy.api.EnergyStorageUtil;
import team.reborn.energy.api.base.SimpleBatteryItem;
import java.util.List;
import java.util.function.Predicate;
@ -76,6 +77,29 @@ public class ItemUtils {
return false;
}
public static boolean isEqualIgnoreEnergy(ItemStack stack1, ItemStack stack2) {
if (stack1 == stack2) {
return true;
}
if (!stack1.isOf(stack2.getItem())) {
return false;
}
if (stack1.getCount() != stack2.getCount()) {
return false;
}
if (stack1.getNbt() == stack2.getNbt()) {
return true;
}
if (stack1.getNbt() == null || stack2.getNbt() == null) {
return false;
}
NbtCompound nbt1Copy = stack1.getNbt().copy();
NbtCompound nbt2Copy = stack2.getNbt().copy();
nbt1Copy.remove(SimpleBatteryItem.ENERGY_KEY);
nbt2Copy.remove(SimpleBatteryItem.ENERGY_KEY);
return nbt1Copy.equals(nbt2Copy);
}
//TODO tags
public static boolean isInputEqual(Object input, ItemStack other, boolean matchNBT,
boolean useTags) {

View file

@ -27,7 +27,6 @@ package reborncore.common.util;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.NotNull;
import reborncore.api.items.InventoryBase;
import reborncore.common.blockentity.MachineBaseBlockEntity;
@ -95,12 +94,6 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
return stack;
}
public RebornInventory getExternal(Direction facing) {
throw new UnsupportedOperationException("needs fixing");
//return externalInventory.withFacing(facing);
}
public void read(NbtCompound data) {
read(data, "Items");
}
@ -141,6 +134,7 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
public void setHashChanged() {
this.hasChanged = true;
this.markDirty();
}
public void setHashChanged(boolean changed) {

View file

@ -42,9 +42,9 @@ public class MixinGameRenderer {
@Final
private MinecraftClient client;
@Redirect(method = "updateMovementFovMultiplier", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getSpeed()F"))
private float updateMovementFovMultiplier(AbstractClientPlayerEntity playerEntity) {
float playerSpeed = playerEntity.getSpeed();
@Redirect(method = "updateFovMultiplier", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getFovMultiplier()F"))
private float updateFovMultiplier(AbstractClientPlayerEntity playerEntity) {
float playerSpeed = playerEntity.getFovMultiplier();
for (ItemStack stack : playerEntity.getArmorItems()) {
if (stack.getItem() instanceof ArmorFovHandler) {
playerSpeed = ((ArmorFovHandler) stack.getItem()).changeFov(playerSpeed, stack, client.player);

View file

@ -31,7 +31,6 @@ import net.minecraft.item.Items;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import reborncore.common.fluid.RebornFluidManager;
import reborncore.common.fluid.container.ItemFluidInfo;
@Mixin(BucketItem.class)
@ -48,8 +47,7 @@ public class MixinBucketItem implements ItemFluidInfo {
@Override
public ItemStack getFull(Fluid fluid) {
BucketItem item = RebornFluidManager.getBucketMap().get(fluid);
return new ItemStack(item);
return new ItemStack(fluid.getBucketItem());
}
@Override

View file

@ -1,60 +0,0 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.mixin.common;
import com.google.gson.JsonObject;
import net.minecraft.recipe.RecipeManager;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import reborncore.common.crafting.ConditionManager;
import java.util.Iterator;
import java.util.Map;
@Mixin(RecipeManager.class)
public class MixinRecipeManager {
@Inject(method = "apply", at = @At("HEAD"))
private void deserialize(Map<Identifier, JsonObject> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
Iterator<Map.Entry<Identifier, JsonObject>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Identifier, JsonObject> entry = iterator.next();
Identifier id = entry.getKey();
JsonObject json = entry.getValue();
// TODO dont hard code this as its awful
if (id.getNamespace().equals("reborncore") || id.getNamespace().equals("techreborn")) {
if (!ConditionManager.shouldLoadRecipe(json)) {
iterator.remove();
}
}
}
}
}

View file

@ -1,7 +1,7 @@
{
"required": true,
"package": "reborncore.mixin.client",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinGameRenderer",
"MixinDebugRenderer",

View file

@ -1,7 +1,7 @@
{
"required": true,
"package": "reborncore.mixin.common",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_17",
"mixins": [
"AccessorFluidBlock",
"AccessorFoliagePlacerType",
@ -14,7 +14,6 @@
"MixinItemStack",
"MixinLivingEntity",
"MixinPlayerEntity",
"MixinRecipeManager",
"MixinServerPlayerEntity"
],
"injectors": {

View file

@ -12,7 +12,7 @@ plugins {
id 'eclipse'
id 'maven-publish'
id "org.cadixdev.licenser" version "0.6.1"
id "fabric-loom" version "0.10-SNAPSHOT"
id "fabric-loom" version "0.11-SNAPSHOT"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "de.undercouch.download" version "4.1.1"
}
@ -138,13 +138,6 @@ loom {
}
sourceSets {
// Add a generated resources directory
generated {
resources {
compiledBy("runDatagen")
}
}
// Add a data gen sourceset
datagen {
compileClasspath += main.compileClasspath
@ -161,8 +154,11 @@ sourceSets {
}
main {
runtimeClasspath += generated.runtimeClasspath
runtimeClasspath += generated.output
resources {
srcDirs += [
'src/main/generated'
]
}
}
}
@ -206,7 +202,7 @@ loom {
server()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
vmArg "-Dfabric-api.datagen.modid=techreborn-datagen"
runDir "build/datagen"
source sourceSets.datagen
@ -230,27 +226,25 @@ loom {
}
}
}
assemble.dependsOn runDatagen
test.dependsOn runGametest
runDatagen {
// Doesnt re-run the task when its up-to date
outputs.dir('src/generated/resources')
outputs.dir('src/main/generated')
}
jar {
exclude "**/*.psd"
dependsOn("runDatagen")
from file('src/generated/resources')
from file('src/main/generated')
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null}
// A bit of a hack to allow the generated sources when they already exist
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn 'fixTranslations'
dependsOn 'runDatagen'
}
task crowdinExport() {
description "Triggers crowdin to export the latest translations"
onlyIf {
@ -318,7 +312,7 @@ curseforge {
id = "233564"
changelog = ENV.CHANGELOG ?: "No changelog provided"
releaseType = ENV.RELEASE_CHANNEL ?: "release"
addGameVersion "1.18" // Also update in RebornCore/build.gradle
addGameVersion "1.18.1" // Also update in RebornCore/build.gradle
addGameVersion "Fabric"
mainArtifact remapJar

View file

@ -2,18 +2,18 @@
org.gradle.jvmargs=-Xmx2G
# Mod properties
mod_version=5.1.0-beta.4
mod_version=5.1.0-beta.5
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18
yarn_version=1.18+build.1
loader_version=0.12.8
fapi_version=0.44.0+1.18
minecraft_version=1.18.1
yarn_version=1.18.1+build.18
loader_version=0.12.12
fapi_version=0.46.1+1.18
# Dependencies
energy_version=2.0.0-beta1
rei_version=7.0.337
energy_version=2.1.0
rei_version=7.1.361
trinkets_version=3.0.2
autoswitch_version=-SNAPSHOT
dashloader_version=2.0

View file

@ -53,6 +53,7 @@ class SmeltingRecipesProvider extends TechRebornRecipesProvider {
(CommonTags.Items.sheldoniteOres) : TRContent.Ingots.PLATINUM,
(CommonTags.Items.platinumDusts) : TRContent.Ingots.PLATINUM,
(Items.IRON_INGOT) : TRContent.Ingots.REFINED_IRON,
(cItem("iron_plates")): TRContent.Plates.REFINED_IRON,
(CommonTags.Items.silverOres) : TRContent.Ingots.SILVER,
(CommonTags.Items.rawSilverOres) : TRContent.Ingots.SILVER,
(CommonTags.Items.tinOres) : TRContent.Ingots.TIN,

View file

@ -33,8 +33,8 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import reborncore.common.blockentity.RedstoneConfiguration;
import reborncore.common.config.Configuration;
import reborncore.common.recipes.RecipeCrafter;
@ -58,7 +58,7 @@ import java.util.function.Predicate;
public class TechReborn implements ModInitializer {
public static final String MOD_ID = "techreborn";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static TechReborn INSTANCE;
public static ItemGroup ITEMGROUP = FabricItemGroupBuilder.build(

View file

@ -26,7 +26,7 @@ package techreborn.api.generator;
import net.minecraft.fluid.Fluid;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
public record FluidGeneratorRecipe(Fluid fluid, int energyPerMb,
EFluidGenerator generatorType) {

View file

@ -26,7 +26,7 @@ package techreborn.api.generator;
import com.google.common.collect.Sets;
import net.minecraft.fluid.Fluid;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
import java.util.HashSet;
import java.util.Optional;

View file

@ -37,7 +37,7 @@ import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
public class FluidReplicatorRecipe extends RebornFluidRecipe {
@ -66,7 +66,7 @@ public class FluidReplicatorRecipe extends RebornFluidRecipe {
return false;
}
final BlockPos hole = blockEntity.getPos().offset(blockEntity.getFacing().getOpposite(), 2);
final Fluid fluid = techreborn.utils.FluidUtils.fluidFromBlock(blockEntity.getWorld().getBlockState(hole).getBlock());
final Fluid fluid = FluidUtils.fluidFromBlock(blockEntity.getWorld().getBlockState(hole).getBlock());
if (fluid == Fluids.EMPTY) {
return true;
}

View file

@ -38,7 +38,6 @@ import reborncore.api.blockentity.InventoryProvider;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank;
@ -46,7 +45,7 @@ import techreborn.api.generator.EFluidGenerator;
import techreborn.api.generator.FluidGeneratorRecipe;
import techreborn.api.generator.FluidGeneratorRecipeList;
import techreborn.api.generator.GeneratorRecipeHelper;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider {
@ -89,10 +88,10 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
if (ticksSinceLastChange >= 10) {
ItemStack inputStack = inventory.getStack(0);
if (!inputStack.isEmpty()) {
if (FluidUtils.isContainerEmpty(inputStack) && !tank.getFluidAmount().isEmpty()) {
FluidUtils.fillContainers(tank, inventory, 0, 1);
} else if (inputStack.getItem() instanceof ItemFluidInfo && getRecipes().getRecipeForFluid(((ItemFluidInfo) inputStack.getItem()).getFluid(inputStack)).isPresent()) {
if (FluidUtils.containsMatchingFluid(inputStack, f -> getRecipes().getRecipeForFluid(f).isPresent())) {
FluidUtils.drainContainers(tank, inventory, 0, 1);
} else {
FluidUtils.fillContainers(tank, inventory, 0, 1);
}
}

View file

@ -47,7 +47,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.ModRecipes;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
/**
* @author drcrazy

View file

@ -47,7 +47,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.ModRecipes;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider {

View file

@ -47,7 +47,7 @@ import techreborn.config.TechRebornConfig;
import techreborn.init.ModRecipes;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider {

View file

@ -409,6 +409,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
@Override
public void writeNbt(NbtCompound tag) {
tag.putBoolean("locked", locked);
super.writeNbt(tag);
}
@Override

View file

@ -41,10 +41,10 @@ import techreborn.init.TRContent;
public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider {
/**
* MFSU should store 4M Energy with 512 E/t I/O
* MFSU should store 40M Energy with 512 E/t I/O
*/
public HighVoltageSUBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.HIGH_VOLTAGE_SU, pos, state, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, RcEnergyTier.HIGH, 4_000_000);
super(TRBlockEntities.HIGH_VOLTAGE_SU, pos, state, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, RcEnergyTier.HIGH, 40_000_000);
}
@Override

View file

@ -40,10 +40,10 @@ import techreborn.init.TRContent;
public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider {
/**
* MFE should store 300k energy with 128 E/t I/O
* MFE should store 4M energy with 128 E/t I/O
*/
public MediumVoltageSUBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, pos, state, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, RcEnergyTier.MEDIUM, 300_000);
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, pos, state, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, RcEnergyTier.MEDIUM, 4_000_000);
}
@Override

View file

@ -43,15 +43,13 @@ import reborncore.client.screen.BuiltScreenHandlerProvider;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.screen.builder.ScreenHandlerBuilder;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.fluid.FluidUtil;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.FluidTextHelper;
import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
import java.util.List;
@ -160,7 +158,7 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
info.add(
new LiteralText(String.valueOf(this.tank.getFluidAmount()))
.append(new TranslatableText("techreborn.tooltip.unit.divider"))
.append(WordUtils.capitalize(FluidUtil.getFluidName(this.tank.getFluid())))
.append(WordUtils.capitalize(FluidUtils.getFluidName(this.tank.getFluid())))
);
} else {
info.add(new TranslatableText("techreborn.tooltip.unit.empty"));

View file

@ -24,6 +24,11 @@
package techreborn.blockentity.storage.item;
import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage;
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
import net.fabricmc.fabric.api.transfer.v1.storage.base.CombinedStorage;
import net.minecraft.block.BlockState;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
@ -51,6 +56,7 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import java.util.List;
import java.util.Objects;
public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider {
@ -66,6 +72,8 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
private int serverCapacity = -1;
private ItemStack storeItemStack;
// Fabric transfer API support for the internal stack (one per direction);
private final SingleStackStorage[] internalStoreStorage = new SingleStackStorage[6];
private TRContent.StorageUnit type;
@ -75,23 +83,21 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
public StorageUnitBaseBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.STORAGE_UNIT, pos, state);
inventory = new RebornInventory<>(2, "ItemInventory", 64, this);
}
public StorageUnitBaseBlockEntity(BlockPos pos, BlockState state, TRContent.StorageUnit type) {
super(TRBlockEntities.STORAGE_UNIT, pos, state);
inventory = new RebornInventory<>(2, "ItemInventory", 64, this);
configureEntity(type);
}
private void configureEntity(TRContent.StorageUnit type) {
// Set capacity to local config unless overridden by server
if(serverCapacity == -1){
this.maxCapacity = type.capacity;
}
storeItemStack = ItemStack.EMPTY;
inventory = new RebornInventory<>(2, "ItemInventory", 64, this);
this.type = type;
}
@ -313,8 +319,6 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
if (tagCompound.contains("lockedItem")) {
lockedItemStack = ItemStack.fromNbt(tagCompound.getCompound("lockedItem"));
}
inventory.read(tagCompound);
}
@Override
@ -340,8 +344,6 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
if (isLocked()) {
tagCompound.put("lockedItem", lockedItemStack.writeNbt(new NbtCompound()));
}
inventory.write(tagCompound);
}
@Override
@ -500,4 +502,57 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
public void setStoredStackFromNBT(NbtCompound tag) {
storeItemStack = ItemStack.fromNbt(tag);
}
private Storage<ItemVariant> getInternalStoreStorage(Direction side) {
Objects.requireNonNull(side);
if (internalStoreStorage[side.getId()] == null) {
internalStoreStorage[side.getId()] = new SingleStackStorage() {
@Override
protected ItemStack getStack() {
return storeItemStack;
}
@Override
protected void setStack(ItemStack stack) {
if (stack.isEmpty()) {
// Ensure we maintain reference equality to EMPTY
storeItemStack = ItemStack.EMPTY;
} else {
storeItemStack = stack;
}
}
@Override
protected int getCapacity(ItemVariant itemVariant) {
// subtract capacity of output slot (super capacity is the default capacity)
return maxCapacity - super.getCapacity(itemVariant);
}
@Override
protected boolean canInsert(ItemVariant itemVariant) {
// Check insertion with the same rules as the input slot
return StorageUnitBaseBlockEntity.this.canInsert(INPUT_SLOT, itemVariant.toStack(), side);
}
@Override
protected boolean canExtract(ItemVariant itemVariant) {
// Check extraction with the same rules as the output slot
return StorageUnitBaseBlockEntity.this.canExtract(OUTPUT_SLOT, itemVariant.toStack(), side);
}
@Override
protected void onFinalCommit() {
inventory.setHashChanged();
}
};
}
return internalStoreStorage[side.getId()];
}
public Storage<ItemVariant> getExposedStorage(Direction side) {
return new CombinedStorage<>(List.of(
getInternalStoreStorage(side),
InventoryStorage.of(this, side)
));
}
}

View file

@ -24,13 +24,13 @@
package techreborn.client.gui;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.ClientChunkManager;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonSimple;
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.client.screen.builder.BuiltScreenHandler;
@ -54,7 +54,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
addDrawableChild(new GuiButtonSimple(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
addDrawableChild(new ButtonWidget(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
}
@Override

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
@ -64,7 +65,7 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
drawSlot(matrixStack, 48, gridYPos + 36, layer);
if (!blockEntity.isMultiblockValid()) {
getMinecraft().getTextureManager().bindTexture(new Identifier("techreborn", "textures/item/part/digital_display.png"));
RenderSystem.setShaderTexture(0, new Identifier("techreborn", "textures/item/part/digital_display.png"));
drawTexture(matrixStack, x + 68, y + 22, 0, 0, 16, 16, 16, 16);
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available")

View file

@ -24,16 +24,14 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TexturedButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonSimple;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.common.network.NetworkManager;
@ -41,12 +39,10 @@ import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
import techreborn.packets.ServerboundPackets;
import techreborn.utils.PlayerUtils;
import java.util.ArrayList;
import java.util.List;
public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
IronFurnaceBlockEntity blockEntity;
private static final Identifier EXP_BUTTON_TEXTURE = new Identifier("minecraft", "textures/item/experience_bottle.png");
public GuiIronFurnace(int syncID, PlayerEntity player, IronFurnaceBlockEntity furnace) {
@ -61,11 +57,9 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
@Override
public void init() {
super.init();
addSelectableChild(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) {
@Override
public void renderTooltip(MatrixStack matrixStack, int mouseX, int mouseY) {
ButtonWidget.TooltipSupplier tooltipSupplier = (button, matrices, mouseX, mouseY) -> {
PlayerEntity player = MinecraftClient.getInstance().player;
if (player == null) { return; }
String message = "Experience: ";
float furnaceExp = blockEntity.experience;
@ -89,18 +83,23 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
}
}
List<Text> list = new ArrayList<>();
list.add(new LiteralText(message));
GuiIronFurnace.this.renderTooltip(matrixStack, list, mouseX, mouseY);
RenderSystem.setShaderColor(1, 1, 1, 1);
renderTooltip(matrices, new LiteralText(message), mouseX, mouseY);
};
}
@Override
protected void renderBackground(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY) {
client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y);
}
});
addDrawableChild(new TexturedButtonWidget(
getGuiLeft() + 116,
getGuiTop() + 58,
16,
16,
0,
0,
1,
EXP_BUTTON_TEXTURE,
16,
16,
b -> onClick(),
tooltipSupplier,
LiteralText.EMPTY));
}
@Override

View file

@ -29,7 +29,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.common.fluid.FluidUtil;
import reborncore.common.fluid.FluidUtils;
import reborncore.common.fluid.container.FluidInstance;
import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
@ -67,7 +67,7 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else {
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.type"), 10, 20, 4210752);
textRenderer.draw(matrixStack, FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
textRenderer.draw(matrixStack, FluidUtils.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.amount"), 10, 50, 4210752);

View file

@ -301,10 +301,10 @@ public class TechRebornConfig {
@Config(config = "items", category = "power", key = "quantumSuitDamageAbsorbCost", comment = "Quantum Suit Cost for Damage Absorbed")
public static double damageAbsorbCost = 10;
@Config(config = "items", category = "upgrades", key = "overclcoker_speed", comment = "Overclocker behavior speed multipiler")
@Config(config = "items", category = "upgrades", key = "overclocker_speed", comment = "Overclocker behavior speed multiplier")
public static double overclockerSpeed = 0.25;
@Config(config = "items", category = "upgrades", key = "overclcoker_power", comment = "Overclocker behavior power multipiler")
@Config(config = "items", category = "upgrades", key = "overclocker_power", comment = "Overclocker behavior power multiplier")
public static double overclockerPower = 0.75;
@Config(config = "items", category = "upgrades", key = "energy_storage", comment = "Energy storage behavior extra power")

View file

@ -25,18 +25,19 @@
package techreborn.events;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
import net.minecraft.block.*;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.RebornRegistry;
import reborncore.common.powerSystem.RcEnergyTier;
import team.reborn.energy.api.EnergyStorage;
import techreborn.TechReborn;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.blocks.misc.*;
import techreborn.config.TechRebornConfig;
import techreborn.init.*;
@ -172,6 +173,16 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, EquipmentSlot.LEGS), "peridot_leggings"));
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, EquipmentSlot.FEET), "peridot_boots"));
RebornRegistry.registerItem(TRContent.SILVER_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.HEAD), "silver_helmet"));
RebornRegistry.registerItem(TRContent.SILVER_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.CHEST), "silver_chestplate"));
RebornRegistry.registerItem(TRContent.SILVER_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.LEGS), "silver_leggings"));
RebornRegistry.registerItem(TRContent.SILVER_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.FEET), "silver_boots"));
RebornRegistry.registerItem(TRContent.STEEL_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.HEAD), "steel_helmet"));
RebornRegistry.registerItem(TRContent.STEEL_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.CHEST), "steel_chestplate"));
RebornRegistry.registerItem(TRContent.STEEL_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.LEGS), "steel_leggings"));
RebornRegistry.registerItem(TRContent.STEEL_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.FEET), "steel_boots"));
// Battery
RebornRegistry.registerItem(TRContent.RED_CELL_BATTERY = InitUtils.setup(new BatteryItem(TechRebornConfig.redCellBatteryMaxCharge, RcEnergyTier.LOW), "red_cell_battery"));
RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new BatteryItem(TechRebornConfig.lithiumIonBatteryMaxCharge, RcEnergyTier.MEDIUM), "lithium_ion_battery"));
@ -211,6 +222,7 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.MANUAL = InitUtils.setup(new ManualItem(), "manual"));
RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new DebugToolItem(), "debug_tool"));
RebornRegistry.registerItem(TRContent.CELL = InitUtils.setup(new DynamicCellItem(), "cell"));
TRContent.CELL.registerFluidApi();
TechReborn.LOGGER.debug("TechReborns Items Loaded");
}
@ -232,6 +244,7 @@ public class ModRegistry {
}
private static void registerApis() {
EnergyStorage.SIDED.registerForBlockEntities((be, direction) -> ((CableBlockEntity) be).getSideEnergyStorage(direction), TRBlockEntities.CABLE);
EnergyStorage.SIDED.registerForBlockEntity(CableBlockEntity::getSideEnergyStorage, TRBlockEntities.CABLE);
ItemStorage.SIDED.registerForBlockEntity(StorageUnitBaseBlockEntity::getExposedStorage, TRBlockEntities.STORAGE_UNIT);
}
}

View file

@ -24,12 +24,16 @@
package techreborn.events;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
import net.minecraft.block.Block;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.fluid.FlowableFluid;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.integrated.IntegratedServer;
@ -44,6 +48,7 @@ import net.minecraft.world.gen.HeightContext;
import org.jetbrains.annotations.Nullable;
import reborncore.common.BaseBlockEntityProvider;
import techreborn.init.TRContent;
import techreborn.items.DynamicCellItem;
import techreborn.items.UpgradeItem;
import techreborn.utils.ToolTipAssistUtils;
import techreborn.world.OreDistribution;
@ -56,12 +61,18 @@ public class StackToolTipHandler implements ItemTooltipCallback {
public static final Map<Item, Boolean> ITEM_ID = Maps.newHashMap();
private static final Map<Block, OreDistribution> ORE_DISTRIBUTION_MAP = Maps.newHashMap();
private static final List<Block> UNOBTAINABLE_ORES = Lists.newLinkedList();
public static void setup() {
ItemTooltipCallback.EVENT.register(new StackToolTipHandler());
for (TRContent.Ores ore : TRContent.Ores.values()) {
if (ore.isDeepslate()) continue;
if (ore.isDeepslate()) {
TRContent.Ores normal = ore.getUnDeepslate();
if (normal.distribution != null && normal.distribution.dimension != TargetDimension.OVERWORLD)
UNOBTAINABLE_ORES.add(ore.block);
continue;
}
if (ore.distribution != null) {
ORE_DISTRIBUTION_MAP.put(ore.block, ore.distribution);
@ -103,19 +114,26 @@ public class StackToolTipHandler implements ItemTooltipCallback {
tooltipLines.addAll(ToolTipAssistUtils.getUpgradeStats(TRContent.Upgrades.valueOf(upgrade.name.toUpperCase()), stack.getCount(), Screen.hasShiftDown()));
}
OreDistribution oreDistribution = ORE_DISTRIBUTION_MAP.get(block);
if (item instanceof DynamicCellItem cell) {
Fluid fluid = cell.getFluid(stack);
if (!(fluid instanceof FlowableFluid) && fluid != Fluids.EMPTY)
ToolTipAssistUtils.addInfo("unplaceable_fluid", tooltipLines, false);
}
if (oreDistribution != null) {
Text text = switch (oreDistribution.dimension) {
Text text = null;
if (UNOBTAINABLE_ORES.contains(block))
text = new TranslatableText("techreborn.tooltip.unobtainable");
OreDistribution oreDistribution = ORE_DISTRIBUTION_MAP.get(block);
if (oreDistribution != null && text == null) {
text = switch (oreDistribution.dimension) {
case OVERWORLD -> getOverworldOreText(oreDistribution);
case END -> new TranslatableText("techreborn.tooltip.ores.end");
case NETHER -> new TranslatableText("techreborn.tooltip.ores.nether");
};
}
if (text != null)
tooltipLines.add(text.copy().formatted(Formatting.AQUA));
}
}
private static boolean isTRItem(Item item) {
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");

View file

@ -85,10 +85,11 @@ public enum ModFluids {
FluidSettings fluidSettings = FluidSettings.create();
Identifier texture = new Identifier(TechReborn.MOD_ID, "block/fluids/" + this.toString().toLowerCase(Locale.ROOT) + "_flowing");
Identifier texture_still = new Identifier(TechReborn.MOD_ID, "block/fluids/" + this.toString().toLowerCase(Locale.ROOT) + "_still");
Identifier texture_flowing = new Identifier(TechReborn.MOD_ID, "block/fluids/" + this.toString().toLowerCase(Locale.ROOT) + "_flowing");
fluidSettings.setStillTexture(texture);
fluidSettings.setFlowingTexture(texture);
fluidSettings.setStillTexture(texture_still);
fluidSettings.setFlowingTexture(texture_flowing);
stillFluid = new RebornFluid(true, fluidSettings, () -> block, () -> bucket, () -> flowingFluid, () -> stillFluid) {
};

View file

@ -49,6 +49,12 @@ public enum TRArmorMaterials implements ArmorMaterial {
PERIDOT(17, new int[]{3, 8, 3, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Gems.PERIDOT.asItem());
}),
SILVER(14, new int[]{1, 3, 5, 2}, 20, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Ingots.SILVER.asItem());
}),
STEEL(24, new int[]{3, 5, 6, 2}, 5, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.75F, 0.1F, () -> {
return Ingredient.ofItems(TRContent.Ingots.STEEL.asItem());
}),
QUANTUM(75, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> Ingredient.EMPTY),
CLOAKING_DEVICE(5, new int[]{0, 2, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, () -> Ingredient.EMPTY),
LITHIUM_BATPACK(25, new int[]{0, 5, 0, 0}, 10, SoundEvents.ITEM_ARMOR_EQUIP_TURTLE, 0.0F, () -> Ingredient.EMPTY),
@ -60,18 +66,25 @@ public enum TRArmorMaterials implements ArmorMaterial {
private final int enchantability;
private final SoundEvent soundEvent;
private final float toughness;
private final float knockbackResistance;
private final Lazy<Ingredient> repairMaterial;
TRArmorMaterials(int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterialIn) {
SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterialIn) {
this.maxDamageFactor = maxDamageFactor;
this.damageReductionAmountArray = damageReductionAmountArray;
this.enchantability = enchantability;
this.soundEvent = soundEvent;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairMaterial = new Lazy<>(repairMaterialIn);
}
TRArmorMaterials(int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterialIn) {
this(maxDamageFactor, damageReductionAmountArray, enchantability, soundEvent, toughness, 0.0F, repairMaterialIn);
}
@Override
public int getDurability(EquipmentSlot slotIn) {
return MAX_DAMAGE_ARRAY[slotIn.getEntitySlotId()] * maxDamageFactor;
@ -109,6 +122,6 @@ public enum TRArmorMaterials implements ArmorMaterial {
@Override
public float getKnockbackResistance() {
return 0; //Knockback resitance
return knockbackResistance;
}
}

View file

@ -43,7 +43,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.event.GameEvent;
import techreborn.items.DynamicCellItem;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
public class TRCauldronBehavior {
public static void init() {

View file

@ -231,6 +231,22 @@ public class TRContent {
public static Item PERIDOT_LEGGINGS;
@Nullable
public static Item PERIDOT_BOOTS;
@Nullable
public static Item SILVER_HELMET;
@Nullable
public static Item SILVER_CHESTPLATE;
@Nullable
public static Item SILVER_LEGGINGS;
@Nullable
public static Item SILVER_BOOTS;
@Nullable
public static Item STEEL_HELMET;
@Nullable
public static Item STEEL_CHESTPLATE;
@Nullable
public static Item STEEL_LEGGINGS;
@Nullable
public static Item STEEL_BOOTS;
public enum SolarPanels implements ItemConvertible {
BASIC(RcEnergyTier.MICRO, TechRebornConfig.basicGenerationRateD, TechRebornConfig.basicGenerationRateN),
@ -373,6 +389,8 @@ public class TRContent {
private final static Map<Ores, Ores> deepslateMap = new HashMap<>();
private final static Map<Ores, Ores> unDeepslateMap = new HashMap<>();
public enum Ores implements ItemConvertible {
// when changing ores also change data/techreborn/tags/items/ores.json for correct root advancement display
// as well as data/minecraft/tags/blocks for correct mining level
@ -424,6 +442,7 @@ public class TRContent {
Ores(TRContent.Ores stoneOre) {
this((OreDistribution) null);
deepslateMap.put(stoneOre, this);
unDeepslateMap.put(this, stoneOre);
}
@Override
@ -436,6 +455,11 @@ public class TRContent {
return deepslateMap.get(this);
}
public TRContent.Ores getUnDeepslate() {
Preconditions.checkArgument(isDeepslate());
return unDeepslateMap.get(this);
}
public boolean isDeepslate() {
return name.startsWith("deepslate_");
}
@ -600,7 +624,7 @@ public class TRContent {
}
public enum Dusts implements ItemConvertible {
ALMANDINE, ALUMINUM, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME,
ALMANDINE, ALUMINUM, AMETHYST, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME,
CINNABAR, CLAY, COAL, DARK_ASHES, DIAMOND, DIORITE, ELECTRUM, EMERALD, ENDER_EYE, ENDER_PEARL, ENDSTONE,
FLINT, GALENA, GRANITE, GROSSULAR, INVAR, LAZURITE, MAGNESIUM, MANGANESE, MARBLE, NETHERRACK,
NICKEL, OBSIDIAN, OLIVINE, PERIDOT, PHOSPHOROUS, PLATINUM, PYRITE, PYROPE, QUARTZ, RED_GARNET, RUBY, SALTPETER,
@ -809,6 +833,7 @@ public class TRContent {
UU_MATTER,
PLANTBALL,
COMPRESSED_PLANTBALL,
SPONGE_PIECE,
SYNTHETIC_REDSTONE_CRYSTAL;

View file

@ -1,3 +1,27 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.init;
import net.minecraft.item.ToolMaterial;

View file

@ -24,6 +24,13 @@
package techreborn.items;
import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantItemStorage;
import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.FluidDrainable;
import net.minecraft.block.FluidFillable;
@ -60,12 +67,11 @@ import net.minecraft.world.event.GameEvent;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.text.WordUtils;
import org.jetbrains.annotations.Nullable;
import reborncore.common.fluid.FluidUtil;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.util.ItemNBTHelper;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
import reborncore.common.fluid.FluidUtils;
/**
* Created by modmuss50 on 17/05/2016.
@ -160,7 +166,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
Fluid fluid = getFluid(itemStack);
if (fluid != Fluids.EMPTY) {
//TODO use translation keys for fluid and the cell https://fabric.asie.pl/wiki/tutorial:lang?s[]=translation might be useful
return new LiteralText(WordUtils.capitalizeFully(FluidUtil.getFluidName(fluid).replaceAll("_", " ")) + " Cell");
return new LiteralText(WordUtils.capitalizeFully(FluidUtils.getFluidName(fluid).replaceAll("_", " ")) + " Cell");
}
return super.getName(itemStack);
}
@ -171,7 +177,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
Fluid containedFluid = getFluid(stack);
BlockHitResult hitResult = raycast(world, player, containedFluid == Fluids.EMPTY ? RaycastContext.FluidHandling.SOURCE_ONLY : RaycastContext.FluidHandling.NONE);
if (hitResult.getType() == HitResult.Type.MISS) {
if (hitResult.getType() == HitResult.Type.MISS || !(containedFluid instanceof FlowableFluid || Fluids.EMPTY == containedFluid)) {
return TypedActionResult.pass(stack);
}
if (hitResult.getType() != HitResult.Type.BLOCK) {
@ -238,10 +244,75 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
@Override
public Fluid getFluid(ItemStack itemStack) {
NbtCompound tag = itemStack.getNbt();
return getFluid(itemStack.getNbt());
}
private Fluid getFluid(@Nullable NbtCompound tag) {
if (tag != null && tag.contains("fluid")) {
return Registry.FLUID.get(new Identifier(tag.getString("fluid")));
}
return Fluids.EMPTY;
}
public void registerFluidApi() {
FluidStorage.ITEM.registerForItems((stack, ctx) -> new CellStorage(ctx), this);
}
public class CellStorage extends SingleVariantItemStorage<FluidVariant> {
public CellStorage(ContainerItemContext context) {
super(context);
}
@Override
protected FluidVariant getBlankResource() {
return FluidVariant.blank();
}
@Override
protected FluidVariant getResource(ItemVariant currentVariant) {
return FluidVariant.of(getFluid(currentVariant.getNbt()));
}
@Override
protected long getAmount(ItemVariant currentVariant) {
return getResource(currentVariant).isBlank() ? 0 : FluidConstants.BUCKET;
}
@Override
protected long getCapacity(FluidVariant variant) {
return FluidConstants.BUCKET;
}
@Override
protected ItemVariant getUpdatedVariant(ItemVariant currentVariant, FluidVariant newResource, long newAmount) {
if (newAmount != 0 && newAmount != FluidConstants.BUCKET) {
throw new IllegalArgumentException("Only amounts of 0 and 1 bucket are supported! This is a bug!");
}
// TODO: this is not ideal since we delete any extra NBT, but it probably doesn't matter in practice?
if (newResource.isBlank() || newAmount == 0) {
return ItemVariant.of(DynamicCellItem.this);
} else {
return ItemVariant.of(getCellWithFluid(newResource.getFluid()));
}
}
// A few "hacks" to ensure that transfer is always exactly 0 or 1 bucket.
@Override
public long insert(FluidVariant insertedResource, long maxAmount, TransactionContext transaction) {
if (isResourceBlank() && maxAmount >= FluidConstants.BUCKET) {
return super.insert(insertedResource, FluidConstants.BUCKET, transaction);
} else {
return 0;
}
}
@Override
public long extract(FluidVariant extractedResource, long maxAmount, TransactionContext transaction) {
if (!isResourceBlank() && maxAmount >= FluidConstants.BUCKET) {
return super.extract(extractedResource, FluidConstants.BUCKET, transaction);
} else {
return 0;
}
}
}
}

View file

@ -35,7 +35,6 @@ import net.minecraft.tag.Tag;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
@ -95,7 +94,7 @@ public class DrillItem extends PickaxeItem implements RcEnergyItem, DynamicAttri
if (Items.DIAMOND_SHOVEL.getMiningSpeedMultiplier(new ItemStack(Items.DIAMOND_SHOVEL), blockIn) > 1.0f) {
return true;
}
return Items.DIAMOND_PICKAXE.getMiningSpeedMultiplier(new ItemStack(Items.DIAMOND_SHOVEL), blockIn) > 1.0f;
return Items.DIAMOND_PICKAXE.getMiningSpeedMultiplier(new ItemStack(Items.DIAMOND_PICKAXE), blockIn) > 1.0f;
}
// MiningToolItem

View file

@ -35,7 +35,6 @@ 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.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
@ -54,7 +53,7 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
// 10k Energy with 128 E\t charge rate
public RockCutterItem() {
// combat stats same as for diamond pickaxe. Fix for #2468
super(TRToolMaterials.ROCK_CUTTER, 1, -2.8F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
super(TRToolMaterials.ROCK_CUTTER, 1, -2.8f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
}
// PickaxeItem
@ -66,7 +65,7 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
@Override
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
if (getStoredEnergy(stack) < cost) {
return 2F;
return 1.0f;
} else {
return Items.DIAMOND_PICKAXE.getMiningSpeedMultiplier(stack, state);
}

View file

@ -1,142 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.utils;
import net.minecraft.block.Block;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.util.Tank;
import reborncore.mixin.common.AccessorFluidBlock;
import java.util.List;
import java.util.stream.Collectors;
public class FluidUtils {
@NotNull
public static Fluid fluidFromBlock(Block block) {
if (block instanceof AccessorFluidBlock) {
return ((AccessorFluidBlock) block).getFluid();
}
return Fluids.EMPTY;
}
public static List<Fluid> getAllFluids() {
return Registry.FLUID.stream().collect(Collectors.toList());
}
public static boolean drainContainers(Tank tank, Inventory inventory, int inputSlot, int outputSlot) {
return drainContainers(tank, inventory, inputSlot, outputSlot, false);
}
public static boolean drainContainers(Tank tank, Inventory inventory, int inputSlot, int outputSlot, boolean voidFluid) {
ItemStack inputStack = inventory.getStack(inputSlot);
ItemStack outputStack = inventory.getStack(outputSlot);
if (inputStack.isEmpty()) return false;
if (!(inputStack.getItem() instanceof ItemFluidInfo itemFluidInfo)) return false;
if (FluidUtils.isContainerEmpty(inputStack)) return false;
if (outputStack.getCount() >= outputStack.getMaxCount()) return false;
if (!outputStack.isEmpty() && !FluidUtils.isContainerEmpty(outputStack)) return false;
if (!outputStack.isEmpty() && !outputStack.isItemEqual(itemFluidInfo.getEmpty())) return false;
FluidInstance tankFluidInstance = tank.getFluidInstance();
Fluid tankFluid = tankFluidInstance.getFluid();
if (tankFluidInstance.isEmpty() || tankFluid == itemFluidInfo.getFluid(inputStack)) {
FluidValue freeSpace = tank.getFluidValueCapacity().subtract(tankFluidInstance.getAmount());
if (freeSpace.equalOrMoreThan(FluidValue.BUCKET) || voidFluid) {
inputStack.decrement(1);
if (!voidFluid) {
tankFluidInstance.setFluid(itemFluidInfo.getFluid(inputStack));
tankFluidInstance.addAmount(FluidValue.BUCKET);
}
if (outputStack.isEmpty()) {
inventory.setStack(outputSlot, itemFluidInfo.getEmpty());
} else {
outputStack.increment(1);
}
}
}
return true;
}
public static boolean fillContainers(Tank source, Inventory inventory, int inputSlot, int outputSlot) {
ItemStack inputStack = inventory.getStack(inputSlot);
ItemStack outputStack = inventory.getStack(outputSlot);
if (!FluidUtils.isContainerEmpty(inputStack)) return false;
ItemFluidInfo itemFluidInfo = (ItemFluidInfo) inputStack.getItem();
FluidInstance sourceFluid = source.getFluidInstance();
if (sourceFluid.getFluid() == Fluids.EMPTY || sourceFluid.getAmount().lessThan(FluidValue.BUCKET)) {
return false;
}
if (!outputStack.isEmpty()) {
if (outputStack.getCount() >= outputStack.getMaxCount()) return false;
if (!(outputStack.getItem() instanceof ItemFluidInfo outputFluidInfo)) return false;
if (!outputStack.isItemEqual(itemFluidInfo.getEmpty())) return false;
if (outputFluidInfo.getFluid(outputStack) != sourceFluid.getFluid()) {
return false;
}
}
if (outputStack.isEmpty()) {
inventory.setStack(outputSlot, itemFluidInfo.getFull(sourceFluid.getFluid()));
} else {
outputStack.increment(1);
}
sourceFluid.subtractAmount(FluidValue.BUCKET);
inputStack.decrement(1);
return true;
}
public static boolean fluidEquals(@NotNull Fluid fluid, @NotNull Fluid fluid1) {
return fluid == fluid1;
}
public static boolean isContainerEmpty(ItemStack stack) {
if (stack.isEmpty())
return false;
if (stack.getItem() instanceof ItemFluidInfo itemFluidInfo)
return itemFluidInfo.getFluid(stack) == Fluids.EMPTY;
return false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

View file

@ -377,6 +377,7 @@
"_comment7": "Dusts",
"item.techreborn.almandine_dust": "Almandine Dust",
"item.techreborn.aluminum_dust": "Aluminium Dust",
"item.techreborn.amethyst_dust": "Amethyst Dust",
"item.techreborn.andesite_dust": "Andesite Dust",
"item.techreborn.andradite_dust": "Andradite Dust",
"item.techreborn.ashes_dust": "Ashes",
@ -638,6 +639,7 @@
"item.techreborn.uu_matter": "UU-Matter",
"item.techreborn.plantball": "Plantball",
"item.techreborn.compressed_plantball": "Compressed Plantball",
"item.techreborn.sponge_piece": "Piece of Sponge",
"item.techreborn.synthetic_redstone_crystal": "Synthetic Redstone Crystal",
"_comment14": "Items-Armor",
@ -728,6 +730,16 @@
"item.techreborn.peridot_leggings": "Peridot Leggings",
"item.techreborn.peridot_boots": "Peridot Boots",
"item.techreborn.silver_helmet": "Silver Helmet",
"item.techreborn.silver_chestplate": "Silver Chestplate",
"item.techreborn.silver_leggings": "Silver Leggings",
"item.techreborn.silver_boots": "Silver Boots",
"item.techreborn.steel_helmet": "Steel Helmet",
"item.techreborn.steel_chestplate": "Steel Chestplate",
"item.techreborn.steel_leggings": "Steel Leggings",
"item.techreborn.steel_boots": "Steel Boots",
"_comment18": "Message",
"techreborn.message.missingmultiblock": "Incomplete Multiblock",
"techreborn.message.setTo": "Set to",
@ -747,6 +759,8 @@
"techreborn.message.info.item.techreborn.energy_storage_upgrade": "Increase energy store",
"techreborn.message.info.item.techreborn.superconductor_upgrade": "Increases energy flow rate",
"techreborn.message.info.unplaceable_fluid": "Cannot be placed",
"techreborn.message.info.block.techreborn.basic_solar_panel": "Produce energy from sunlight",
"techreborn.message.info.block.techreborn.advanced_solar_panel": "Produce energy from sunlight",
"techreborn.message.info.block.techreborn.industrial_solar_panel": "Produce energy from sunlight",
@ -870,6 +884,7 @@
"techreborn.tooltip.ores.overworld" : "Can be found at y levels %s < %s",
"techreborn.tooltip.ores.nether" : "Can be found in the nether",
"techreborn.tooltip.ores.end" : "Can be found in the end",
"techreborn.tooltip.unobtainable": "Unobtainable in Survival Mode",
"_comment23": "ManualUI",
"techreborn.manual.wiki": "Online wiki",

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/beryllium_flowing"
"particle": "techreborn:block/fluids/beryllium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/biofuel_flowing"
"particle": "techreborn:block/fluids/biofuel_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/calcium_flowing"
"particle": "techreborn:block/fluids/calcium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/calcium_carbonate_flowing"
"particle": "techreborn:block/fluids/calcium_carbonate_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/carbon_flowing"
"particle": "techreborn:block/fluids/carbon_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/carbon_fiber_flowing"
"particle": "techreborn:block/fluids/carbon_fiber_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/chlorite_flowing"
"particle": "techreborn:block/fluids/chlorite_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/compressed_air_flowing"
"particle": "techreborn:block/fluids/compressed_air_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/deuterium_flowing"
"particle": "techreborn:block/fluids/deuterium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/diesel_flowing"
"particle": "techreborn:block/fluids/diesel_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/electrolyzed_water_flowing"
"particle": "techreborn:block/fluids/electrolyzed_water_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/glyceryl_flowing"
"particle": "techreborn:block/fluids/glyceryl_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/helium_flowing"
"particle": "techreborn:block/fluids/helium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/helium3_flowing"
"particle": "techreborn:block/fluids/helium3_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/heliumplasma_flowing"
"particle": "techreborn:block/fluids/heliumplasma_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/hydrogen_flowing"
"particle": "techreborn:block/fluids/hydrogen_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/lithium_flowing"
"particle": "techreborn:block/fluids/lithium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/mercury_flowing"
"particle": "techreborn:block/fluids/mercury_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/methane_flowing"
"particle": "techreborn:block/fluids/methane_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/nitro_carbon_flowing"
"particle": "techreborn:block/fluids/nitro_carbon_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/nitro_diesel_flowing"
"particle": "techreborn:block/fluids/nitro_diesel_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/nitrocoal_fuel_flowing"
"particle": "techreborn:block/fluids/nitrocoal_fuel_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/nitrofuel_flowing"
"particle": "techreborn:block/fluids/nitrofuel_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/nitrogen_flowing"
"particle": "techreborn:block/fluids/nitrogen_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/nitrogen_dioxide_flowing"
"particle": "techreborn:block/fluids/nitrogen_dioxide_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/oil_flowing"
"particle": "techreborn:block/fluids/oil_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/potassium_flowing"
"particle": "techreborn:block/fluids/potassium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/silicon_flowing"
"particle": "techreborn:block/fluids/silicon_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/sodium_flowing"
"particle": "techreborn:block/fluids/sodium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/sodium_persulfate_flowing"
"particle": "techreborn:block/fluids/sodium_persulfate_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/sodium_sulfide_flowing"
"particle": "techreborn:block/fluids/sodium_sulfide_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/sulfur_flowing"
"particle": "techreborn:block/fluids/sulfur_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/sulfuric_acid_flowing"
"particle": "techreborn:block/fluids/sulfuric_acid_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/tritium_flowing"
"particle": "techreborn:block/fluids/tritium_still"
}
}

View file

@ -1,5 +1,6 @@
{
{
"textures": {
"particle": "techreborn:block/fluids/wolframium_flowing"
"particle": "techreborn:block/fluids/wolframium_still"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "techreborn:item/dust/amethyst_dust"
}
}

Some files were not shown because too many files have changed in this diff Show more