Skip to content

Commit

Permalink
Changed to use Forge's milk, closes #912
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Jan 17, 2021
1 parent 8c3aa59 commit 67e6dcc
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 98 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ repositories {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.16.4-35.0.0'
minecraft 'net.minecraftforge:forge:1.16.5-36.0.1'
if (findProject(':titanium') != null) {
compile project(':titanium')
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/buuz135/industrial/IndustrialForegoing.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.NonNullLazy;
import net.minecraftforge.event.RegistryEvent;
Expand Down Expand Up @@ -116,6 +117,7 @@ public IndustrialForegoing() {
}
LaserDrillRarity.init();
PlayerInventoryFinder.init();
ForgeMod.enableMilkFluid();
}

public static FakePlayer getFakePlayer(World world) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
package com.buuz135.industrial.block.generator.mycelial;

import com.buuz135.industrial.module.ModuleCore;
import com.buuz135.industrial.plugin.jei.generator.MycelialGeneratorRecipe;
import com.buuz135.industrial.utils.IndustrialTags;
import com.hrznstudio.titanium.component.fluid.SidedFluidTankComponent;
Expand All @@ -34,6 +33,7 @@
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -66,7 +66,7 @@ public List<BiPredicate<ItemStack, Integer>> getSlotInputPredicates() {

@Override
public List<Predicate<FluidStack>> getTankInputPredicates() {
return Arrays.asList(fluidStack -> fluidStack.getFluid().isEquivalentTo(ModuleCore.MILK.getSourceFluid()), null);
return Arrays.asList(fluidStack -> fluidStack.getFluid().isEquivalentTo(ForgeMod.MILK.get()), null);
}

@Override
Expand Down Expand Up @@ -103,7 +103,7 @@ public int getSlotSize() {

@Override
public List<MycelialGeneratorRecipe> getRecipes() {
return Collections.singletonList(new MycelialGeneratorRecipe(Arrays.asList(new ArrayList<>(), Collections.singletonList(Ingredient.fromTag(Tags.Items.SLIMEBALLS))), Arrays.asList(Arrays.asList(new FluidStack(ModuleCore.MILK.getSourceFluid(), 250)), Arrays.asList()), 20*20, 200));
return Collections.singletonList(new MycelialGeneratorRecipe(Arrays.asList(new ArrayList<>(), Collections.singletonList(Ingredient.fromTag(Tags.Items.SLIMEBALLS))), Arrays.asList(Arrays.asList(new FluidStack(ForgeMod.MILK.get(), 250)), Arrays.asList()), 20*20, 200));
}

@Override
Expand Down

This file was deleted.

15 changes: 4 additions & 11 deletions src/main/java/com/buuz135/industrial/module/ModuleCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@
import com.buuz135.industrial.item.addon.EfficiencyAddonItem;
import com.buuz135.industrial.item.addon.RangeAddonItem;
import com.buuz135.industrial.item.addon.SpeedAddonItem;
import com.buuz135.industrial.item.bucket.MilkBucketItem;
import com.buuz135.industrial.proxy.StrawRegistry;
import com.buuz135.industrial.utils.Reference;
import com.hrznstudio.titanium.event.handler.EventManager;
import com.hrznstudio.titanium.fluid.TitaniumFluidInstance;
import com.hrznstudio.titanium.module.Feature;
import com.hrznstudio.titanium.tab.AdvancedTitaniumTab;
import net.minecraft.block.Block;
import net.minecraft.item.*;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
Expand Down Expand Up @@ -90,13 +92,9 @@ public class ModuleCore implements IModule {
public static TitaniumFluidInstance ESSENCE = new TitaniumFluidInstance(Reference.MOD_ID, "essence", FluidAttributes.builder(new ResourceLocation(Reference.MOD_ID, "blocks/fluids/essence_still"), new ResourceLocation(Reference.MOD_ID, "blocks/fluids/essence_flow")), true, TAB_CORE);
public static TitaniumFluidInstance SLUDGE = new TitaniumFluidInstance(Reference.MOD_ID, "sludge", FluidAttributes.builder(new ResourceLocation(Reference.MOD_ID, "blocks/fluids/sludge_still"), new ResourceLocation(Reference.MOD_ID, "blocks/fluids/sludge_flow")), true, TAB_CORE);
public static TitaniumFluidInstance PINK_SLIME = new TitaniumFluidInstance(Reference.MOD_ID, "pink_slime", FluidAttributes.builder(new ResourceLocation(Reference.MOD_ID, "blocks/fluids/pink_slime_still"), new ResourceLocation(Reference.MOD_ID, "blocks/fluids/pink_slime_flow")), true, TAB_CORE);
public static TitaniumFluidInstance MILK = new TitaniumFluidInstance(Reference.MOD_ID, "milk", FluidAttributes.builder(new ResourceLocation(Reference.MOD_ID, "blocks/fluids/milk_still"), new ResourceLocation(Reference.MOD_ID, "blocks/fluids/milk_flow")), false, TAB_CORE);
public static TitaniumFluidInstance BIOFUEL = new TitaniumFluidInstance(Reference.MOD_ID, "biofuel", FluidAttributes.builder(new ResourceLocation(Reference.MOD_ID, "blocks/fluids/biofuel_still"), new ResourceLocation(Reference.MOD_ID, "blocks/fluids/biofuel_flow")), true, TAB_CORE);
public static TitaniumFluidInstance ETHER = new TitaniumFluidInstance(Reference.MOD_ID, "ether_gas", FluidAttributes.builder(new ResourceLocation(Reference.MOD_ID, "blocks/fluids/ether_gas_still"), new ResourceLocation(Reference.MOD_ID, "blocks/fluids/ether_gas_flow")).gaseous(), true, TAB_CORE);

public static Item MILK_BUCKET = new MilkBucketItem(() -> ModuleCore.MILK.getSourceFluid(), new Item.Properties().maxStackSize(1).containerItem(Items.BUCKET).group(ItemGroup.MISC)).setRegistryName("minecraft", "milk_bucket");


@Override
public List<Feature.Builder> generateFeatures() {
PITY_RARITY = Rarity.create("pity", TextFormatting.GREEN);
Expand Down Expand Up @@ -150,11 +148,6 @@ public List<Feature.Builder> generateFeatures() {
features.add(Feature.builder("sludge").content(TitaniumFluidInstance.class, SLUDGE));
features.add(Feature.builder("biofuel").content(TitaniumFluidInstance.class, BIOFUEL));
features.add(Feature.builder("ether").content(TitaniumFluidInstance.class, ETHER));
features.add(Feature.builder("milk").content(TitaniumFluidInstance.class, MILK));
features.add(Feature.builder("milk_bucket_replacement")
.description("If enabled the minecraft bucket item will be replaced with bucket that contains IF milk")
.content(Item.class, MILK_BUCKET));
MILK.setBucketFluid(MILK_BUCKET);
TAB_CORE.addIconStack(new ItemStack(PLASTIC));
features.add(createFeature(DARK_GLASS));
builder = Feature.builder("laser_lens");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.tags.ITag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.Tags;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.items.ItemHandlerHelper;
Expand Down Expand Up @@ -190,7 +191,7 @@ public void registerRecipes(IRecipeRegistration registration) {
new MachineProduceWrapper(ModuleAgricultureHusbandry.MOB_CRUSHER, new FluidStack(ModuleCore.ESSENCE.getSourceFluid(), 1000)),
new MachineProduceWrapper(ModuleAgricultureHusbandry.SLAUGHTER_FACTORY, new FluidStack(ModuleCore.MEAT.getSourceFluid(), 1000)),
new MachineProduceWrapper(ModuleAgricultureHusbandry.SLAUGHTER_FACTORY, new FluidStack(ModuleCore.PINK_SLIME.getSourceFluid(), 1000)),
new MachineProduceWrapper(ModuleAgricultureHusbandry.ANIMAL_RANCHER, new FluidStack(ModuleCore.MILK.getSourceFluid(), 1000)),
new MachineProduceWrapper(ModuleAgricultureHusbandry.ANIMAL_RANCHER, new FluidStack(ForgeMod.MILK.get(), 1000)),
new MachineProduceWrapper(ModuleAgricultureHusbandry.SEWER, new FluidStack(ModuleCore.SEWAGE.getSourceFluid(), 1000)),
new MachineProduceWrapper(ModuleAgricultureHusbandry.PLANT_GATHERER, new FluidStack(ModuleCore.SLUDGE.getSourceFluid(), 1000)),
new MachineProduceWrapper(ModuleResourceProduction.WATER_CONDENSATOR, new FluidStack(Fluids.WATER, 1000))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@ParametersAreNonnullByDefault
public class EssenceStrawHandler extends StrawHandlerBase {
public EssenceStrawHandler() {
super(ModuleCore.ESSENCE.getSourceFluid());
super(() -> ModuleCore.ESSENCE.getSourceFluid());
setRegistryName("essence");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@ParametersAreNonnullByDefault
public class LavaStrawHandler extends StrawHandlerBase {
public LavaStrawHandler() {
super(Fluids.LAVA);
super(() -> Fluids.LAVA);
setRegistryName("lava");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
*/
package com.buuz135.industrial.utils.apihandlers.straw;

import com.buuz135.industrial.module.ModuleCore;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeMod;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
public class MilkStrawHandler extends StrawHandlerBase {
public MilkStrawHandler() {
super(ModuleCore.MILK.getSourceFluid());
super(ForgeMod.MILK);
setRegistryName("milk");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class PotionStrawHandler extends StrawHandlerBase {
private List<Triple<Effect, Integer, Integer>> potions = new ArrayList<>();

public PotionStrawHandler(Fluid fluid) {
super(fluid);
super(() -> fluid);
}

public PotionStrawHandler addPotion(EffectInstance effect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
import net.minecraft.fluid.Fluid;

import javax.annotation.ParametersAreNonnullByDefault;
import java.util.function.Supplier;

@ParametersAreNonnullByDefault
public abstract class StrawHandlerBase extends StrawHandler {
private final Fluid fluid;
private final Supplier<Fluid> fluid;

public StrawHandlerBase(Fluid fluid) {
public StrawHandlerBase(Supplier<Fluid> fluid) {
this.fluid = fluid;
}

@Override
public boolean validFluid(Fluid fluid) {
return this.fluid == fluid;
return this.fluid.get() == fluid;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class WaterStrawHandler extends StrawHandlerBase {

public WaterStrawHandler() {
super(Fluids.WATER);
super(() -> Fluids.WATER);
setRegistryName("water");
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ side = "BOTH"
[[dependencies.industrialforegoing]] #optional
modId = "forge" #mandatory
mandatory = true #mandatory
versionRange = "[34.1.25,)" #mandatory
versionRange = "[36.0.1,)" #mandatory
ordering = "NONE"
side = "BOTH"

0 comments on commit 67e6dcc

Please sign in to comment.