Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

fr3qu3ncy

Members
  • Posts

    20
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

fr3qu3ncy's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. No, it‘s for an entity from another mod
  2. How can I get the used ItemStack from SpecialSpawn? I want to do things based on if a mob was spawned by a special spawn egg. I tried adding a CompoundNBT with this hierachy: EntityTag - ForgeData - MyTag - true to make it merge this data into the persistentData of the entity, but it's always empty.
  3. @diesieben07 debug.log Had to upload it to Google Drive since the debug.log is too large for pastebin.
  4. Hey guys, I'm trying to run the dev env with two mods (Alexs Mobs and Citadel), therefore I copied their build.gradle because there's a lot of mixin stuff: build.gradle: https://pastebin.com/PUef70eP The server boots up normally when I use the old mappings, but when I change to Mojang's mappings, I get this error on startup: java.lang.BootstrapMethodError: java.lang.ClassFormatError: Duplicate method name "isFood" with signature "(Lnet.minecraft.item.ItemStack;)Z" in class file com/github/alexthe666/alexsmobs/entity/EntityRaccoon I already use fg.deof to match the mappings of the mods to my mappings, what else could be the reason for this error?
  5. Hey! I created a library for coding mods and would like to include that in my jar, it's located on a maven repository. What is the right way to do so? I tried shadowJar, and changed jar.finalizedBy to shadowJar.finalizedBy, but still get NoSuchMethodExceptions. Is there any other way to do it, so that it also works with runClient and runServer? Edit: This works on a real client, but throws NoClassDefFoundError when started from runClient: https://pastebin.com/eFUqejaL
  6. Hey! I get this error when trying to load my mod together with a few others: de.fr3qu3ncy.shadowmobs.caps.BooleanCapability cannot be cast to com.robertx22.age_of_exile.dimension.dungeon_data.WorldDungeonCap at com.robertx22.age_of_exile.uncommon.datasaving.Load.dungeonData(Load.java:38) ~[mmorpg:?] {re:classloading} at com.robertx22.age_of_exile.event_hooks.ontick.OnTickDungeonWorld.onEndTick(OnTickDungeonWorld.java:13) ~[mmorpg:?] {re:classloading} How can the other mod access my (BooleanCapability) cap? It is loaded by World#getCapability and the capability has a unique resource location, both caps are attached in CapabilityAttachEvent<World>. The BooleanCapability class doesn't even exist in age_of_exile. Other mod's code: https://github.com/RobertSkalko/Age-of-Exile/blob/c5740a9cca788b8d02d904ca5230f34381e25d43/src/main/java/com/robertx22/age_of_exile/uncommon/datasaving/Load.java#L36 My code: https://pastebin.com/KknmYrpc
  7. For anyone trying to do the same: I copied PiglinAi and edited the findNearestValidTarget method, got it working now.
  8. Is there a way I can make a custom piglin not attack or pathfind players? I tried overriding setTarget, didn't work. Also tried clearing some memories from the brain, worked somehow but made the piglins move around weird. Am I missing some easy way?
  9. Hey, is it possible to change the tool break sound? I tried PlaySoundAtEntityEvent, but it's not called for the break sound. And in PlaySoundSourceEvent, I cannot get the entity to compare the held item with my custom item.
  10. Hey, is there any way to get the player (maybe just the UUID?) that caused a loot drop? I want to change the loot based on a capability that is attached to the ItemStack the player is holding while mining blocks or killing mobs.
  11. I figured it out, didn't register correctly. Thank you!
  12. Okay, so this is my code now: public class CIContainer extends AbstractContainerMenu { public final IItemHandler handler; public static CIContainer fromNetwork(final int windowId, final Inventory playerInventory, FriendlyByteBuf data) { return new CIContainer(windowId, playerInventory, new ItemStackHandler(27)); } public CIContainer(final int windowId, final Inventory playerInventory, IItemHandler handler) { super(BannedTools.CI_CONTAINER.get(), windowId); this.handler = handler; addPlayerSlots(playerInventory); addMySlots(); } private void addPlayerSlots(Inventory playerInventory) { int originX = 7; int originY = 67; //Hotbar for (int col = 0; col < 9; col++) { int x = originX + col * 18; int y = originY + 58; this.addSlot(new Slot(playerInventory, col, x+1, y+1)); } //Player Inventory for (int row = 0; row < 3; row++) { for (int col = 0; col < 9; col++) { int x = originX + col * 18; int y = originY + row * 18; int index = (col + row * 9) + 9; this.addSlot(new Slot(playerInventory, index, x+1, y+1)); } } } private void addMySlots() { if (this.handler == null) return; int cols = 9; int rows = 3; int slot_index = 0; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { int x = 7 + col * 18; int y = 17 + row * 18; this.addSlot(new SlotItemHandler(this.handler, slot_index, x + 1, y + 1)); slot_index++; if (slot_index >= 27) break; } } } @Override public void clicked(int slot, int dragType, ClickType clickTypeIn, Player player) { getSlot(slot).container.setChanged(); super.clicked(slot, dragType, clickTypeIn, player); } @Override public boolean stillValid(Player player) { return true; } @Override @Nonnull public ItemStack quickMoveStack(@Nonnull Player playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.slots.get(index); if (slot.hasItem()) { int bagslotcount = this.slots.size(); ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.copy(); if (index < playerIn.getInventory().items.size()) { if (!this.moveItemStackTo(itemstack1, playerIn.getInventory().items.size(), bagslotcount, false)) return ItemStack.EMPTY; } else if (!this.moveItemStackTo(itemstack1, 0, playerIn.getInventory().items.size(), false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) slot.set(ItemStack.EMPTY); else slot.setChanged(); } return itemstack; } } Registering: private static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, MODID); public static final RegistryObject<MenuType<CIContainer>> CI_CONTAINER = CONTAINERS.register("ci_container", () -> IForgeMenuType.create(CIContainer::fromNetwork)); And this is how I open the inventory: @SubscribeEvent public void onRightClick(PlayerInteractEvent.RightClickItem event) { if (!(event.getItemStack().is(this))) return; if (event.getSide() == LogicalSide.CLIENT) return; ItemStack item = event.getItemStack(); ServerPlayer player = (ServerPlayer) event.getPlayer(); LazyOptional<IItemHandler> cap = item.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); if (cap.isPresent()) { IItemHandler itemHandler = cap.resolve().get(); NetworkHooks.openGui(player, new SimpleMenuProvider( (windowId, playerInventory, playerEntity) -> new CIContainer(windowId, playerInventory, itemHandler), new TextComponent("Test"))); } } openGui() is executed, but nothing happens.
  13. @SubscribeEvent public void onSetup(FMLClientSetupEvent event) { event.enqueueWork(() -> { MenuScreens.register(ChestItemMenu.CHEST_ITEM_MENU, ContainerScreen::new); }); } And this is how I register it. How can I open that GUI now?
  14. Like this? public class ChestItemMenu implements IForgeMenuType<ChestMenu> { private static final MenuType<ChestMenu> CHEST_ITEM_MENU = register("chest_item_menu", ChestMenu::threeRows); private static <T extends AbstractContainerMenu> MenuType<T> register(String p_39989_, MenuType.MenuSupplier<T> p_39990_) { return Registry.register(Registry.MENU, p_39989_, new MenuType<>(p_39990_)); } @Override public ChestMenu create(int windowId, Inventory playerInv, FriendlyByteBuf extraData) { return ChestMenu.threeRows(windowId, playerInv); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.