-
Notifications
You must be signed in to change notification settings - Fork 12
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
Showing
28 changed files
with
437 additions
and
3 deletions.
There are no files selected for viewing
147 changes: 147 additions & 0 deletions
147
src/main/java/nightkosh/gravestone_extended/block/BlockCursedFlame.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,147 @@ | ||
package nightkosh.gravestone_extended.block; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockFire; | ||
import net.minecraft.block.BlockTNT; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import nightkosh.gravestone_extended.core.GSTabs; | ||
import nightkosh.gravestone_extended.core.ModInfo; | ||
import nightkosh.gravestone_extended.helper.GameRuleHelper; | ||
|
||
import java.util.Random; | ||
|
||
/** | ||
* GraveStone mod | ||
* | ||
* @author NightKosh | ||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) | ||
*/ | ||
public class BlockCursedFlame extends BlockFire { | ||
|
||
public BlockCursedFlame() { | ||
super(); | ||
this.setUnlocalizedName("cursed_flame"); | ||
this.setCreativeTab(GSTabs.otherItemsTab); | ||
this.setRegistryName(ModInfo.ID, "cursed_flame"); | ||
} | ||
|
||
@Override | ||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { | ||
entity.setFire(8);//TODO !!!!!!!!!!!!!!!!!!! | ||
} | ||
|
||
@Override | ||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { | ||
if (GameRuleHelper.checkFireTick(world)) { | ||
if (world.isAreaLoaded(pos, 2)) { // Forge: prevent loading unloaded chunks when spreading fire | ||
Block block = world.getBlockState(pos.down()).getBlock(); | ||
boolean flag = block.isFireSource(world, pos.down(), EnumFacing.UP); | ||
|
||
int i = state.getValue(AGE); | ||
|
||
if (!flag && world.isRaining() && this.canDie(world, pos) && rand.nextFloat() < 0.2F + i * 0.03F) { | ||
} else { | ||
if (i < 15) { | ||
state = state.withProperty(AGE, i + rand.nextInt(3) / 2); | ||
world.setBlockState(pos, state, 4); | ||
} | ||
|
||
world.scheduleUpdate(pos, this, this.tickRate(world) + rand.nextInt(10)); | ||
|
||
if (!flag) { | ||
if (!this.canNeighborCatchFire(world, pos)) { | ||
return; | ||
} | ||
|
||
if (!this.canCatchFire(world, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) { | ||
return; | ||
} | ||
} | ||
|
||
boolean flag1 = world.isBlockinHighHumidity(pos); | ||
int j = 0; | ||
|
||
if (flag1) { | ||
j = -50; | ||
} | ||
|
||
this.tryCatchFire(world, pos.east(), 300 + j, rand, i, EnumFacing.WEST); | ||
this.tryCatchFire(world, pos.west(), 300 + j, rand, i, EnumFacing.EAST); | ||
this.tryCatchFire(world, pos.down(), 250 + j, rand, i, EnumFacing.UP); | ||
this.tryCatchFire(world, pos.up(), 250 + j, rand, i, EnumFacing.DOWN); | ||
this.tryCatchFire(world, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH); | ||
this.tryCatchFire(world, pos.south(), 300 + j, rand, i, EnumFacing.NORTH); | ||
|
||
for (int k = -1; k <= 1; ++k) { | ||
for (int l = -1; l <= 1; ++l) { | ||
for (int i1 = -1; i1 <= 4; ++i1) { | ||
if (k != 0 || i1 != 0 || l != 0) { | ||
int j1 = 100; | ||
|
||
if (i1 > 1) { | ||
j1 += (i1 - 1) * 100; | ||
} | ||
|
||
BlockPos blockpos = pos.add(k, i1, l); | ||
int k1 = this.getNeighborEncouragement(world, blockpos); | ||
|
||
if (k1 > 0) { | ||
int l1 = (k1 + 40 + world.getDifficulty().getDifficultyId() * 7) / (i + 30); | ||
|
||
if (flag1) { | ||
l1 /= 2; | ||
} | ||
|
||
if (l1 > 0 && rand.nextInt(j1) <= l1 && (!world.isRaining() || !this.canDie(world, blockpos))) { | ||
int i2 = i + rand.nextInt(5) / 4; | ||
|
||
if (i2 > 15) { | ||
i2 = 15; | ||
} | ||
|
||
world.setBlockState(blockpos, state.withProperty(AGE, i2), 3); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean canDie(World world, BlockPos pos) { | ||
return false; | ||
} | ||
|
||
protected void tryCatchFire(World world, BlockPos pos, int chance, Random random, int age, EnumFacing face) { | ||
int i = world.getBlockState(pos).getBlock().getFlammability(world, pos, face); | ||
|
||
if (random.nextInt(chance) < i) { | ||
IBlockState iblockstate = world.getBlockState(pos); | ||
|
||
if (random.nextInt(age + 10) < 5 && !world.isRainingAt(pos)) { | ||
int j = age + random.nextInt(5) / 4; | ||
|
||
if (j > 15) { | ||
j = 15; | ||
} | ||
|
||
world.setBlockState(pos, this.getDefaultState().withProperty(AGE, j), 3); | ||
} else { | ||
world.setBlockToAir(pos); | ||
} | ||
|
||
if (iblockstate.getBlock() == Blocks.TNT) { | ||
Blocks.TNT.onBlockDestroyedByPlayer(world, pos, iblockstate.withProperty(BlockTNT.EXPLODE, true)); | ||
} | ||
} | ||
} | ||
} |
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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/nightkosh/gravestone_extended/item/itemblock/IBCursedFlame.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,19 @@ | ||
package nightkosh.gravestone_extended.item.itemblock; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.item.ItemBlock; | ||
import nightkosh.gravestone_extended.core.GSBlock; | ||
|
||
/** | ||
* GraveStone mod | ||
* | ||
* @author NightKosh | ||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) | ||
*/ | ||
public class IBCursedFlame extends ItemBlock { | ||
|
||
public IBCursedFlame(Block block) { | ||
super(block); | ||
this.setRegistryName(GSBlock.CURSED_FLAME.getRegistryName()); | ||
} | ||
} |
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
50 changes: 50 additions & 0 deletions
50
src/main/resources/assets/gravestone-extended/blockstates/cursed_flame.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,50 @@ | ||
{ | ||
"multipart": [ | ||
{ "when": {"north": false, "east": false, "south": false, "west": false, "up": false}, | ||
"apply": [ | ||
{ "model": "gravestone-extended:cursed_flame/floor0" }, | ||
{ "model": "gravestone-extended:cursed_flame/floor1" } | ||
] | ||
}, | ||
{ "when": {"OR": [{"north": true}, {"north": false, "east": false, "south": false, "west": false, "up": false}]}, | ||
"apply": [ | ||
{ "model": "gravestone-extended:cursed_flame/side0" }, | ||
{ "model": "gravestone-extended:cursed_flame/side1" }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt0" }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt1" } | ||
] | ||
}, | ||
{ "when": {"OR": [{"east": true}, {"north": false, "east": false, "south": false, "west": false, "up": false}]}, | ||
"apply": [ | ||
{ "model": "gravestone-extended:cursed_flame/side0", "y": 90 }, | ||
{ "model": "gravestone-extended:cursed_flame/side1", "y": 90 }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt0", "y": 90 }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt1", "y": 90 } | ||
] | ||
}, | ||
{ "when": {"OR": [{"south": true}, {"north": false, "east": false, "south": false, "west": false, "up": false}]}, | ||
"apply": [ | ||
{ "model": "gravestone-extended:cursed_flame/side0", "y": 180 }, | ||
{ "model": "gravestone-extended:cursed_flame/side1", "y": 180 }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt0", "y": 180 }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt1", "y": 180 } | ||
] | ||
}, | ||
{ "when": {"OR": [{"west": true}, {"north": false, "east": false, "south": false, "west": false, "up": false}]}, | ||
"apply": [ | ||
{ "model": "gravestone-extended:cursed_flame/side0", "y": 270 }, | ||
{ "model": "gravestone-extended:cursed_flame/side1", "y": 270 }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt0", "y": 270 }, | ||
{ "model": "gravestone-extended:cursed_flame/side_alt1", "y": 270 } | ||
] | ||
}, | ||
{ "when": {"up": true}, | ||
"apply": [ | ||
{ "model": "gravestone-extended:cursed_flame/up0" }, | ||
{ "model": "gravestone-extended:cursed_flame/up1" }, | ||
{ "model": "gravestone-extended:cursed_flame/up_alt0" }, | ||
{ "model": "gravestone-extended:cursed_flame/up_alt1" } | ||
] | ||
} | ||
] | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/floor.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,29 @@ | ||
{ | ||
"ambientocclusion": false, | ||
"elements": [ | ||
{ "from": [ 0, 0, 8.8 ], | ||
"to": [ 16, 22.4, 8.8 ], | ||
"rotation": { "origin": [ 8, 8, 8 ], "axis": "x", "angle": -22.5, "rescale": true }, | ||
"shade": false, | ||
"faces": { "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#fire" }} | ||
}, | ||
{ "from": [ 0, 0, 7.2 ], | ||
"to": [ 16, 22.4, 7.2 ], | ||
"rotation": { "origin": [ 8, 8, 8 ], "axis": "x", "angle": 22.5, "rescale": true }, | ||
"shade": false, | ||
"faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#fire" }} | ||
}, | ||
{ "from": [ 8.8, 0, 0 ], | ||
"to": [ 8.8, 22.4, 16 ], | ||
"rotation": { "origin": [ 8, 8, 8 ], "axis": "z", "angle": -22.5, "rescale": true }, | ||
"shade": false, | ||
"faces": { "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#fire" }} | ||
}, | ||
{ "from": [ 7.2, 0, 0 ], | ||
"to": [ 7.2, 22.4, 16 ], | ||
"rotation": { "origin": [ 8, 8, 8 ], "axis": "z", "angle": 22.5, "rescale": true }, | ||
"shade": false, | ||
"faces": { "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#fire" }} | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/floor0.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,7 @@ | ||
{ | ||
"parent": "gravestone-extended:block/cursed_flame/floor", | ||
"textures": { | ||
"particle": "gravestone-extended:blocks/cursed_flame/layer_0", | ||
"fire": "gravestone-extended:blocks/cursed_flame/layer_0" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/floor1.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,7 @@ | ||
{ | ||
"parent": "gravestone-extended:block/cursed_flame/floor", | ||
"textures": { | ||
"particle": "gravestone-extended:blocks/cursed_flame/layer_1", | ||
"fire": "gravestone-extended:blocks/cursed_flame/layer_1" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/side.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,13 @@ | ||
{ | ||
"ambientocclusion": false, | ||
"elements": [ | ||
{ "from": [ 0, 0, 0.01 ], | ||
"to": [ 16, 22.4, 0.01 ], | ||
"shade": false, | ||
"faces": { | ||
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#fire" }, | ||
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#fire" } | ||
} | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/side0.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,7 @@ | ||
{ | ||
"parent": "gravestone-extended:block/cursed_flame/side", | ||
"textures": { | ||
"particle": "gravestone-extended:blocks/cursed_flame/layer_0", | ||
"fire": "gravestone-extended:blocks/cursed_flame/layer_0" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/side1.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,7 @@ | ||
{ | ||
"parent": "gravestone-extended:block/cursed_flame/side", | ||
"textures": { | ||
"particle": "gravestone-extended:blocks/cursed_flame/layer_1", | ||
"fire": "gravestone-extended:blocks/cursed_flame/layer_1" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/side_alt.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,13 @@ | ||
{ | ||
"ambientocclusion": false, | ||
"elements": [ | ||
{ "from": [ 0, 0, 0.01 ], | ||
"to": [ 16, 22.4, 0.01 ], | ||
"shade": false, | ||
"faces": { | ||
"south": { "uv": [ 16, 0, 0, 16 ], "texture": "#fire" }, | ||
"north": { "uv": [ 16, 0, 0, 16 ], "texture": "#fire" } | ||
} | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/side_alt0.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,7 @@ | ||
{ | ||
"parent": "gravestone-extended:block/cursed_flame/side_alt", | ||
"textures": { | ||
"particle": "gravestone-extended:blocks/cursed_flame/layer_0", | ||
"fire": "gravestone-extended:blocks/cursed_flame/layer_0" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/gravestone-extended/models/block/cursed_flame/side_alt1.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,7 @@ | ||
{ | ||
"parent": "gravestone-extended:block/cursed_flame/side_alt", | ||
"textures": { | ||
"particle": "gravestone-extended:blocks/cursed_flame/layer_1", | ||
"fire": "gravestone-extended:blocks/cursed_flame/layer_1" | ||
} | ||
} |
Oops, something went wrong.