Jump to content

Twingemios

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Twingemios

  1. After a lot of research I have written what I believe to be all of the necessary code. I'm currently struggling to get it run however. I can't figure out how to make the .json file for the auto_smelt. I just need it so that the player is sent to test function in the LootItemCondition I have created. That way I can check their capability { "condition": "minecraft:entity_properties", "predicate": { "type": "minecraft:player" } }
  2. Alright I've got that. Now do you know of any sources that may be able to help with the other parts of this? The docs don't cover any custom LootItemConditions or types.
  3. I want to add a feature to my mod where any blocks a player breaks are auto-smelted whenever they have a certain capability value. Is there any good resources on creating new LootItemConditions that check a player's capabilities. Or if LootModifiers aren't the best way to go about this what is the best?
  4. I'm trying to create an effect that will prevent the player from opening their inventory. However since I cannot cancel an InputEvent.KeyInputEvent or change the keys that were pressed I don't know what I can do. Is there a way I can stop the inventory key from opening up the inventory menu? Or something that will stop the inventory from opening.
  5. I'm working on a mod and I want to reverse the player's controls but what I am doing doesn't seem to be working. public static void movementInputUpdate(MovementInputUpdateEvent event){ Player player = Minecraft.getInstance().player; if(Minecraft.getInstance().player.isAlive()) { if(chaosActs.hasAct("reverse_controls")){ boolean up = event.getInput().up; boolean down = event.getInput().down; boolean left = event.getInput().left; boolean right = event.getInput().right; event.getInput().up = down; event.getInput().down = up; event.getInput().left = right; event.getInput().right = left; However previously in this mod I had an effect that forced the player to crouch event.getInput().shiftKeyDown = true; And when I even placed it inside of the first chunk of code and it worked fine. Is there something I am doing wrong? is there a better way to invert the player's controls?
  6. How can I do that? It requires that a LazyOptional must be returned in getCapability public class ChaosActsProvider implements ICapabilitySerializable<CompoundTag> { @CapabilityInject(IChaosActs.class) public static final Capability<IChaosActs> CAPABILITY = null; public static final ChaosActs instance = new ChaosActs(); @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { return cap == CAPABILITY ? instance : LazyOptional.empty(); } @Override public CompoundTag serializeNBT() { CompoundTag cnbt = new CompoundTag(); cnbt.putInt("timer",instance.getTimer()); return cnbt; } @Override public void deserializeNBT(CompoundTag nbt) { instance.setTimer(nbt.getInt("timer")); } }
  7. Then what do I do with this? It needs the instance @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return cap == CAPABILITY ? instance.cast() : LazyOptional.empty(); }
  8. I am aware that I need to register the capabilities, I just haven't provided that code as far as I am pretty sure nothing has changed in that department. What do I do in place of the Factory and Storage for the capability?
  9. I'm trying to make some capabilities in 1.17 after moving from 1.16 and I can't figure out how I am supposed to do them now. This is how I did them in 1.16. public class Cooldowns implements ICooldowns { private int summonCooldown = 0; @Override public void setSummonCooldown(int var) { this.summonCooldown = var; } @Override public int getSummonCooldown() { return this.summonCooldown; } } public class CooldownCapability implements ICapabilitySerializable<CompoundNBT> { @CapabilityInject(ICooldowns.class) public static final Capability<ICooldowns> CAPABILITY = null; private LazyOptional<ICooldowns> instance = LazyOptional.of(CAPABILITY::getDefaultInstance); @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return cap == CAPABILITY ? instance.cast() : LazyOptional.empty(); } @Override public CompoundNBT serializeNBT() { return (CompoundNBT) CAPABILITY.getStorage().writeNBT(CAPABILITY, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")), null); } @Override public void deserializeNBT(CompoundNBT nbt) { CAPABILITY.getStorage().readNBT(CAPABILITY, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")), null, nbt); } } public class CooldownStorage implements IStorage<ICooldowns> { @Override public CompoundNBT writeNBT(Capability<ICooldowns> capability, ICooldowns instance, Direction side) { CompoundNBT cnbt = new CompoundNBT(); cnbt.putInt("summoncooldown",instance.getSummonCooldown()); return cnbt; } @Override public void readNBT(Capability<ICooldowns> capability, ICooldowns instance, Direction side, INBT nbt) { CompoundNBT inbt = (CompoundNBT) nbt; instance.setSummonCooldown(inbt.getInt("summoncooldown")); } } From I understand IStorage and getDefaultInstance are depreciated. What do I need to change in order to run this code on 1.17? I've tired to do a lot of research on this but it seems forge's read the docs for 1.17 is outdated as it still tells me to use IStorage.
  10. (Im very new to minecraft modding but not Java) How could I go about changing the player's model to another model like a Zombie? I've looked at how it is done in previous versions but with the changes to how rendering works in 1.15.2 it wont work (At least I don't think). UPDATE: I have figured it out and I will update this post with the code I used so that others can use it once I've fully finished it
×
×
  • Create New...

Important Information

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