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.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. 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.
  2. 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
  3. Open up the Block class. Ctrl-F "onBlockActivated" Copy-paste
  4. 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.
  5. Your method signature is wrong.
  6. 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
  7. 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.
  8. Let me just go look at vanilla code for a second. Oh look at that. EntityAIZombieAttack extends EntityAIAttackMelee
  9. 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.
  10. 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.
  11. There are random update ticks. Look at BlockCrops. Line 28, specifically.
  12. 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)
  13. 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?
  14. IBlockState#getValue(BlockDirectional.FACING)
  15. Containers are instanced once and then it just renders AFAIK. Have you tried making the changes, then closing and re-opening the GUI?
  16. Always post the crash report.
  17. No, you do not need a spawn egg for spawners to work.
  18. Null check, yes. Also sendUpdate is a void, so you don't return anything.
  19. My first guess is that worldObj is null (which can happen).
  20. Use your debugger and figure it out. If the variant isn't the variant you expect, what is it?
  21. I think you have to try and merge the changes you made with the changes on the current Head locally.
  22. 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.
  23. Deprecated methods are fine to override but not to invoke.
  24. 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); }

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.