Everything posted by Choonster
-
[1.11]Getting active potion from entity
This is correct.
-
[1.10.2] Make player not eat
You need to call ItemStack#getItemUseAction on the ItemStack from the event and check if the returned value is EnumAction.EAT . Don't create your own getItemUseAction method that always returns EnumAction.EAT , this makes no sense. You should also check if the player has your potion effect before you cancel the event. You don't merge the events together. A class can contain any number of @SubscribeEvent methods.
-
[1.11]Getting active potion from entity
Use the methods you mentioned in the OP: EntityLivingBase#getActivePotionEffects , EntityLivingBase#isPotionActive and EntityLivingBase#getActivePotionEffect . How you get these to execute on the server depends on what causes the code to run. Is it a key binding? Is it an event handler? Is it something else?
-
[1.11]Getting active potion from entity
On the client side, you can only get the active potion effects of the client player. On the server side, you can get the active potion effects of any entity.
-
[1.11]Getting active potion from entity
The client only rarely receives potion effect data for entities that aren't the client player (see EntityTrackerEntry#updatePlayerEntity and the methods that call it). The potion particle colour is calculated server-side and sent to the client where it's used to spawn the particles. This means that you can't reliably access active potion effects for entities other than the client player on the client side.
-
Collision box changes based on blockstate
This is where you lose me. What exactly is it that I'm storing in this variable? And are you referring to each of the four possible properties? Are these what I need to be storing in variables? getActualState returns a value of type IBlockState , you need to store this value in a variable. So here you mean instead of having state.getValue(BACK) I should be putting state.getValue(variable that stores the state.withProperty(BACK, back)? Instead of calling state.getValue(...) , call actualState.getValue(...) ; where actualState is the variable storing the value returned by getActualState .
-
[1.11]Getting active potion from entity
Those methods should work. Where are you calling them from? Which entity are you calling them on? Does the entity definitely have the potion effect on it?
-
Collision box changes based on blockstate
Your getActualState method checks each of the adjacent blocks to see if they're hot tubs and then returns an IBlockState with the BACK , FORWARD , LEFT and RIGHT properties set to the appropriate values. Your addCollisionBoxesToList method needs to call getActualState and store the IBlockState returned by it in a variable. It then needs to call IBlockState#getValue on this IBlockState value instead of the IBlockState argument.
-
Collision box changes based on blockstate
getActualState doesn't modify its arguments (and it can't, since IBlockState is immutable), it returns the actual state. You need to get the values from the IBlockState returned by getActualState instead of getting them from the IBlockState argument.
-
[1.10.2] Extending/attaching additional data to itemstack?
how do i attach a capability to a itemstack thats inside of player inventory ?? Subscribe to AttachCapabilitiesEvent.Item and use AttachCapabilitiesEvent#addCapability to attach a capability provider to the ItemStack . Once this PR is merged, you should subscribe to AttachCapabilitiesEvent<ItemStack> instead.
-
Collision box changes based on blockstate
Since the properties are stored in the actual state, you need to call Block#getActualState and get the values from the IBlockState returned by it. Block#addCollisionBoxesToList is called whenever an entity moves into the block space and in various other places. You don't need to manually update it. Side note: Always annotate override methods with @Override .
-
[1.10.2] Extending/attaching additional data to itemstack?
You can do this by storing the data in the stack's compound tag or by attaching a capability to the stack.
-
Collision box changes based on blockstate
Are those properties stored in the metadata or set in the actual state? If it's the latter, you have to call Block#getActualState yourself. In 1.11.2, an extra boolean parameter was added to Block#addCollisionBoxToList indicating whether the actual state should be used ( false ) or not ( true ).
-
Collision box changes based on blockstate
Which version of Minecraft are you using? My advice in your previous thread assumed you were using 1.9+, but it looks like you're using 1.8.9 (where the collision box logic is slightly different). In 1.8.x, you override Block#addCollisionBoxesToList to call Block#setBlockBounds followed by the super method for each bounding box, then call Block#setBlockBounds to restore the block's default bounding box at the end of the method. To make it easier to update to newer versions, I suggest you store each bounding box in a static final field and create a method like Block#setBlockBounds that sets Block#minX/Y/Z and Block#maxX/Y/Z from the coordinates of an AxisAlignedBoundingBox . When you update to 1.9+, you can simply replace each pair of calls to this method and the super method with calls to Block.addCollisionBoxToList .
-
[1.10.2] Make player not eat
PlayerInteractEvent.RightClickItem is fired when a player right clicks with an item, you can cancel it to prevent Item#onItemRightClick from being called. ItemStack#getItemUseAction returns the Item 's use action, this will be EnumAction.EAT for food. PlayerInteractEvent.RightClickBlock is fired when a player right clicks a block, you can use this to detect the player right clicking a cake and cancel the event to prevent Block#onBlockActivated , Item#onItemUse and Item#onItemUseFirst from being called. To store the timer, you'll want to use the Capability system or a Potion / PotionEffect .
-
[1.11] Trouble creating TileEntity with inventory.
That's the method, yes. It's been deobfuscated to getCount in newer mappings. I suggest you update your mappings to the latest snapshot from the MCPBot website so this and other methods have deobfuscated names.
-
[1.10] MissingVariantException
That's not how Forge's blockstates format works. The format is documented here. The defaults section can only contain the same values as a single variant would, it can't have multiple variants in it. Each key in the variants section can either be a fully-defined variant (e.g. connections=4,facing=east or normal ) or a property name (e.g. connections ). The value of a fully-defined variant key can either be an array of variants (in which case one will be chosen at random when the model is rendered) or a single variant (must not have an object as the first value, otherwise the deserialiser won't recognise it as a fully-defined variant). The value of a property name key must be an object that maps each value of the property to a variant. You can see some examples of the format here, here and here.
-
[1.11.2] Making a animated block model???
Forge has an animation system for baked models, you can find some documentation on it here.
-
[SOLVED][1.8]Problem with BlockStates - Slabs'n'Stairs
Only the BlockStairs.HALF and BlockStairs.FACING properties are stored in metadata, the BlockStairs.SHAPE property is set in the actual state ( BlockStairs#getActualState ).
-
Logger refuses to execute this line of commands.
You've imported the wrong Logger and LogManager classes: Minecraft uses org.apache.logging.log4j rather than java.util.logging . marker: null is also invalid syntax.
-
[1.11.2] Animate Blocks?
Forge has an animation system for baked models, you can find some documentation on it here.
-
[1.11 - 1.11.2]A mod that uses another mod but don't need the other mod.
Include after:<modid> in your @Mod annotation's dependencies property. This tells FML to initialise your mod after the other mod, but only if it's loaded. You can also use required-before , before and required-after in this dependency string.
-
trying to get intellij IDEA to recognize classes and resolve an error
You only need to run one, though running all three probably won't hurt. I cloned the Matter Overdrive repository and set it up following the instructions I linked and it was able to find vanilla classes without issue; but there were a bunch of compilation errors in the mod itself.
-
trying to get intellij IDEA to recognize classes and resolve an error
Have you run the setpDecompWorkspace (for your local project) or setupCiWorkspace (for the CI build) tasks? Forge's documentation explains how to set up your development environment here. That NoClassDefFoundError is caused by referencing a client-only class from common code. Translation should only be done on the client with net.minecraft.client.resources.I18n ; but if for some reason you need to translate something server-side, use net.minecraft.util.text.translation.I18n instead. The latter is deprecated because it should be avoided when possible.
-
Where do I find some documentation to Minecraft mechanics?
MovementInput#updatePlayerMoveState is overridden by MovementInputFromOptions#updatePlayerMoveState , which actually reads the player's input. In vanilla, EntityPlayerSP#movementInput is always an instance of MovementInputFromOptions . Those flags store the MovementInput values from the previous tick before updating the MovementInput with the player's current input. flag (set from MovementInput#jump ) is used to toggle creative and elytra flight and to charge/release the horse jump meter. flag1 (set from MovementInput#sneak ) and flag2 (set from MovementInput#moveForward being greater than or equal to [nobbc]0.[/nobbc] is used to toggle sprinting (i.e. only start sprinting if the player wasn't holding sneak and wasn't moving forward at full speed).
IPS spam blocked by CleanTalk.