Jump to content

Belpois

Members
  • Posts

    128
  • Joined

  • Last visited

Everything posted by Belpois

  1. Removed the "@Instance" you don't need it... calling "Globals.instance" should allow you to get the static field from anywhere you want. Reading the error, it's trying to set the Global instance to Main which is illegal... Removing the @Instance should make it work.
  2. The flow of logic you need is rather simple, When picking the middle block and it breaks, a blockBreakEvent is triggered, in that event find the surrounding blocks do your check logic and break them in code. If you go though the same breaking mechanism minecraft has implemented other mods should not complain. Steps in a list [*]Listen on break event [*]Find surrounding blocks and apply check logic [*]Break the discovered blocks
  3. If I understand correctly, you want to Add or Remove some custom tasks you have created, "while" a button in the GUI is clicked on. Correct? In that case, if the change will effect all players on the server, then yes you need packets. Also can you please explain in more detail what you need, include some code while your at it
  4. Well Redstone is a huge part of Minecraft, when I say huge i mean HUGE and in order to explain everything it would take time. I urge you to try and understand how the BlockButton works under "package net.minecraft.block;" I know it may be hard to read though the obfuscated code but it the variable types are not obfuscated and you can probably track them down and understand. It takes time but it will teach how to read other peoples code and understand programming better. Here is a list of overrides you might want to focus on: int isProvidingWeakPower(IBlockAccess p_149709_1_, int p_149709_2_, int p_149709_3_, int p_149709_4_, int p_149709_5_); int isProvidingStrongPower(IBlockAccess p_149748_1_, int p_149748_2_, int p_149748_3_, int p_149748_4_, int p_149748_5_); boolean canProvidePower(); updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_); Also type redstone in the search field for these forums and see what people had asked for in the past, you might encounter something that solvea your problems
  5. No, you do not have to call it yourself simply implement your logic inside and it will be called on its own. As for Redstone look at some of the Redstone code in any redstone enabled block in vanilla, it should get you started.
  6. Take a look at the Mekanism mod project structure as it uses a few API's, it should help you get started. https://github.com/aidancbrady/Mekanism
  7. Hook up to the LivingJumpEntity event and add to the entities motiony field. Do some check logic first or all entities in the server will start jumping like crazy!
  8. That's what gravity will do to you Take a look at the Squid logic in vanilla minecraft and see how they made it float
  9. ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) ItemStack: Is the stack of items the player right clicked with. World: The world that the player is currently in. EntityPlayer: The player that actually right clicked the ItemStack.
  10. No, you don't need to register your custom types. I suggest these tutorials: http://www.wuppy29.com/minecraft/modding-tutorials/forge-modding-1-7/#sthash.S10Q8b2I.qZ82y6uJ.dpbs http://www.pahimar.com/tutorials/lets-mod/ http://jabelarminecraft.blogspot.com/
  11. I think he is referring to to either the proxy pattern or the static instances you initialize in the main mod file, both of which are basic code structures. @Mod.Instance(Reference.MOD_ID) public static ModClass instance; @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static IProxy proxy; public static Random random = new Random(); @EventHandler public void preInit(FMLPreInitializationEvent event) { // Pre Init code here }
  12. This might be useful, it's a tutorial on how to work with forge events: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html
  13. I generally try to avoid reflection or code manipulation altogether when I have access to available fields or events. Not true, see above. The JVM people are smart people, much smarter than any of us here. They know how to make this shit fast. Yeah I pulled those values out of my posterior, and though the code will likely execute at a similar speed once compiled it's not a recommend practice. as Ernio said, you could simply stop the normal zombie from spawning and create your own zombie based on the vanilla class file by extending it, I'd still recommend the events.
  14. I work in this kind of stuff and from experience on working with big projects manipulating byte code or using reflection will slow down performance much much more then executing a few extra lines of code here and there. Use the events, that's what they are made for. Comparison Setting something to null is maybe 3 instructions to the CPU, when reflection is more likely to be in the hundreds
  15. You really don't need to use reflection... Simply register with LivingUpdateEvent, which is triggered each time the entity is updated. There are lots of other events, here is a list http://www.minecraftforge.net/wiki/Event_Reference A little tip: When it comes down to reflection, stop, think and change the way you are coding. Reflection might be nice and powerful but also slow down the JVM drastically.
  16. I was just looking through some of the vanilla code and the base EntityMob class has this method protected Entity findPlayerToAttack() { EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); return var1 != null && this.canEntityBeSeen(var1)?var1:null; } You can use that, execute it and the nearest player will be the entity.
  17. So when the mob spawns, you go in front of it but "mop" is still null?
  18. That's because the raytrace is returning null, check if null first
  19. If you want to detect when a mob is looking at a player, in the update code type // "this" is a reference to the entity, it is a basic Java keyword that represents the instance MovingObjectPosition mop = this.rayTrace(200, 1.0F) Entity entity = mop.entityHit;
  20. EntityPlayer needs to be replaced by the instance of either the mob or a player
  21. float distance = 200; rayTrace(distance, 1.0F) Quote From: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-finding-block.html This is from 1.7.2 but the ray tracer shouldnt have changed, so it should work with 1.6.4
×
×
  • Create New...

Important Information

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