Everything posted by Draco18s
-
Not equal to air
While I know I can do this with Eclipse, I prefer not to for very large classes like Block because the list is very very large and often I'm already looking at the method I want to override.
-
[1.10.2][SOLVED] Getting a Block Property by property name
You can't compare strings this way. Well you can but its not going to work. http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
-
Not equal to air
Open up the Block class. Ctrl-F "onBlockActivated" Copy-paste
-
[1.10.2][SOLVED] Getting a Block Property by property name
This is how I handled getting the property with the name "age", along with its max and current value: Iterator<IProperty<?>> props = state.getPropertyNames().iterator(); while(props.hasNext()) { IProperty<?> p = props.next(); //lower case just to insure we're matching if(p instanceof PropertyInteger && p.getName().toLowerCase().equals("age")) { PropertyInteger ageProp = (PropertyInteger)p; //do whatever: int maxAge = (Integer) ageProp.getAllowedValues().toArray()[ageProp.getAllowedValues().size()-1]; int currAge = state.getValue(ageProp); } } And if there are any improvements, I would be interested.
-
Not equal to air
Your method signature is wrong.
-
Not equal to air
Please don't check against the air block. Many mods use "technical" blocks for various things (usually lighting), but which should be treated like air. I'd suggest checking the block's material against Material.AIR
-
[1.10] How to Entity Make Attack
EntityAIAttackMelee isn't an "attack you when you attack it" it's the "I bump into you and deal damage" behavior. You might also want to look at what makes EntityAIZombieAttack different.
-
[1.10] How to Entity Make Attack
Let me just go look at vanilla code for a second. Oh look at that. EntityAIZombieAttack extends EntityAIAttackMelee
-
MC1.10+ drops from leaves
Ahh. IBlockState blockstate = world.getBlockState(pos); Don't do this. You want event.getState() (getBlockState? I am not sure on the exact name). That will give you the block that decayed.
-
Help with setBlockState
scheduled ticks are, by definition, not random. You can use a random interval, but they are distinct from random update ticks, which are given to a fixed number of blocks in each chunk at random. Yes: Use @Override on every method that you are overriding. If Eclipse says "not valid, suggest remove" then you should fix the signature. Eclipse can't suggest an alternate signature, its too complex of an operation.
-
Help with setBlockState
There are random update ticks. Look at BlockCrops. Line 28, specifically.
-
Help with setBlockState
For random ticks, you didn't specify that your block should receive random ticks). For right-clicking, you have the wrong method signature (@Override would tell you this). You want public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
-
Help with setBlockState
You can simplify this: BlockPos pos0 = new BlockPos(pos.getX(), (pos.getY()+1) , pos.getZ()); BlockPos pos0 = pos.up(); That said, what isn't working correctly?
-
[Solved] [1.11] Creating Quarry
IBlockState#getValue(BlockDirectional.FACING)
-
Intellj Debug Question
Containers are instanced once and then it just renders AFAIK. Have you tried making the changes, then closing and re-opening the GUI?
-
TE throws a Null Exception during update.
Always post the crash report.
-
[1.10] CustomEntity transform automaticaly into pig? o.O
No, you do not need a spawn egg for spawners to work.
-
TE throws a Null Exception during update.
*Cough*
-
TE throws a Null Exception during update.
Null check, yes. Also sendUpdate is a void, so you don't return anything.
-
TE throws a Null Exception during update.
My first guess is that worldObj is null (which can happen).
-
MC1.10+ drops from leaves
Use your debugger and figure it out. If the variant isn't the variant you expect, what is it?
-
[Pull Request] Fix Conflicts
I think you have to try and merge the changes you made with the changes on the current Head locally.
-
MC1.10+ drops from leaves
Oh. Try this. ((BlockBOPLeaves)BOPBlocks.leaves_2).variantProperty This is also why I store my block variant properties in an API location, not only so I don't need to cast things, use static fields inside my classes (which wouldn't be present in the API), or other weirdness.
-
[1.11] Many Block Methods are Deprecated.
Deprecated methods are fine to override but not to invoke.
-
MC1.10+ drops from leaves
Can you post the code that defines the variant? e.g. I have this: public class Props { public static final PropertyEnum<EnumOreFlower> FLOWER_TYPE = PropertyEnum.<EnumOreFlower>create("flower_type", EnumOreFlower.class); }
IPS spam blocked by CleanTalk.