mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 22:44:07 +01:00
Change to use Forge milk
This commit removes Create's fluid milk, and changes things to instead use the milk fluid already provided by Forge. This makes the mod more compatible with other mods. I also added an event subscriber to the MissingMappings event in the AllFluids class, to convert already existing Create milk to Forge milk so that players don't lose any stored milk. Note: I did not update language files and remove textures to reflect the fact that Create's milk to longer existsMissingMappings, so right now there are some unused resources that can be cleaned up.
This commit is contained in:
parent
5179aad4fe
commit
6e0a758d1f
@ -10,7 +10,7 @@
|
||||
"item": "minecraft:bucket"
|
||||
},
|
||||
{
|
||||
"fluid": "create:milk",
|
||||
"fluid": "minecraft:milk",
|
||||
"amount": 1000
|
||||
}
|
||||
]
|
||||
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:flowing_milk",
|
||||
"create:milk"
|
||||
]
|
||||
}
|
@ -19,9 +19,14 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.RegistryEvent.MissingMappings.Mapping;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
||||
public class AllFluids {
|
||||
|
||||
@ -37,11 +42,6 @@ public class AllFluids {
|
||||
.tag(AllTags.forgeFluidTag("tea"))
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<VirtualFluid> MILK = REGISTRATE.virtualFluid("milk")
|
||||
.lang(f -> "fluid.create.milk", "Milk")
|
||||
.tag(Tags.Fluids.MILK)
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> HONEY =
|
||||
REGISTRATE.standardFluid("honey", NoColorFluidAttributes::new)
|
||||
.lang(f -> "fluid.create.honey", "Honey")
|
||||
@ -116,5 +116,19 @@ public class AllFluids {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventBusSubscriber(modid = Create.ID, bus = Bus.FORGE)
|
||||
public static class MissingMappingsSubscriber {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void missingMappings(RegistryEvent.MissingMappings<Fluid> event) {
|
||||
for (Mapping<Fluid> mapping : event.getMappings(Create.ID)) {
|
||||
if (mapping.key.getPath().equals("milk"))
|
||||
mapping.remap(ForgeMod.MILK.get());
|
||||
else if (mapping.key.getPath().equals("flowing_milk"))
|
||||
mapping.remap(ForgeMod.FLOWING_MILK.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
@ -107,6 +108,8 @@ public class Create {
|
||||
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
||||
() -> () -> CreateClient.addClientListeners(forgeEventBus, modEventBus));
|
||||
|
||||
ForgeMod.enableMilkFluid();
|
||||
}
|
||||
|
||||
public static void init(final FMLCommonSetupEvent event) {
|
||||
|
@ -13,6 +13,7 @@ import net.minecraft.item.MilkBucketItem;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
@ -105,7 +106,7 @@ public class GenericItemFilling {
|
||||
|
||||
private static boolean canFillBucketInternally(FluidStack availableFluid) {
|
||||
return availableFluid.getFluid()
|
||||
.isEquivalentTo(AllFluids.MILK.get().getFlowingFluid());
|
||||
.isEquivalentTo(ForgeMod.MILK.get());
|
||||
}
|
||||
|
||||
public static ItemStack fillItem(World world, int requiredAmount, ItemStack stack, FluidStack availableFluid) {
|
||||
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllRecipeTypes;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
|
||||
public class EmptyingRecipeGen extends ProcessingRecipeGen {
|
||||
|
||||
@ -27,7 +28,7 @@ public class EmptyingRecipeGen extends ProcessingRecipeGen {
|
||||
|
||||
MILK_BUCKET = create("milk_bucket", b -> b
|
||||
.require(Items.MILK_BUCKET)
|
||||
.output(AllFluids.MILK.get(), 1000)
|
||||
.output(ForgeMod.MILK.get(), 1000)
|
||||
.output(Items.BUCKET))
|
||||
|
||||
;
|
||||
|
@ -16,8 +16,8 @@
|
||||
"item": "minecraft:glass_bottle"
|
||||
},
|
||||
{
|
||||
"fluid": "create:milk",
|
||||
"fluid": "minecraft:milk",
|
||||
"amount": 250
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user