Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ArcaneDiver

Members
  • Joined

  • Last visited

  1. Ok, resolved by ignoring END Phase. Thank you so much
  2. Hi, i'm trying to implement a cooldown for an ability, and i found that every second a tick event is called 20 times. Here is my actual code: Decreasing the cooldown @SubscribeEvent public static void onSonarCooldown(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; ISonarData data = player.getCapability(EntitySonarDataHandler.CAPABILITY_SONAR_DATA).orElse(null); if(data != null) { if(data.getCooldown() > 0) { data.setCooldown(data.getCooldown() - 1); } } } Setting the cooldown data.setCooldown(10 * 20); But the cooldown isn't 10sec but less. How can i implement it better?
  3. They have to be applied on the server. Use !world.isRemote to check it. Also check documentation about sides https://mcforge.readthedocs.io/en/latest/concepts/sides/
  4. Oks thank you so much.
  5. But what about IInventory#openInventory? Just ignore
  6. Lol ?‍♂️. I'm so bad.
  7. Yes because i have to pass an IInventory to Slot. I obviously could be wrong because i'm quite new with GUI.
  8. I resolved by use a KeyBindingEvent and sending a packet to the server which calls NetworkHooks.openGui
  9. Hi, i have attached a IItemHandler capability to my entity but i have to pass an IInventory to my Container and i don't kwon how convert it in order to be able to pass to the Container constructor. Here is the code: Entity: @CapabilityInject(IItemHandler.class) private static Capability<IItemHandler> ITEM_HANDLER_CAPABILITY = null; protected IItemHandler inventory = new ItemStackHandler(); Container: public class RidableDolphinContainer extends Container { private PlayerInventory playerInventory; private IInventory inventory; public RidableDolphinContainer(int windowID, PlayerInventory playerInventory) { this(windowID, playerInventory, new Inventory(1)); } public RidableDolphinContainer(int windowID, PlayerInventory playerInventory, IInventory inventory) { super(ModContainers.RIDABLE_DOLPHIN.get(), windowID); assertInventorySize(inventory, 1); this.playerInventory = playerInventory; this.inventory = inventory; inventory.openInventory(playerInventory.player); this.addSlot(new SlotSonarRidableDolphin(inventory, 0, 80, 20));
  10. I tried to implement this by modifing the container on GuiOpenEvent and PlayerContainerEvent.Open but i sadly discovered that PlayerContainerEvent.Open doesn't fire for the Container of the player then how can i say "when i press E open my container"? Here is the code of events: @SubscribeEvent public static void onDolphinContainerOpen(PlayerContainerEvent.Open event) { // Never fires :C ServerPlayerEntity playerEntity = (ServerPlayerEntity) event.getPlayer(); if(playerEntity.getRidingEntity() instanceof RidableDolphinEnitity) { RidableDolphinEnitity dolphin = (RidableDolphinEnitity) playerEntity.getRidingEntity(); playerEntity.openContainer = new RidableDolphinContainer(playerEntity.currentWindowId, playerEntity.inventory, dolphin.getInventory()); } } @SubscribeEvent public static void onDolphinGuiOpen(GuiOpenEvent event) { if(event.getGui() instanceof ContainerScreen) { ClientPlayerEntity player = Minecraft.getInstance().player; if (player != null && player.getRidingEntity() instanceof RidableDolphinEnitity) { RidableDolphinEnitity dolphin = (RidableDolphinEnitity) player.getRidingEntity(); if(!(event.getGui() instanceof RidableDolphinScreen)) { ContainerScreen<?> oldScreen = (ContainerScreen) event.getGui(); Container oldContainer = oldScreen.getContainer(); RidableDolphinContainer container = new RidableDolphinContainer(oldContainer.windowId, player.inventory, dolphin.getInventory()); RidableDolphinScreen screen = new RidableDolphinScreen(container, player.inventory, dolphin.getDisplayName()); player.openContainer = container; event.setGui(screen); } } } }
  11. Hey, how can i associate my custom ContainerScreen to my own entity? Like horse inventory. In order to when i click E to open inventory my custom container should display. But that doesn't append. I have already register the screen in the ScreenManager. Here is my custom entity: public class RidableDolphinEnitity extends DolphinEntity implements INamedContainerProvider { protected Inventory inventory = new Inventory(2); public RidableDolphinEnitity(EntityType<RidableDolphinEnitity> type, World worldIn) { super(type, worldIn); } public Inventory getInventory() { return inventory; } @Nullable @Override public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) { return new RidableDolphinContainer(id, inventory, getInventory()); } @Override public ITextComponent getDisplayName() { return TextComponentUtils.toTextComponent(() -> "Dolphin Inventory"); } }
  12. You should create an issue in the repo of the mod. https://github.com/BluSunrize/ImmersiveEngineering/issues There the creator of the mod could gives you the correct support.
  13. The main problem of the potion effect is that the effect can be seen by everyone instead a sonar like effect should be seen only by the player that has activate the effect.
  14. I have created the packet but the effect still doesn't applies, but i got an idea what if i use setGlowing(true) then i start a thread that sleep for 10 sec then it calls setGlowing(false). Is it a good way?
  15. Ok, but i need a potion like effect because i need that after a while it disappear. I think that the problem is that i haven't the server's world...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.