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.

Emerald_Galaxy

Members
  • Joined

  • Last visited

Everything posted by Emerald_Galaxy

  1. I want to make a tree with leaves that start wide on the bottom and get thinner as they get higher, kinda like a pine. Any ideas on how I can do that
  2. What a coincidence, I was actually about to use that tutorial since it was the only one to actually label them. Also, I have tried copying other trees leaf gen as well as messing with the variables, but both ended up just making a single leaf appear. Thanks.
  3. For the past couple days, I've been trying to figure out how leaf generation works. And I just don't understand the giant mess of ifs and fors in Minecraft's tree generators. Can someone help me understand what each thing does, or at least make it a little easier to understand.
  4. I feel so stupid right now. Turns out I just couldn't find my ore even though it actually was spawning, just not in every chunk like I foolishly assumed. Well, sorry for wasting everyone's time But tbh, I probably would've never thought to check whether or not my genchecker was right or not if it wasn't for the first reply I got. Thank you
  5. So I recently made a new oreGen for my ore and when I ran it the first time, it worked. But now after I've tryed adding a biome checker so I can set its biome, it wont work anymore, and it still won't work even after I disabled the extra parts I added, can someone help me figure out whats wrong. OreGeneration package emerald.masonsores.World; import java.util.ArrayList; import java.util.Random; import emerald.masonsores.Init.ModBlocks; import emerald.masonsores.World.Biomes.MasoniteMountains; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.fml.common.IWorldGenerator; import scala.actors.threadpool.Arrays; public class CustomOreGenerator implements IWorldGenerator { private WorldGenerator MASONITE; //private WorldGenerator MASONITE_BIOME; public CustomOreGenerator() { MASONITE = new WorldGenMinable(ModBlocks.MASONITE_ORE.getDefaultState(), 1, BlockMatcher.forBlock(Blocks.STONE)); //MASONITE_BIOME = new WorldGenMinable(ModBlocks.MASONITE_ORE.getDefaultState(), 8, BlockMatcher.forBlock(Blocks.STONE)); } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimension()) { //The Nether case -1: break; //The Overworld case 0: runGenerator(MASONITE, world, random, chunkX, chunkZ, 1, 0, 32); //runGenerator(MASONITE, world, random, chunkX, chunkZ, 3, 0, 64, MasoniteMountains.class); break; //The End case 1: } } private void runGenerator(WorldGenerator gen, World world, Random rand, int chunkX, int chunkZ, int chance, int minHeight, int maxHeight) { if(minHeight > maxHeight || minHeight < 0 || maxHeight > 256) throw new IllegalArgumentException("An Error Occurred While Generating Ores: Ore Spawned Out Of Bounds!"); int heightDiff = maxHeight - minHeight + 1; //ArrayList<Class<?>> classesList = new ArrayList<Class<?>>(Arrays.asList(classes)); for(int i = 0; i < chance; i++) { int x = chunkX * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightDiff); int z = chunkZ * 16 + rand.nextInt(16); BlockPos pos = new BlockPos(x, y, z); /*Class<?> biome = world.provider.getBiomeForCoords(pos).getClass(); if(classesList.contains(biome) || classes.length == 0) {*/ gen.generate(world, rand, new BlockPos(x, y, z)); System.out.println("Ore Generated At " + x + " " + y + " " + z); //} } } } Just a side note. I made a generation checker to tell me where and if an ore generates. And the weird thing is they do, but when I teleport to the location, its just stone.
  6. Alright thanks everyone for the help, I finally got it to work and I wouldn't have been able to do it without you!
  7. I figured as much. Just making sure I'm not messing up on that. Thanks.
  8. Another question. Should I register an itemblock for my doubleslab?
  9. Ok I see what your saying. But my problem is I don't know what to put in for the Block parameter. I have both the BlockSlabs in there (My slab and doubleslab) but what do I put for the Block.
  10. So after a long break off modding, I decided to remake my old mod from 1.11.2. So far, it's been going well except that I can't seem to figure out how to make an ItemSlab for my slab. Nor can I even begin to implement a way to register it using my registry handler. If anyone has some ideas on how I can do this, please explain. My Registry Handler package emerald.emeraldsores.Util.Handlers; import emerald.emeraldsores.Init.ModBlocks; import emerald.emeraldsores.Init.ModItems; import emerald.emeraldsores.Util.ModelInterface; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for(Item item : ModItems.ITEMS) { if(item instanceof ModelInterface) { ((ModelInterface)item).registerModels(); } } for(Block block : ModBlocks.BLOCKS) { if(block instanceof ModelInterface) { ((ModelInterface)block).registerModels(); } } } }
  11. Thank you that really explained a couple things. Now I just need a way to have it check what item was picked up and then i'll be done. i've looked at the event before, and saw that it had an item variable which seems to get the Item but i don't know. I need to look into it more. If anyone could give me an example EntityItemPickupEvent being used to give an achievement, i would really appreciate it. For the time being i'll be looking through some of the classes that are related to this event.
  12. I meant to say that I need help with events like the EntityItemPickupEvent. I've never really used events and just need some help with using them
  13. Ok so as the title states, i've been trying to get a EntityItemPickup event going, however i've been having trouble and can't seem to figure out how. If someone can explain to me how to create an EntityItemPickup event then please do. Any help is appreciated.
  14. Oh ok i fixed it. Turns out i was missing the "powered=true/false" variant, though i tried to add it before, i guess i put it in the wrong place
  15. So I Recently Started Modding, After Finally Being Able To Learn Java, And Everything's Been Going Fine So Far. But When I Tried To Make My Fence Gate, I Can't Seem To Get It To Render. I See A Missing Variant Exception But My Blockstate File Is Pretty Much The Same As The Normal Fence Gate Blockstate File. Can Anyone Find Out What I Did Wrong So I Can Render My Fence Gate? Edit: Forgot To Put My class And json MasonwoodFenceGate.java package com.emerald.moreOres.blocks.fences; import javax.annotation.Nullable; import com.emerald.moreOres.BlockList; import com.emerald.moreOres.MoreOres; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockWall; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class MasonwoodFenceGate extends BlockHorizontal { public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyBool POWERED = PropertyBool.create("powered"); public static final PropertyBool IN_WALL = PropertyBool.create("in_wall"); protected static final AxisAlignedBB AABB_COLLIDE_ZAXIS = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D); protected static final AxisAlignedBB AABB_COLLIDE_XAXIS = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D); protected static final AxisAlignedBB AABB_COLLIDE_ZAXIS_INWALL = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 0.8125D, 0.625D); protected static final AxisAlignedBB AABB_COLLIDE_XAXIS_INWALL = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 0.8125D, 1.0D); protected static final AxisAlignedBB AABB_CLOSED_SELECTED_ZAXIS = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.5D, 0.625D); protected static final AxisAlignedBB AABB_CLOSED_SELECTED_XAXIS = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.5D, 1.0D); public MasonwoodFenceGate() { //Material super(Material.WOOD, Material.WOOD.getMaterialMapColor()); //Default State setDefaultState(this.blockState.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false))); //Setting Registry Name setUnlocalizedName(BlockList.BList.MASONWOOD_FENCE_GATE.getUnlocalizedName()); setRegistryName(BlockList.BList.MASONWOOD_FENCE_GATE.getRegistryName()); //Creative Tab setCreativeTab(MoreOres.tabEmeraldsBlocks); //Footstep Sound setSoundType(SoundType.WOOD); //Hardness setHardness(5.0F); //Explosion Resistance setResistance(75.0F); } public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { state = this.getActualState(state, source, pos); return ((Boolean) state.getValue(IN_WALL)).booleanValue() ? (((EnumFacing) state.getValue(FACING)).getAxis() == EnumFacing.Axis.X ? AABB_COLLIDE_XAXIS_INWALL : AABB_COLLIDE_ZAXIS_INWALL) : (((EnumFacing) state.getValue(FACING)).getAxis() == EnumFacing.Axis.X ? AABB_COLLIDE_XAXIS : AABB_COLLIDE_ZAXIS); } public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { EnumFacing.Axis enumfacing$axis = ((EnumFacing) state.getValue(FACING)).getAxis(); if (enumfacing$axis == EnumFacing.Axis.Z && (canFenceGateConnectTo(worldIn, pos, EnumFacing.WEST) || canFenceGateConnectTo(worldIn, pos, EnumFacing.EAST)) || enumfacing$axis == EnumFacing.Axis.X && (canFenceGateConnectTo(worldIn, pos, EnumFacing.NORTH) || canFenceGateConnectTo(worldIn, pos, EnumFacing.SOUTH))) { state = state.withProperty(IN_WALL, Boolean.valueOf(true)); } return state; } public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing) state.getValue(FACING))); } public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation((EnumFacing) state.getValue(FACING))); } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return worldIn.getBlockState(pos.down()).getMaterial().isSolid() ? super.canPlaceBlockAt(worldIn, pos) : false; } @Nullable public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return ((Boolean) blockState.getValue(OPEN)).booleanValue() ? NULL_AABB : (((EnumFacing) blockState.getValue(FACING)).getAxis() == EnumFacing.Axis.Z ? AABB_CLOSED_SELECTED_ZAXIS : AABB_CLOSED_SELECTED_XAXIS); } public boolean isOpaqueCube(IBlockState state) { return false; } public boolean isFullCube(IBlockState state) { return false; } public boolean isPassable(IBlockAccess worldIn, BlockPos pos) { return ((Boolean) worldIn.getBlockState(pos).getValue(OPEN)).booleanValue(); } public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { boolean flag = worldIn.isBlockPowered(pos); return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()) .withProperty(OPEN, Boolean.valueOf(flag)).withProperty(POWERED, Boolean.valueOf(flag)) .withProperty(IN_WALL, Boolean.valueOf(false)); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (((Boolean) state.getValue(OPEN)).booleanValue()) { state = state.withProperty(OPEN, Boolean.valueOf(false)); worldIn.setBlockState(pos, state, 10); } else { EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw); if (state.getValue(FACING) == enumfacing.getOpposite()) { state = state.withProperty(FACING, enumfacing); } state = state.withProperty(OPEN, Boolean.valueOf(true)); worldIn.setBlockState(pos, state, 10); } worldIn.playSound(playerIn, pos, ((Boolean) state.getValue(OPEN)).booleanValue() //Open And Close Sound ? SoundEvents.BLOCK_FENCE_GATE_OPEN : SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundCategory.BLOCKS, 1.0F, 1.0F); return true; } public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { if (!worldIn.isRemote) { boolean flag = worldIn.isBlockPowered(pos); if (((Boolean) state.getValue(POWERED)).booleanValue() != flag) { worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)).withProperty(OPEN, Boolean.valueOf(flag)), 2); if (((Boolean) state.getValue(OPEN)).booleanValue() != flag) { worldIn.playSound(null, pos, //Open And Close Sound flag ? SoundEvents.BLOCK_FENCE_GATE_OPEN : SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundCategory.BLOCKS, 1.0F, 1.0F); } } } } @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return true; } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)) .withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)) .withProperty(POWERED, Boolean.valueOf((meta & 8) != 0)); } public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((EnumFacing) state.getValue(FACING)).getHorizontalIndex(); if (((Boolean) state.getValue(POWERED)).booleanValue()) { i |= 8; } if (((Boolean) state.getValue(OPEN)).booleanValue()) { i |= 4; } return i; } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { FACING, OPEN, POWERED, IN_WALL }); } @Override public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing) { Block connector = world.getBlockState(pos.offset(facing)).getBlock(); return connector instanceof BlockFence || connector instanceof BlockWall; } private boolean canFenceGateConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) { Block block = world.getBlockState(pos.offset(facing)).getBlock(); return block.canBeConnectedTo(world, pos.offset(facing), facing.getOpposite()); } } masonwood_fence_gate.json { "variants": { "facing=south,in_wall=false,open=false": { "model": "more_ores:masonwood_fence_gate_closed", "uvlock": true }, "facing=west,in_wall=false,open=false": { "model": "more_ores:masonwood_fence_gate_closed", "uvlock": true, "y": 90 }, "facing=north,in_wall=false,open=false": { "model": "more_ores:masonwood_fence_gate_closed", "uvlock": true, "y": 180 }, "facing=east,in_wall=false,open=false": { "model": "more_ores:masonwood_fence_gate_closed", "uvlock": true, "y": 270 }, "facing=south,in_wall=false,open=true": { "model": "more_ores:masonwood_fence_gate_open", "uvlock": true }, "facing=west,in_wall=false,open=true": { "model": "more_ores:masonwood_fence_gate_open", "uvlock": true, "y": 90 }, "facing=north,in_wall=false,open=true": { "model": "more_ores:masonwood_fence_gate_open", "uvlock": true, "y": 180 }, "facing=east,in_wall=false,open=true": { "model": "more_ores:masonwood_fence_gate_open", "uvlock": true, "y": 270 }, "facing=south,in_wall=true,open=false": { "model": "more_ores:masonwood_wall_gate_closed", "uvlock": true }, "facing=west,in_wall=true,open=false": { "model": "more_ores:masonwood_wall_gate_closed", "uvlock": true, "y": 90 }, "facing=north,in_wall=true,open=false": { "model": "more_ores:masonwood_wall_gate_closed", "uvlock": true, "y": 180 }, "facing=east,in_wall=true,open=false": { "model": "more_ores:masonwood_wall_gate_closed", "uvlock": true, "y": 270 }, "facing=south,in_wall=true,open=true": { "model": "more_ores:masonwood_wall_gate_open", "uvlock": true }, "facing=west,in_wall=true,open=true": { "model": "more_ores:masonwood_wall_gate_open", "uvlock": true, "y": 90 }, "facing=north,in_wall=true,open=true": { "model": "more_ores:masonwood_wall_gate_open", "uvlock": true, "y": 180 }, "facing=east,in_wall=true,open=true": { "model": "more_ores:masonwood_wall_gate_open", "uvlock": true, "y": 270 } } }

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.