Jump 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.

Ewe Loon

Members
  • Joined

  • Last visited

Everything posted by Ewe Loon

  1. there are other functions you can use too, check the following classes org.lwjgl.input.Keyboard; org.lwjgl.input.Mouse; they are both available to use however the GUI uses them to so don't expect the events to work but you probably wont need them
  2. Bullshit. You are the one registering the IEEP instance, you decide exactly which entities you add it to. sorry, you are correct on this, I thought it was a static hashmap, but it isnt. Bullshit. Both getEntityData and IEEP are Forge patches. getEntityData saves in a tag called "ForgeData". Definitely added by Mojang. Both forge, wow, I wouldnt have expected that. Bullshit. I still think there is a lot of inefficient code in it, but what hasn't got that problem these days, my computer is many years old, and still runs it ok, so the inefficiency isn't an issue anyway NBT is a HashMap that stores each property on it's own as a structure of wrappers (NBTTagInt for integer, etc.). With IEEP you have one HashMap that stores reference to one wrapper object (implementing IEEP) that stores all your data. With that method primitives do not get boxed, etc. I was referring to efficiency , one you write methods in your class to read and write the values the other its in a separate class, just a different approach The only "good" thing about getEntityData is that it is a little bit easier to use if you just store one thing. That's all. getEntityData has some builtin error checking, getExtendedProperties() will return null if it wasn't registered to that entity so error checking is necessary. I think its time for this to be closed diesieben07, You're one of the best coders in here, you personally have answered some of the hardest questions i have asked, and pointed me to good resources, keep up the good work
  3. seems as if its not loading the texture possible problem is in this line private static final ResourceLocation mobTextures = new ResourceLocation(Reference.MODID + "textures/entity/EntityRpgGoblin.png"); try changing it to private static final ResourceLocation mobTextures = new ResourceLocation(Reference.MODID + ":textures/entity/entityrpggoblin.png"); and rename the image to lowercase note i added ":" before texture always use lowercase for filenames, saves lots of issues as it is case sensitive also make sure Reference.MODID is lowercase too as having uppercase also causes lots of issues you image should be in resources in a package called "assets.mod.textures.entity" where "mod" is replaces with Reference.MODID
  4. using extended entity properties adds the properties to all entities in the game , this is also inefficient as they all get loaded and saved even if not used as for 2 mods using the same tag ids , the same can happen with extended entity properties too the differences between the 2 differences is one was added by FORGE and the other was added by MOJANG after forge added their one if you are really worried about efficiency dont use minecraft at all, if you read the code you will see that most of it is inefficiently written anyway >> In more complicated cases, like IEEP being synchronized to client and used renderer (GUI for e.g) those calls would be made on FPS-timing, on my comp it could get to about 500 calls if not more. Kinda stupid to read NBT 500 times per second, don't you think? NBT is a HashMap Extended Entity Properties are also HashMaps wow what a difference BOTH methods have pros and cons , dont rubbish one just because you thought of something else
  5. this is probably what makes them render transparent or not transparent @Override public boolean isLeaves(IBlockAccess world, int x, int y, int z) { return true; } if you are doing custom rendering my advice would be to add a setting to your mods configuration and an option so the client can toggle it as to why isOpaqueCube is needed for multiplayer, i will explain the difference between multiplayer and singleplayer multiplayer is the client running without a server in the background and connected to an ipaddress singleplayer is the client running with a server in the background and connected directly to that server isOpaqueCube is used by the client to determine which blocks do not need to be rendered
  6. I have seen several reasons what classes cannot be found, the most common is that the class is only provided on one side, eg. serverside code trying to access proxyclient since it implements ISidedInventory this could be your problem though unlikely or it would happen more often this problem could even be caused by the java version the person with the problem is using it could also be an incompatibility with the forge version they are using or even there installation of the mod is incorrect, even a corrupted download
  7. sorry to say but unfortunatly the ticks per day is hard coded and cannot be changed however if you write a mod that constantly sets the time to what you want you could simulate a different time period, though keeping the client and server in sync might be more of a problem
  8. NBTTagCompound is nothing more than a HashMap with lots of methods for access tell me how it uses IO operations
  9. all entities have a NBTTagCompound that gets saves use getEntityData() method to retreive the tag to save your data in
  10. its called by one of the other functions in the gui , you have probably overridden it and not called the super method if you put a debug line in it you will find it most likely isn't being called if you cant find it post the whole class
  11. thats the gui code, what about the blocks code your block should extend BlockContainer or implement ITileEntityProvider then store the information in the attached tile entity
  12. here is some code for adding village structures in 1.7.10 during FMLPreInitializationEvent call VillagerRegistry.instance().registerVillageCreationHandler(new StoreHandler()); MapGenStructureIO.func_143031_a(ComponentShop.class, VillageIdiot.modid+":vibss"); StoreHandler class package me.el.VillageIdiot; import java.util.List; import java.util.Random; import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight; import net.minecraft.world.gen.structure.StructureVillagePieces.Start; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; public class StoreHandler implements IVillageCreationHandler { @Override public PieceWeight getVillagePieceWeight(Random random, int i) { return new PieceWeight(ComponentShop.class, 9, 1); } @Override public Class<?> getComponentClass() { return ComponentShop.class; } @Override public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) { return ComponentShop.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5); } } ComponentShop class package me.el.VillageIdiot; import java.util.List; import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces.Start; public class ComponentShop extends StructureVillagePieces.House1{ private int averageGroundLevel=-1; private static Random rng=new Random(); private static BlockSelector basment; public ComponentShop() { } /** * @param villagePiece * @param par2 */ public ComponentShop(Start villagePiece, int par2, Random rnd, StructureBoundingBox sbb, int cbs){ super(); this.coordBaseMode = cbs; this.boundingBox = sbb; } public static ComponentShop buildComponent (Start villagePiece, List<?> pieces, Random random, int x, int y, int z, int cbs, int p5){ //System.out.println("ComponentEtchStore buildComponent "+x+" "+y+" "+z); StructureBoundingBox nbb = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, -2, 0, 10, 4, 7, cbs); //System.out.println("ComponentEtchStore buildComponent "+nbb.toString()); ComponentShop r= canVillageGoDeeper(nbb) && StructureComponent.findIntersecting(pieces, nbb) == null ? new ComponentShop(villagePiece, p5, random, nbb, cbs) : null; //System.out.println("ComponentEtchStore buildComponent "+r+" "+nbb); return r; } @Override public boolean addComponentParts (World world, Random random, StructureBoundingBox nsbb){ //System.out.println("ComponentDJStore addComponentParts "+this+" "+nsbb+" "+averageGroundLevel); StructureBoundingBox sbb= new StructureBoundingBox(nsbb); if (this.averageGroundLevel < 0){ this.averageGroundLevel = this.getAverageGroundLevel(world, nsbb); if (this.averageGroundLevel < 0){ return true; } this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 2, 0); } int s2 = getMetadataWithOffset(Blocks.oak_stairs, 2); int s3 = getMetadataWithOffset(Blocks.oak_stairs, 3); int ld= getMetadataWithOffset(Blocks.ladder, 5); fillWithRandomizedBlocks(world, sbb, 0, -3, 0, 9, 1, 6, false, rng, basment); fillWithBlocks(world, sbb, 1, 1, 1, 8, 1, 5, Blocks.planks, Blocks.planks, false); fillWithBlocks(world, sbb, 0,2,0 , 9, 5, 6, Blocks.planks, Blocks.planks, false); fillWithBlocks(world, sbb, 0, 3, 3 , 9, 3, 3, Blocks.glass_pane, Blocks.glass_pane, false); fillWithBlocks(world, sbb, 2, 3, 0 , 3, 3, 6, Blocks.glass_pane, Blocks.glass_pane, false); fillWithBlocks(world, sbb, 6, 3, 6 , 7, 3, 6, Blocks.glass_pane, Blocks.glass_pane, false); fillWithAir(world, sbb, 1, 2, 1, 8, 4, 5); fillWithAir(world, sbb, 1, -2, 1, 8, -1, 5); fillWithMetadataBlocks(world, sbb, 1, -2, 3, 1, 2, 3, Blocks.ladder, ld, Blocks.ladder, ld, false); fillWithBlocks(world, sbb, 0, 6, 2, 9, 7, 4, Blocks.planks, Blocks.planks, false); fillWithMetadataBlocks(world, sbb, 0, 8, 3, 9, 8, 3, Blocks.wooden_slab, 5, Blocks.wooden_slab, 5, false); for (int t=0;t<3;t++){ fillWithMetadataBlocks(world, sbb, 0, 5+t, 0+t, 9, 5+t, 0+t, Blocks.dark_oak_stairs, s3, Blocks.dark_oak_stairs, s3, false); fillWithMetadataBlocks(world, sbb, 0, 5+t, 6-t, 9, 5+t, 6-t, Blocks.dark_oak_stairs, s2, Blocks.dark_oak_stairs, s2, false); } placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 5, 3, 0, sbb); placeDoorAtCurrentPosition(world, sbb, rng, 7, 2, 0, getMetadataWithOffset(Blocks.wooden_door, 1)); placeBlockAtCurrentPosition(world, Blocks.stone_stairs, s3, 7, 1, -1, sbb); placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 4, 1, sbb); placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 4, 1, sbb); placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 4, 5, sbb); placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 4, 5, sbb); spawnVillagers(world, sbb, 3, 2, 4, 2); return true; } @Override protected int getVillagerType(int n) { VillageIdiot.log("getVillagerType"+n); if ((n&1)==0){ return VillageIdiot.proxy.idiot_b; }else{ return VillageIdiot.proxy.idiot_s; } } static{ basment=new BlockSelector(){ @Override public void selectBlocks(Random rng, int x, int y, int z, boolean b) { field_151562_a=Blocks.stonebrick; } @Override public int getSelectedBlockMetaData() { int r = rng.nextInt(5); if (r>2)r=0; return r; } }; }; } you might find some errors as it will try to spawn villagers with professions you don't have as i skipped there code, but it should be easily fixed
  13. my first advice in use all lowercase for filenames, disk names mod id etc. only use uppercase in the lang file as translated text these are sections of my records mod (no ogg files provided) the main class of the mod is LoonRecords definition of LoonRecords.modid public static final String modid="loonrecords"; public static ItemGoldRecord diskadeline=new ItemGoldRecord("adeline"); // called during FMLPreInitializationEvent GameRegistry.registerItem(diskadeline, "record_adeline"); here is the ItemGoldRecord class import java.util.ArrayList; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; public class ItemGoldRecord extends ItemRecord { public static ArrayList<ItemGoldRecord> list=new ArrayList<ItemGoldRecord>(); private String recordname; protected ItemGoldRecord(String name) { super(name); list.add(this); setUnlocalizedName("record"); setTextureName("record_"+name); setCreativeTab(CreativeTabs.tabMisc); recordname=name; } @Override public ResourceLocation getRecordResource(String arg0) { ResourceLocation r=super.getRecordResource(LoonRecords.modid+":"+arg0); return r; } @Override public void registerIcons(IIconRegister reg) { itemIcon=reg.registerIcon(LoonRecords.modid+":record_"+recordname); } @Override public String getUnlocalizedName() { return "record."+recordname; } @Override public String getUnlocalizedName(ItemStack arg0) { return getUnlocalizedName(); } } this class keeps a list of all records added with it (i use the list for the villager that sells them in my mod) thats the code side of it , you will notice all text is lowercase in resources assetts.loonrecords sounds.json file { "records.adeline": { "category": "record", "sounds": [ { "name": "records/adeline", "stream": true } ] }, this file needs to be carefully written, to add more records repeat all but the first "{" when finished remove the lase "," and put a "}" on the last line use spaces not tabs in resources assetts.loonrecords.lang in en_US.lang file record.adeline.name=Music Disk Adeline item.record.adeline.desc=Balad for Adeline in resources assetts.loonrecords.sounds.records is the adaline.oog file hope this helps
  14. I think you have all missed something very simple, when you register your blocks you you specify a item class to associate with it for itemstacks (the second param) GameRegistry.registerBlock(woolslab1, MetaItem.class, "woolslab1"); here is my meta item class public class MetaItem extends ItemBlockWithMetadata{ public MetaItem(Block blk) { super(blk,blk); } @Override public String getUnlocalizedName(ItemStack stack) { return getUnlocalizedName()+stack.getItemDamage(); } } then add the names to the lang file and its done
  15. I added a group of colored stone blocks in my block class public static BlockIndexed[] colorstone=new BlockIndexed[numstones]; int the init method for(int s=0;s<numstones;s++){ colorstone[s]=new BlockIndexed(Material.rock); String ns=""+(s+1); String tname="colorstone"+ns; String name=tname+"_"; colorstone[s].setBlockName(name); colorstone[s].setBlockTextureName(tname); colorstone[s].setCreativeTab(LoonBlocksTabs.colorblock_tab); colorstone[s].setHardness(2.5F); colorstone[s].setResistance(15.F); colorstone[s].setStepSound(Block.soundTypePiston); GameRegistry.registerBlock(colorstone[s], ColorItem.class, name); using this method I also added slabs, wall, and steps for each stone hope this gives you a good idea
  16. I have created a custom world type, however i cant find anywhere to set the spawn location I have extended WorldType to set my own Chunk Provider and getSpawnFuzz() my chunk provider implements IChunkProvider neither of these classes seem to have anywhere to set the spawn location currently i'm using EntityJoinWorldEvent to set position, as a temporary solution, but would like a better way as this moves the player every time they log in Any suggestions
  17. entities do cause it, but might not be the only thing that can I spawned lots of entities (chickens) and the crash occurred every time, killed them off, no crashes spawned lots of cows , and got crashes again It will be something to do with the network traffic they are causing
  18. from what i read in you first post you want to use dependencies, thats depending on methods / classes in another mod, never done it myself, but intend to soon as i'm getting copies of the same classes in several of my mods anyone know of a good and simple tutorial for working with dependencies
  19. are you wanting grass or tallgrass or tallgrass2 ?
  20. build, forge_1.13.0.1180 server running on ubuntu if there are too many (less than 300) entities and a cleien with a slow internet connection trys to connect this error occurs about 200 times per second, flooding memory and causing so much lag that even the console is almost unresponsive [16:02:02] [Netty IO #2/ERROR] [FML/]: NetworkDispatcher exception java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcher.writev0(Native Method) ~[?:1.6.0_24] at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51) ~[?:1.6.0_24] at sun.nio.ch.IOUtil.write(IOUtil.java:182) ~[?:1.6.0_24] at sun.nio.ch.SocketChannelImpl.write0(SocketChannelImpl.java:383) ~[?:1.6.0_24] at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:406) ~[?:1.6.0_24] at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:249) ~[NioSocketChannel.class:?] at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:680) [AbstractChannel$AbstractUnsafe.class:?] at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.forceFlush(AbstractNioChannel.java:266) [AbstractNioChannel$AbstractNioUnsafe.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:488) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:?] at java.lang.Thread.run(Thread.java:679) [?:1.6.0_24] [16:02:02] [Netty IO #2/ERROR] [FML/]: NetworkDispatcher exception java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcher.writev0(Native Method) ~[?:1.6.0_24] at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51) ~[?:1.6.0_24] at sun.nio.ch.IOUtil.write(IOUtil.java:182) ~[?:1.6.0_24] at sun.nio.ch.SocketChannelImpl.write0(SocketChannelImpl.java:383) ~[?:1.6.0_24] at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:406) ~[?:1.6.0_24] at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:249) ~[NioSocketChannel.class:?] at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:680) [AbstractChannel$AbstractUnsafe.class:?] at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.forceFlush(AbstractNioChannel.java:266) [AbstractNioChannel$AbstractNioUnsafe.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:488) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:?] at java.lang.Thread.run(Thread.java:679) [?:1.6.0_24] [16:02:02] [Netty IO #2/ERROR] [FML/]: NetworkDispatcher exception this was tested on a server with clients having no mods Note. connecting from lan has no problem just tested with latest recommended build forge server 1.13.2.1230 problem still occurs though error messages didnot appear on the console however the errors are still in logs\fml-server-latest.log
  21. the packet-handling is all done in the background by the methods called in the code i posted, the code here is the code called by entering a portal with portal creation / searching removes and location provided so you wont have to do anything other than what i provided
  22. ok results brewing_stand.getItem() == null Blocks.brewing_stand == net.minecraft.block.BlockBrewingStand@81d5d1 this is probibly because Blocks.brewing_stand is being used not Items.brewing_stand
  23. actually the error is not that brewing_stand is null or the error would be at line 10 of proxyclient not on this line of code in ItemStack String s = this.getItem().getItemStackDisplayName(this); it appears that Blocks.brewing_stand is still null during post init , though i would have assumed it would be set, will investigate further and report
  24. for those whom are interested , when serverside you can use MinecraftServer.getServer().worldServers[n].provider.isDaytime() or other methods to get or set other info
  25. can you use @Override public boolean onBlockDestroyed(ItemStack itm, World wld,Block blk, int x, int y,int z, EntityLivingBase plr) { to break the blocks onBlockStartBreak might be client side only, and causing the problems

Important Information

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

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.