Skip 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.

V0idWa1k3r

Members
  • Joined

  • Last visited

Everything posted by V0idWa1k3r

  1. Loader#getConfigDir is the way I load json settings from a folder in the config directory in my mod. I do not have to use anything else so I assume you will not have to either.
  2. You can use Loader#getConfigDir to get the configuration directory then step a directory higher and enter the mods directory since both config and mods directories are located within the same directory. You could also use reflection to access Loader.canonicalModsDir. There might be a better way that I am unaware of though.
  3. EntityLivingBase#isPotionActive is the method that checks is the specified potion active for the entity. It takes a Potion argument and you can get the potion instances from the MobEffects class. Your current code doesnt't work because it contains syntax errors.
  4. Use IGuiHandler with EntityPlayer#openGui(Object mod, int modGuiId, World world, int x, int y, int z) for your custom GUIs. Your solution will open a gui/container pair of a vanilla furnace which is likely not what you want. If you do want that you can Still use IGuiHandler. Just return vanilla's ContainerFurnace and GuiFurnace in corresponding methods. Make sure that your TE implements IInteractionObject. I do not see Override annotations in your code(Code-style issue #2)
  5. If there are no overloads then you are using a forge version which doesn't have that introduced. In the newer version GameRegistry#registerTileEntity(Class<? extends TileEntity> tileEntityClass, String key) is deprecated with a comment that it'll be removed in 1.13.
  6. It's still GameRegistry#registerTileEntity. Use the overload which takes a ResourceLocation as the second argument though.
  7. The field is public. just bind Then use the UVs from the TextureAtlasSprite when making vertices with the BufferBuilder.
  8. All sprites(blocks & items) are stored in one texture which is TextureMap.LOCATION_BLOCKS_TEXTURE. TextureAtlasSprite contains the UV coordinates for that sprite on this texture.
  9. You could. Or you could use BufferBuilder directly. These are static: Gui#drawScaledCustomSizeModalRect Gui#drawModalRectWithCustomSizedTexture
  10. The same way vanilla uses them in it's GUI
  11. It's ITickable#update now. You will need to implement ITickable on your TileEntity.
  12. You can override Block#getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos), check if the item in player's main hand is shears and return a lower value.
  13. Use Block#createTileEntity(World world, IBlockState state). This method has a IBlockState as a parameter and you can return null if you do not want a TE to be created.
  14. If you are using a TESR then TileEntity#getRenderBoundingBox allows you to specify a custom AxisAlignedBB to do frustrum checks and TileEntity#getMaxRenderDistanceSquared allows you to control the distance at which your tile will no longer be rendered.
  15. Item#onItemUseFirst is called on both the client and the server. You lack a !world.isRemote check.
  16. If you use Item#onItemUseFirst instead of Item#onItemUse returning EnumActionResult.SUCCESS will prevent Block#onBlockActivated from firing thus preventing any GUI/Container showing up. Alternatively you may set the result of PlayerInteractEvent.RightClickBlock to DENY
  17. Icons have been replaced by the new model system. If you needed the icon for something else rather than defining the texture for the block(ex. rendering the icon in a TESR) you can use BlockModelShapes#getTexture Block#getBlockLayer Is still getRenderType. It now defines the way blocks are rendered(models/invisible/liquids) instead of being ids for block renderers since those are gone in favour of the model system.
  18. You can't reference client-side only code like that from your common code, use proxies. Or delete that line entirely since you do nothing with the mc local anyway. What do you mean by "can't connect"? Is there an error in your log?
  19. You can use the built-in gui sync methods in Container class: Container#addListener(IContainerListener listener) is for initial sync when the player opens the GUI, Container#detectAndSendChanges() is for periodic detection of changes and sending those changes to the client and Container#updateProgressBar(int id, int data) is for receiving updates on the client. You send updates with IContainerListener#sendWindowProperty. See ContainerFurnace or ContainerBrewingStand for examples. This obviously only works for the GUIs. If you want the data for a progress bar in the world or for something else you will have to use packets as Draco said.
  20. Add a server-side check (!this.world.isRemote) to your te's update method. Recipe processing code like that should not run on the client anyway.
  21. You would need to iterate through all inventory slots and check if each one of them is empty incrementing some counter if it is. To clarify - you would need to iterate the InventoryPlayer#mainInventory list.
  22. There is Block#updateTick but if you want something like a spawner you most likely are looking for ITickable#update for which you would need a TileEntity. I would recommend looking into the way vanilla spawners work(BlockMobSpawner and TileEntityMobSpawner).
  23. Override CreativeTabs#getIconItemStack and return an ItemStack chosen based on time from an array/list of ItemStacks.
  24. If you do not want a TESR then don't register it. An empty TESR still has it's render method called even if it doesn't do anything. You can have a TE without a TESR. As for your issue - override Block#getRenderType and make it return EnumBlockRenderType.MODEL. BlockBed overrides that to return something else.
  25. I do not think there is a method to render particles in the gui as vanilla never does that. The default spawnParticle method spawns them in the world only. You would need to create your own method to render the particle in the gui.

Important Information

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

Account

Navigation

Search

Search

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.