TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
Hi I'm pretty sure there is no such event, but you could perhaps add code to the Entity's .onUpdate, to inspect Entity.onGround, and if true, check the block underneath it. -TGG
-
@lex or @Alexiy If you post a zip of your code somewhere I can download it and give it a try here. I'm interested because I'm working on partially-transparent rendering at the moment myself. -TGG
-
Hi Some random ideas * is the rendering wrong or is the side-closed-logic wrong? * Is the black texture correct or does it look wrong? * are you using alpha blending (drawing order can be important)? * isOpaqueCube set to false? * do you draw the list or are you relying on vanilla to do it? * have you tried using Tessellator instead of direct calls to OpenGL? * have you set all the necessary flags or is vanilla affecting it depending on what has just been drawn? * starting coordinates provided by vanilla correct? * does it only happen when you're far away? (TileEntity out of rendering range?) -TGG
-
dude, look at Draco's code, I think it does exactly what you want and it's not very complicated. -TGG
-
Hi An idea - you could perhaps store the information in custom objects that your code maintains separate from the vanilla. Your TileEntities would be used like references to the object, so that your code loads the object whenever one of the TileEntities needs it, and when the player has moved away and there are no more of those TileEntities loaded, you unload the Object. There are a couple of places you can store your own objects to make them persistent - world.perWorldStorage in particular, used by vanilla for villages, but can be hijacked for your own purposes relatively easily. -TGG
-
Isn't it the same as 1.6.4? ISimpleBlockRenderingHandler http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html -TGG
-
[1.7.2]IndexOutOfBoundsException: Index: 45, Size: 45
TheGreyGhost replied to grim3212's topic in Modder Support
Yeah I think you're right, it has been given a list of 54 objects for some reason. The parent container also has 54 slots. But for some reason the container on the client has only 45. How many should it have, based on what you intended? Can you tell why ? (perhaps a couple more breakpoints in your container constructor) -? My guess is some sort of mismatch between your client and server container creation code - perhaps the TileEntity is a different size on both sides? -TGG -
[1.7.2]IndexOutOfBoundsException: Index: 45, Size: 45
TheGreyGhost replied to grim3212's topic in Modder Support
Hi I don't know exactly what the cause is but I can suggest a couple of ways to troubleshoot it. The problem is that the packet is trying to send 46 items (0 - 45) when you only have room in your inventory for 45. Perhaps if you put a breakpoint in the vanilla code at the point it is about to send the packet, and look at the list of inventory items it is about to send, you might gain a useful clue. In EntityPlayerMP.sendContainerAndContentsToPlayer this.playerNetServerHandler.sendPacket(new S30PacketWindowItems(par1Container.windowId, par2List)); -TGG -
Hi You can get all entities within a certain x,y,z range by defining an AxisAlignedBoundingBox and calling the function below Snippet taken from EntityLiving.onLivingUpdate:: List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(1.0D, 0.0D, 1.0D)); You can tell if an entity is behind the player by: 1) calculating the direction vector from the player to the entity 2) calculating the dot product of this vector with the player's look vector 3) if the dot product is negative, the entity is behind the player. Let us know if you need more help? -TGG
-
Hi Whenever I need a delay, I base it on the number of ticks that have elapsed - i.e. register a TickHandler which gets called every tick (1/20 of a second) and then just decrements a tickcounter each time until it reaches zero, then execute my code. No threads required. For 1.6.4 this was as described here http://greyminecraftcoder.blogspot.com.au/2013/12/forge-techniques-events.html For 1.7.2 it has been replaced by a new event (which I forget the name of, but shouldn't be too hard to find). If you need more help let us know? -TGG
-
Hi Unfortunately it is pretty difficult to override some of the minecraft default behaviour for user inputs. You could perhaps stop multiple clicking by overrwriting the repeat counter every tick using your own TickEvent. if (this.gameSettings.keyBindUseItem.pressed && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem()) { this.clickMouse(1); } Unfortunately rightClickDelayTimer is private so you would need to use reflection (AccessTransformer) to access it. This link talks a bit more about user input and where the clicks are detected (and the "repeat click every x ticks" code) http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html If you dig through the vanilla code you might be able to find a place to intercept it, for example the PlayerInteractEvent (with RIGHT_CLICK_AIR) Some items (eg) the bow do this by overriding getMaxItemUseDuration, that might also be of help. -TGG
-
Hi Keen, glad it helped Re the maths - I learnt that stuff at school (I did maths in final year) but I did manage to find this nifty site using a couple of key words I remember... http://www.mathsisfun.com/geometry/unit-circle.html or, more complicated, here http://en.wikipedia.org/wiki/Unit_circle -TGG
-
Ah yeah, you're right, missed that, my bad EntityLiving:: /** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ protected boolean interact(EntityPlayer par1EntityPlayer) -TGG
-
Hi If you're just starting out, some of the topics on this page might be useful for background information http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html Just for an initial test I'd suggest public class EntityWhirlWindDustFX extends EntityHeartFX { public EntityWhirlWindDustFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) { super(par1World, par2, par4, par6, par8, par10, par12); } } then in your Item add the line Minecraft.getMinecraft().effectRenderer.addEffect(new EntityWhirlWindDustFX(world, randPosX, randPosY, randPosZ, 0.0D, 0.0D, 0.0D, 0.5F)); Hopefully (once you've correctly my code syntax if necessary :-) ) this will spawn hearts when you click the item Once you get this far, you can change your constructor, and start overriding various methods in your EntityWhirlWindDustFX to customise the behaviour, especially the .onUpdate() Your math looks roughly right except this.posX = this.entityCentreX + distToCentre * Math.cos(2 * 3.141 * (tickCount / 20) * secondsPerRevolution); should probably be / secondsPerRevolution); Sorry, that was my fail :-) -TGG
-
Hi You might find these links useful http://greyminecraftcoder.blogspot.com/2013/12/forge-techniques-events.html http://www.minecraftforum.net/topic/1419836-forge-4x-events-howto/ The code you're looking isn't a method of Entity. The event is triggered in EntityPlayer:: public boolean interactWith(Entity par1Entity) { if (MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(this, par1Entity))) return false; ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; if (!par1Entity.interactFirst(this)) { If you want to override a method in your entity, interactFirst might work (but I'm not certain of how that works). -TGG
-
Hi I'm pretty sure you need to create your new EntityFX spawnedEntityFX = new EntityVortexFX(x,y,z etc) Minecraft.getMinecraft().effectRenderer.addEffect(spawnedEntityFX); I don't think you should use spawnEntity because they aren't handled the same way as effects particles. Effects are client-side only (they don't do anything except look good) but entities are controlled by the server and if you have too many it will get very slow. -TGG
-
Hi You might find this link useful http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html EntityInteractEvent might be the thing you're looking for. Have you used events before? -TGG
-
Hi If you want the particles to move in a circle, you will need to update their velocity every tick ("speed" is not the same as velocity because velocity has a direction). If you just provide an initial velocity they will keep going in a straight line; vanilla particles which change their direction or speed (eg due to gravity or due to slowing down) use the onUpdate method So if you want your particles to swirl, I'd suggest copying the EntitySmokeFX into your own class and changing the onUpdate method to set a new motionX, Y, Z every tick, or alternatively just to set the position directly using something like onUpdate() ... ++tickCount; this.posX = this.centreX + circleRadius * Math.cos(2 * 3.141 * (tickCount / 20.0) * secondsPerRevolution); this.posZ = this.centreZ + circleRadius * Math.sin(2 * 3.141 * (tickCount / 20.0) * secondsPerRevolution); (You'll need to set your centreX, centreZ, circleRadius etc when you create the particle) Might need a bit of tweaking but the basic idea should work... -TGG
-
I reckon GotoLink is right. -TGG
-
[1.6.4] Making a transparent block that gives out light.
TheGreyGhost replied to majesticmadman98's topic in Modder Support
Hi sleep is good! These links give a bit of background you might find useful http://greyminecraftcoder.blogspot.com/2013/07/rendering-transparent-blocks.html http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html In fact, most of the "Block" section might be of interest... http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG -
Hi Odd error, haven't see that one before. Try adding a breakpoint here and then seeing why world is null, that is very unusual. Do you know how to use the debugger? If not there's a good introduction here... http://www.vogella.com/tutorials/EclipseDebugging/article.html It appears that something is wrong with the ChunkProviderServer, it's worldObj hasn't been initialised properly? public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { long worldSeed = world.getSeed(); // breakpoint here Random fmlRandom = new Random(worldSeed); I'd be willing to bet it is something to do with your IWorldGenerator I can't say much more than that because I've never tried world generation, but I'd suggest going over the tutorial(s) again because I think you've missed something. -TGG
-
Hi A good place to start is net.minecraft.util.FoodStats -TGG
-
Hi Does it "snap" to the correct location after (say) 20 seconds, and if you try to pick it up is it actually in the wall, not where it appears to be? If so it might be something to do with this http://www.minecraftforge.net/forum/index.php/topic,14315.msg74087.html#msg74087 Short fix: derive your arrow from EntityArrow -TGG
-
really? That's odd Because they can't be changed easily once it becomes obvious they are stupid :-) -TGG
-
[SOLVED] SMP particles not appearing for other clients
TheGreyGhost replied to coolAlias's topic in Modder Support
Hi spawnParticle does nothing on the server WorldManager:: public void spawnParticle(String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) {} I'm pretty sure that particle effects are always triggered on the client in response to something else, and there is no packet to say "draw particle effects". Packet63 appears to be unused anywhere in the vanilla. I think you're probably stuck with writing your own "spawn particles here" packet from the server to client. -TGG