Jump to content

Karutoh

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Karutoh

  1. Does Blitz 3D support animation time stamps and triangle meshes? If so where can I find tutorials using this model file?
  2. AH okay so that makes much more sense. For the FissionProvider#instance can I use the Fission class instead of the IFission interface class? That would make the serialization and deserialization easier by just calling those methods directly and returning them and would allow me to set the variables. Also for the FissionProvider.FISSION variable what is the second arguement in the new ResourceLocation(EventHorizon.MOD_ID, "fission"); referencing?
  3. Ah okay so here's what I have on a custom class implementing ICapabilityProvider. The serializers confuse me and I'm not sure what they are for. Is it this when the capability is used in other mods, between server/client, or save/load? public class FissionProvider implements ICapabilitySerializable<CompoundNBT> { private LazyOptional<IFission> instance = LazyOptional.of(CapabilityRegister.FISSION::getDefaultInstance); @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return CapabilityRegister.FISSION.orEmpty(cap, instance); } @Override public CompoundNBT serializeNBT() { IFission fission = instance.orElseThrow(() -> new IllegalArgumentException("at serialize")); CompoundNBT nbt = new CompoundNBT(); nbt.putFloat("temperature", fission.getTemperature()); nbt.putLong("neutrons", fission.getNeutrons()); return nbt; } @Override public void deserializeNBT(CompoundNBT nbt) { //IFission fission = instance.orElseThrow(() -> new IllegalArgumentException("at serialize")); } } I'm confused on the serializers on the register as well. public class CapabilityRegister { @CapabilityInject(IFission.class) public static Capability<IFission> FISSION = null; public static void init() { CapabilityManager.INSTANCE.register(IFission.class, new IStorage<IFission>() { @Override public INBT writeNBT(Capability<IFission> capability, IFission instance, Direction side) { return null; } @Override public void readNBT(Capability<IFission> capability, IFission instance, Direction side, INBT nbt) { } }, Fission::new); } }
  4. Oh okay. I was unaware I could override a function like that in a Item class. Also would this work if I changed the public class Fission implements IFission, INBTSerializable<CompoundNBT> to public class Fission implements IFission, ICapabilitySerializable<CompoundNBT> ?
  5. I'm having a hard time understanding capabilities as there seems to be a few ways of adding them making it really confusing to me. I also seem to be missing something when adding a capability to an ItemStack. Could someone nudge me in the right direction? I've tried looking at the Forge Docs and Github code and nothing seems to help. package com.event_horizon.capabilities; public interface IFission { public float getDuration(); public float getTemperature(); public void addNeutrons(final long neutrons); public long getNeutrons(); } package com.event_horizon.capabilities; import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.common.util.INBTSerializable; public class Fission implements IFission, INBTSerializable<CompoundNBT> { private static final float duration = 0.0001f; private float temperature = 293; private long neutrons = 0; @Override public float getDuration() { return duration; } @Override public float getTemperature() { return temperature; } @Override public void addNeutrons(long neutrons) { this.neutrons += neutrons; } @Override public long getNeutrons() { return neutrons; } @Override public CompoundNBT serializeNBT() { CompoundNBT nbt = new CompoundNBT(); nbt.putFloat("temperature", temperature); nbt.putLong("neutrons", neutrons); return nbt; } @Override public void deserializeNBT(CompoundNBT nbt) { temperature = nbt.getFloat("temperature"); neutrons = nbt.getLong("neutrons"); } } package com.event_horizon.events; import com.event_horizon.EventHorizon; import com.event_horizon.capabilities.FissionProvider; import com.event_horizon.items.FuelRod; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid = EventHorizon.MOD_ID, bus = Bus.FORGE) public class CapabilitiesEvent { public static final ResourceLocation FISSION = new ResourceLocation(EventHorizon.MOD_ID, "fission"); @SubscribeEvent public static void itemStackCapabilities(AttachCapabilitiesEvent<ItemStack> event) { Item item = event.getObject().getItem(); if (item instanceof FuelRod) { event.addCapability(FISSION, new Fission()); } } }
  6. If you haven't already I would recommend giving these a read. They're just Forge Docs. but they explain most of it pretty well. Blender Addon: https://github.com/phonon/blender-minecraft-json Docs: https://mcforge.readthedocs.io/en/latest/models/files/#model-files https://mcforge.readthedocs.io/en/latest/animation/intro/
  7. This was a problem for me as well in Minecraft 1.16.1, and Forge 32.0.98. The func_235861_h_() solved the issue.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.