Large amount of fluid work

This commit is contained in:
modmuss50 2019-07-23 20:46:07 +01:00
parent 1e52477b9e
commit 83bf6add1e
20 changed files with 52 additions and 124 deletions

View file

@ -64,8 +64,6 @@ public class TechReborn implements ModInitializer {
@SuppressWarnings("unused") @SuppressWarnings("unused")
RegistrationManager registrationManager = new RegistrationManager("techreborn", getClass()); RegistrationManager registrationManager = new RegistrationManager("techreborn", getClass());
// TechRebornAPI.subItemRetriever = new SubItemRetriever(); // TechRebornAPI.subItemRetriever = new SubItemRetriever();
// Done like this to load them here
ModFluids.values();
// Done to force the class to load // Done to force the class to load
ModRecipes.GRINDER.getName(); ModRecipes.GRINDER.getName();

View file

@ -25,7 +25,7 @@
package techreborn.api.fluidreplicator; package techreborn.api.fluidreplicator;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity; import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
import techreborn.utils.FluidUtils; import techreborn.utils.FluidUtils;

View file

@ -29,8 +29,8 @@ import net.minecraft.item.ItemStack;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity; import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;

View file

@ -25,7 +25,7 @@
package techreborn.api.fluidreplicator; package techreborn.api.fluidreplicator;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import techreborn.utils.FluidUtils; import techreborn.utils.FluidUtils;
import java.util.ArrayList; import java.util.ArrayList;

View file

@ -25,7 +25,7 @@
package techreborn.api.generator; package techreborn.api.generator;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import techreborn.utils.FluidUtils; import techreborn.utils.FluidUtils;
public class FluidGeneratorRecipe { public class FluidGeneratorRecipe {

View file

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

View file

@ -26,7 +26,7 @@ package techreborn.api.generator;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Optional; import java.util.Optional;

View file

@ -28,7 +28,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity; import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
public class IndustrialGrinderRecipe extends RebornRecipe { public class IndustrialGrinderRecipe extends RebornRecipe {

View file

@ -28,7 +28,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity; import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
public class IndustrialSawmillRecipe extends RebornRecipe { public class IndustrialSawmillRecipe extends RebornRecipe {

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import techreborn.api.generator.EFluidGenerator; import techreborn.api.generator.EFluidGenerator;
import techreborn.api.generator.FluidGeneratorRecipe; import techreborn.api.generator.FluidGeneratorRecipe;
import techreborn.api.generator.FluidGeneratorRecipeList; import techreborn.api.generator.FluidGeneratorRecipeList;

View file

@ -1,49 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.blocks.fluid;
import net.minecraft.block.FluidBlock;
import net.minecraft.fluid.BaseFluid;
public class BlockFluidBase extends FluidBlock {
public BlockFluidBase(BaseFluid fluid, Settings properties) {
super(fluid, properties);
}
// @Override
// public boolean canDisplace(IBlockAccess world, BlockPos pos) {
// if (world.getBlockState(pos).getMaterial().isLiquid())
// return false;
// return super.canDisplace(world, pos);
// }
//
// @Override
// public boolean displaceIfPossible(World world, BlockPos pos) {
// if (world.getBlockState(pos).getMaterial().isLiquid())
// return false;
// return super.displaceIfPossible(world, pos);
// }
}

View file

@ -1,43 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.blocks.fluid;
import net.minecraft.fluid.BaseFluid;
public class BlockFluidTechReborn extends BlockFluidBase {
String name;
public BlockFluidTechReborn(BaseFluid fluid, Settings properties, String name) {
super(fluid, properties);
//setTranslationKey(name);
this.name = name;
}
//
// @Override
// public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
// return BlockFaceShape.UNDEFINED;
// }
}

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import techreborn.blockentity.machine.tier3.QuantumTankBlockEntity; import techreborn.blockentity.machine.tier3.QuantumTankBlockEntity;
public class GuiQuantumTank extends GuiBase { public class GuiQuantumTank extends GuiBase {

View file

@ -40,6 +40,7 @@ import techreborn.blocks.misc.BlockRubberPlankSlab;
import techreborn.blocks.misc.BlockRubberPlankStair; import techreborn.blocks.misc.BlockRubberPlankStair;
import techreborn.blocks.misc.BlockRubberSapling; import techreborn.blocks.misc.BlockRubberSapling;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.init.ModFluids;
import techreborn.init.TRArmorMaterial; import techreborn.init.TRArmorMaterial;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRContent.*; import techreborn.init.TRContent.*;
@ -69,6 +70,7 @@ import techreborn.items.tool.vanilla.*;
import techreborn.utils.InitUtils; import techreborn.utils.InitUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.Consumer;
/** /**
* @author drcrazy * @author drcrazy
@ -80,6 +82,7 @@ public class ModRegistry {
public static void setupShit(){ public static void setupShit(){
registerBlocks(); registerBlocks();
registerItems(); registerItems();
registerFluids();
} }
public static void registerBlocks() { public static void registerBlocks() {
@ -208,4 +211,8 @@ public class ModRegistry {
TechReborn.LOGGER.debug("TechReborns Items Loaded"); TechReborn.LOGGER.debug("TechReborns Items Loaded");
} }
public static void registerFluids() {
Arrays.stream(ModFluids.values()).forEach(ModFluids::register);
}
} }

View file

@ -24,9 +24,14 @@
package techreborn.init; package techreborn.init;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.fluid.Fluid; import net.minecraft.util.registry.Registry;
import techreborn.blocks.fluid.BlockFluidTechReborn; import reborncore.common.fluid.*;
import techreborn.TechReborn;
public enum ModFluids { public enum ModFluids {
BERYLLIUM, BERYLLIUM,
CALCIUM, CALCIUM,
@ -63,24 +68,34 @@ public enum ModFluids {
COMPRESSED_AIR, COMPRESSED_AIR,
ELECTROLYZED_WATER; ELECTROLYZED_WATER;
public Fluid fluid; private final RebornFluid fluid;
public BlockFluidTechReborn block; private RebornFluidBlock block;
public String name; private RebornBucketItem bucket;
private final Identifier identifier;
ModFluids() { ModFluids() {
this.name = this.name().replace("_", "").toLowerCase(); //Is this ok? this.identifier = new Identifier("techreborn", this.name().replace("_", "").toLowerCase());
fluid = new Fluid(name, new Identifier("techreborn", "fixme"), new Identifier("techrebonr", "alsofixme")); fluid = new RebornFluid(FluidSettings.create(), () -> block, () -> bucket);
block = new RebornFluidBlock(fluid, FabricBlockSettings.of(Material.WATER).noCollision().hardness(100.0F).dropsNothing().build());
bucket = new RebornBucketItem(fluid, new Item.Settings().group(TechReborn.ITEMGROUP));
} }
public void register() {
RebornFluidManager.register(fluid, identifier);
Registry.register(Registry.BLOCK, identifier, block);
Registry.register(Registry.ITEM, identifier, bucket);
}
@Deprecated //TODO this is bad!
public Fluid getFluid() { public Fluid getFluid() {
return fluid; return new Fluid();
} }
public BlockFluidTechReborn getBlock() { public RebornFluidBlock getBlock() {
return block; return block;
} }
public String getName() { public Identifier getIdentifier() {
return name; return identifier;
} }
} }

View file

@ -30,9 +30,9 @@ import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.RecipeManager; import reborncore.common.crafting.RecipeManager;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import reborncore.fluid.FluidUtil; import reborncore.common.fluid.FluidUtil;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.api.recipe.recipes.BlastFurnaceRecipe; import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
import techreborn.api.recipe.recipes.IndustrialGrinderRecipe; import techreborn.api.recipe.recipes.IndustrialGrinderRecipe;

View file

@ -25,7 +25,7 @@
package techreborn.init.recipes; package techreborn.init.recipes;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import techreborn.api.generator.EFluidGenerator; import techreborn.api.generator.EFluidGenerator;
import techreborn.api.generator.GeneratorRecipeHelper; import techreborn.api.generator.GeneratorRecipeHelper;
import techreborn.init.ModFluids; import techreborn.init.ModFluids;

View file

@ -33,7 +33,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.FluidUtils; import techreborn.utils.FluidUtils;

View file

@ -26,7 +26,7 @@ package techreborn.items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import techreborn.utils.FluidUtils; import techreborn.utils.FluidUtils;
public class ItemCells { public class ItemCells {

View file

@ -28,8 +28,8 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import reborncore.fluid.Fluid; import reborncore.common.fluid.Fluid;
import reborncore.fluid.FluidStack; import reborncore.common.fluid.FluidStack;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;