-
[SOLVED] [1.15.2] Create cooldown
Ok, resolved by ignoring END Phase. Thank you so much
-
[SOLVED] [1.15.2] Create cooldown
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?
-
[1.15.1] Potion effect stuck at 0 time left
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/
-
[SOLVED] IItemHandler to IInventory
Oks thank you so much.
-
[SOLVED] IItemHandler to IInventory
But what about IInventory#openInventory? Just ignore
-
[SOLVED] IItemHandler to IInventory
Lol ?♂️. I'm so bad.
-
[SOLVED] IItemHandler to IInventory
Yes because i have to pass an IInventory to Slot. I obviously could be wrong because i'm quite new with GUI.
-
[SOLVED] [1.15.2] Open Inventory while riding a custom entity
I resolved by use a KeyBindingEvent and sending a packet to the server which calls NetworkHooks.openGui
-
[SOLVED] IItemHandler to IInventory
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));
-
[SOLVED] [1.15.2] Open Inventory while riding a custom entity
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); } } } }
-
[SOLVED] [1.15.2] Open Inventory while riding a custom entity
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"); } }
-
immersive engineering
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.
-
[1.15.2] Glowing potion effect does not applies
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.
-
[1.15.2] Glowing potion effect does not applies
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?
-
[1.15.2] Glowing potion effect does not applies
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...
IPS spam blocked by CleanTalk.