Added frosted obsidian

This commit is contained in:
Sollace 2021-12-31 14:54:51 +02:00
parent 117bbd797a
commit 3a39f9c9e4
15 changed files with 90 additions and 4 deletions

View file

@ -0,0 +1,29 @@
package com.minelittlepony.unicopia.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FrostedIceBlock;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class FrostedObsidianBlock extends FrostedIceBlock {
public FrostedObsidianBlock(Settings settings) {
super(settings);
}
@Override
protected void melt(BlockState state, World world, BlockPos pos) {
if (world.getDimension().isUltrawarm()) {
world.removeBlock(pos, false);
return;
}
world.setBlockState(pos, Blocks.LAVA.getDefaultState());
world.updateNeighbor(pos, Blocks.LAVA, pos);
}
@Override
public PistonBehavior getPistonBehavior(BlockState state) {
return PistonBehavior.BLOCK;
}
}

View file

@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.block;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder; import net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.MapColor; import net.minecraft.block.MapColor;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -17,6 +18,8 @@ public interface UBlocks {
.strength(2) .strength(2)
.sounds(BlockSoundGroup.STONE))); .sounds(BlockSoundGroup.STONE)));
Block FROSTED_OBSIDIAN = register("frosted_obsidian", new FrostedObsidianBlock(FabricBlockSettings.copy(Blocks.OBSIDIAN).ticksRandomly()));
private static <T extends Block> T register(String name, T item) { private static <T extends Block> T register(String name, T item) {
return Registry.register(Registry.BLOCK, new Identifier("unicopia", name), item); return Registry.register(Registry.BLOCK, new Identifier("unicopia", name), item);
} }

View file

@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.block.state;
import java.util.function.Predicate; import java.util.function.Predicate;
import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.util.Registries; import com.minelittlepony.unicopia.util.Registries;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -25,7 +26,7 @@ public class StateMaps {
public static final BlockStateConverter ICE_AFFECTED = register("ice", new BlockStateMap.Builder() public static final BlockStateConverter ICE_AFFECTED = register("ice", new BlockStateMap.Builder()
.replaceMaterial(Material.WATER, Blocks.FROSTED_ICE) .replaceMaterial(Material.WATER, Blocks.FROSTED_ICE)
.replaceMaterial(Material.LAVA, Blocks.OBSIDIAN) .replaceMaterial(Material.LAVA, UBlocks.FROSTED_OBSIDIAN)
.add(StateMapping.cycleProperty(Blocks.SNOW, SnowBlock.LAYERS, 7)) .add(StateMapping.cycleProperty(Blocks.SNOW, SnowBlock.LAYERS, 7))
.replaceBlock(Blocks.FIRE, Blocks.AIR) .replaceBlock(Blocks.FIRE, Blocks.AIR)
.setProperty(Blocks.REDSTONE_WIRE, RedstoneWireBlock.POWER, 0)); .setProperty(Blocks.REDSTONE_WIRE, RedstoneWireBlock.POWER, 0));
@ -42,10 +43,10 @@ public class StateMaps {
.removeBlock(Blocks.SNOW) .removeBlock(Blocks.SNOW)
.removeBlock(Blocks.SNOW_BLOCK) .removeBlock(Blocks.SNOW_BLOCK)
.removeBlock(StateMaps::isPlant) .removeBlock(StateMaps::isPlant)
.replaceBlock(Blocks.ICE, Blocks.WATER) .replaceBlock(BlockTags.ICE, Blocks.WATER)
.replaceBlock(Blocks.PACKED_ICE, Blocks.WATER)
.replaceBlock(Blocks.CLAY, Blocks.BROWN_CONCRETE) .replaceBlock(Blocks.CLAY, Blocks.BROWN_CONCRETE)
.replaceBlock(Blocks.OBSIDIAN, Blocks.LAVA) .replaceBlock(Blocks.OBSIDIAN, Blocks.LAVA)
.replaceBlock(UBlocks.FROSTED_OBSIDIAN, Blocks.LAVA)
.replaceBlock(Blocks.GRASS_BLOCK, Blocks.DIRT) .replaceBlock(Blocks.GRASS_BLOCK, Blocks.DIRT)
.replaceBlock(Blocks.MOSSY_COBBLESTONE, Blocks.COBBLESTONE) .replaceBlock(Blocks.MOSSY_COBBLESTONE, Blocks.COBBLESTONE)
.replaceBlock(Blocks.MOSSY_COBBLESTONE_WALL, Blocks.COBBLESTONE_WALL) .replaceBlock(Blocks.MOSSY_COBBLESTONE_WALL, Blocks.COBBLESTONE_WALL)

View file

@ -0,0 +1,16 @@
{
"variants": {
"age=0": {
"model": "unicopia:block/frosted_obsidian_0"
},
"age=1": {
"model": "unicopia:block/frosted_obsidian_1"
},
"age=2": {
"model": "unicopia:block/frosted_obsidian_2"
},
"age=3": {
"model": "unicopia:block/frosted_obsidian_3"
}
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "unicopia:block/frosted_obsidian_0"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "unicopia:block/frosted_obsidian_1"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "unicopia:block/frosted_obsidian_2"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "unicopia:block/frosted_obsidian_3"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"unicopia:frosted_obsidian"
]
}

View file

@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"unicopia:rocks" "unicopia:rocks",
"unicopia:frosted_obsidian"
] ]
} }

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"unicopia:frosted_obsidian"
]
}