Merge pull request #1889 from vemerion/fix-milk

Change to use Forge milk
This commit is contained in:
simibubi 2021-07-24 21:04:44 +02:00 committed by GitHub
commit 6bb6727fc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 18 deletions

View file

@ -10,7 +10,7 @@
"item": "minecraft:bucket"
},
{
"fluid": "create:milk",
"fluid": "minecraft:milk",
"amount": 1000
}
]

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"create:flowing_milk",
"create:milk"
]
}

View file

@ -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());
}
}
}
}

View file

@ -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;
@ -108,6 +109,8 @@ public class Create {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
() -> () -> CreateClient.addClientListeners(forgeEventBus, modEventBus));
ForgeMod.enableMilkFluid();
}
public static void init(final FMLCommonSetupEvent event) {

View file

@ -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()
.isSame(AllFluids.MILK.get().getFlowing());
.isSame(ForgeMod.MILK.get());
}
public static ItemStack fillItem(World world, int requiredAmount, ItemStack stack, FluidStack availableFluid) {

View file

@ -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))
;

View file

@ -16,8 +16,8 @@
"item": "minecraft:glass_bottle"
},
{
"fluid": "create:milk",
"fluid": "minecraft:milk",
"amount": 250
}
]
}
}