TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
[SOLVED][1.7.10] Saving Block Direction State
TheGreyGhost replied to Chasingu's topic in Modder Support
Hi You need to save the direction data. You can either use metadata (to save the direction as block information, if you only need 0-15), or you can save it in the TileEntity as "NBT" data. Your TileEntity will need to implement methods for: writeToNBT, readFromNBT, getDescriptionPacket, onDataPacket This link might be useful http://www.minecraftforge.net/forum/index.php/topic,23256.msg117993.html#msg117993 http://cazzar.net/tutorials/minecraft/Tile-Entity-Updates-The-Quick-and-Dirty-Method/ http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html -TGG -
Hi Just to check - do you understand the purpose of binding your texture before rendering? Where did you get the idea to use loadTexture from? You need to replace the loadTexture with bindTexture, not just delete it. -TGG
-
Hi Try adding breakpoints to here ForgeHooks.canToolHarvestBlock() public static boolean canToolHarvestBlock(Block block, int metadata, ItemStack stack) { String tool = block.getHarvestTool(metadata); // Breakpoint here if (stack == null || tool == null) return false; return stack.getItem().getHarvestLevel(stack, tool) >= block.getHarvestLevel(metadata); } and ForgeHooks::canHarvestBlock() public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) { if (block.getMaterial().isToolNotRequired()) // Breakpoint here { return true; } ItemStack stack = player.inventory.getCurrentItem(); String tool = block.getHarvestTool(metadata); if (stack == null || tool == null) { return player.canHarvestBlock(block); } int toolLevel = stack.getItem().getHarvestLevel(stack, tool); if (toolLevel < 0) { return player.canHarvestBlock(block); } return toolLevel >= block.getHarvestLevel(metadata); } Then step through the code line by line to see why it lets your tool harvest the block when it shouldn't. -TGG
-
Hi Your foodDonut has an extra space in one of the parameters "AAA " There is a strong hint in your error file at net.lumberstock.mod.Lumberstock.Init(Lumberstock.java:179) ~[bin/:?] This tells you that the problem was caused in your code probably at this line. But if you don't notice the extra space, you could look at what is happening in the recipe at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:232) ~[forgeSrc-1.7.10-10.13.1.1220.jar:?] --> you see for (int i1 = 0; i1 < j * k; ++i1) { char c0 = s.charAt(i1); The index i1 is 10, which is more than the number of slots, so j and/or k are too big If you look further up to where j and k are calculated, you find while (p_92103_2_[i] instanceof String) // "AAA", "A A", "AAA " { String s2 = (String)p_92103_2_[i++]; ++k; j = s2.length(); s = s + s2; } So this code is looping through the string array you provided; k is the number of rows of (eg) "AAA" and j is the length of the last one. The only way this can be more than 9 is if you have got the number of rows wrong or the size of the last row wrong. Even better - if you add a breakpoint to your code, then step in and watch what is happening to the variables directly. That makes it very obvious what is going wrong. http://www.vogella.com/tutorials/EclipseDebugging/article.html - for Eclipse. IntelliJ is very similar. -TGG
-
Howdy All I'm having a problem while debugging a new mod. I am using the standard structure of src/main/java and src/main/resources But when I Debug Minecraft Client, all resources are not found (mcmod.info, lang, textures, etc). If I use the gradle runClient instead, it all works fine. Debug Minecraft Client copies the resources to build\resources and the mod code goes into build\classes During mod initialisation, the FMLFolderResourcePack for the mod is added as build\classes\main Any help on why the resources are being copied to the wrong place? -TGG
-
Hi Show a screenshot of what it looks like? You mean - the arrow doesn't look like an arrow, it has a number of smaller pictures on it? Perhaps this is your problem this.loadTexture(bowMod.MODID+":"+"itemDemonArrow"); and private void loadTexture(String string) { } perhaps you mean bindTexture? I'm guessing you used loadTexture, but it gave you a compile error that the loadTexture method couldn't be found, so you created an empty one? -TGG
-
[1.7.10] EntityClientPlayerMP cannot be cast to EntityPlayerMP
TheGreyGhost replied to gline9's topic in Modder Support
Hi The problem is that you're using getInt() and setInt() in your message fromBytes and toBytes. (Have a look at the javadoc for those two methods to see why they're wrong) Use readInt and writeInt instead. -TGG -
[Solved] My Mod Works for Me But Not For A Friend
TheGreyGhost replied to Magthidon's topic in Modder Support
FYI I think the problem is because you are using a different version of Java to your friend. The Map.replace() method was only added to the language recently. So your code builds fine, but when it runs on his machine, the method is missing. -TGG -
You might find this useful http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html It's for 1.6.4 but it's still almost identical for 1.7.10, just some of the packets have changed names. -TGG
-
Hi Have you tried putting a breakpoint at the ISound line and inspecting mapSoundPositions? Should show you pretty quickly what's wrong. -TGG
-
[Solved] My Mod Works for Me But Not For A Friend
TheGreyGhost replied to Magthidon's topic in Modder Support
different version of minecraft or forge maybe? If you post the jar somewhere (like, on dropbox) we could try it ourselves -TGG -
[SOLVED][1.7.10]Projectile doesn't register hitting entities
TheGreyGhost replied to blfngl's topic in Modder Support
Hi > the bullet won't ever register hitting an entity. Hits blocks fine though. Do you mean - the bullet goes right through the block? or it just does no damage? Have you tried placing a breakpoint in onImpact() on the first line and trying to hit an entity with the bullet? -TGG -
Hi I have to admit, I don't see any "strange black overlays". What am I looking for? -TGG
-
To be honest, no I have no idea what you mean, could you post screenshots please? And - is it some of the items black all of the time, or all of the items black but only some of the time? What do you mean by "overlay"? -TGG
-
SOLVED: CustomEntityArrow Not Rendering Correctly
TheGreyGhost replied to kitsushadow's topic in Modder Support
Hi I saw a very similar bug a year ago. It was caused by some vanilla code which treats projectiles differently from others, by checking for instance of EntityArrow Try changing your EntityModelArrow extends Entity to EntityModelArrow extends EntityArrow -TGG -
Hi An ISimpleBlockRenderingHandler will do fine if you register it correctly. If you tried it but it didn't work, show us some code? This link shows the important steps http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html This link might help to understand lighting... http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html -TGG
-
[1.7.10] PlayerSleepInBedEvent behaving differently on a server
TheGreyGhost replied to VikeStep's topic in Modder Support
If you just want something cosmetic to happen on the client, like the bed makes a creaking sound when you try to sleep in it, or it changes appearance to get rumpled sheets or something, then by all means do it client only. Otherwise you probably need the server. You can check if the block the player is right-clicking by using PlayerInteractEvent PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK -TGG -
Hi let me guess... NullPointerException? getHeldItem() may return null, you need to check for it. You might find this link useful with some background info on nullpointerexception debugging... http://www.terryanderson.ca/debugging/run.html -TGG
-
[1.7.10] PlayerSleepInBedEvent behaving differently on a server
TheGreyGhost replied to VikeStep's topic in Modder Support
Hi I don't know the answer but I think you can find out if you place a breakpoint in BlockBed.onActivated() and see why it is different on the Single Player vs the server. -TGG -
[1.7.10] [Solved] io.netty.handler.codec.DecoderException
TheGreyGhost replied to xandayn's topic in Modder Support
Hi Your setInt(0) is overwriting the discriminator, which is placed into the buffer before the call to toBytes I suggest you use readInt() and writeInt() instead of getInt() and setInt().. -TGG -
[1.7.10] Game lags a ton when generating blocks in the sky
TheGreyGhost replied to Eternaldoom's topic in Modder Support
by crikey that is mind bending, my eyes are watering I'm out of ideas about the cause of the lag, sorry. Haven't really done much terrain gen myself. You might need to resort to some trial and error with benchmarking to narrow it down. -TGG -
Custom EntityItem going random direction when thrown
TheGreyGhost replied to The_Fireplace's topic in Modder Support
Hi Item dropping / throwing takes place in EntityPlayer.func_146097_a(), with motion being set in this bit f = 0.3F; entityitem.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); entityitem.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); entityitem.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * f + 0.1F); You could set a breakpoint in there and follow through what is happening, will probably give you a clue. -TGG -
Hi You might gain some useful ideas (in addition to the ones above) by looking how BlockRedstoneLight works. There are two instances of it; Blocks.lit_redstone_lamp and Blocks.redstone_lamp It switches between them based on whether it is getting redstone power or not. If you look at BlockDaylightDetector, it shows you how you might tell whether it's daylight or not. -TGG
-
[1.7.10] Game lags a ton when generating blocks in the sky
TheGreyGhost replied to Eternaldoom's topic in Modder Support
Hi A couple of thoughts 1) I helped to optimise another mod once which was generating blocks (spheres) in the sky. The lag was awful. The reason turned out to be the lighting calculations. Adding blocks in the sky caused a cascading series of updates to the skylight map- each update of a block's lighting value affects all its neighbours, which affects all their neighbours, and so on. The solution was to provide a better initialisation of the lighting map instead of just having them all set to 15. 2) You can enable profiling by typing /debug start in the chat: On success, starts or stops the debug session. While active, includes notifications about potential performance bottlenecks in the console. When stopped, creates a profiler results file in the folder "debug". You can even add your own sections similar to the vanilla ones. Minecraft.getMinecraft().mcProfiler.endStartSection("startOfMyCode"); 3) You could also add your own profiling code to narrow down where the time is being spent eg startTime = System.nanoTime(); // do stuff timeSpent = System.nanoTime() - startTime; System.out.println("Time spent in xxx (ms)" + timeSpent / 1000000); -TGG