
blahblahbal
Members-
Posts
96 -
Joined
-
Last visited
Everything posted by blahblahbal
-
[1.8.9] Running code every tick while in a world
blahblahbal replied to blahblahbal's topic in Modder Support
...Derp. That's fixed. But something else must be wrong, because it still doesn't work. EDIT: Nevermind, I had the wrong index on the getCurrentArmor call. And all the other things where the index is needed. -
[1.8.9] Running code every tick while in a world
blahblahbal replied to blahblahbal's topic in Modder Support
I've changed the Event to a TickEvent, but it still doesn't seem to work. I'm still using the hardcoded value of 86, but will change it when I get it working. I did notice that the ID is stored as the Key, not the Value, so I changed containsValue to containsKey. @SubscribeEvent public void playerTick(TickEvent.PlayerTickEvent event) { if (event.phase == TickEvent.Phase.END) // && event.side == Side.SERVER) { EntityPlayer player = (EntityPlayer)event.player; if (player.inventory.armorInventory[3] != null) { if (EnchantmentHelper.getEnchantments(player.getCurrentArmor(3)).containsKey(86)) { if (EnchantmentHelper.getEnchantmentLevel(86, new ItemStack(player.getCurrentArmor(3).getItem())) == 2) { if (player.worldObj.isRemote) { int x = (int) Math.floor(player.posX); int y = (int) (player.posY - player.getYOffset()); int z = (int) Math.floor(player.posZ); BlockPos pos = new BlockPos(x, y, z); Block b = player.worldObj.getBlockState(pos.down()).getBlock(); if ((b == Blocks.lava || b == Blocks.flowing_lava || b == Blocks.water || b == Blocks.flowing_water) && player.worldObj.isAirBlock(pos)) { if (!player.isSneaking()) { player.motionY = 0.0d; player.fallDistance = 0.0f; player.onGround = true; } } } } if ((!player.capabilities.isFlying) && (player.moveForward > 0.0F)) { if ((player.worldObj.isRemote) && (!player.isSneaking())) { if (!PlayerEvents.INSTANCE.prevStep.containsKey(Integer.valueOf(player.getEntityId()))) { PlayerEvents.INSTANCE.prevStep.put(Integer.valueOf(player.getEntityId()), Float.valueOf(player.stepHeight)); } player.stepHeight = 1.0F; } } } } } } I know it's getting to at least the containsKey call because I had forgotten the null check and it errored. -
[1.8.9] Running code every tick while in a world
blahblahbal replied to blahblahbal's topic in Modder Support
Alright, I see your point. Regardless, this isn't the reason why the code isn't working. I don't know why we're discussing something that has nothing to do with why the code isn't working. -
[1.8.9] Running code every tick while in a world
blahblahbal replied to blahblahbal's topic in Modder Support
I could have, yes, but why do that when it's longer and less direct? Plus, I looked at the vanilla code for the getEnchantments method and it simply saves the id and level. -
[1.8.9] Running code every tick while in a world
blahblahbal replied to blahblahbal's topic in Modder Support
@SubscribeEvent public void onLivingUpdate(LivingEvent event) { if (event.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entityLiving; if (EnchantmentHelper.getEnchantments(player.getCurrentArmor(3)).containsValue(86)) { if (EnchantmentHelper.getEnchantmentLevel(86, new ItemStack(player.getCurrentArmor(3).getItem())) == 2) { if (player.worldObj.isRemote) { int x = (int) Math.floor(player.posX); int y = (int) (player.posY - player.getYOffset()); int z = (int) Math.floor(player.posZ); BlockPos pos = new BlockPos(x, y, z); Block b = player.worldObj.getBlockState(pos.down()).getBlock(); if ((b == Blocks.lava || b == Blocks.flowing_lava || b == Blocks.water || b == Blocks.flowing_water) && player.worldObj.isAirBlock(pos)) { if (!player.isSneaking()) { player.motionY = 0.0d; player.fallDistance = 0.0f; player.onGround = true; } } } } if ((!player.capabilities.isFlying) && (player.moveForward > 0.0F)) { if ((player.worldObj.isRemote) && (!player.isSneaking())) { if (!PlayerEvents.INSTANCE.prevStep.containsKey(Integer.valueOf(player.getEntityId()))) { PlayerEvents.INSTANCE.prevStep.put(Integer.valueOf(player.getEntityId()), Float.valueOf(player.stepHeight)); } player.stepHeight = 1.0F; } } } } } Here it is. I have it in my ModEventHandler class. -
[1.8.9] Running code every tick while in a world
blahblahbal replied to blahblahbal's topic in Modder Support
I actually already have the stepping/water walking code. I'm just trying to figure out how to actually run it while the player has boots that are enchanted with this enchantment equipped. I tried onLivingUpdate, but that broke the whole thing. -
Okay, so I'm trying to figure out what event, or how to even do something that will allow an enchantment I've thought of; Stepping. It would allow the player (when their boots are enchanted with this) to step up blocks at level 1 and 2, and walk on water and lava at level 2. Would this be done with an event, or...? I've got the code all ready to go, I just don't know where to put it. EDIT: I'm not even sure the title of this thread is appropriate for what I'm trying to do...
-
Ah... alright. What about increasing eggs/ender pearls/snowballs to 64?
-
Is there a way to increase the max stack size on things? For example, I would like to increase the max stack of everything that doesn't have a max stack of 1 to 100. This includes things like eggs, snowballs, ender pearls, etc.
-
[1.8.9] Stopping a player from harvesting a block
blahblahbal replied to blahblahbal's topic in Modder Support
Alright, got that. I should've mentioned in the OP that I also need to know how to get the pickaxe that is mining the block, or the harvest level of said pickaxe. -
So I've set bedrock to breakable, but I only want it breakable with one tool. I know I have to subscribe to PlayerEvent.BreakSpeed, and I've looked at it in the source, but how do I cancel the event? (It says it's 'Cancelable') And what file should I put the code for this in? I have a ModEventHandler.java, I'm assuming there?
-
I've run into a wall trying to figure out a custom potion. I want to make an effect similar to the 'on fire' effect, but in a potion, and with a different 'blue fire' texture. I've made the texture, and started a file, but I'm not sure how to go about applying the damage and using the new texture. Here is what I have so far: http://puu.sh/nMCYU/2d4dab8c82.txt It's not much (and I would have uploaded it to GitHub, but I keep uploading incomplete things and I want to stop doing that), and I'm not sure if I've even done it right.
-
[1.8.9] Rendering a circular texture in a sphere-like manner
blahblahbal replied to blahblahbal's topic in Modder Support
Okay... I think I understand.. but I'm still not understanding how to rotate the texture on a different axis. In order to get it to work the way I wanted it, I'll have to rotate it not only on the axis the arrow does it on, but also on the uh... well the arrow rotates on the axis that the player is facing in... so I guess it depends on that. Anyway, I want to rotate it on the axis that is perpendicular to the aforementioned axis, and is parallel to the ground. I hope that can be understood >_<. -
[1.8.9] Rendering a circular texture in a sphere-like manner
blahblahbal replied to blahblahbal's topic in Modder Support
I guess what I meant isn't getting through. I want to draw my flat texture in such a way that it appears to be a sphere; that is, similar to the way the arrow model is made. Draw the texture on the X plane, Y plane, and Z plane. So that it looks like this (sorta): http://ethericstudies.org/concepts/images/X-Y-Z%20Planes.gif[/img] -
[1.8.9] Rendering a circular texture in a sphere-like manner
blahblahbal replied to blahblahbal's topic in Modder Support
Well... yeah, that's what I meant. The code drawing the parts of an arrow just takes a flat texture and makes it 3D, right? Because if not, then why is the texture in the entity folder of textures? -
Oh wow, I'm dumb. Lol. Can't believe I forgot to register it... lol. Thanks to everyone who helped!
-
Alright, so I'm trying to figure out how to render a 16x16 pixel texture of a circle in a way that makes it look like a sphere. This means on the X, Y, and Z planes, as well as on the diagonals. I'm baffled by the way the vanilla arrow renders and I could use some help understanding how that works. I may even be able to figure out my rendering code by myself if I could just understand what the arrow rendering code is doing. This is an example of the texture I'm using.
-
Well... I've gotten some work done, but there are a few problems: - The projectiles are invisible - The projectiles don't seem to move at all The whole mod's code is here: https://github.com/blahblahbal/Blah-s-Minecraft-Mod The projectile code is in item, projectile, and render.
-
Hmm... so I've changed the code around a bit, but it's still generating as before. I really don't know what's wrong .
-
[1.8.9] Making a torch emit 'more' light than 15
blahblahbal replied to blahblahbal's topic in Modder Support
Alright, so how do I do that? And is it possible to leave the vanilla torch the way it is but add a new torch that uses the new system? -
Ah, alright. What I meant by 'time until they disappear' was that they should disappear when they hit a block, or after a certain time in the air. Since these are 'magic' weapons, you wouldn't be able to collect the projectile ball anyway.
-
Is it possible to create custom projectiles, like the arrow, except they are not affected by gravity (or at least not affected as much as arrows are)? I also would like to change their expiration time (the time before they disappear) so I can create projectiles that wouldn't travel forever. This is all for a gem staff 'magic' weapon thing I'm planning; they'll shoot balls of 'energy' or something.
-
I've encountered a weird generation issue with my custom gems' ores. When I first added them, I used an array of Block to initialize them and a 'gemNames' string array, with the names of each gem in it (like this). Then I just added the WorldGenerator code, with the same parameters for every gem (with the exception of the Block parameter). This made only the first one generate. I was puzzled, so I removed the ruby generator (commented it out). Then only citrine generated. So I changed the parameters of each generator to be different (here), and then they worked... sorta. The problem is that they generate on the same X and Z coordinate, but different Y. This is strange because my other generators (this) work just fine and don't stack vertically. Anyone have any idea what's going on?
-
Nevermind about the xray mod incompatibility, it was that I had updated the config file for that mod (to work with the 1.9 version) and the 1.8.9 version of the xray mod couldn't read it. Anyway, I'm still stumped about the liquid... it doesn't have a 'current' and I can't jump out of it if I can't touch the bottom of a pool of it.
-
Here's the whole mod on GitHub: https://github.com/blahblahbal/Blah-s-Minecraft-Mod Fluid code is in the main directory and ModBlockFluid is in blahmod.blocks. I've run into a small problem that I think I've fixed; it's related to checking if the fluid is the right one for the mixing code. I haven't tested yet, though, so I don't know if I've fixed it. Wait... since vanilla liquids don't run the code I've added, they would 'ignore' it, and as such not be futzed with even if I don't check for a block type, right?