Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Veru useful thing: In Client proxy: @Override public EntityPlayer getPlayerEntity(MessageContext ctx) { // Double-check is inevitable! return (ctx.side.isClient() ? Minecraft.getMinecraft().thePlayer : super.getPlayerEntity(ctx)); } In Common proxy: /** * Returns a side-appropriate EntityPlayer for use during message handling. */ public EntityPlayer getPlayerEntity(MessageContext ctx) { return ctx.getServerHandler().playerEntity; } And yes - tho it's client (in client method) you still need to check if it really is client.
  2. What exacly do you want to do? Single-calc are best to be lauched right before block is broken (BreakEvent, HarvestCheck) You might wanna use PlayerInteractEvent, tho idk how is it called when you hold left-click (Idk if once per click or continiusly).
  3. 1. Did you register it? 2. Is it being called (did you used right event bus?) 3. does isATree actually return ture sometimes? (if getting passed)?
  4. This is probably BEST pack of basic tutorials ever made for 1.8 so far. http://www.minecraftforge.net/forum/index.php/topic,26267.0.html After you learn all its content you are most likely able to write quite advanced stuff. As a very useful other tuts: Packets: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with Events and Data-holding. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and You know this = you can make anything you want actually (as long as it's not super-custom).
  5. Above is true. Since official github source has been taken down along with downloads, Spigot team (what's left of it), is making updates by patcher distribution that doesn't contain "taken-down" code (the one that was affected by DMCA) therefore it's legal. I wouldn't really count on ANYTHING bukkit-based. That era has ended the day, some selfish persona done DMCA. Next era would be Sponge project (for now doesn't have actual server implementation, just in-dev API that works with Forge). https://spongepowered.org/ If anything - invest you time in this. It comes with very good (still wip tho) docs, code and developers, and seems like it will lead in near future. Note that you can still code server mods with Forge.
  6. You can't expect anyone to write whole method for you. Learn Java and your IDE (eclipse). It proposes you methods/fields. Hints: player.inventory.mainInventory ItemStack.stackSize
  7. 1. Make use of proxies! Don't EVER do this: if(event.getSide() == Side.CLIENT) 2. proxy.registerRenderInfo(); GameRegistry.registerBlock(PavelowOre, "PavelowOre"); You can't be registering renderers before you register item/block. Also - adding renderers should happen in init(). http://www.minecraftforge.net/forum/index.php/topic,26267.0.html Have look here.
  8. IMessage ALWAYS requires empty constructor. public class ARMessage implements IMessage { public String text; public MyMessage() { } public MyMessage(String text) { this.text = text; } Why do you have ARMessage and MyMessage() ? (copy-paste mistake?) Also: Might not be it.
  9. CMON Man! Each line = one translation.
  10. Unless your problem is "I don't know how to create new file" then you can simply create new one, lel Also this: src/main/java/resources - is bad, resources shouldn't be inside java (by default).
  11. Check out how to add them. I might be able to give you example: src/main/resources/assets/modid/lang/en_US.lang and inside: tile.<unloc name>.name=<ingame name> tile.ore_copper.name=Copper Ore You will soon crash into rendering stuff, have look at this: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html
  12. I don't think so, but hey - you can do anything using PlayerTickEvent. Subscribe to that event and check if current level != (or >) levelLastTick. Don't forget to do that server side (!world.isRemote) and in Phase.START. Obviously you will need to save levelLastTick somewhere. For that you can use IExtendedEntityProperties. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and 2nd post in thread. Disclaimer: There might be a better way.
  13. What? 1. You don't use IDs as of 1.6.x+ 2. Blocks aren't named (in constructor), they are only registered to GameRegistry and have unlocalized name. 3. In-game names are defined by lang files. public BlockTest(Material material) { super(material); setUnlocalizedName("someUnlocName"); } .... Block blockTest = new BlockTest(someMaterial); GameRegistry.registerBlock(blockTest, "someUnlocName");
  14. @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { if (!world.isRemote) { System.out.println("WORKS"); } } Are you telling me this is not printing ANYTHING? Cleanup your code and repost it.
  15. Subscribe to PlayerTickEvent. Pseudo: static int maxItemAmout = 10; //max limit of your item. //check phase to be START. PlayerTickEvent event; // this doesnt look like it, learn how to use events. if (!event.player.world.isRemote){ //run code on server-side int count = 0; for (int i = 0; i < event.player.inventory.length; ++i){ ItemStack stack = event.player.inventory[i]; if (stack != null){ if (stack.getItem() == yourItem){ if (count >= maxItemAmout){ //set stack to null, since you cant have any more (limit exceeded), go to next slot. } else{ count += stack.getStackSize() //again check if count is exceded and if is lower stack size by amout you exceeded. } } } } }
  16. Sorry, but WHAT?! You shouldn't be sending any world changes from client to server (othen than player operations ofc). Why are you doing it? Server is a tea-kattle. Client is just a cup. I can't imagine someone pouring tea from cup to kattle, that breaks the concept. Could you please explain? Server alredy knows in what world client is (client can be only in ONE world at the time).
  17. I don't quite get what you mean. Getting entity from vector should be made on server (!world.isRemote) then you will apply changes to server-side values and send packet to clients that will update client-side values, you shouldnt ever use client to compute stuff, unless you have predictable results (operation mirroring). What is the problem? And btw: if(list.iterator().hasNext()){ EntityMyMob ent = (EntityMyMob)list.get(0); This piece of code breaks eveary law of iteration.
  18. /** * Called when a block is placed by a player. * * If a Block Place event is cancelled, the block will not be placed. */ @Cancelable public static class PlaceEvent extends BlockEvent
  19. For future - use words wisely. "When pick up" is not same as "when added to inventory". Please precise that. As to how - post above pretty much outlines everything. You will be scanning for item in EntityItemPickupEvent (for "pick up") or in PlayerTickEvent (phase start, side server). Using hasItem() and then iterating is waste of CPU. Do it all in one loop. Iterate check it item is right and increment total quantity, if quantity > max, remove item/stack.
  20. From McByExample: // This is currently necessary in order to make your block render properly when it is an item (i.e. in the inventory // or in your hand or thrown on the ground). // Minecraft knows to look for the item model based on the GameRegistry.registerBlock. However the registration of // the model for each item is normally done by RenderItem.registerItems(), and this is not currently aware // of any extra items you have created. Hence you have to do it manually. This will probably change in future. // It must be done in the init phase, not preinit, and must be done on client only. Item itemBlockSimple = GameRegistry.findItem("minecraftbyexample", "mbe01_block_simple"); ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation("minecraftbyexample:mbe01_block_simple", "inventory"); final int DEFAULT_ITEM_SUBTYPE = 0; Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlockSimple, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation); This happens ofc in client-proxy (registerRendering), MUST be in in init() (load). // Lol I noticed now that the posted code alredy said this Now note (as I said before): models/items/blockname.json MUST HAVE SAME FILENAME as blockstates/blockname.json.
  21. world.isRemote - client !world.isRemote - server You did world.isRemote. As a follow-up - you know that client's values will be 0 (not like server ones), you will need to use packets/dataWatchers. Also - consider making all your stats = 0 (they are not initialized when constructed). Might save you NPE in some critical case (idk your whole coding style, might not).
  22. I saw your other thread: http://www.minecraftforge.net/forum/index.php/topic,28575.0.html Are you sure your workspace is not corrupted?
  23. You don't have lwjgl, so I am pretty sure you set up your workspace incorrectly. Best way to fix it would be simply set it up again, have you tried that? http://www.minecraftforge.net/forum/index.php/topic,14048.0.html#post_update_forge
  24. When should it happen? To access inventory: player.inventory... and you can pretty much manipulate any ItemStack[slot_index] As to "detecting" Should it be on tick? on Click? on some event?
  25. Theory: http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-18.html http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-texturing-quads-faces.html http://greyminecraftcoder.blogspot.com.au/2014/12/block-rendering-18.html Practice: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html
×
×
  • Create New...

Important Information

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