Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. 1. Learn about Forge Events. 2. Do NOT proceed until you understand them. 3. Subscribe to HarvestDropsEvent and add new loot to drop list. 4. Example: @SubscribeEvent public void onHarvestDrops(HarvestDropsEvent event) { Block block = event.state.getBlock(); if (block == Blocks.iron_ore) { event.drops.clear(); // you can also clear drops event.drops.addAll(some collection of ItemStacks); } } To add ItemStack to drop you can simply do: new ItemStack(Item, amount, meta).
  2. yes it is, but both 4 sides are able to connect with redstone, and it will work like a normal diode or a flip-flop. what i want is let only 2 side to connect( i mean graphic) i Two things: 1. "both 4 sides" - both can only ever refere to 2 objects. 2. How do you support your claim?
  3. I honestly belive that EntityPlayer is not being rendered like other entities. You approach is good-looking, but if it was correct (or should I say: working) approach - everyone would use it. What everybody does (and what I think you must do) is to use RenderPlayerEvent, cancel rendering and call your own renderer class.
  4. You can grab player's pos and simply check if it's water - this will give you pretty good idea if you are in water - but as said - need to count fact that depth of water might be 1 (standing) - that can also be catched by checking one block below - if block you are in and below you is water you have 100% (unless you count situation where you head is inside wall and legs in water, lol) that you are AT LEAST swimming or more - diving. This will also catch "dolphin-jumping" out of water. Pretty simple solution.
  5. Only ocean? Well, 1st you need to check biome - look how F3 debug checks player's biome (GuiIngame). Then obviously check if isWet. Now only cases left is when "jumping out of water" - I don't see how is that bad for you, I mean - isWet was designed to know if your head is underwater (you know - no air). If you need to know even when you are just touching water - will have to somehow check blocks around (under or at feet) - but this will again produce next problems and will need extra checks for special cases. Is "just touching water" worth it? Can't help more, but it's basically catching all "wet cases".
  6. public boolean isWet() { return this.inWater || this.worldObj.canLightningStrike(new BlockPos(this.posX, this.posY, this.posZ)) || this.worldObj.canLightningStrike(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ)); } public boolean isInWater() { return this.inWater; } Apparently isWet also check for rain - #canLightningStrike checks if it's raining and if you are not covered from sky. (Those claims are not 100% true, a only glimpsed at code). As to "why" - is you are fully underwater it should always be true. When jumping out of water the "inWater" WILL hange, it refers to "about" center of entity.
  7. Offtopic, but: I have ideas what this might be, but may I ask - is there alredy some see-for-myself code (tried to find something on GitHub, but couldn't :C) or anything at all about it? Really interesting.
  8. Looking at it now - IT SHOULD, but why it doesn't? (Also: how the hell I didn't notice that before). Just to support this claim: (Yes, this is dedicated server) public class IOUtils { public static File getMcDir() { System.out.println("Guess what?"); if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDedicatedServer()) { return new File("."); } return Minecraft.getMinecraft().mcDataDir; } } [16:44:55] [server thread/INFO] [sTDOUT]: [x.common.utils.IOUtils:getMcDir:21]: Guess what? [16:44:55] [server thread/INFO] [sTDOUT]: [x.common.utils.IOUtils:getMcDir:21]: Guess what? EDIT: Oh, the MYSTERY! I can almost hear brainz humming.
  9. public static File getMcDir() { if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDedicatedServer()) { return new File("."); } return Minecraft.getMinecraft().mcDataDir; } I think it's about 5th time I'm pasting this utility here Edit: According to revelation below this post - code above should be "proxified".
  10. Also - if you have problem writing implementation of those - look type hierarchy on IResourcePack - especially FileResourcePack which can load .zip/.jar files as ResourcePacks (yes, its ready-to-use, and I recomment using this, instead of loading e.g non-zipped folder structure).
  11. Just to second what diesieben said - 1.8 is superior to 1.7.10 in practiacally everything, including stability (althrought both are stable). Modders and Forge supporters should encourage other modders to updatie to newer versions, because not everyone does that (and because some people are expecting "easy ways") trend developed that 1.8 is something of a test build. No it's not - either way, everyone WILL have to go through 1.8 updates when 1.9 comes out. Stay on 1.8, encourage others to update, don't be forced to downgrade (unless it's small mod or without rendering stuff - which changed the most).
  12. Why are you trying to make something that you simply can't do? To write ANY mod you need to learn Java, can't do anything without it. Poiting out obvious problems is pointless - there will be more and more. You have bad bracketing, how can you not see that? (Oh, you don't know Java). Please, stop trying to be coder when you are not. And if you really want to be one - learn basic concepts of coding in Java. For past days you've been posting countless threads about how to make, where to get working code, or "who will write it for me?" - you are WASTING your OWN time. Spend it on actually learning Java.
  13. I am not asking how to do that (because it's damn easy, but takes about 4 hours to make it WELL (with debugging ofc), which can be spent on other things), I am asking if anyone knows ready-to-use API that would simply generate JSON-String from NBTTagCompound and other way around. Well, I'll probably post working parsers if I won't find anything Thanks
  14. Best templates (for basic/intermidiate stuff) with explanations are here: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html And info about mc itself: http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html
  15. I just loved this!
  16. Basically I am searching web before I write it myself (which would be probably waste of time in this case). Found few threads/sources with such tool, but skimming code just to know which is best of them would take lot of time, so here I am asking - anyone used something nice in past? Links? Simple API would be nice, or Git with source which I can use. Thanks.
  17. Glad you did, but I don't really get what you are onto with: Because there is simply no such code there NBTTagList mitems = new NBTTagList(); for (int i = 0; i < getSizeInventory(); ++i) { ItemStack stack = getStackInSlot(i); if (stack != null) { NBTTagCompound item = new NBTTagCompound(); item.setByte("Slot", (byte)i); stack.writeToNBT(compound); // compound != item mitems.appendTag(item); } }
  18. // JokesOn EDIT: Removed. I guess not everyone knows memes :C // JokesOff 1. Learn Java 2. Learn what is constructor. 3. Look at your Renderer's constructor. 4. Figure out what should be inside. 5.Come back with code that actually is being called. Code in question: public RenderSoul(RenderManager p_i46153_1_, ModelBase p_i46153_2_, float p_i46153_3_) { super(p_i46153_1_, p_i46153_2_, p_i46153_3_); } new RenderSoul(Minecraft.getMinecraft().getRenderManager()) // Where are 3 args? I see only one.
  19. By glancing on your code - it's not NBT's methods. 1. Where are those method placed? Player's IEEP, mob, item? 2. Who owns inventory? Player, mob, item, tileEntity? 3. Where should it be stored? Item, player, mob? Write what is your expected outcome, not just "it's not working". (E.g: I want player to have additional inventory).
  20. Again: Did you register the renderer? Next: What are you putting into RenderSoul constructor. Whole Code, not just parts. Last: Fix variable namig - to something meaningful. Whenever something changes - you need to post changes. Best would be git. If you did register it, check (by placing print) if your renderer is being called at all.
  21. Sooo... where is rendering class? You only gave model. Also - look at your client proxy. Since when registering entity is a renderig stuff for client? 1. Creating entity should be done in COMMON proxy or main mod class. All in pre-init. 2. Then you need to register renderer in CLIENT proxy. Rendering goes to init phase. To make renderer you can extend Render<something>.class. According to your namig - EntitySoul - should this be alive? Moreover - should this be a mob? Sould sounds rather like EntityLivingBase or JUST Entity. To register renderer you use: RenderingRegistry.registerEntityRenderingHandler(EntitySomething.class, new RenderSomething(Minecraft.getMinecraft().getRenderManager())); Sidenote: I don't belive you that it worked before. It couldn't unless you had mentioned above stuff and removed it on accident.
  22. So couple days ago i created a shrine with power and everything, worked and powered just fine and today i bacame a code wizard... wat ._. any ideas? Above can be translated: "I don't see your code, bruh!" :'(
  23. It works, but it doesn't. 1. While I am looking deeper - Ids can't be saved in byte[]. Ids expand much further.
  24. How it should be written (according to me ;p) 1. If you are changing currently held itemStack - packet can be literally EMPTY. * On receive (handlerr) you can pull out player (sender) from MessageContext: ctx.getServerHandler().playerEntity * From EntityPlayerMP returned you can get inventory, the slot can be gotten from: ctx.getServerHandler().playerEntity.inventory.currentItem 2. If you are changing others then you need to send "byte slotId" via packet (buffer.write/readByte). * Do as in 1., but use slotId from packet instead of "currentItem". Editing ItemStacks is matter of server-side code, all code (its 1.7.10) can be in handler itself. You just operate on ItemStacks. EDIT Do not make this mistake: Since your handler class is inside packet class, when using data send by packet inside handler, don't use e.g: "this.slotId". Use "message.slotId" - the message is in handler's method.
  25. What type of inventory update are we talking about? You want to change item in slot? Add something? Edit ItemStack? Whos inventory is it - player, entity, chest?
×
×
  • Create New...

Important Information

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