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.

kenoba10

Members
  • Joined

  • Last visited

Everything posted by kenoba10

  1. I do know how to change it in intellij but idk about eclipse, what you need to do is change the start parameters for minecraft to --username (username) -password (password)
  2. your server proxy should be on the server side not your common proxy but I doubt thats whats causing it, you can try it though
  3. I think I see your problem, in your gui handler class you are returning null, rather than your container, in getServerGuiElement and returning the container rather than the gui in the getClientGuiElement. You may have other issues but that is the only issues I see at first glance.
  4. Because I can't see your code, I can't tell for sure but I think you are referencing your client proxy as cleintProxy, which I doubt is your actual name for the class.
  5. ids are not reset if they are already generated, new ids are only generated for the new blocks and items
  6. thank you, I tried something similar to this and it works great!
  7. the order that you register your items in with GameRegistry.registerItem(); is what order they are put in the creative tab. However you will need to restart your world for the order to change because the ids are assigned when you create your world randomly
  8. the order that you register your items in with GameRegistry.registerItem(); is what order they are put in the creative tab. However you will need to restart your world for the order to change because the ids are assigned when you create your world randomly
  9. your block extends the BasicBlock class, does that class extend a BlockContainer because I beleive any tile entity needs to extend a BlockContainer
  10. it should work it is usually just very hard to see in the console
  11. float f = 1.0f; float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; double d = (double)f; double d1 = player.prevPosX + (player.posX - player.prevPosX) * d; double d2 = (player.prevPosY + (player.posY - player.prevPosY) * d + 1.6200000000000001d) - (double)player.yOffset; double d3 = player.prevPosZ + (player.posZ - player.prevPosZ) * d; Vec3 vec1 = Vec3.createVectorHelper(d1, d2, d3); float f11 = MathHelper.cos(-f2 * 0.01745329f - 3.141593f); float f12 = MathHelper.sin(-f2 * 0.01745329f - 3.141593f); float f13 = -MathHelper.cos(-f1 * 0.01745329f); float f14 = MathHelper.sin(-f1 * 0.01745329f); float f15 = f12 * f13; float f16 = f14; float f17 = f11 * f13; double d11 = 5000d; Vec3 vec2 = vec1.addVector((double)f15 * d11, (double)f16 * d11, (double)f17 * d11); MovingObjectPosition position = world.func_147447_a(vec1, vec2, false, true, true); if(position != null && position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = position.blockX; int y = position.blockY; int z = position.blockZ; EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z); world.spawnEntityInWorld(lightning); } This is the code I use in my mod and it works just fine world is a World and player is an EntityPlayer
  12. if you are what you may want to do is change FMLNetworkHandler.openGui(player, GeneralTech.instance, GuiIDS.guiIDTeleporter, world, x, y, z); to player.openGui(GeneralTech.instance, GuiIDS.guiIDTeleporter, world, x, y, z
  13. are you registering your tile entity? I don't see it in your code, but I could be missing it
  14. In my mod, I have a sword which when sneak right clicked opens a gui, the gui, container, and iinventory work just fine but I am having trouble figuring out how to save the item in the slot of the gui to the sword as nbt data. Here is my code right now: Sword Class: public class ItemRaveSword extends SwordElectricFactory{ private boolean lightning; private boolean fireball; public ItemRaveSword() { super(ToolMaterials.RAVE); this.setUnlocalizedName("swordRave"); lightning = false; fireball = false; } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(player.isSneaking()) { player.openGui(ElectricFactory.instance, 0, world, (int) player.posX, (int) player.posY, (int) player.posZ); } else { if (lightning) spawnLightning(world, player); else if (fireball) spawnFireball(world, player); } return stack; } } GUI Handler: public class GUIHandler implements IGuiHandler{ public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if(id == 0) return new RaveSwordContainer(player, player.getHeldItem()); return null; } public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if(id == 0) return new RaveSwordGUI(player, player.getHeldItem()); return null; } } GUI: @SideOnly(Side.CLIENT) public class RaveSwordGUI extends GuiContainer{ public RaveSwordGUI(EntityPlayer player, ItemStack sword) { super(new RaveSwordContainer(player, sword)); } protected void drawGuiContainerForegroundLayer(int x, int y) { } protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MODID.toLowerCase(), "textures/gui/ravesword.png")); int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); } } Container: public class RaveSwordContainer extends Container{ public RaveSwordContainer(EntityPlayer player, ItemStack sword) { addSlots(player, sword); } public ItemStack transferStackInSlot(EntityPlayer player, int index) { ItemStack newStack = null; Slot slot = (Slot) inventorySlots.get(index); if(slot != null && slot.getHasStack()) { ItemStack stack = slot.getStack(); newStack = stack.copy(); if(index < 1) { if(!this.mergeItemStack(stack, 1, inventorySlots.size(), false)) return null; } else if(!this.mergeItemStack(stack, 0, 1, false)) return null; if(stack.stackSize == 0) slot.putStack(null); else slot.onSlotChanged(); } return newStack; } public boolean canInteractWith(EntityPlayer player) { return true; } private void addSlots(EntityPlayer player, ItemStack sword) { addSlotToContainer(new Slot(new RaveSwordInventory(sword), 0, 80, 35)); for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for(int i = 0; i < 9; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); } } } IInventory: public class RaveSwordInventory implements IInventory{ private ItemStack[] inventory; private ItemStack sword; public RaveSwordInventory(ItemStack sword) { inventory = new ItemStack[1]; this.sword = sword; } public String getInventoryName() { return "swordRave"; } public boolean hasCustomInventoryName() { return false; } public int getSizeInventory() { return inventory.length; } public int getInventoryStackLimit() { return 1; } public void markDirty() { } public void openInventory() { } public void closeInventory() { } public boolean isUseableByPlayer(EntityPlayer player) { return true; } public boolean isItemValidForSlot(int index, ItemStack stack) { return true; } public ItemStack getStackInSlot(int index) { return inventory[index]; } public ItemStack getStackInSlotOnClosing(int index) { if(inventory[index] != null) { ItemStack stack = inventory[index]; inventory[index] = null; return stack; } else { return null; } } public void setInventorySlotContents(int index, ItemStack stack) { inventory[index] = stack; } public ItemStack decrStackSize(int index, int amount) { ItemStack stack = getStackInSlot(index); if(stack != null) { if(stack.stackSize <= amount) { setInventorySlotContents(index, null); } else { stack = stack.splitStack(amount); if(stack.stackSize == 0) setInventorySlotContents(index, null); } } return stack; } } This all works just fine I just need to figure out how to use nbt to save and read what item is stored in the gui
  15. in the configuration gui class where you have: super(screen, new ConfigElement(ConfigurationHandler.configuration.getCategory("(category)")).getChildElements(), Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())); change the second false to true super(screen, new ConfigElement(ConfigurationHandler.configuration.getCategory("(category)")).getChildElements(), Reference.MODID, false, true, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString()));
  16. What I believe you need to do is in your block class, register multiple icons inside of one in your registerIcons method and determine which one to do in a getIcon method: @SideOnly(Side.CLIENT) public static Icon topIcon; @SideOnly(Side.CLIENT) public static Icon bottomIcon; @SideOnly(Side.CLIENT) public void registerIcons(IconRegister icon) { topIcon = icon.registerIcon(); bottomIcon = icon.registerIcon(); sideIcon = icon.registerIcon(); } @SideOnly(Side.CLIENT) public Icon getIcon(int side, int metadata) { if(side == 0) { return bottomIcon; } else if(side == 1) { return topIcon; } else { return sideIcon; } } Different numbers in getIcon match the side of the block, however I do not know all possible sides This should answer your question though
  17. I'd like to see this get answered because I want to make a Tech Mod also with a power system
  18. I've done this and thats not exactly what im talking about. I decided to give up on this because I think its a value that can't be changed
  19. I changed it back
  20. When i change the value it just shoots nothing no difference in drawback: public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int par4) { int j = getMaxItemUseDuration(itemStack) - par4; ArrowLooseEvent event = new ArrowLooseEvent(player, itemStack, j); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return; } j = event.charge; boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemStack) > 0; if (flag || player.inventory.hasItem(Item.arrow.itemID)) { float f = (float)j / 20.0F; f = (f * f + f * 2.0F) / 3.0F; if ((double)f < 0.1D) { return; } if (f > 1.0F) { f = 1.0F; } EntityArrow entityArrow = new EntityArrow(world, player, f * 2.0F); if (f == 1.0F) { entityArrow.setIsCritical(true); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStack); if (k > 0) { entityArrow.setDamage(entityArrow.getDamage() + (double)k * 0.5D + 0.5D); } int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, itemStack); if (l > 0) { entityArrow.setKnockbackStrength(l); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, itemStack) > 0) { entityArrow.setFire(100); } itemStack.damageItem(1, player); world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); if (flag) { entityArrow.canBePickedUp = 2; } else { player.inventory.consumeInventoryItem(Item.arrow.itemID); } if (!world.isRemote) { world.spawnEntityInWorld(entityArrow); } } }
  21. Do you know which value is it? I'm guessing it's: int j = this.getMaxItemUseDuration(par1ItemStack) - par4; float f = (float)j / 20.0F;
  22. Look at the vanilla lava and water classes and see how their coded see if you can figure out what your not doing
  23. Ik somehow it can be done the More Bows mod has it
  24. I did and nothing I think its in the Bow EnumAction or something

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.