
Yagoki
Members-
Posts
290 -
Joined
-
Last visited
Everything posted by Yagoki
-
It appears someone's already done this: http://www.planetminecraft.com/mod/kaevators-super-slopes/
-
I can't help, but I'll keep this bumped as I need it too, it's been bothering me for a while
-
your ID's are called before they are initialized in your config.(hence, as they are ints they take the default value of 0) you need to move your item constructor to some other method, maby make one labled add items then assign your varible it's value e.g: public Item scienceMetaItem; public static void addItems(){ scienceMetaItem = new ItemScienceMetaItem(scienceMetaItemID).setItemName("Meta Item"); } call this after your config has happend
-
I just finished making all the blocks and adding all the effects to the tile entities, and thought it would be cool if I could add something like a wire-frame to show where it's affecting or what it's doing. Not sure how to do this tough as I know zit about doing stuff like this or if it's even possible. If you guys could help it'd be awesome. also thought about adding some swirly particles moving into one of the blocks to show a tractor beam, but that would just put me in waaaay too far over my head. Thanks
-
I'm trying to make a block have a feature which can be toggled, I added this in the writetoNBT(...) and readFromNBT(...) methods, but now, judging from the print-stream and how i see nothing happen when it loads, it wont load on the client side. Not sure how to fix this or why it doesn't happen as it shows the NBT being read then re-initializes the TileEntity (i'm guessing for the client side) and doesn't read the NBT. Help please The TileEntity: http://paste.minecraftforge.net/view/638e0283 The block: http://paste.minecraftforge.net/view/66a6296b Thanks
-
Tile entity not acting as it should and throws error
Yagoki replied to Yagoki's topic in Modder Support
ok that was a bit of a derp moment, moved it there earlier without thinking to make the code look neater. Thanks for pointing that out. -
Tile entity not acting as it should and throws error
Yagoki replied to Yagoki's topic in Modder Support
thanks, it no longer throws the error but the update entity method isn't getting called -
I'm trying to create a tile entity which pulls nearby entities towards it. looking at other peoples code for tile entities I put together the following class (how the class currently affects the player is just to see if it's working, [also i changed some stuff without cleaning my code to see whether it was just variables being too small for me to notice the effect]) http://gw.minecraftforge.net/84qY The block class is here: http://gw.minecraftforge.net/hbiC when i run the game it throws the following error: 2013-02-24 17:48:38 [sEVERE] [ForgeModLoader] A TileEntity type yagoki.mods.mtech.blocks.tile.TileEntityAttractor has throw an exception trying to write state. It will not persist. Report this to the mod author java.lang.RuntimeException: class yagoki.mods.mtech.blocks.tile.TileEntityAttractor is missing a mapping! This is a bug! at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:107) at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:311) at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:127) at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:232) at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:284) at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:844) at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:373) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) can someone tell me how to resolve this, as I've not (as far as I can tell) done anything different to the classes I learnt form which all, supposedly, work fine.
-
on re-reading your post i realised that my tick handler method probably isn't the most optimal here, have you instead considered overriding public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { //code } in your block class? you could also look at the following other methods in the block class: public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) { //code } public void onFallenUpon(World par1World, int par2, int par3, int par4, Entity par5Entity, float par6) { //code } [EDIT] all these methods are in the block class
-
Adding components to an item using NBT tags [SOLVED]
Yagoki replied to Yagoki's topic in Modder Support
Thanks, looks like I was just looking in the wrong place then. duh -
I'm currently trying to add modules to an armour in my mod which gives various abilities to the player such as faster movement and increased jump height. I'm fine on how to do that in the tick handler, but what i need to know is how to add a tag to the item so that these are toggle-able based on the modules installed on the item. Thanks in advance
-
not definite as I've not done any biome or dimension ID stuff myself, but in the biome spawning script(and ore) can you not get it to check the world dimension id (using world.provider.dimensionID) and if it is not equal to your dimensions id return false or stop the script or something (I'm assuming a world parameter is passed somewhere) again i've not got any experience of this but that would be my first guess
-
i found out how to do the player.motionY in the tick handler (SeKtOR check your thread on it, i've posted it there) you just have to make sure you register the tick handler correctly in both proxys, else the client and server desynchronise so the player does not update, until it sends and receives the player data from the server (like on taking damage) basicly you need a setup like this: in common proxy: public void registerTickHandler() { TickRegistry.registerTickHandler(new MyTickHandler(), Side.SERVER); } in client proxy: public void registerTickHandler() { TickRegistry.registerTickHandler(new MyTickHandler(), Side.CLIENT); } in the TickHandler: public class MyTickHandler implements ITickHandler { @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { playerTick((EntityPlayer)tickData[0]); } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER); } @Override public String getLabel() { return "MY_PLAYER_TICK"; } public static void playerTick(EntityPlayer player) { //stuff to do to player } }
-
I GOT IT WORKING!!!!!!!!!! just had to register it in the client proxy aswell the code is now just the same (player.motionY += number in tick handler) with it regesterd as TickRegistry.registerTickHandler(new TickHandler(), Side.SERVER); in common proxy and TickRegistry.registerTickHandler(new AAPlayerTickHandler(), Side.CLIENT); in the client proxy YAY IT WORKS
-
Just had the brilliant idea of scrolling through github to see if there were any open source mods which had done this. Looking in the source for MachineMuse modular power suits (Epic mod, try it out) In the tick data they only specified TickType.PLAYER. not player and server. not tried it yet, and it may be a while before i can, but give this a go and see what you can do (tell me what you manage so i know if it works when i get round to doing this) I'll post a link to the source so you can look yourself and see what you think https://github.com/MachineMuse/MachineMusePowersuits/blob/master/src/minecraft/net/machinemuse/powersuits/tick/PlayerTickHandler.java
-
that's what i found here too
-
http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file
-
just found something else that's odd. I told it to print the motionY before and after setting it to 1. oddly the speed it was saying before was not equal to 0 whilst standing still, instead it was a bit lower than what i was setting it to. (told it to set it to 1, and it said the initial velocity was 0.907.... told it to set it to 2 and it said it started at 1.8.....) this is odd and may shine some light on our problem. [EDIT] after my player.motionY=2, it seems that it is normally at -0.0784000015258789 whilst stationary. guess this is gravity or something
-
i've tried with both, it seems to work the same both way, it's just i didn't bother changing it before posting as i was changing it to see whether it was the tick type that was the problem [edit] i just realised what you meant, yeah that's probably true, not got a way to try it though
-
I'm guessing this is in a tick handler, i'm having the same problem, it will update the velocity if the player takes damage it seems, so it could be that the velocity isn't updated through this method without something else happening to the player. Not sure how to do this Here is the tick handler as i have it (i'm guessing his is similar) [edit] whoops looks like he updated the thread whilst i was typing this
-
[Solved] Ore Generation in Nether + very weird crafting recipe glitch?
Yagoki replied to milogold's topic in Modder Support
read through it for sure, otherwise you can't understand what it's doing, but the code is, mostly, straight from WorldGenMinable in the minecraft source code -
[Solved] Ore Generation in Nether + very weird crafting recipe glitch?
Yagoki replied to milogold's topic in Modder Support
i'll just give you the classes to save you some time: package //Your package; import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import cpw.mods.fml.common.IWorldGenerator; public class OreGeneration implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); break; case 0: generateOverworld(world, random, chunkX * 16, chunkZ * 16); break; case -1: generateNeather(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateNeather(World world, Random random, int X, int Z) { for(int i = 0; i < numberOfVeins; i++) { int randX = X + random.nextInt(16); int randY = random.nextInt(maxHeight); int randZ = Z + random.nextInt(16); (new WorldGenMinableNether(block.blockID, clusterSize)).generate(world, random, randX, randY, randZ); } } private void generateOverworld(World world, Random random, int X, int Z) { } private void generateEnd(World world, Random random, int X, int Z) { } } to generate in the end: package //Your package; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class WorldGenMinableEnd extends WorldGenerator { /** The block ID of the ore to be placed using this generator. */ private int minableBlockId; private int metadata = 0; /** The number of blocks to generate. */ private int numberOfBlocks; public WorldGenMinableEnd(int par1, int par2) { minableBlockId = par1; numberOfBlocks = par2; } public WorldGenMinableEnd(int par1, int par2, int par3) { minableBlockId = par1; metadata = par2; numberOfBlocks = par3; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d = (float)(par3 + + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(par3 + - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(par5 + + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(par5 + - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = (par4 + par2Random.nextInt(3)) - 2; double d5 = (par4 + par2Random.nextInt(3)) - 2; for (int i = 0; i <= numberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)numberOfBlocks; double d9 = (par2Random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2D); int k = MathHelper.floor_double(d7 - d11 / 2D); int l = MathHelper.floor_double(d8 - d10 / 2D); int i1 = MathHelper.floor_double(d6 + d10 / 2D); int j1 = MathHelper.floor_double(d7 + d11 / 2D); int k1 = MathHelper.floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(l1, i2, j2) == Block.whiteStone.blockID) { par1World.setBlockAndMetadata(l1, i2, j2, minableBlockId, metadata); } } } } } return true; } } to generate in the nether package //Your package; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class WorldGenMinableNether extends WorldGenerator { /** The block ID of the ore to be placed using this generator. */ private int minableBlockId; private int metadata = 0; /** The number of blocks to generate. */ private int numberOfBlocks; public WorldGenMinableNether(int par1, int par2) { minableBlockId = par1; numberOfBlocks = par2; } public WorldGenMinableNether(int par1, int par2, int par3) { minableBlockId = par1; metadata = par2; numberOfBlocks = par3; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d = (float)(par3 + + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(par3 + - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(par5 + + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(par5 + - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = (par4 + par2Random.nextInt(3)) - 2; double d5 = (par4 + par2Random.nextInt(3)) - 2; for (int i = 0; i <= numberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)numberOfBlocks; double d9 = (par2Random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2D); int k = MathHelper.floor_double(d7 - d11 / 2D); int l = MathHelper.floor_double(d8 - d10 / 2D); int i1 = MathHelper.floor_double(d6 + d10 / 2D); int j1 = MathHelper.floor_double(d7 + d11 / 2D); int k1 = MathHelper.floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(l1, i2, j2) == Block.netherrack.blockID) { par1World.setBlockAndMetadata(l1, i2, j2, minableBlockId, metadata); } } } } } return true; } } then in your init method in the main mod file add this GameRegistry.registerWorldGenerator(new OreGeneration()); just copy and paste most of that and you should be ok with regards to the crafting thing, try getting rid of the empty quotes, you should only need to include the lines being used. -
just to look like it's glowing, not actually giving off light. I saw how it was done for an entity in the enderman render files (for the eyes), but how do i render blocks like this?
-
Hello All, How can i add a custom renderer to my block/tile entity so that it: [*]animated [*]glows (like xycraft) thanks in advance P.S. also i'm still looking for advice on adding HUD elements when armor is equipped