-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Just deal with the Poppys and Dandelions. Don't know how to remove them
- Loading branch information
1 parent
a37415f
commit 4abd98e
Showing
11 changed files
with
181 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/main/java/androsa/gaiadimension/block/GDCrystalBloom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package androsa.gaiadimension.block; | ||
|
||
import androsa.gaiadimension.registry.GDBlocks; | ||
import androsa.gaiadimension.registry.GDTabs; | ||
import androsa.gaiadimension.registry.ModelRegisterCallback; | ||
import net.minecraft.block.BlockBush; | ||
import net.minecraft.block.SoundType; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.block.properties.PropertyEnum; | ||
import net.minecraft.block.state.BlockStateContainer; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.creativetab.CreativeTabs; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.BlockRenderLayer; | ||
import net.minecraft.util.IStringSerializable; | ||
import net.minecraft.util.NonNullList; | ||
import net.minecraft.util.math.AxisAlignedBB; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.RayTraceResult; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.client.model.ModelLoader; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
import java.util.Locale; | ||
|
||
public class GDCrystalBloom extends BlockBush implements ModelRegisterCallback { | ||
|
||
protected static final AxisAlignedBB PLANT_AABB = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); | ||
|
||
public static final PropertyEnum<CrystalBloomVariant> VARIANT = PropertyEnum.create("variant", CrystalBloomVariant.class); | ||
|
||
public GDCrystalBloom() { | ||
super(Material.PLANTS); | ||
|
||
this.setHardness(0.0F); | ||
this.setSoundType(SoundType.PLANT); | ||
this.setCreativeTab(GDTabs.tabBlock); | ||
} | ||
|
||
@Override | ||
public BlockStateContainer createBlockState() { | ||
return new BlockStateContainer(this, VARIANT); | ||
} | ||
|
||
@Override | ||
public int getMetaFromState(IBlockState state) { | ||
return state.getValue(VARIANT).ordinal(); | ||
} | ||
|
||
@Override | ||
@Deprecated | ||
public IBlockState getStateFromMeta(int meta) { | ||
return getDefaultState().withProperty(VARIANT, CrystalBloomVariant.values()[meta]); | ||
} | ||
|
||
@Override | ||
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) { | ||
for(int i = 0; i < CrystalBloomVariant.values().length; i++) | ||
items.add(new ItemStack(this, 1, i)); | ||
} | ||
|
||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { | ||
return new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).ordinal()); | ||
} | ||
|
||
public boolean canPlaceBlockAt(IBlockState state) { | ||
return state.getBlock() == GDBlocks.glitterGrass || state.getBlock() == GDBlocks.heavySoil; | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@Override | ||
public BlockRenderLayer getBlockLayer() { | ||
return BlockRenderLayer.TRANSLUCENT; | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@Override | ||
public void registerModel() { | ||
for (int i = 0; i < CrystalBloomVariant.values().length; i++) { | ||
String variant = "inventory_" + CrystalBloomVariant.values()[i].getName(); | ||
ModelResourceLocation mrl = new ModelResourceLocation(getRegistryName(), variant); | ||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), i, mrl); | ||
} | ||
} | ||
|
||
public enum CrystalBloomVariant implements IStringSerializable { | ||
THISCUS, | ||
OUZIUM, | ||
VARLOOM, | ||
CORRUPT_VARLOOM, | ||
MISSINGNO; | ||
|
||
@Override | ||
public String getName() { | ||
return name().toLowerCase(Locale.ROOT); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/androsa/gaiadimension/world/GDGenCrystalBloom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package androsa.gaiadimension.world; | ||
|
||
import androsa.gaiadimension.block.GDCrystalBloom; | ||
import androsa.gaiadimension.registry.GDBlocks; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.gen.feature.WorldGenerator; | ||
|
||
import java.util.Random; | ||
|
||
public class GDGenCrystalBloom extends WorldGenerator { | ||
private final IBlockState tallGrassState; | ||
|
||
public GDGenCrystalBloom(GDCrystalBloom.CrystalBloomVariant var1) { | ||
this.tallGrassState = GDBlocks.crystalBloom.getDefaultState().withProperty(GDCrystalBloom.VARIANT, var1); | ||
} | ||
|
||
@Override | ||
public boolean generate(World worldIn, Random rand, BlockPos position) { | ||
for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, worldIn, position) || iblockstate.getBlock().isLeaves(iblockstate, worldIn, position)) && position.getY() > 0; iblockstate = worldIn.getBlockState(position)) { | ||
position = position.down(); | ||
} | ||
|
||
for (int i = 0; i < 128; ++i) { | ||
BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); | ||
|
||
if (worldIn.isAirBlock(blockpos) && GDBlocks.crystalBloom.canPlaceBlockAt(worldIn, blockpos)) { | ||
worldIn.setBlockState(blockpos, this.tallGrassState, 2); | ||
} | ||
} | ||
return true; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/resources/assets/gaiadimension/blockstates/crystal_bloom.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"forge_marker": 1, | ||
"defaults": { | ||
"model": "minecraft:cross", | ||
"transform": "forge:default-item" | ||
}, | ||
"variants": { | ||
"inventory_thiscus": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus"}}], | ||
"inventory_ouzium": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/ouzium" }}], | ||
"inventory_varloom": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus"}}], | ||
"inventory_corrupt_varloom": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus"}}], | ||
"inventory_missingno": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus"}}], | ||
|
||
"variant=thiscus": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus"}}], | ||
"variant=ouzium": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/ouzium" }}], | ||
"variant=varloom": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus"}}], | ||
"variant=corrupt_varloom": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus"}}], | ||
"variant=missingno": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus"}}] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+441 Bytes
src/main/resources/assets/gaiadimension/textures/blocks/thiscus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.