Jump to content

StudioMaker

Members
  • Posts

    35
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

StudioMaker's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hey, i want to have my snow block to generate 100 % on stone over the y cords 110. Is it possible to do that? This is my class rn package com.studiomaker.poweredelements2.world.gen; import java.util.Random; import com.studiomaker.poweredelements2.init.ModBlocks; 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 net.minecraftforge.fml.common.Mod.EventHandler; public class WorldGenCustomOres implements IWorldGenerator { private WorldGenerator snow_mountain; // private WorldGenerator energetic_ore_block; // private WorldGenerator red_crystal; public WorldGenCustomOres() { snow_mountain = new WorldGenMinable(ModBlocks.SNOW_MOUNTAIN.getDefaultState(), 3, BlockMatcher.forBlock(Blocks.STONE)); // energetic_ore_block = new WorldGenMinable(ModBlocks.ENERGETIC_ORE_BLOCK.getDefaultState(), 3, BlockMatcher.forBlock(Blocks.STONE)); } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimension()) { case 0: runGenerator(snow_mountain, world, random, chunkX, chunkZ, 255, 110, 100); // runGenerator(energetic_ore_block, world, random, chunkX, chunkZ, 50, 0, 100); } } 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("Ore generated out of bounds"); int heightDiff = maxHeight - minHeight + 1; for(int i = 0; i < chance; i++) { int x = chunkX * 32 + rand.nextInt(32); int y = minHeight + rand.nextInt(heightDiff); int z = chunkZ * 32 + rand.nextInt(32); gen.generate(world, rand, new BlockPos(x,y,z)); } } }
  2. Yeah i know that but then the texture has to be in diffrent timezones or something depending on where they are placed because all animation textures are synced but idk
  3. Hey, how do i make a multitexture that isnt limited on 1 block? I have tried some diffrent methods but i just haven't figured it out. Here is how it is https://gyazo.com/4c755034151dded847383d4f81ed4f5b And i want it to be like this https://gyazo.com/e925553a02116011cdf0c21ac1f2d48b instead of this https://gyazo.com/3c22cb5d185fc5ecd527096e709833d9, is it even possible to code that? Here is my block class, have not anything special there atm package com.studiomaker.poweredelements2.blocks; import java.util.EnumSet; import java.util.List; import java.util.Random; import java.util.Set; import javax.annotation.Nullable; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.studiomaker.poweredelements2.init.ModBlocks; import com.studiomaker.poweredelements2.util.IHasModel; import net.minecraft.block.Block; import net.minecraft.block.BlockObserver; import net.minecraft.block.BlockRedstoneDiode; import net.minecraft.block.BlockRedstoneRepeater; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.IStringSerializable; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class Screen extends BlockBase implements IHasModel { private final boolean isOn; public Screen(String name, Material material, boolean isOn) { super(name, material); setSoundType(SoundType.GLASS); setHardness(0.5F); setResistance(0.5F); setTickRandomly(true); this.isOn = isOn; if (isOn) { this.setLightLevel(1.0F); } } }
  4. I noticed btw that i can click u on items etc in both tabs, but i cant click r on a item in the default survival tab?
  5. Galacticraft has like 1 survival mode tab in your inventory, and i cant look at recipes etc with nei when im in the default tab, i can only do that in the galacticraft tab, any ideas / help?
  6. And yes i have tried with diffrent methods but idk
  7. Hello, I want my block (Frozen dirt) after a while to transform into my dirt. i just didnt figure it out how to do that, here is my FrozenDirt class package com.studiomaker.poweredelements2.blocks; import java.util.Random; import com.studiomaker.poweredelements2.init.ModBlocks; import com.studiomaker.poweredelements2.util.IHasModel; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.world.World; public class FrozenDirt extends BlockBase implements IHasModel { public FrozenDirt(String name, Material material) { super(name, material); setSoundType(SoundType.GLASS); setHardness(1.0F); setResistance(1F); setTickRandomly(true); } } And here is my MarsDirt class package com.studiomaker.poweredelements2.blocks; import java.util.Random; import com.studiomaker.poweredelements2.init.ModBlocks; import com.studiomaker.poweredelements2.init.ModItems; import com.studiomaker.poweredelements2.util.IHasModel; import net.minecraft.block.BlockSapling; import net.minecraft.block.IGrowable; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class MarsDirt extends BlockBase implements IHasModel { public MarsDirt(String name, Material material) { super(name, material); setSoundType(SoundType.GROUND); setHardness(1.0F); setResistance(1F); } @Override public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) { IBlockState plant = plantable.getPlant(world, pos.offset(direction)); net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); if (plant.getBlock() instanceof BlockSapling) { return true; } return false; } @Override public void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source) { } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if(rand.nextInt(99)+1 <= 60) { IBlockState iblockstate = worldIn.getBlockState(pos.up()); if (iblockstate.getBlock() instanceof IGrowable && iblockstate.getBlock() != Blocks.GRASS) { IGrowable igrowable = (IGrowable)iblockstate.getBlock(); if (igrowable.canGrow(worldIn, pos.up(), iblockstate, worldIn.isRemote)) { if (!worldIn.isRemote) { if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos.up(), iblockstate)) { igrowable.grow(worldIn, worldIn.rand, pos.up(), iblockstate); worldIn.playEvent(300, pos, 0); } } } } } } }
  8. I dont want them to spawn multiple but they do..
  9. I tried using some weird methods to try out new stuff package com.studiomaker.poweredelements2.world.gen; import java.util.ArrayList; import java.util.List; import java.util.Random; import com.studiomaker.poweredelements2.init.ModBlocks; import com.studiomaker.poweredelements2.util.handlers.EnumHandler; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; 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 net.minecraftforge.fml.common.Mod.EventHandler; public class WorldGenCrystal implements IWorldGenerator { private WorldGenerator crystal; public WorldGenCrystal() { crystal = new WorldGenMinable(ModBlocks.CRYSTAL.getDefaultState(), 1, BlockMatcher.forBlock(Blocks.STONE)); } public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { int x = chunkX * 50 + random.nextInt(50); int z = chunkZ * 50 + random.nextInt(50); for(int i = 15; i < 50; i++) { BlockPos pos = new BlockPos(x, i, z); BlockPos belowPos = pos.down(); IBlockState state = world.getBlockState(pos); IBlockState stateBelow = world.getBlockState(belowPos); if(state.getBlock().isAir(state, world, pos) && stateBelow.getBlock() == Blocks.STONE) { makeCrystalCaveAt(world, pos, random); return; } } } public void makeCrystalCaveAt(World world, BlockPos source, Random rand) { double expandX = (rand.nextDouble() - 0.5) * 2; double expandY = (rand.nextDouble() - 0.5) * 0.1F; double expandZ = (rand.nextDouble() - 0.5) * 2; double curveAngle = rand.nextDouble() * Math.PI * 2; double curveRatio = rand.nextDouble() * 0.25 + 0.1; double curveX = Math.cos(curveAngle) * curveRatio; double curveY = (rand.nextFloat() - 0.5F) * 0.05F; double curveZ = Math.sin(curveAngle) * curveRatio; BlockPos hollowingCenter = source; Vec3d expansion = new Vec3d(expandX, expandY, expandZ).normalize(); Vec3d curvature = new Vec3d(curveX, curveY, curveZ); int color1 = rand.nextInt(12); int color2; do { color2 = rand.nextInt(12); } while(color2 == color1); IBlockState crystal1 = ModBlocks.CRYSTAL.getStateFromMeta(color1); IBlockState crystal2 = ModBlocks.CRYSTAL.getStateFromMeta(color2); int length = 12 + rand.nextInt(10); int size = 4 + rand.nextInt(11); for(int i = 0; i < length; i++) { hollowOut(world, hollowingCenter, rand, size, crystal1, crystal2); BlockPos currentCenter = hollowingCenter; if(hollowingCenter.getY() < 10) { expansion = new Vec3d(expansion.x, -expansion.y, expansion.z); curvature = new Vec3d(curvature.x, -curvature.y, curvature.z); } expansion = expansion.add(curvature).normalize(); } } private void hollowOut(World world, BlockPos source, Random rand, int width, IBlockState crystal1, IBlockState crystal2) { List<BlockPos> crystals = new ArrayList(); int max = width * width; for(int i = -width; i <= width; i++) for(int j = -width; j <= width; j++) for(int k = -width; k <= width; k++) { BlockPos pos = source.add(i, j, k); int dist = i * i + j * j + k * k; if(dist < max) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(block.getBlockHardness(state, world, pos) != -1) world.setBlockToAir(pos); } else if(dist - 1 < max) crystals.add(pos); } for(BlockPos pos : crystals) { if(rand.nextInt(3) == 0) makeCrystal(world, pos, rand, rand.nextBoolean() ? crystal1 : crystal2); else if(rand.nextInt(2) == 0) { IBlockState stateAt = world.getBlockState(pos); Block blockAt = stateAt.getBlock(); if(blockAt.isAir(stateAt, world, pos) || blockAt == ModBlocks.CRYSTAL || blockAt.getBlockHardness(stateAt, world, pos) == -1) continue; IBlockState oreState = Blocks.GOLD_ORE.getDefaultState(); if(rand.nextInt(3) == 0) { if(rand.nextInt(3) == 0) oreState = Blocks.DIAMOND_ORE.getDefaultState(); else oreState = Blocks.EMERALD_ORE.getDefaultState(); } world.setBlockState(pos, oreState); } } } private void makeCrystal(World world, BlockPos source, Random rand, IBlockState crystal) { boolean up = rand.nextBoolean(); EnumFacing shift = up ? EnumFacing.UP : EnumFacing.DOWN; BlockPos startPos = source; IBlockState state = world.getBlockState(startPos); if(state.getBlock() == ModBlocks.CRYSTAL) return; int tests = 0; while(state.getBlock().isAir(state, world, startPos)) { startPos = startPos.offset(shift.getOpposite()); state = world.getBlockState(startPos); tests++; if(tests >= 10) return; } int size = 3 + rand.nextInt(4); BlockPos pos = startPos; for(int i = 0; i < size; i++) { IBlockState stateAt = world.getBlockState(pos); Block block = stateAt.getBlock(); if(block.getBlockHardness(stateAt, world, pos) == -1) break; world.setBlockState(pos, crystal); pos = pos.offset(shift); } } }
  10. Uhm .. https://gyazo.com/b50fdc6cd17aa39caf6ef72f2a60d75e
  11. hmm could u explain a bit more lol, thats why i asked
  12. Nope didnt work, something is wrong or that isnt the solve. Here is my code package com.studiomaker.poweredelements2.world.gen; import java.util.Random; import com.studiomaker.poweredelements2.init.ModBlocks; import com.studiomaker.poweredelements2.util.handlers.EnumHandler; 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 net.minecraftforge.fml.common.Mod.EventHandler; public class WorldGenCrystal implements IWorldGenerator { private WorldGenerator crystal; public WorldGenCrystal() { crystal = new WorldGenMinable(ModBlocks.CRYSTAL.getDefaultState(), 5, BlockMatcher.forBlock(Blocks.STONE)); } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimension()) { case 0: runGenerator(crystal, world, random, chunkX, chunkZ, 50, 0, 35); } } 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("Ore generated out of bounds"); int heightDiff = maxHeight - minHeight + 1; for (int i = 0; i < 128; ++i) { int x = chunkX * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightDiff); int z = chunkZ * 16 + rand.nextInt(16); pos = pos.up(); gen.generate(world, rand, new BlockPos(x,y,z)); } } }
×
×
  • Create New...

Important Information

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