-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ce1f1a
commit cee728d
Showing
20 changed files
with
218 additions
and
307 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
src/main/java/mod/emt/harkenscythe/blocks/HSBlockCreep.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,115 @@ | ||
package mod.emt.harkenscythe.blocks; | ||
|
||
import java.util.Random; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import mod.emt.harkenscythe.init.HSBlocks; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.SoundType; | ||
import net.minecraft.block.material.MapColor; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.EnumParticleTypes; | ||
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; | ||
|
||
// TODO: Creep blocks are tillable with glaives and can be filled with blood | ||
// Using creepballs on soul sand will also create creep blocks | ||
public class HSBlockCreep extends Block | ||
{ | ||
protected static final AxisAlignedBB CREEP_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D); | ||
|
||
public HSBlockCreep() | ||
{ | ||
super(Material.GRASS, MapColor.RED); | ||
this.setHardness(0.6F); | ||
this.setHarvestLevel("shovel", 0); | ||
this.setSoundType(SoundType.PLANT); | ||
this.setTickRandomly(true); | ||
} | ||
|
||
// TODO: Creep blocks should only spread in the Nether, also see whether or not this properly works in that dimension | ||
@Override | ||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) | ||
{ | ||
if (!worldIn.isRemote) | ||
{ | ||
if (!worldIn.isAreaLoaded(pos, 3)) return; | ||
if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) | ||
{ | ||
if (this == HSBlocks.creep_block) worldIn.setBlockState(pos, Blocks.SOUL_SAND.getDefaultState()); | ||
} else | ||
{ | ||
if (worldIn.getLightFromNeighbors(pos.up()) >= 9) | ||
{ | ||
for (int i = 0; i < 4; ++i) | ||
{ | ||
BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); | ||
|
||
if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos)) | ||
{ | ||
return; | ||
} | ||
|
||
IBlockState iblockstate = worldIn.getBlockState(blockpos.up()); | ||
IBlockState iblockstate1 = worldIn.getBlockState(blockpos); | ||
|
||
if (iblockstate1.getBlock() == Blocks.SOUL_SAND && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2) | ||
{ | ||
worldIn.setBlockState(blockpos, HSBlocks.creep_block.getDefaultState()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess world, BlockPos pos) | ||
{ | ||
return CREEP_AABB; | ||
} | ||
|
||
@Override | ||
public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entity) | ||
{ | ||
entity.motionX *= 0.4D; | ||
entity.motionZ *= 0.4D; | ||
} | ||
|
||
// TODO: Fancier particles? Maybe little red particles? | ||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) | ||
{ | ||
super.randomDisplayTick(stateIn, worldIn, pos, rand); | ||
|
||
if (rand.nextInt(10) == 0) | ||
{ | ||
worldIn.spawnParticle(EnumParticleTypes.TOWN_AURA, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D); | ||
} | ||
} | ||
|
||
@Override | ||
public Item getItemDropped(IBlockState state, Random rand, int fortune) | ||
{ | ||
return Blocks.SOUL_SAND.getItemDropped(Blocks.SOUL_SAND.getDefaultState(), rand, fortune); | ||
} | ||
|
||
|
||
@Override | ||
public boolean isFireSource(World world, BlockPos pos, EnumFacing side) | ||
{ | ||
return true; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/mod/emt/harkenscythe/blocks/HSBlockMaterial.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,31 @@ | ||
package mod.emt.harkenscythe.blocks; | ||
|
||
import mod.emt.harkenscythe.init.HSBlocks; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.SoundType; | ||
import net.minecraft.block.material.MapColor; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
public class HSBlockMaterial extends Block | ||
{ | ||
public HSBlockMaterial(Material material, MapColor mapColor, float hardness, float resistance, SoundType soundType) | ||
{ | ||
super(material, mapColor); | ||
this.setHardness(hardness); | ||
this.setResistance(resistance); | ||
this.setSoundType(soundType); | ||
} | ||
|
||
@Override | ||
public boolean isFireSource(World world, BlockPos pos, EnumFacing side) | ||
{ | ||
if (this == HSBlocks.biomass_block) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/resources/assets/harkenscythe/blockstates/biomass_block.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,17 @@ | ||
{ | ||
"forge_marker": 1, | ||
"defaults": { | ||
"model": "cube_all", | ||
"textures": { | ||
"all": "harkenscythe:blocks/block_biomass" | ||
} | ||
}, | ||
"variants": { | ||
"normal": [ | ||
{} | ||
], | ||
"inventory": [ | ||
{} | ||
] | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/resources/assets/harkenscythe/blockstates/creep_block.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,19 @@ | ||
{ | ||
"forge_marker": 1, | ||
"defaults": { | ||
"model": "cube_bottom_top", | ||
"textures": { | ||
"bottom": "blocks/soul_sand", | ||
"top": "harkenscythe:blocks/block_creep_top", | ||
"side": "harkenscythe:blocks/block_creep_side" | ||
} | ||
}, | ||
"variants": { | ||
"normal": [ | ||
{} | ||
], | ||
"inventory": [ | ||
{} | ||
] | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/resources/assets/harkenscythe/blockstates/livingmetal_block.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,17 @@ | ||
{ | ||
"forge_marker": 1, | ||
"defaults": { | ||
"model": "cube_all", | ||
"textures": { | ||
"all": "harkenscythe:blocks/block_livingmetal" | ||
} | ||
}, | ||
"variants": { | ||
"normal": [ | ||
{} | ||
], | ||
"inventory": [ | ||
{} | ||
] | ||
} | ||
} |
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
Binary file added
BIN
+721 Bytes
src/main/resources/assets/harkenscythe/textures/blocks/block_biomass.png
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
+707 Bytes
src/main/resources/assets/harkenscythe/textures/blocks/block_creep_side.png
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
+605 Bytes
src/main/resources/assets/harkenscythe/textures/blocks/block_creep_tilled.png
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
+616 Bytes
...n/resources/assets/harkenscythe/textures/blocks/block_creep_tilled_bloodied.png
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
+506 Bytes
src/main/resources/assets/harkenscythe/textures/blocks/block_creep_top.png
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
+420 Bytes
src/main/resources/assets/harkenscythe/textures/blocks/block_livingmetal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 0 additions & 44 deletions
44
src/main/resources/assets/harkenscythe/textures/blocks/soul_cake_slice1.json
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/main/resources/assets/harkenscythe/textures/blocks/soul_cake_slice2.json
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/main/resources/assets/harkenscythe/textures/blocks/soul_cake_slice3.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.