Everything posted by V0idWa1k3r
-
[1.12.2] Recommanded way of accessing the mods folder?
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.
-
[1.12.2] Recommanded way of accessing the mods folder?
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.
-
[1.11.2] How to tell if player has a potion effect.
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.
-
How to register TileEntity in 1.12?
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)
-
How to register TileEntity in 1.12?
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.
-
How to register TileEntity in 1.12?
It's still GameRegistry#registerTileEntity. Use the overload which takes a ResourceLocation as the second argument though.
-
Using an already existing block texture
The field is public. just bind Then use the UVs from the TextureAtlasSprite when making vertices with the BufferBuilder.
-
Using an already existing block texture
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.
-
Change hearts based on potion effect?
You could. Or you could use BufferBuilder directly. These are static: Gui#drawScaledCustomSizeModalRect Gui#drawModalRectWithCustomSizedTexture
-
Change hearts based on potion effect?
The same way vanilla uses them in it's GUI
-
Tile Entity onUpdate() in 1.12
It's ITickable#update now. You will need to implement ITickable on your TileEntity.
-
Have a modblock break faster with shears, like wool?
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.
-
[1.12.2] TileEntity on Blocks with Properties [Solved]
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.
-
Large Custom Model Render Bounds Help
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.
-
[1.12.2] Adding NBT Data To Item
Item#onItemUseFirst is called on both the client and the server. You lack a !world.isRemote check.
-
[1.12.2] Adding NBT Data To Item
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
-
[1.12.2] [Solved] Updating mods. Replace some methods
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.
-
Player Tick Event on Serverside [Problem] [1.12]
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?
-
[1.12.2] Data exchanging between Client and Server
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.
- [SOLVED] [1.12.2] Phantom item in Machine inventory
-
Getting a number of empty inventory slots
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.
-
Serverside Method when Block is in world
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).
-
Creative tab with updating icon
Override CreativeTabs#getIconItemStack and return an ItemStack chosen based on time from an array/list of ItemStacks.
-
[1.12.2] Custom bed without TileEntity-based rendering?
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.
-
Spawn particles in GUI
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.
IPS spam blocked by CleanTalk.