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.

Eria8

Members
  • Joined

  • Last visited

Everything posted by Eria8

  1. I realise that I need to use packets to sync the amounts. But without packets it should still render, just the amount would always be 0, right?
  2. I'm trying to use Capabilities to add a kind of player currency. But I can't get it to work. I've followed a couple of tutorials on it pretty much exactly, but when I try to render the amount on the corner of the screen it's always null. I apologise if this post is large, I guess the site appearance just changed and there's no preview option? ScreenTag (the gui with currency amount that's trying to be rendered) private Minecraft mc; private final int colour = new Color(255, 85, 255).getRGB(); public ScreenTag(Minecraft mc) { this.mc = mc; } @SubscribeEvent public void onRenderGui(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.EXPERIENCE) { return; } IEchoesCapability echoes = mc.thePlayer.getCapability(EchoesManager.ECHOES, null); // if (echoes == null) return; // <- This always fires. Why is this always null? // drawCenteredString(mc.fontRendererObj, TextFormatting.RED + "Blood Echoes: " + TextFormatting.WHITE + echoes.getEchoes(), 20, 20, colour); drawCenteredString(mc.fontRendererObj, TextFormatting.RED + "Insight: " + TextFormatting.WHITE + echoes.getInsight(), 20, 50, colour); } IEchoesCapability (I don't think I'd need to post the Echoes class that implements this interface since it's just variable setters/getters) public boolean useEchoes(int amount); public void addEchoes(int amount); public void setEchoes(int amount); public int getEchoes(); // public boolean useInsight(int amount); public void addInsight(int amount); public void setInsight(int amount); public int getInsight(); EchoesStorage implements IStorage<IEchoesCapability> @Override public NBTBase writeNBT(Capability<IEchoesCapability> capability, IEchoesCapability instance, EnumFacing side) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("echoes", instance.getEchoes()); nbt.setInteger("insight", instance.getInsight()); return nbt; } @Override public void readNBT(Capability<IEchoesCapability> capability, IEchoesCapability instance, EnumFacing side, NBTBase nbt) { instance.setEchoes(((NBTTagCompound) nbt).getInteger("echoes")); instance.setInsight(((NBTTagCompound) nbt).getInteger("insight")); } Capabilities (event handler) public static final ResourceLocation ECHOES = new ResourceLocation(Main.MODID, "echoes"); @SubscribeEvent public void attach(AttachCapabilitiesEvent.Entity event) { if (event.getEntity() instanceof EntityPlayer) { event.addCapability(ECHOES, new EchoesManager()); } } @SubscribeEvent public void clone(PlayerEvent.Clone event) { if (event.isWasDeath()) { IEchoesCapability original = event.getOriginal().getCapability(EchoesManager.ECHOES, null); IEchoesCapability cloned = event.getEntityPlayer().getCapability(EchoesManager.ECHOES, null); cloned.setEchoes(original.getEchoes()); cloned.setInsight(original.getInsight()); } } EchoesManager implements ICapabilitySerializable<NBTBase> @CapabilityInject(IEchoesCapability.class) public static final Capability<IEchoesCapability> ECHOES = null; private IEchoesCapability instance = ECHOES.getDefaultInstance(); @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { return capability == ECHOES; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { return capability == ECHOES ? ECHOES.<T>cast(instance) : null; } @Override public NBTBase serializeNBT() { return ECHOES.getStorage().writeNBT(ECHOES, instance, null); } @Override public void deserializeNBT(NBTBase nbt) { ECHOES.getStorage().readNBT(ECHOES, instance, null, nbt); } inside Main class @EventHandler public void init(FMLInitializationEvent event) { proxy.init(); MinecraftForge.EVENT_BUS.register(new ScreenTag(Minecraft.getMinecraft())); } and inside ServerProxy public void init() { CapabilityManager.INSTANCE.register(IEchoesCapability.class, new EchoesStorage(), Echoes.class); MinecraftForge.EVENT_BUS.register(new Capabilities()); } I think that should be everything relevant. The whole mod kinda depends on this working properly, so could someone tell me what exactly I'm doing wrong?
  3. I want to make a sort of event where lots of mobs continuously spawn near the player one night until dawn. I was thinking about having a chance to start the event every time the world time hits 8:00 PM and every few minutes check if random coordinates near the player can have a mob spawn there and then spawn a bunch at like 20 of those random coordinates. But that doesn't seem like the best way to do it. And I'm not sure how that would turn out on a server. Is there an easier way of doing something like that?
  4. I finally managed to get my mod to successfully run in a server environment in Eclipse. But when I then load the client and try to connect to the server this is the crash I get: I'd really like NOT to have to compile my mod every time I want to test its compatibility with multiplayer. I assume it's because Eclipse doesn't log into my account when loading Minecraft, so is there any way to do that without compiling the mod every time?
  5. ...Totally forgot about this :l But it just made it smaller and still has that extra piece on the right side: and this doesn't change anything.
  6. I decided to try making a simple GUI with just text and images displayed, but couldn't find anything but crafting/smelting/inventory tutorials. So I had someone send me some of their code to build from. However, it doesn't look right, they haven't responded to my questions in a few days and I'm hoping to release the latest update of my mod this week, so hopefully somewhere here can help me out. I'm trying to make a GUI but the background isn't working properly. This is the background that's supposed to appear (size is 315x195): This is the background that DOES appear (ignore the buttons): This is the code for that GUI page: I've looked through vanilla and some open-source mod GUI classes but I can't seem to figure out what on earth I'm doing wrong. So any help would be appreciated...
  7. I made a grappling hook of sorts. Basically I just copied the Ender Pearl entity, changed the gravity and added some stuff. It used to work fine, but now for some reason when it hits a block nothing happens. I didn't think I changed it at all after I got it working, but if I did I have no idea what I messed up. Can someone take a look at this and help me understand why it's not working?
  8. I have over 11000 lines in one of my structure codes, a big water temple, and it's important that it's generated exactly how it's built (converted a schematic to java). Because of its length I need to break it down into several methods, one for each floor. But when I try to make it generate in 8 pieces, for some reason it skips every other piece and puts a big space between them. Here's what I mean (screenshot): Can someone tell me what I'm doing wrong? Generating it: The structure (without the code that places each block):
  9. I've been using: EntityPlayer player = (EntityPlayer)event.entity; or: EntityPlayer player = Minecraft.getMinecraft().thePlayer; in my code, but when I try to test it on a server, I get an error on this line in my main class: public static final KeyHandlerEvents keyBinding = new KeyHandlerEvents(); saying: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP The content of that class is in the spoiler at the bottom. The rest of the error is here if it matters: Before I added anything that uses EntityPlayer player = (EntityPlayer)event.entity; or EntityPlayer player = Minecraft.getMinecraft().thePlayer; it worked fine on servers, and in single player it works perfectly fine as it is now, so how exactly do I reference the player on a server if not either of those? The class it's pointing at now is this if someone needs to see the whole thing. There's probably other places, but I can't check until this one passes startup:
  10. Yeah, I've already tried that. It can't delete it because the file does not exist.
  11. So I'm making like the 30th update for my mod and for some reason I suddenly can't build. It seems it can't find a file called "Thumbs.db" even though that file does not exist even with hidden files enabled. This is the full error log I get: And even when I completely disable image caching which is supposed to fix "Thumbs.db" related errors, the same thing happens. A quick response would be very much appreciated...
  12. Titles says it all... I DID implement IBossDisplayData. Is that not enough? Entity code:
  13. So I made an invisibility cloak. It works like it's supposed in the sense that the invisibility buff does show up in the inventory when worn, however, I can still see the player... Is that something wrong with my code?
  14. I want to completely disable wooden tools. I removed their recipes, but they still generate in the bonus chest. I tried : But it doesn't do a thing. Can someone shed some light on this?
  15. I deleted most Vanilla recipes and replaced them with different ones and they all work fine. Except for a Bed. When I put the last item in the crafting grid it crashes. Recipe line: GameRegistry.addShapedRecipe(new ItemStack(Blocks.bed, 1), new Object[] {" ", "AAA", "BCB", 'A', Main.cloth, 'B', Blocks.fence, 'C', Blocks.wooden_slab}); This is the console error log: Why is this happening?
  16. First of all, they show up perfectly fine in the Eclipse test environment: But when I compile the mod and go into normal single-player they're just not there: They clearly are all in that tab: bluePot = new com.pixelmoncore.blocks.EntityBluePot().setCreativeTab(tabPixelmonCoreDecoration).setBlockName("bluePot"); GameRegistry.registerBlock(bluePot, "bluePot"); brownPot = new com.pixelmoncore.blocks.EntityBrownPot().setCreativeTab(tabPixelmonCoreDecoration).setBlockName("brownPot"); GameRegistry.registerBlock(brownPot, "brownPot"); PC = new com.pixelmoncore.blocks.EntityPC().setCreativeTab(tabPixelmonCoreDecoration).setBlockName("PC"); GameRegistry.registerBlock(PC, "PC"); Plant = new com.pixelmoncore.blocks.EntityPlant().setCreativeTab(tabPixelmonCoreDecoration).setBlockName("plant"); GameRegistry.registerBlock(Plant, "Plant"); CuttingBoard = new com.pixelmoncore.blocks.EntityCuttingBoard().setCreativeTab(tabPixelmonCoreDecoration).setBlockName("cuttingboard"); GameRegistry.registerBlock(CuttingBoard, "CuttingBoard"); Skillet = new com.pixelmoncore.blocks.EntitySkillet().setCreativeTab(tabPixelmonCoreDecoration).setBlockName("skillet"); GameRegistry.registerBlock(Skillet, "Skillet"); So why don't they show up after compiling??
  17. Certain ores just won't generate. All oreBlock classes and where they're registered in the main class are just copied and pasted from on another, and just renamed and have their harvest level changed. They show up perfectly fine in creative tabs and act normally when placed, but they won't generate. Even when they're in the same generation section they won't spawn. For example, for(int i = 0; i < 6 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(30); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.oreCoinSilver, 3)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.oreCoinGold, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.oreStar, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.oreComet, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.eridiumOre, 3)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 3 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(20); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.oreBand, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.oreCrown, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.unobtainiumOre, 4)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(12); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.oreStatue, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.oreVase, 1)).generate(world, random, chunkX, chunkY, chunkZ); (new WorldGenMinable(Main.adamantiumOre, 5)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(3); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.GoddessOre, 1)).generate(world, random, chunkX, chunkY, chunkZ); } GoddessOre, oreBand, oreCrown, oreStar and oreComet won't spawn, but all the others DO. Using WorldEdit I took out a 128x128 area of land and removed every block except ores, and not one of those ore had generated there. I also used the "//replace [ore] 0" command to see if they'd be in a 256x256 area of land, but "0 blocks were replaced." They don't generate. How can they not generate when other blocks with the same rarity that were copy/pasted from them do?
  18. I have lots of ores. All the ones that are supposed to spawn in stone work fine. But I tried getting some to spawn in Sand, Endstone, Dirt, etc but they just won't appear even after setting them to attempt generation in very high amounts... I made a new WorldGenMinable class for each block I wanted an ore to place before I realised you could just add a third parameter, but it doesn't work either way. Main: public static SpecialWorldGen SpecialGen = new SpecialWorldGen(); package com.pixelmoncore.main; import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import com.pixelmoncore.main.SandGenMinable; import com.pixelmoncore.main.DirtGenMinable; import com.pixelmoncore.main.EndGenMinable; import com.pixelmoncore.main.WaterGenMinable; import com.pixelmoncore.main.LavaGenMinable; public class SpecialWorldGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: generateInNether(world, random, chunkX*16, chunkZ*16); break; case 0: generateInOverworld(world, random, chunkX*16, chunkZ*16); break; case 1: generateInEnd(world, random, chunkX*16, chunkZ*16); break; } } private void generateInEnd(World world, Random random, int x, int z) { for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(256); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.endstoneOre, 1, Blocks.end_stone)).generate(world, random, chunkX, chunkY, chunkZ); } } private void generateInOverworld(World world, Random random, int x, int z) { for(int i = 0; i < 3 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(50); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.aquaOre, 1, Blocks.water)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 20 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(68); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.sandFossil, 20, Blocks.sand)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(128); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.dirtOre, 1, Blocks.dirt)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 16 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(80); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.infestedDirt, 1, Blocks.dirt)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(64); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.lavaOre, 1, Blocks.lava)).generate(world, random, chunkX, chunkY, chunkZ); } } private void generateInNether(World world, Random random, int x, int z) { for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(30); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.hellstoneOre, 5, Blocks.netherrack)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 5 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(20); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.obsidianOre, 10, Blocks.nettherack)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(64); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.lavaOre, 1, Blocks.lava)).generate(world, random, chunkX, chunkY, chunkZ); } } } This is what I had before that didn't work either: What am I doing wrong?
  19. Ah, I thought that might be it, but I've been going off of tutorials that showed it the way I had it, so... Got it working, thanks.
  20. I'm trying to get a block with a texture for sides, top and bottom. But all sides are always the side texture. I've followed several tutorials but it's just not working. This is my code. What am I doing wrong? package com.pixelmoncore.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import com.pixelmoncore.main.Main; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class Wall extends Block { @SideOnly(Side.CLIENT) public IIcon topIcon; @SideOnly(Side.CLIENT) public IIcon bottomIcon; @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return side == 1 || side == 0 ? this.topIcon : (side == 4 ? this.bottomIcon : this.blockIcon); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon(Main.modid + ":" + "wallSide"); this.topIcon = iconRegister.registerIcon(Main.modid + ":" + "wallTop"); this.bottomIcon = iconRegister.registerIcon(Main.modid + ":" + "wallBottom"); } public Wall() { super(Material.rock); this.setHardness(2F); this.setResistance(20F); } public void setHarvestLevel(String toolClass, int level) { for (int m = 0; m < 16; m++) { setHarvestLevel("pickaxe", 2); } } }
  21. So I have lots of custom ores and I want each one to be mineable only with the previous tier of ore For example, Orichulum can only be mined with Diamond, Mythril only with Orichulum, and so on. But for some reason, every tool I make can mine every block I make, regardless of its harvest level. What am I doing wrong? ToolMaterials: public static ToolMaterial ORICHULUM = EnumHelper.addToolMaterial("ORICHULUM", 4, 1800, 9F, 4F, 50); public static ToolMaterial MYTHRIL = EnumHelper.addToolMaterial("MYTHRIL", 5, 2100, 10.0F, 6.0F, 12); public static ToolMaterial ERIDIUM = EnumHelper.addToolMaterial("ERIDIUM", 6, 2800, 11.0F, 8.0F, 14); Tools: orichulumPick = new com.pixelmoncore.tools.nightmarePick(ORICHULUM).setCreativeTab(tabPixelmonCoreTools).setUnlocalizedName("orichulumPick").setTextureName("pixelmoncore:" + "orichulumPick"); mythrilPick = new com.pixelmoncore.tools.nightmarePick(MYTHRIL).setCreativeTab(tabPixelmonCoreTools).setUnlocalizedName("mythrilPick").setTextureName("pixelmoncore:" + "mythrilPick"); package com.pixelmoncore.tools; import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; public class orichulumPick extends ItemPickaxe { public orichulumPick(ToolMaterial material) { super(material); this.setMaxStackSize(1); } public void addInformation(ItemStack item, EntityPlayer player, List list, boolean par4) { list.add("Can mine Mythril"); } } package com.pixelmoncore.tools; import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; public class mythrilPick extends ItemPickaxe { public mythrilPick(ToolMaterial material) { super(material); this.setMaxStackSize(1); } public void addInformation(ItemStack item, EntityPlayer player, List list, boolean par4) { list.add("Can mine Eridium"); } } Blocks: package com.pixelmoncore.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class orichulumOre extends Block { public orichulumOre() { super(Material.rock); this.setHardness(4F); this.setResistance(5F); } public void setHarvestLevel(String toolClass, int level) { for (int m = 0; m < 16; m++) { setHarvestLevel("pickaxe", 3); } } } package com.pixelmoncore.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class mythrilOre extends Block { public mythrilOre() { super(Material.rock); this.setHardness(6F); this.setResistance(5F); } public void setHarvestLevel(String toolClass, int level) { for (int m = 0; m < 16; m++) { setHarvestLevel("pickaxe", 4); } } }
  22. So I removed an item from my mod because it was just pretty pointless and when I tried loading a world I had made before removing it, instead of just erasing any trace of the item like every single time I've done something similar before 1.7, it refuses to load the world. All I get is this crash report: Anyone know what's going on or how to fix it?
  23. I AM using those folders. As I said, it's always built perfectly before and I didn't change the directory.

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.