-
Notifications
You must be signed in to change notification settings - Fork 31
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
10 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
src/main/generated/assets/infernalexp/blockstates/luminous_fungus.json
This file was deleted.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
src/main/java/org/infernalstudios/infernalexp/block/custom/LuminousFungusBlock.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,51 @@ | ||
package org.infernalstudios.infernalexp.block.custom; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.PlantBlock; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.state.StateManager; | ||
import net.minecraft.state.property.BooleanProperty; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.BlockView; | ||
import net.minecraft.world.World; | ||
|
||
public class LuminousFungusBlock extends PlantBlock { | ||
public static final BooleanProperty IS_LIT = BooleanProperty.of("is_lit"); | ||
|
||
public LuminousFungusBlock(Settings settings) { | ||
super(settings); | ||
this.setDefaultState(this.getDefaultState().with(IS_LIT, false)); | ||
} | ||
|
||
@Override | ||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { | ||
builder.add(IS_LIT); | ||
} | ||
|
||
@Override | ||
protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { | ||
return floor.isSideSolidFullSquare(world, pos, Direction.UP); | ||
} | ||
|
||
@Override | ||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { | ||
super.onEntityCollision(state, world, pos, entity); | ||
if (!state.get(IS_LIT) && entity instanceof LivingEntity living) { | ||
living.addStatusEffect(new StatusEffectInstance(StatusEffects.GLOWING, 200, 0)); | ||
world.setBlockState(pos, state.with(IS_LIT, true)); | ||
} | ||
} | ||
|
||
@Override | ||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { | ||
super.randomTick(state, world, pos, random); | ||
if (state.get(IS_LIT)) world.setBlockState(pos, state.with(IS_LIT, false)); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/resources/assets/infernalexp/blockstates/luminous_fungus.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,10 @@ | ||
{ | ||
"variants": { | ||
"is_lit=true": { | ||
"model": "infernalexp:block/luminous_fungus_lit" | ||
}, | ||
"is_lit=false": { | ||
"model": "infernalexp:block/luminous_fungus" | ||
} | ||
} | ||
} |
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/infernalexp/models/block/luminous_fungus_lit.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,6 @@ | ||
{ | ||
"parent": "minecraft:block/cross", | ||
"textures": { | ||
"cross": "infernalexp:block/luminous_fungus_lit" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ernalexp/models/item/luminous_fungus.json → ...ernalexp/models/item/luminous_fungus.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "infernalexp:block/luminous_fungus" | ||
"layer0": "infernalexp:block/luminous_fungus_lit" | ||
} | ||
} |
Binary file modified
BIN
-7 Bytes
(96%)
src/main/resources/assets/infernalexp/textures/block/luminous_fungus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed
BIN
-183 Bytes
src/main/resources/assets/infernalexp/textures/block/luminous_fungus_off.png
Binary file not shown.