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.

DosMike

Members
  • Joined

  • Last visited

  1. file and fileCopy hurt me, they should both be invalid pathnames starting with a colon... if you want to write in the game directory you should be able to just use a relative path (new File("words.txt"), or new File(".", "words.txt") if you want to explicitly mention a directory) besides that copying a file twice to append a line seems highly inefficient, instead try using a FileWriter: new BufferedWriter(new FileWriter("words.txt", true)); The second argument is the append flag, for more information google it. Also please don't forget to .flush() any output stream before closing it to prevent data loss
  2. Ah thank you very much, that did the trick
  3. So I basically want to be able to put stuff on a block and take it back off (changing it's state). Since I want to partially require different items/tools for that I'm using the onBlockActivated-Method: @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!facing.equals(EnumFacing.UP)) return false; ItemStack item = playerIn.getHeldItem(hand); if (item == null || item.isEmpty()) return false; Type type = state.getValue(VARIANT); if (item.getItem().getToolClasses(item).contains("shovel")) { if (type.equals(Type.CLEAN)) return false; // clean up cleaned if (type.equals(Type.HAYED)) { //take back clean wheat if (!worldIn.isRemote) { worldIn.setBlockState(pos, getStateFromMeta(Type.CLEAN.getMeta())); Renergy.l("Dropping Wheat"); EntityItem recycle = new EntityItem(worldIn, hitX, hitY + 0.1, hitZ, new ItemStack(Items.WHEAT)); recycle.setDefaultPickupDelay(); worldIn.spawnEntity(recycle); worldIn.playSound(playerIn, hitX, hitY, hitZ, SoundEvents.BLOCK_GRASS_BREAK, SoundCategory.BLOCKS, 1f, 1f); } return true; } //More cases.... Now changing the BlockState and decreasing the item in hand (placing something on the block) works without any problems. Taking the item back from the block (with a shovel in this case) however only changes the BlockState. The item wont spawn, the sound wont play and what frustrates me the most is that there is absolutely no StackTrace whatsoever. There seems to be a similar topic from about a year ago that sadly never got resolved, so I'm opening this topic. I'm currently building against forge 2619

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.