
blahblahbal
Members-
Posts
96 -
Joined
-
Last visited
Everything posted by blahblahbal
-
By indentation do you mean me putting if statements' bodies on the next line in some places and not in others? And it's solved anyway, since I ran a chunkExists check. I also just realized I probably could have used modulus instead of all those math operations above the for loops.
-
Scratch that last post. I ran a chunkExists check and now it works. Thanks for helping out.
-
Nope, same issue. For reference, here is the code for the new tree: package blahblahbal.blahmod.world; import java.util.Random; import blahblahbal.blahmod.blocks.ModBlocks; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; public class WorldGenCedarTree extends WorldGenAbstractTree { private static final IBlockState log = ModBlocks.cedarLog.getDefaultState(); private static final IBlockState leaf = ModBlocks.cedarLeaves.getDefaultState(); public WorldGenCedarTree(boolean f) { super(false); } public WorldGenCedarTree(World w, Random r, BlockPos bp) { super(true); generate(w, r, bp); } @Override public boolean generate(World worldIn, Random rand, BlockPos position) { if (position.getY() < 10 || position.getY() > 240) return false; int rn = rand.nextInt(5); int leafRad = rand.nextInt(5) + 4; int TOP_POS = position.getY() + rn + 14; int distTopBot = (TOP_POS) - (position.getY() + 4); // distance between the top and the bottom minus 4 int middleTopBot = (int)(distTopBot / 2); // the middle int TOP_HALF_POS = TOP_POS - middleTopBot; // the top half position int distTopToHalf = TOP_POS - TOP_HALF_POS; // distance between top and middle int middleTopHalf = (int)(distTopToHalf / 2); // the middle between top and middle int TOP_QUARTER_POS = TOP_POS - middleTopHalf; // the top quarter position int distTopToQuarter = TOP_POS - TOP_QUARTER_POS; // distance between top and quarter int middleTopQuarter = (int)(distTopToQuarter / 2); // the middle between top and quarter int TOP_EIGHTH_POS = TOP_POS - middleTopQuarter; // the top eighth position for (int x = position.getX(); x <= position.getX() + 1; x++) { for (int z = position.getZ(); z <= position.getZ() + 1; z++) { for (int y = position.getY(); y <= position.getY() + rn + 14; y++) { if (y > position.getY() + 4) { makeCircle(x, y, z, leafRad, leaf, worldIn); } else if (y >= TOP_HALF_POS) { makeCircle(x, y, z, leafRad - 1, leaf, worldIn); } else if (y >= TOP_QUARTER_POS) { makeCircle(x, y, z, leafRad - 2, leaf, worldIn); } else if (y >= TOP_EIGHTH_POS) { makeCircle(x, y, z, leafRad - 3, leaf, worldIn); } if (y < position.getY() + rn + 12) this.setBlockAndNotifyAdequately(worldIn, new BlockPos(x, y, z), log); } } } return true; } public void makeCircle(int x, int y, int z, float r, IBlockState state, World world) { int fx = (int)(x - r); //first x int fy = (int)(z - r); //first y int lx = (int)(x + r); //last x int ly = (int)(z + r); //last y for (int i = fx; i < lx + 1; i++) { for (int j = fy; j < ly + 1; j++) { if (distance(i, j, x, z) <= r) { if (state == null) world.setBlockToAir(new BlockPos(i, y, j)); else this.setBlockAndNotifyAdequately(world, new BlockPos(i, y, j), state); } } } } public static float distance(float x1, float y1, float x2, float y2) { final float x_d = x2 - x1; final float y_d = y2 - y1; return (float)Math.sqrt(x_d * x_d + y_d * y_d); } } It throws the Already decorating exception at the first leaf placement line.
-
I just started work on a new biome, and I'm getting the same error. I wonder if updating to 1902 will fix this problem. I'll reply here when I find that out.
-
So... how would I go about generating this tree then? If it's trying to generate in a chunk that isn't there yet... Is it possible to force a chunk to generate before the tree is generated? EDIT: I realized I forgot to say where I call my generate method. I'm calling it in both the Palm Sapling block code and in the BiomeGenTropics file. For reference, here is the github repo: https://github.com/blahblahbal/Blah-s-Minecraft-Mod/tree/Structure-fix The first is in the block folder, the second is in the world folder.
-
Alright, done that. Just loaded up the game, and the door renders now. The only issue now is that the item won't render. It displays a missing block texture, which I find odd. Is this because I have the ItemDiamondDoor file still in there? The door item shows up in JEI, but when I place that it only places the bottom half. EDIT: Working on it now, pseudo-removed the ItemDiamondDoor class and am testing.
-
I see a lot of reasons to update to 1.9. Regardless, let me merge and download the fix. I uh... don't see a merge button on the page you linked? I've never done a merge on github before (you can probably tell).
-
The problem with that theory is that when I generate it with just one of the four 'slants' it works. The issue arises when I try to randomize the slant to one of four directions.
-
Oh, right. I'll delete that section. Should be uploaded in about a minute or two.
-
Extra information - If I change the generation to only include one of the four offsets (each of which create a slant of the tree), it generates just fine. I'm not even sure what this would tell me. Especially since the error is 'Already decorating,' which makes no sense to me.
-
Okay, I tried to compile it in the new location, and it's only 'compiling' the resources. I'm not sure where I need to put the .class files in order to get them to compile. EDIT: Nevermind, fixed it. Uploading to github in a couple minutes.
-
Ah, ok. I think I've got it now, check this screenshot: It's still a tad wonky (with the src and src/main folders), but at least it looks a lot better than before.
-
I know I have a running thread that isn't solved yet, but because it isn't solved (and I've exhausted my thought processes for that particular area), I thought I'd move over to a different part of my mod. One that involves my custom biome, the Tropics. Anyway, when trying to make a custom tree (a palm tree), I get an error on worldgen with a seed I know spawns you in the new custom biome: https://pastebin.com/1rC4xggP This is the code for WorldGenDifferentPalmTree (line 190 is the line in generate() that has the leafPosMod3 array in it): package main.java.blahblahbal.blahmod.world; import java.util.Random; import main.java.blahblahbal.blahmod.blocks.BlockPalmLeaves; import main.java.blahblahbal.blahmod.blocks.ModBlocks; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; public class WorldGenDifferentPalmTree extends WorldGenAbstractTree { private static final IBlockState log = ModBlocks.palmLog.getDefaultState(); private static final IBlockState leaves = ModBlocks.palmLeaves.getDefaultState().withProperty(BlockPalmLeaves.CHECK_DECAY, Boolean.valueOf(false)).withProperty(BlockPalmLeaves.DECAYABLE, Boolean.valueOf(false)); private static final IBlockState coco = ModBlocks.coconut.getDefaultState(); private int[][] logPosMod1 = new int[][] { {0, 0, 0}, {0, 1, 0}, {0, 2, 0}, {0, 3, 0}, {0, 4, -1}, {0, 5, -1}, {0, 6, -2}, {0, 7, -3} }; private int[][] logPosMod2 = new int[][] { {0, 0, 0}, {0, 1, 0}, {0, 2, 0}, {0, 3, 0}, {0, 4, 1}, {0, 5, 1}, {0, 6, 2}, {0, 7, 3} }; private int[][] logPosMod3 = new int[][] { {0, 0, 0}, {0, 1, 0}, {0, 2, 0}, {0, 3, 0}, {-1, 4, 0}, {-1, 5, 0}, {-2, 6, 0}, {-3, 7, 0} }; private int[][] logPosMod4 = new int[][] { {0, 0, 0}, {0, 1, 0}, {0, 2, 0}, {0, 3, 0}, {1, 4, 0}, {1, 5, 0}, {2, 6, 0}, {3, 7, 0} }; private int[][] leafPosMod1 = new int[][] { {0, 8, -3}, {0, 8, -2}, {0, 8, -1}, {1, 8, -3}, {1, 8, -2}, {1, 8, -1}, {-1, 8, -3}, {-1, 8, -2}, {-1, 8, -1}, {0, 8, -4}, {0, 8, -5}, {1, 8, -4}, {1, 8, -5}, {-1, 8, -4}, {-1, 8, -5}, {2, 8, -2}, {2, 8, -3}, {2, 8, -4}, {-2, 8, -2}, {-2, 8, -3}, {-2, 8, -4}, {3, 7, -2}, {3, 7, -3}, {3, 7, -4}, {-3, 7, -2}, {-3, 7, -3}, {-3, 7, -4}, {0, 7, 0}, {1, 7, 0}, {-1, 7, 0}, {0, 7, -6}, {1, 7, -6}, {-1, 7, -6}, {0, 7, 1}, {0, 7, -7}, {-4, 7, -3}, {4, 7, -3} }; private int[][] leafPosMod2 = new int[][] { {-1, 8, 1}, {0, 8, 1}, {1, 8, 1}, {-1, 8, 2}, {0, 8, 2}, {1, 8, 2}, {-1, 8, 3}, {0, 8, 3}, {1, 8, 3}, {0, 8, 0}, {0, 8, -1}, {1, 8, 0}, {1, 8, -1}, {-1, 8, 0}, {-1, 8, -1}, {2, 8, 2}, {2, 8, 1}, {2, 8, 0}, {-2, 8, 2}, {-2, 8, 1}, {-2, 8, 0}, {3, 7, 2}, {3, 7, 1}, {3, 7, 0}, {-3, 7, 2}, {-3, 7, 1}, {-3, 7, 0}, {0, 7, 4}, {1, 7, 4}, {-1, 7, 4}, {0, 7, -2}, {1, 7, -2}, {-1, 7, -2}, {0, 7, 5}, {0, 7, -1}, {-4, 7, 1}, {4, 7, 1} }; private int[][] leafPosMod3 = new int[][] { {1, 8, -1}, {2, 8, -1}, {3, 8, -1}, {1, 8, 0}, {2, 8, 0}, {3, 8, 0}, {1, 8, 1}, {2, 8, 1}, {3, 8, 1}, {2, 8, -2}, {2, 8, -3}, {3, 8, -2}, {3, 8, -3}, {1, 8, -2}, {1, 8, -3}, {4, 8, 0}, {4, 8, -1}, {4, 8, -2}, {0, 8, 0}, {0, 8, -1}, {0, 8, -2}, {5, 7, 0}, {5, 7, -1}, {5, 7, -2}, {-1, 7, 0}, {-1, 7, -1}, {-1, 7, -2}, {2, 7, 2}, {3, 7, 2}, {1, 7, 2}, {2, 7, -4}, {3, 7, -4}, {1, 7, -4}, {2, 7, 3}, {2, 7, -3}, {-2, 7, -1}, {6, 7, -1} }; private int[][] leafPosMod4 = new int[][] { {-3, 8, -1}, {-2, 8, -1}, {-1, 8, -1}, {-3, 8, 0}, {-2, 8, 0}, {-1, 8, 0}, {-3, 8, 1}, {-2, 8, 1}, {-1, 8, 1}, {-2, 8, -2}, {-2, 8, -3}, {-1, 8, -2}, {-1, 8, -3}, {-3, 8, -2}, {-3, 8, -3}, {0, 8, 0}, {0, 8, -1}, {0, 8, -2}, {-4, 8, 0}, {-4, 8, -1}, {-4, 8, -2}, {1, 7, 0}, {1, 7, -1}, {1, 7, -2}, {-5, 7, 0}, {-5, 7, -1}, {-5, 7, -2}, {-2, 7, 2}, {-1, 7, 2}, {-3, 7, 2}, {-2, 7, -4}, {-1, 7, -4}, {-3, 7, -4}, {-2, 7, 3}, {-2, 7, -3}, {-6, 7, -1}, {2, 7, -1} }; private int[][] cocoPos1 = new int[][] { {0, 7, -3}, {0, 7, -1}, {1, 7, -2}, {-1, 7, -2} }; private int[][] cocoPos2 = new int[][] { {0, 7, 1}, {0, 7, 3}, {1, 7, 2}, {-1, 7, 2} }; private int[][] cocoPos3 = new int[][] { {-2, 7, -1}, {-2, 7, 1}, {-1, 7, 0}, {-3, 7, 0} }; private int[][] cocoPos4 = new int[][] { {2, 7, -1}, {2, 7, 1}, {3, 7, 0}, {1, 7, 0} }; public WorldGenDifferentPalmTree(boolean f) { super(false); } public WorldGenDifferentPalmTree(World worldIn, Random rand, BlockPos pos) { super(true); generate(worldIn, rand, pos); } public boolean generate(World arg0, Random arg1, BlockPos arg2) { if (arg0.getBlockState(arg2.down()).getBlock() != ModBlocks.blackSand) return false; int rn = arg1.nextInt(4); if (rn == 0) { buildLayer(arg0, arg2, logPosMod1, log); buildLayer(arg0, arg2, leafPosMod1, leaves); buildLayer(arg0, arg2, cocoPos1, coco); } else if (rn == 1) { buildLayer(arg0, arg2, logPosMod2, log); buildLayer(arg0, arg2, leafPosMod2, leaves); buildLayer(arg0, arg2, cocoPos2, coco); } else if (rn == 2) { buildLayer(arg0, arg2, logPosMod3, log); buildLayer(arg0, arg2, leafPosMod3, leaves); buildLayer(arg0, arg2, cocoPos3, coco); } else if (rn == 3) { buildLayer(arg0, arg2, logPosMod4, log); buildLayer(arg0, arg2, leafPosMod4, leaves); buildLayer(arg0, arg2, cocoPos4, coco); } /*buildLayer(arg0, arg2, logPosMod1, log); buildLayer(arg0, arg2, leafPosMod1, leaves); buildLayer(arg0, arg2, cocoPos1, coco);*/ return true; } private void buildLayer(World world, BlockPos frontLeftCorner, int[][] blockPositions, IBlockState toPlace) { // iterate through the entire int[][] for(int[] coord : blockPositions) { placeBlock(world, frontLeftCorner, coord[0], coord[1], coord[2], toPlace); } } /** Helper Method **/ private void placeBlock(World world, BlockPos frontLeftCorner, int[] offsets, IBlockState toPlace) { placeBlock(world, frontLeftCorner, offsets[0], offsets[1], offsets[2], toPlace); } /** Places a block using corner position and offsets **/ private void placeBlock(World world, BlockPos frontLeftCorner, int offsetX, int offsetY, int offsetZ, IBlockState toPlace) { // figure out where that block is relative to the corner BlockPos placePos = frontLeftCorner.add(offsetX, offsetY, offsetZ); world.setBlockState(placePos, toPlace, 2); } } Side note: I also can't figure out how to force the custom leaves to not decay after a short while. (This is why I've set the leaves' CHECK_DECAY and DECAYABLE to false.
-
Oh, the door opens/closes just fine. It's just that it renders invisible and when I place it, it doesn't place both halves. EDIT: Here's a gif of what's happening: (Excuse the error in the middle of the gif, that happens with the Minecraft launcher's output window sometimes)
-
Ah, yeah... I have no clue what the sourceSets section even does. It doesn't change where the command prompt draws the files from. Anyway, I've uploaded the other missing files onto the repo.
-
Should the structure in the Eclipse package explorer be composed of folders, or source folders? EDIT: I'm assuming source folders, because if they were just folders, they won't compile, since as they are in the first screenshot, they don't. But from what you said about the Eclipse screenshot... it's confusing me.
-
Ah, okay. I've got the folder(s) setup now, but it's not compiling when I save a source file. Do I have the folder tree done correctly? This is inside
-
Okay, so I followed the instructions on that page again, after extracting the MDK to another directory. Oddly, when I ran 'gradlew setupDecompWorkspace' it didn't decompile Minecraft. Is there something I'm missing on that page?
-
Hmm... I followed that page exactly. I can't remember what exactly went wrong, since it was more than a year ago that I started this. I do remember running 'gradlew eclipse' and it not working. Or something. What I do know is that I had to fiddle with some settings in Eclipse, since it didn't create the workspace properly. From what I can tell of YouTube videos, my workspace is quite different from most modders'. I had to import the deobfed.jar with the project setup manually. ...It's really fuzzy in my mind what I had to do. Maybe I should just rewind, and re-setup everything. Before I go any further, what are the exact files I need on the repo? That I don't have, I mean.
-
Fixed that by creating another subfolder. It seems that there are way too many subfolders. I'm not sure if I should even upload the source in its current structure. In Eclipse, it needs the 'package main.java.blahblahbal.blahmod.<whatever>', but in yours it doesn't have that type of structure. Just 'package choonster.testmod3.<whatever>'. Did I set up Eclipse incorrectly? I don't even remember how I set it up. I think I had to do some minor hackery to get it to work, even though I followed the step-by-step instructions provided in the download. Plus, when I compile the mod and run Minecraft (like I said above), it gives that 'java.lang.ClassNotFoundException.' I moved the files/folders within yet another subfolder, and (as I said at the start of this post) it works (which makes sense actually). I guess I just don't understand why all the folders are needed, and that's why the original structure of my mod is odd. I'm gonna upload the build.gradle file, and the other files in a minute or two.
-
It looks like I messed up the structure more than I thought I did. I moved things around into a similar structure as yours is in, but Eclipse is forcing me to put 'main.java.blahblahbal.blahmod.<whatever>' in place of EVERY 'blahmod.<whatever>' in the code's imports and package declaration(s). I'll mess around with it some more. EDIT: Now when I load the game, it says 'java.lang.ClassNotFoundException: main.java.blahblahbal.blahmod.Main' Probably because the structure is broken...
-
Alrighty, I'll fix the structure tomorrow, since it's late here right now. I'm also going to look into updating to 1.11.2. The last time I tried to update I had problems, but that was on a super early version of Forge for 1.9. There might be some issues with fixing the structure, since I've built a lot of it around the improper structure. Hopefully I won't have too many edits to do.
-
So... no one can help? I'm sure there's someone out there who's able to. I know I'm not the best programmer, but I'm trying. I don't have the resources a lot of people have, since I am the only one working on my project. I've been working on the door problem for the last few hours (as well as some things with my custom biome), but no luck as of yet.
-
I'm having issues getting a custom door to even appear in-game. Its item is fine, but when I place it, it 1) only places half of the door, 2) doesn't drop the right item/block when mined (instead it drops a block that apparently derives its name from an item), and 3) renders invisible. Here is the code on github: BlockDiamondDoor: https://github.com/blahblahbal/Blah-s-Minecraft-Mod/blob/master/blahmod/blocks/BlockDiamondDoor.java ItemDiamondDoor: https://github.com/blahblahbal/Blah-s-Minecraft-Mod/blob/master/blahmod/items/ItemDiamondDoor.java ModBlocks: https://github.com/blahblahbal/Blah-s-Minecraft-Mod/blob/master/blahmod/blocks/ModBlocks.java ModItems: https://github.com/blahblahbal/Blah-s-Minecraft-Mod/blob/master/blahmod/items/ModItems.java And the json models are simply copied from vanilla. I must be missing something, but I can't see it.
-
I've been having issues getting a couple of custom blocks to render. It makes absolutely no sense to me as to why they won't render, because I have other leaves and logs that render just fine. And I simply copied the code from the fine blocks to create the new ones. The ones that won't render are the Palm Leaves and Palm Log. They're part of a new biome I added called Tropics. Here is the code on github: https://github.com/blahblahbal/Blah-s-Minecraft-Mod The specific files are in the world, blocks, and client directories. I am at a loss for why they won't render. All I am looking for is a second set of eyes, maybe that will help me see something that I missed. Side note - my custom saplings also won't render, and I have no reference for that. I copied the vanilla json files, but I think it has something to do with ItemBlocks and/or the way I register them in BlockRenderRegister. EDIT: I should mention that they render fine in the inventory, just not in the world. EDIT2: Oh geez, I'm an idiot. Apparently I copied the wrong blockstates files to the log and leaf blocks. Testing to make sure they work right now.