Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ashjack

Members
  • Joined

  • Last visited

Everything posted by ashjack

  1. I have cut out a lot of unnecessary code for this post, so any uneven brackets are actually even, but their opposite bracket has been cut out. @Override public void onUpdate() { // // greet player if (System.currentTimeMillis() - greetTimer > 1000) { Random r = new Random(); double dist = this.theData.getDistanceToPlayer(); if (SimukraftReloaded.states != null) { Long ls=System.currentTimeMillis()- theData.anyFolkLastSpoke; if (SimukraftReloadedConfig.configFolkTalkingEnglish == true && ls > 5000) { if ((!theData.greetedToday & dist < 5) || (theData.vocation==Vocation.BURGERSWAITER && dist <5 && r.nextInt(20)==2)) { theData.greetedToday = true; theData.anyFolkLastSpoke = System .currentTimeMillis(); int sf = r.nextInt(25) + 1; String fn = "ashjacksimukraftreloaded:"; if(theData.vocation !=null && theData.vocation==Vocation.BURGERSWAITER) { sf=r.nextInt(6); // 0 to 5 fn+="burger"; switch(sf) { case 0: if(theData.gender==0) { fn+="ma"; } else { fn+="fa"; } break; case 1: if(theData.gender==0) { fn+="mb"; } else { fn+="fb"; } break; case 2: if(theData.gender==0) { fn+="mc"; } else { fn+="fc"; } break; case 3: if(theData.gender==0) { fn+="md"; } else { fn+="fd"; } break; case 4: if(theData.gender==0) { fn+="me"; } else { fn+="fe"; } break; case 5: if(theData.gender==0) { fn+="mf"; } else { fn+="ff"; } break; } } else { // non Vocational if (theData.age >= 18) { if (SimukraftReloaded.isDayTime()) { if (sf == 1) { if (theData.gender == 0) { fn += "daymone"; } else { fn += "dayfone"; } } else if (sf == 2) { if (theData.gender == 0) { fn += "daymtwo"; } else { fn += "dayftwo"; } } else if (sf == 3) { if (!this.worldObj.isRaining()) { if (theData.gender == 0) { fn += "daymthree"; } else { fn += "dayfthree"; } } else { if (theData.gender == 0) { fn += "mwxbad"; } else { fn += "fwxbad"; } } } else if (sf == 4) { if (theData.gender == 0) { fn += "meight"; } else { fn += "feight"; } } else if (sf == 5) { if (theData.gender == 0) { fn += "mnine"; } else { fn += "fnine"; } } else if (sf == 6) { if (theData.gender == 0) { fn += "mseven"; } else { fn += "fseven"; } } else if (sf > 6) { // 7 > 97 if (theData.gender == 0) { fn += "mspeak"; } else { fn += "fspeak"; } fn = fn + Character .toString((char) (sf + 90)); } } else { if (sf == 1) { if (theData.gender == 0) { fn += "nightmone"; } else { fn += "nightfone"; } } else if (sf == 2) { if (theData.gender == 0) { fn += "nightmtwo"; } else { fn += "nightftwo"; } } else if (sf == 3) { if (theData.gender == 0) { fn += "nightmthree"; } else { fn += "nightfthree"; } } else if (sf == 4) { if (theData.gender == 0) { fn += "meight"; } else { fn += "feight"; } } else if (sf == 5) { if (theData.gender == 0) { fn += "mnine"; } else { fn += "fnine"; } } else if (sf == 6) { if (theData.gender == 0) { fn += "mseven"; } else { fn += "fseven"; } } } } else // child speaking { sf = r.nextInt(3) + 1; fn += "cspeak"; fn = fn + Character.toString((char) (sf + 96)); } } if (r.nextBoolean()) { try { // SimukraftReloaded.log("greeting: " + fn); ModSimukraft.proxy.getClientWorld() .playSound(this.posX, this.posY, this.posZ, fn, 1.0f, 1.0f, false); } catch (Exception e) { } } } } }
  2. I have a mod on the Minecraft Forums, but a few people have been complaining of a crash they are receiving when near farms (lots of animal sounds combined with NPC sounds). Here is the log: http://pastebin.com/raw.php?i=qKx8MbuC I have absolutely no idea what is causing it, but some users have reported successfully stopping it by manually going into the jar file and deleting all the sounds. I have only had this crash once, so it appears that users with better computers (such as myself) receive the crash less frequently than the users with lesser quality computers. One user even said the mod was unplayable because they received the crash seconds after logging into their world. Please help me work out what is causing this.
  3. I am trying to use another class to hold the code that adds objects to the dataWatcher of an entity, but when I try to call the function in the other class in the entityInit() function in my entity, I get this error: Here is my code: MyEntity.java public DataWatcher dataWatcher = this.dataWatcher; public List<Gene> entityGenes = new ArrayList<Gene>(); public void entityInit() { for(int i=0; i<entityGenes.size(); i++) //<---The error point to this line of code { entityGenes.get(i).entityInit(); } /*this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); <---Adding the objects like this is fine this.dataWatcher.addObject(18, Byte.valueOf((byte)0));*/ super.entityInit(); } GeneExplosive.java public class GeneExplosive extends Gene { public void entityInit() { owner.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); owner.dataWatcher.addObject(17, Byte.valueOf((byte)0)); owner.dataWatcher.addObject(18, Byte.valueOf((byte)0)); super.entityInit(); } } Gene.java public abstract class Gene { public void entityInit() { } }
  4. But player.getLookVec only returns one Vec3, and world.rayTraceBlocks requires two different Vec3s.
  5. I am trying to recreate the dark matter tools from Equivalent Exchange 2, and for the shovel, want to have a 3x3 layer of blocks broken when you break a block. However, this 3x3 layer currently stays flat, and I want to find a way of checking if the player is mining from the side, or from the top/bottom of the block, and then remove the surrounding blocks accordingly. How do I check what direction the player has mined from? I think that player.cameraPitch would be too inaccurate.
  6. Removing the if(true) changes nothing, so I'm going to assume that piece of code was useless.
  7. I do know some Java, but I didn't know the name of the onItemUse function at the time, so I found a snipped online which included that bit, so I thought I needed it to be there. What I mean about the change is that say there were three ores in a vein. When I use the item on it, the ores disappear, but I need to save and quit to menu, and reload the world to see the three ores in my inventory.
  8. I have been trying to make a vein mining tool, similar to the dark matter pickaxe from EE2, and my code will remove all the blocks in the vein, and should give them to the player, but the new blocks only show up when I save and quit the world, and reload it. I don't need to close Minecraft, just the world. I have a feeling it's something to do with the !world.isRemote check, but putting it on the outside causes a crash, so I have to put it inside. Here is my code: public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int i, int j, int k, int l, float a, float b, float c) { int veinSize = 0; Block originalBlock = null; if(!world.isRemote) { if(true) { AlchemicalExchange.log.info("Has Used Item"); List<V3> vein = new ArrayList<V3>(); originalBlock = world.getBlock(i, j, k); if(originalBlock instanceof BlockOre) { AlchemicalExchange.log.info("Block is an ore"); vein.add(0, new V3(originalBlock, i, j, k)); for(int x=0; x<vein.size(); x++) { AlchemicalExchange.log.info("Running for loop"); if(vein.get(x) != null) { V3 adjBlock = new V3(vein.get(x).block, vein.get(x).x, vein.get(x).y, vein.get(x).z); AlchemicalExchange.log.info("Checking for adjacent ore block"); /*X AXIS*/ if(world.getBlock((int)adjBlock.x+1, (int)adjBlock.y, (int)adjBlock.z) == originalBlock) { vein.add(new V3(adjBlock.block, adjBlock.x+1, adjBlock.y, adjBlock.z)); world.setBlockToAir((int)adjBlock.x+1, (int)adjBlock.y, (int)adjBlock.z); veinSize++; AlchemicalExchange.log.info("Found adjacent ore block on the X Axis (Right)"); } if(world.getBlock((int)adjBlock.x-1, (int)adjBlock.y, (int)adjBlock.z) == originalBlock) { vein.add(new V3(adjBlock.block, adjBlock.x-1, adjBlock.y, adjBlock.z)); world.setBlockToAir((int)adjBlock.x-1, (int)adjBlock.y, (int)adjBlock.z); veinSize++; AlchemicalExchange.log.info("Found adjacent ore block on the X Axis (Left)"); } /*Y AXIS*/ if(world.getBlock((int)adjBlock.x, (int)adjBlock.y+1, (int)adjBlock.z) == originalBlock) { vein.add(new V3(adjBlock.block, adjBlock.x, adjBlock.y+1, adjBlock.z)); world.setBlockToAir((int)adjBlock.x, (int)adjBlock.y+1, (int)adjBlock.z); veinSize++; AlchemicalExchange.log.info("Found adjacent ore block on the Y Axis (Above)"); } if(world.getBlock((int)adjBlock.x, (int)adjBlock.y-1, (int)adjBlock.z) == originalBlock) { vein.add(new V3(adjBlock.block, adjBlock.x, adjBlock.y-1, adjBlock.z)); world.setBlockToAir((int)adjBlock.x, (int)adjBlock.y-1, (int)adjBlock.z); veinSize++; AlchemicalExchange.log.info("Found adjacent ore block on the Y Axis (Below)"); } /*Z AXIS*/ if(world.getBlock((int)adjBlock.x, (int)adjBlock.y, (int)adjBlock.z+1) == originalBlock) { vein.add(new V3(adjBlock.block, adjBlock.x, adjBlock.y, adjBlock.z+1)); world.setBlockToAir((int)adjBlock.x, (int)adjBlock.y, (int)adjBlock.z+1); veinSize++; AlchemicalExchange.log.info("Found adjacent ore block on the Z Axis (Front)"); } if(world.getBlock((int)adjBlock.x, (int)adjBlock.y, (int)adjBlock.z-1) == originalBlock) { vein.add(new V3(adjBlock.block, adjBlock.x, adjBlock.y, adjBlock.z-1)); world.setBlockToAir((int)adjBlock.x, (int)adjBlock.y, (int)adjBlock.z-1); veinSize++; AlchemicalExchange.log.info("Found adjacent ore block on the Z Axis (Back)"); } } } if(vein.size() == 1) { world.setBlockToAir(i, j, k); veinSize++; } } } } player.inventory.addItemStackToInventory(new ItemStack(originalBlock, veinSize, originalBlock.getDamageValue(world, i, j, k))); return true; }
  9. Some HUD that my mod puts on the screen gets in the way of the debug screen, but I don't know how to check to see if it is open. I'm sure it's just a simple boolean hidden somewhere in the code, but I simply cannot find it. How do I check to see if it is open?
  10. I didn't use any jar, I made a zip file from the files in the classes folder. Is that where I went wrong?
  11. It's worth noting, based on other people with this issue, that I did build it with gradle, and I didn't package it from eclipse...
  12. When I try to run Minecraft with my mod in it, it crashes, giving me this error: The file it refers to is here: package info.satscape.simukraft.common; import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockLightBox extends Block { private IIcon icons[]; public BlockLightBox() { super(Material.wood); setLightLevel(1.0F); this.setCreativeTab(CreativeTabs.tabMisc); setStepSound(Block.soundTypeWood); setHardness(2F); setResistance(1.0F); setTickRandomly(true); setBlockName("SUKlight"); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { icons = new IIcon[8]; icons[0] = iconRegister.registerIcon("satscapesimukraft:blockLightWhite"); icons[1] = iconRegister.registerIcon("satscapesimukraft:blockLightRed"); icons[2] = iconRegister.registerIcon("satscapesimukraft:blockLightOrange"); icons[3] = iconRegister.registerIcon("satscapesimukraft:blockLightYellow"); icons[4] = iconRegister.registerIcon("satscapesimukraft:blockLightGreen"); icons[5] = iconRegister.registerIcon("satscapesimukraft:blockLightBlue"); icons[6] = iconRegister.registerIcon("satscapesimukraft:blockLightPurple"); icons[7] = iconRegister.registerIcon("satscapesimukraft:blockLightRainbow"); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return meta < 8 && meta >= 0 ? icons[meta] : icons[0]; } public BlockLightBox idDropped(int par1, Random par2Random, int par3) { return this; } @Override public int damageDropped(int j) { return j; } @SideOnly(Side.CLIENT) public void getSubBlocks(Block blockId, CreativeTabs par2CreativeTabs, List par3List) { for (int meta = 0; meta < 8; ++meta) { par3List.add(new ItemStack(blockId, 1, meta)); } } @Override public int getBlockColor() { return 0xffffff; } } And this is how I register the block: @EventHandler public void preInit(FMLPreInitializationEvent evt) { lightBox = new BlockLightBox(); } @EventHandler public void initLoad(FMLInitializationEvent event) { GameRegistry.registerBlock(lightBox, "SUKlight"); }
  13. What do you mean it's in the wrong place? I'm really sorry that I seem so stupid, it's just I'm not very experienced with Java. C# is my specialty.
  14. Ah, okay, I understand now, if the parameters are not correct, Java sees it as a new function. However, this function is also run on both the integrated server and the client, and I still need to add a marker to the array.
  15. Surely if onBlockPlacedBy errors if you give it an @Override then the method doesn't already exist, meaning it won't be called when placing a block? I may be wrong, but that's what I think.
  16. onBlockPlacedBy does not override any method.
  17. I used @SideOnly(Side.SERVER) but the code doesn't run properly. Could I consider making a packet message for this function?
  18. The effects are the spawning of a few lines to show how big an area will be, the area is marked out by the markers that are placed. Also, it checks to see how many markers have been placed, and any more than three means it will not work, however, since it adds two to the array, it thinks I have placed three when in fact I have only placed two
  19. The effects stay for as long as the block(s) exist
  20. Well, only the person placing the markers should see the effects of them, so I guess that's the way to go.
  21. So I should check to see what side is being run, and only add it if it client sided?
  22. So I have been updating a mod from 1.6.4 to 1.7.10, and some code that adds a custom class to an array when you place a block seems to add said class to an array twice. Here is the code: @Override public void onBlockAdded(World world, int i, int j, int k) { hasPlaced = true; Marker ma; markers.add(ma = new Marker(i, j, k, world.provider.dimensionId)); String markerCaption = ""; String helpText = ""; if (markers.size() == 1) { markerCaption = "Front-Left"; helpText = "You can place two more markers to mark out an area for a farm or mine etc. If you wish to do this, place another marker at the front-right position now"; System.out.println(markers.size()); } else if (markers.size() == 2) { markerCaption = "Front-Right"; helpText = "Finally, place a marker at the Rear-Left position"; System.out.println(markers.size()); } else if (markers.size() == 3) { markerCaption = "Rear-Left"; helpText = "You're done, now you can place down a mining box, farming box or right-click the front-left marker to copy a structure!"; System.out.println(markers.size()); } else { System.out.println(markers.size()); markerCaption = "Too many Markers!"; } if (markers.size() < 4) { V3 pos = new V3((double)i, (double)j, (double)k, world.provider.dimensionId); pos.y += 0.01d; if (ModSimukraft.configEnableMarkerAlignmentBeams) { EntityAlignBeam beam = new EntityAlignBeam(world); ma.caption = markerCaption; beam.setLocationAndAngles(pos.x, pos.y, pos.z, 0f, 0f); beam.yaw = 0f; if (!world.isRemote) { world.spawnEntityInWorld(beam); } ma.beams.add(beam); EntityAlignBeam beam2 = new EntityAlignBeam(world); beam2.setLocationAndAngles(pos.x, pos.y, pos.z, 90f, 0f); beam2.yaw = 90f; if (!world.isRemote) { world.spawnEntityInWorld(beam2); } ma.beams.add(beam2); EntityAlignBeam beam3 = new EntityAlignBeam(world); beam3.setLocationAndAngles(pos.x, pos.y, pos.z, 180f, 0f); beam3.yaw = 180f; if (!world.isRemote) { world.spawnEntityInWorld(beam3); } ma.beams.add(beam3); EntityAlignBeam beam4 = new EntityAlignBeam(world); beam4.setLocationAndAngles(pos.x, pos.y, pos.z, 270f, 0f); beam4.yaw = 270f; if (!world.isRemote) { world.spawnEntityInWorld(beam4); } ma.beams.add(beam4); } } if (!helpText.contentEquals("")) { ModSimukraft.sendChat(helpText); } super.onBlockAdded(world, i, j, k); }
  23. Ok, so I added more system output points in the ticking functions, and for some reason the server isn't ticking. I don't see anything wrong with this code - hell, I got it off of a 1.7 modding tutorial, there shouldn't be anything wrong with it... @EventHandler public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(this); } @SubscribeEvent public void tick(WorldTickEvent event) { System.out.println("WorldLoad event tick"); } @SubscribeEvent public void tick(ServerTickEvent event) { System.out.println("Server event tick"); onTickInGame(); }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.