Fixed a crash found in #25 relating to spawn configuration registration
Actually defined hitbox sizes Made size adjustments to several creatures Added the Achillobator, Chilesaurus, Mussaurus, Suchomimus, Thescelosaurus and it's items Improved swimming behavior for terrestrial and avian creatures Made Dilophosaurus animation fixes relating to its frill Added natural breeding as life finds a way Added a short amount of health regeneration after full hunger so dinos don't die from hunting too much Fixed avian AI to not select the Idle state while flying, and generally improved their behavior Increased the chance and timespan of which dinos select a new place to move Increased the minimum speed for dinos to move when roaming to stop animations not playing Set a minimum speed when a dino is on Ice so it actaully moves Add random setting to spawn egg item Fix entities not middle-mouse-clickable Drastically reduced spawn rate of many creatures Fixes hand feeding, and thereby being able to put entities in the breeding state Replaces machine models Changed AI to ignore creepers Adds tags for each entity in the forge namespace to have compatibility with other mods that add the same entity, as long as they support this too Fixes machine input and export logic with pipes and hoppers Fixes inworld water input via bucket with fossil cleaner Fixes pipe logic to actually select a new fill point Fixes herbivores not being able to self feed
This commit is contained in:
+9
@@ -58,6 +58,15 @@ public final class JRClothConfigScreens {
|
||||
.build()
|
||||
);
|
||||
|
||||
general.addEntry(
|
||||
eb.startBooleanToggle(Component.literal("Dinosaur Natural Breeding"), cfg.naturalBreeding)
|
||||
.setDefaultValue(false)
|
||||
.setTooltip(Component.literal("When enabled, dinosaurs have a chance to breed naturally over time. Disabled by default. Life finds a way..."))
|
||||
.setSaveConsumer(v -> cfg.naturalBreeding = v)
|
||||
.requireRestart()
|
||||
.build()
|
||||
);
|
||||
|
||||
general.addEntry(
|
||||
eb.startIntField(Component.literal("FE Per Second"), cfg.fePerSecond)
|
||||
.setDefaultValue(1000)
|
||||
|
||||
@@ -32,8 +32,9 @@ public class DataGenerators {
|
||||
BlockTagsProvider blockTagsProvider = new ForgeBlockTagProvider(packOutput, lookupProvider, existingFileHelper);
|
||||
generator.addProvider(event.includeServer(), blockTagsProvider);
|
||||
generator.addProvider(event.includeServer(), new ForgeItemTagProvider(packOutput, lookupProvider, blockTagsProvider.contentsGetter(), existingFileHelper));
|
||||
generator.addProvider(event.includeServer(), new ForgeEntityTagProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
|
||||
generator.addProvider(event.includeServer(), new LootTableProvider(packOutput, Collections.emptySet(),
|
||||
generator.addProvider(event.includeServer(), new LootTableProvider(packOutput, Collections.emptySet(),
|
||||
List.of(
|
||||
new LootTableProvider.SubProviderEntry(ForgeBlockLootTableProvider::new, LootContextParamSets.BLOCK),
|
||||
new LootTableProvider.SubProviderEntry(ForgeEntityLootTableProvider::new, LootContextParamSets.ENTITY)
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package net.cmr.jurassicrevived.datagen;
|
||||
|
||||
import net.cmr.jurassicrevived.Constants;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.tags.EntityTypeTagsProvider;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ForgeEntityTagProvider extends EntityTypeTagsProvider implements ModEntityTagProvider.EntityTagHelper {
|
||||
|
||||
public ForgeEntityTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
|
||||
super(output, lookupProvider, Constants.MOD_ID, existingFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTags(HolderLookup.Provider provider) {
|
||||
ModEntityTagProvider.registerEntityTags(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tag(TagKey<EntityType<?>> tag, EntityType<?>... entityTypes) {
|
||||
tag(tag).add(entityTypes);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.cmr.jurassicrevived.block.entity.custom.*;
|
||||
import net.cmr.jurassicrevived.config.JRConfigManager;
|
||||
import net.cmr.jurassicrevived.platform.ForgeEnergyStorage;
|
||||
import net.cmr.jurassicrevived.platform.ForgeTankFluidAdapter;
|
||||
import net.cmr.jurassicrevived.platform.transfer.InternalFluidHandler;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
@@ -17,6 +18,7 @@ import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.common.util.NonNullSupplier;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -39,7 +41,49 @@ public class ForgeEvents {
|
||||
|
||||
if (be instanceof TankBlockEntity tank) {
|
||||
event.addCapability(Constants.rl("fluid_tank"),
|
||||
new FluidProvider(() -> new ForgeTankFluidAdapter(tank.getTank(null))));
|
||||
new FluidProvider(() -> new ForgeInternalFluidHandlerAdapter(tank.getFluidHandler(null))));
|
||||
}
|
||||
|
||||
if (be instanceof FossilCleanerBlockEntity cleaner) {
|
||||
event.addCapability(Constants.rl("fluid_fossil_cleaner"),
|
||||
new FluidProvider(() -> new ForgeInternalFluidHandlerAdapter(cleaner.getFluidHandler(null))));
|
||||
}
|
||||
|
||||
if (be instanceof GeneratorBlockEntity gen) {
|
||||
event.addCapability(Constants.rl("item_generator"),
|
||||
new ItemProvider(() -> new InvWrapper(gen.itemHandler)));
|
||||
}
|
||||
if (be instanceof DNAExtractorBlockEntity dna) {
|
||||
event.addCapability(Constants.rl("item_dna_extractor"),
|
||||
new ItemProvider(() -> new InvWrapper(dna.itemHandler)));
|
||||
}
|
||||
if (be instanceof DNAAnalyzerBlockEntity dna) {
|
||||
event.addCapability(Constants.rl("item_dna_analyzer"),
|
||||
new ItemProvider(() -> new InvWrapper(dna.itemHandler)));
|
||||
}
|
||||
if (be instanceof DNAHybridizerBlockEntity dna) {
|
||||
event.addCapability(Constants.rl("item_dna_hybridizer"),
|
||||
new ItemProvider(() -> new InvWrapper(dna.itemHandler)));
|
||||
}
|
||||
if (be instanceof FossilCleanerBlockEntity fc) {
|
||||
event.addCapability(Constants.rl("item_fossil_cleaner"),
|
||||
new ItemProvider(() -> new InvWrapper(fc.itemHandler)));
|
||||
}
|
||||
if (be instanceof FossilGrinderBlockEntity fg) {
|
||||
event.addCapability(Constants.rl("item_fossil_grinder"),
|
||||
new ItemProvider(() -> new InvWrapper(fg.itemHandler)));
|
||||
}
|
||||
if (be instanceof EmbryonicMachineBlockEntity em) {
|
||||
event.addCapability(Constants.rl("item_embryonic_machine"),
|
||||
new ItemProvider(() -> new InvWrapper(em.itemHandler)));
|
||||
}
|
||||
if (be instanceof EmbryoCalcificationMachineBlockEntity ec) {
|
||||
event.addCapability(Constants.rl("item_embryo_calcification"),
|
||||
new ItemProvider(() -> new InvWrapper(ec.itemHandler)));
|
||||
}
|
||||
if (be instanceof IncubatorBlockEntity inc) {
|
||||
event.addCapability(Constants.rl("item_incubator"),
|
||||
new ItemProvider(() -> new InvWrapper(inc.itemHandler)));
|
||||
}
|
||||
|
||||
if (JRConfigManager.get().requirePower) {
|
||||
@@ -91,6 +135,21 @@ public class ForgeEvents {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ItemProvider implements ICapabilityProvider {
|
||||
private final LazyOptional<?> lazy;
|
||||
|
||||
private ItemProvider(NonNullSupplier<?> supplier) {
|
||||
this.lazy = LazyOptional.of(supplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) {
|
||||
return cap == ForgeCapabilities.ITEM_HANDLER ? lazy.cast() : LazyOptional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static final class FluidProvider implements ICapabilityProvider {
|
||||
private final LazyOptional<?> lazy;
|
||||
|
||||
@@ -103,4 +162,54 @@ public class ForgeEvents {
|
||||
return cap == ForgeCapabilities.FLUID_HANDLER ? lazy.cast() : LazyOptional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ForgeInternalFluidHandlerAdapter implements net.minecraftforge.fluids.capability.IFluidHandler {
|
||||
private final InternalFluidHandler handler;
|
||||
|
||||
public ForgeInternalFluidHandlerAdapter(InternalFluidHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTanks() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull net.minecraftforge.fluids.FluidStack getFluidInTank(int tank) {
|
||||
if (tank != 0) return net.minecraftforge.fluids.FluidStack.EMPTY;
|
||||
var fluid = handler.getFluid();
|
||||
return new net.minecraftforge.fluids.FluidStack(fluid.getFluid(), (int) fluid.getAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTankCapacity(int tank) {
|
||||
return tank == 0 ? (int) handler.getCapacity() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFluidValid(int tank, @NotNull net.minecraftforge.fluids.FluidStack stack) {
|
||||
return tank == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(net.minecraftforge.fluids.FluidStack resource, FluidAction action) {
|
||||
if (resource.isEmpty()) return 0;
|
||||
long filled = handler.fill(dev.architectury.fluid.FluidStack.create(resource.getFluid(), resource.getAmount()), action.simulate());
|
||||
return (int) filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull net.minecraftforge.fluids.FluidStack drain(net.minecraftforge.fluids.FluidStack resource, FluidAction action) {
|
||||
if (resource.isEmpty()) return net.minecraftforge.fluids.FluidStack.EMPTY;
|
||||
var drained = handler.drain(resource.getAmount(), action.simulate());
|
||||
return new net.minecraftforge.fluids.FluidStack(drained.getFluid(), (int) drained.getAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull net.minecraftforge.fluids.FluidStack drain(int maxDrain, FluidAction action) {
|
||||
var drained = handler.drain(maxDrain, action.simulate());
|
||||
return new net.minecraftforge.fluids.FluidStack(drained.getFluid(), (int) drained.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user