Everything posted by DARKHAWX
-
[1.9] Particle Effect Stream | Damage Player Touching Side/Infront of Block
Oh, I didn't get that you meant getEntitiesWithinAABB, I kind a just read it as BB and thought I needed to change the bounding box. So I'm meant to call worldIn.getEntitiesWithinAABB() and then damage all entities. But what method do I put that in? It wouldn't be onEntityCollidedWithBlock, because that never gets called.
-
[1.9] Particle Effect Stream | Damage Player Touching Side/Infront of Block
Oh, I didn't get that you meant getEntitiesWithinAABB, I kind a just read it as BB and thought I needed to change the bounding box. So I'm meant to call worldIn.getEntitiesWithinAABB() and then damage all entities. But what method do I put that in? It wouldn't be onEntityCollidedWithBlock, because that never gets called.
-
[1.9] Particle Effect Stream | Damage Player Touching Side/Infront of Block
1) Works perfectly, thanks! 3) So this works mostly. The actual collision box of the block is now 2 blocks in the direction the block is facing (I'm meant to actually just collide with the block, but take damage when within 3 blocks of the block. I just kinda collide with the air), but the bounding box is shown to be 4 blocks in the direction (which is correct). Also the onEntityCollideWithBlock() method never gets called even when I'm touching the block
-
[1.9] Particle Effect Stream | Damage Player Touching Side/Infront of Block
1) Works perfectly, thanks! 3) So this works mostly. The actual collision box of the block is now 2 blocks in the direction the block is facing (I'm meant to actually just collide with the block, but take damage when within 3 blocks of the block. I just kinda collide with the air), but the bounding box is shown to be 4 blocks in the direction (which is correct). Also the onEntityCollideWithBlock() method never gets called even when I'm touching the block
-
[1.9] Particle Effect Stream | Damage Player Touching Side/Infront of Block
I have three questions for today: [*]So currently have a block that will make a flame thrower like particle effect when activated with redstone. The problem is that I have put this code in renderUpdateTick and as such it does not activate nearly fast enough to make a steady steam of particles. Is there some way I can make it tick faster or should I be doing something else to get it to output a stream of particles? [*]I want to make a block that only damages players if they are colliding with it from a certain side (whichever side the block is facing), is there an easy way to do this? Or should I simply just add a check in onEntityCollidedWithBlock()? [*]My last question builds on from the last question. I want to make a block that damages the player if they are within three blocks in the direction the block was faced. I don't really know how I would go about this, any suggestions?
-
[1.9] Particle Effect Stream | Damage Player Touching Side/Infront of Block
I have three questions for today: [*]So currently have a block that will make a flame thrower like particle effect when activated with redstone. The problem is that I have put this code in renderUpdateTick and as such it does not activate nearly fast enough to make a steady steam of particles. Is there some way I can make it tick faster or should I be doing something else to get it to output a stream of particles? [*]I want to make a block that only damages players if they are colliding with it from a certain side (whichever side the block is facing), is there an easy way to do this? Or should I simply just add a check in onEntityCollidedWithBlock()? [*]My last question builds on from the last question. I want to make a block that damages the player if they are within three blocks in the direction the block was faced. I don't really know how I would go about this, any suggestions?
-
[1.9] Modify Vanilla Block Behaviour
Ty so much. I ended up getting it working, although the check to see if its a rose and not another type of flower is a bit messy, but it works!
-
[1.9] Modify Vanilla Block Behaviour
Ty so much. I ended up getting it working, although the check to see if its a rose and not another type of flower is a bit messy, but it works!
-
[1.9] Modify Vanilla Block Behaviour
So I want to make small modifications base vanilla block behaviour, specifically make rose bushes prick (damage) the player when walking through them. I'm not sure how I could do this, and I don't want to go around experimenting with stuff as that will probably break everything. How would I go about doing this? For my specific case is their an easy and simple way of adding functionality to blocks/items?
-
[1.9] Modify Vanilla Block Behaviour
So I want to make small modifications base vanilla block behaviour, specifically make rose bushes prick (damage) the player when walking through them. I'm not sure how I could do this, and I don't want to go around experimenting with stuff as that will probably break everything. How would I go about doing this? For my specific case is their an easy and simple way of adding functionality to blocks/items?
-
[1.9] Block won't show up in creative tab.
Well I'm an idiot. that makes perfect sense.
-
[1.9] Block won't show up in creative tab.
Hi there, I just recently got back into modding and have starting making a basic mod for 1.9. Right now I have simply added a basic item and block as well as a creative tab. My problem is that while the game says the block is registered, it doesn't appear in my creative tab and I cannot give it to myself (through /give). Here is my preInit code: Here is my ModBlocks code: And here is both my BlockDecorativeStone and BlockBasic code: I even have this at the end of my postInit code: It appears that the game registers the block and it executes all fine and dandy like. It will output both "registered" and "TEST: atlantis:decorativeStone" into the console; I just cannot get it to appear in game for some reason. Am I missing something?
-
[1.8] Organising model files
Bit of a weird question, but I want to be able to organise my long list of json files for my block models better (by grouping them up in folders). This, I have been able to achieved fine, my problem is organising the folders for the block models in the players inventory (assets/<modname>/models/item). No matter how I put it, they will not work. The inventory models only works if its in the root item folder. Here is all the relevant info: Pic of directory: /blockstates/alchemicalCraftingTable.json /models/block/alchemicalCraftingTable/alchemicalCraftingTable_east.json /models/item/alchemicalCraftingTable/alchemicalCraftingTable.json BlockRenderRegister Does anyone know what I need to change so that it works properly and so I can organised my item model files? (All the models work when I place them, just not when I have to item in my inventory)
-
[1.8] Check if player is looking at the moon, whilst holding an item
That might be the reason.
-
[1.8] [EDIT] Updating crafting matrix upon changing item in a slot
Okay, so I've now fixed my problems (I was comparing item stacks rather than the items) but have run into another one. In my gui it adds two new inventory slots (on top of the normal crafting matrix, both of which are used in the crafting), but when I change the items in them it doesn't update the crafting matrix. How should I change my Slot code so that it forces the container to update and check if the items match a recipe?
-
[1.7.10] Armor models won't work
Check the logs (when you start the game), its probably telling you that there is a missing texture now. Fix that and you should PROBABLY be all good. Purple/Black texture implies that you are missing the textures for the item/block/armor/etc.
-
[1.8] [EDIT] Updating crafting matrix upon changing item in a slot
So after a bit of tinkering I think I've gotten somewhere... Right now I have a crafting table that I can open and place blocks in, but I'm not sure if I've initialised the crafting table and recipes properly. Also for some reason if I close the inventory whilst items are still in the crafting matrix, they just disappear. This was working beforehand, so I'm not sure what I broke. Here is the code I have: -snip- I don't expect any of you to actually read through the whole code. I'm just thinking that I am not either a) registering my recipes right b) my CraftingManager isn't being registered/initialised correctly c) my Gui/container isn't updating properly If someone could check these for me, or tell me how I'm supposed to do them that would be great. (also wtf am I doing wrong with the disappearing items when closing the inventory?) EDIT: All the recipes will be shapeless and require a solvent and catalyst (both items, can be null), justsoyouknow
-
[1.8] Check if player is looking at the moon, whilst holding an item
So the code for getLookVec is this: /** * returns a (normalized) vector of where this entity is looking */ public Vec3 getLookVec() { return this.getLook(1.0F); } /** * interpolated look vector */ public Vec3 getLook(float p_70676_1_) { if (p_70676_1_ == 1.0F) { return this.getVectorForRotation(this.rotationPitch, this.rotationYawHead); } else { float f1 = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * p_70676_1_; float f2 = this.prevRotationYawHead + (this.rotationYawHead - this.prevRotationYawHead) * p_70676_1_; return this.getVectorForRotation(f1, f2); } } /** * Creates a Vec3 using the pitch and yaw of the entities rotation. * * @param pitch The rotational pitch of the entity. * @param yaw The rotational yaw of the entity. */ protected final Vec3 getVectorForRotation(float pitch, float yaw) { float f2 = MathHelper.cos(-yaw * 0.017453292F - (float)Math.PI); float f3 = MathHelper.sin(-yaw * 0.017453292F - (float)Math.PI); float f4 = -MathHelper.cos(-pitch * 0.017453292F); float f5 = MathHelper.sin(-pitch * 0.017453292F); return new Vec3((double)(f3 * f4), (double)f5, (double)(f2 * f4)); } So I'm assuming its returning the correct value. I think the error is in some part of the code on my part, and probably because getCelestialAngle() probably returns an angle centred on the top left of the sun/moon. Thinking about it, is there anyway I can draw the vector in the world? I could probably use it to visualise what the vectors look like.
-
[1.8] Check if player is looking at the moon, whilst holding an item
if(player.posY < 64) { //probably underground } Well that's an easy solution, but it probably isn't the best. So this is what I've got so far. It works and is accurate enough, but currently doesn't check if the player has a clear line of sight. /** * Checks if the player is looking at a celestial body to a certain degree of accuracy * @param player = player to check agains * @param threshold = maximum difference between the angles (degree of accuracy) * @param checkMoon = whether to instead check if the player is looking at the moon * @param throughWalls = whether to check if the player has a clear line of sight (not implemented yet) * @return true if difference between angles is less than threshold, false otherwise */ public static boolean isLookingAtSun(EntityPlayer player, int threshold, boolean checkMoon, boolean throughWalls) { World worldIn = player.getEntityWorld(); // Maximum range to check if they have clear line of sight int maxRange = 128; // Some math (returns a value between 0 and 1 depending on if its at the horizon or vertical double moonHeightVal = Math.sin((worldIn.getCelestialAngle(0) + 0.25f) * 2 * Math.PI); double time = worldIn.getWorldTime(); double correctAngle = -1; // The players look vector Vec3 vector = player.getLookVec(); double angle; // Angle will now be between 0 and 4. 0 = 0 degrees, 1 = 90 degrees, 2 = 180 degrees, etc. if (time > 23215 || time <= 6000) {// First quad correctAngle = Math.abs(moonHeightVal); } else if (6000 < time && time <= 12785) { //second quad correctAngle = 1-Math.abs(moonHeightVal) + 1; } else if (12785 < time && time <= 18000) { //third quad correctAngle = Math.abs(moonHeightVal) + 2; } else if (18000 < time && time <= 23215) { //forth quad correctAngle = 1-Math.abs(moonHeightVal) + 3; } // Convert angle to both degress and radians double correctAngleD = correctAngle * 90; double correctAngleR = correctAngleD * (Math.PI/180); // Create a vector for the sun Vec3 moon = new Vec3(Math.cos(correctAngleR),Math.sin(correctAngleR), 0); // This should be correct if (checkMoon) { vector = new Vec3(-vector.xCoord, -vector.yCoord, -vector.zCoord); } double dotProd = moon.dotProduct(vector); double absMoon = moon.lengthVector(); double absVector = vector.lengthVector(); // This is the angle between the player vector and the moon angle = Math.acos(dotProd / (absMoon * absVector)) * (180/Math.PI); if (angle < threshold) { return true; } return false; } I'm just going to leave this here for now, I'll probably work on it later. If you guys can make it more accurate or implement a check for looking through walls that would be amazing. But for now it works. EDIT: Its inaccurate because the moon vector seems to not be exactly centred on the moon, I think its slightly above and to the left.
-
[1.8] Check if player is looking at the moon, whilst holding an item
That would be a problem... I'll have to look into some way of blocking this...
-
[1.8] Check if player is looking at the moon, whilst holding an item
Basically when the player looks at the moon, whilst holds my the item it triggers an achievement and allows the player to progress through the mod.
-
[1.8] Check if player is looking at the moon, whilst holding an item
Yes, I do want to do this. I knew it was probably going to be a bit messy, but I enjoy a challenge. The Maths part I'm not worried about at all. The main part I'm having trouble with us understand what methods I SHOULD be using together to find this out, and exactly what each methods returns. As a super side note: how can I make a player hold my item like a thaumometer, or a map (when it covers the players screen)?
-
[Solved] Accessing GUI elements more reliably
Could you not just save the buttons as variables? or use the button id's?
-
[1.8] Check if player is looking at the moon, whilst holding an item
Hey there, So just like the title says, I want to have an item that when held will check, each tick, whether the player is holding said item, and if so, determine whether they are looking at the moon (the player must have line of sight, so no blocks in the way). Now, I have a few small snippets of code that I'm pretty sure work, but I don't know how to piece it all together. For example I think I can use onUpdate() to perform the checks each tick (and I think it also comes with a built in checkiftheplayerisholdingtheitem). And I'm also sure that I can use getCelestialAngle(0) (with a bit of math I'm told) to get the current angle of the moon, and use getLookVec() to get the look vector of the player. But with all of this info I don't know how to put it together, and also how to check if the player can actually see the moon (there are no blocks in between). Does anyone know of a way to put this all together so it works?
-
[1.8] [Solved] Gui not being rendered properly (texture.png > 256x256)
So after a bit of tinkering I found out my problem and just want to share with you if anyone has a similar problem. The issue I was having is that my texture image was >256x256 in size (even though it was still square). Therefore I had to use the method drawModalRectWithCustomSizedTexture() rather than drawTexturedModalRect().
IPS spam blocked by CleanTalk.