mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 07:17:58 +01:00
Make places hay bales edible
This commit is contained in:
parent
d47a1a52f5
commit
f2b817d635
44 changed files with 1027 additions and 50 deletions
1
assets/models/hay_bale.bbmodel
Normal file
1
assets/models/hay_bale.bbmodel
Normal file
File diff suppressed because one or more lines are too long
113
assets/models/hay_bale.json
Normal file
113
assets/models/hay_bale.json
Normal file
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "blocks/hay_block_top",
|
||||
"particle": "blocks/hay_block_side",
|
||||
"side": "blocks/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "bottom_south_east",
|
||||
"from": [8, 0, 8],
|
||||
"to": [16, 8, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"east": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"south": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"west": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"up": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"down": {"uv": [8, 0, 16, 8], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "top_south_east",
|
||||
"from": [8, 8, 8],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"east": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"south": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"west": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"up": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"down": {"uv": [8, 0, 16, 8], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bottom_north_east",
|
||||
"from": [8, 0, 0],
|
||||
"to": [16, 8, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"east": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"south": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"west": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"up": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"down": {"uv": [8, 8, 16, 16], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "top_north_east",
|
||||
"from": [8, 8, 0],
|
||||
"to": [16, 16, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"east": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"south": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"west": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"up": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"down": {"uv": [8, 8, 16, 16], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bottom_south_west",
|
||||
"from": [0, 0, 8],
|
||||
"to": [8, 8, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"east": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"south": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"west": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"up": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"down": {"uv": [0, 0, 8, 8], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "top_south_west",
|
||||
"from": [0, 8, 8],
|
||||
"to": [8, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"east": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"south": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"west": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"up": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"down": {"uv": [0, 0, 8, 8], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bottom_north_west",
|
||||
"from": [0, 0, 0],
|
||||
"to": [8, 8, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"east": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"south": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"west": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"up": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"down": {"uv": [0, 8, 8, 16], "texture": "#top"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "top_north_west",
|
||||
"from": [0, 8, 0],
|
||||
"to": [8, 16, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"east": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"south": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"west": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"up": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"down": {"uv": [0, 8, 8, 16], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -12,6 +12,7 @@ import com.minelittlepony.unicopia.UTags;
|
|||
import com.minelittlepony.unicopia.ability.data.Hit;
|
||||
import com.minelittlepony.unicopia.ability.data.Pos;
|
||||
import com.minelittlepony.unicopia.block.UBlocks;
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||
|
@ -29,7 +30,6 @@ import net.minecraft.item.BoneMealItem;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -233,16 +233,7 @@ public class EarthPonyGrowAbility implements Ability<Pos> {
|
|||
}
|
||||
|
||||
public BlockState getResult(World world, BlockPos pos) {
|
||||
BlockState input = world.getBlockState(pos);
|
||||
BlockState output = this.output;
|
||||
for (var property : input.getProperties()) {
|
||||
output = copyProperty(input, output, property);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
private <T extends Comparable<T>> BlockState copyProperty(BlockState from, BlockState to, Property<T> property) {
|
||||
return to.withIfExists(property, from.get(property));
|
||||
return StateUtil.copyState(world.getBlockState(pos), output);
|
||||
}
|
||||
|
||||
record Result (TransmutationRecipe recipe, Set<BlockPos> matchedLocations) {
|
||||
|
|
214
src/main/java/com/minelittlepony/unicopia/block/EdibleBlock.java
Normal file
214
src/main/java/com/minelittlepony/unicopia/block/EdibleBlock.java
Normal file
|
@ -0,0 +1,214 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.USounds;
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HayBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EdibleBlock extends HayBlock {
|
||||
private static final List<EdibleBlock> REGISTRY = new ArrayList<>();
|
||||
|
||||
static final BooleanProperty TOP_NORTH_EAST = BooleanProperty.of("top_north_east");
|
||||
static final BooleanProperty TOP_NORTH_WEST = BooleanProperty.of("top_north_west");
|
||||
static final BooleanProperty TOP_SOUTH_EAST = BooleanProperty.of("top_south_east");
|
||||
static final BooleanProperty TOP_SOUTH_WEST = BooleanProperty.of("top_south_west");
|
||||
|
||||
static final BooleanProperty BOTTOM_NORTH_EAST = BooleanProperty.of("bottom_north_east");
|
||||
static final BooleanProperty BOTTOM_NORTH_WEST = BooleanProperty.of("bottom_north_west");
|
||||
static final BooleanProperty BOTTOM_SOUTH_EAST = BooleanProperty.of("bottom_south_east");
|
||||
static final BooleanProperty BOTTOM_SOUTH_WEST = BooleanProperty.of("bottom_south_west");
|
||||
|
||||
// [up/down][north/south][west/east]
|
||||
private static final BooleanProperty[] SEGMENTS = {
|
||||
BOTTOM_NORTH_WEST,
|
||||
BOTTOM_NORTH_EAST,
|
||||
BOTTOM_SOUTH_WEST,
|
||||
BOTTOM_SOUTH_EAST,
|
||||
TOP_NORTH_WEST,
|
||||
TOP_NORTH_EAST,
|
||||
TOP_SOUTH_WEST,
|
||||
TOP_SOUTH_EAST
|
||||
};
|
||||
private static final VoxelShape[] SHAPES = {
|
||||
Block.createCuboidShape(0, 0, 0, 8, 8, 8),
|
||||
Block.createCuboidShape(8, 0, 0, 16, 8, 8),
|
||||
Block.createCuboidShape(0, 0, 8, 8, 8, 16),
|
||||
Block.createCuboidShape(8, 0, 8, 16, 8, 16),
|
||||
Block.createCuboidShape(0, 8, 0, 8, 16, 8),
|
||||
Block.createCuboidShape(8, 8, 0, 16, 16, 8),
|
||||
Block.createCuboidShape(0, 8, 8, 8, 16, 16),
|
||||
Block.createCuboidShape(8, 8, 8, 16, 16, 16)
|
||||
};
|
||||
private static final Function<BlockState, VoxelShape> SHAPE_CACHE = Util.memoize(state -> {
|
||||
@Nullable
|
||||
VoxelShape shape = null;
|
||||
for (int i = 0; i < SEGMENTS.length; i++) {
|
||||
if (state.get(SEGMENTS[i])) {
|
||||
shape = shape == null ? SHAPES[i] : VoxelShapes.union(shape, SHAPES[i]);
|
||||
}
|
||||
}
|
||||
return shape == null ? VoxelShapes.fullCube() : shape.simplify();
|
||||
});
|
||||
|
||||
static void bootstrap() {
|
||||
UseBlockCallback.EVENT.register((PlayerEntity player, World world, Hand hand, BlockHitResult hitResult) -> {
|
||||
if (!Pony.of(player).getSpecies().isEquine()
|
||||
|| (player.shouldCancelInteraction() && (!player.getMainHandStack().isEmpty() || !player.getOffHandStack().isEmpty()))) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
BlockPos pos = hitResult.getBlockPos();
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
||||
for (EdibleBlock edibleBlock : REGISTRY) {
|
||||
Block match = edibleBlock.getBaseBlock();
|
||||
if (match != Blocks.AIR && state.isOf(match)) {
|
||||
ActionResult result = StateUtil.copyState(state, edibleBlock.getDefaultState()).onUse(world, player, hand, hitResult);
|
||||
|
||||
if (result.isAccepted()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ActionResult.PASS;
|
||||
});
|
||||
}
|
||||
|
||||
private final Identifier baseBlock;
|
||||
|
||||
public EdibleBlock(Identifier baseBlock, boolean register) {
|
||||
super(Settings.copy(Blocks.HAY_BLOCK));
|
||||
for (BooleanProperty segment : SEGMENTS) {
|
||||
setDefaultState(getDefaultState().with(segment, true));
|
||||
}
|
||||
this.baseBlock = baseBlock;
|
||||
if (register) {
|
||||
REGISTRY.add(this);
|
||||
FlammableBlockRegistry.getDefaultInstance().add(this, 60, 20);
|
||||
}
|
||||
}
|
||||
|
||||
public Block getBaseBlock() {
|
||||
return Registries.BLOCK.get(baseBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey() {
|
||||
return getBaseBlock().getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
super.appendProperties(builder);
|
||||
builder.add(SEGMENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return SHAPE_CACHE.apply(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
if (player.isSpectator()) {
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
ItemStack stack = player.getStackInHand(hand);
|
||||
if (stack.isOf(Items.WHEAT)) {
|
||||
BooleanProperty segment = getHitCorner(hit, 1);
|
||||
|
||||
if (!state.get(segment)) {
|
||||
stack.decrement(1);
|
||||
if (!world.isClient) {
|
||||
state = state.with(segment, true);
|
||||
if (SHAPE_CACHE.apply(state) == VoxelShapes.fullCube()) {
|
||||
state = StateUtil.copyState(state, getBaseBlock().getDefaultState());
|
||||
}
|
||||
world.setBlockState(pos, state);
|
||||
}
|
||||
world.playSound(player, pos, this.getSoundGroup(state).getPlaceSound(), SoundCategory.BLOCKS);
|
||||
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
BooleanProperty corner = getHitCorner(hit, -1);
|
||||
|
||||
if (!state.get(corner)) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
if (!(player.isCreative() || player.getHungerManager().isNotFull()) || !player.isSneaking()) {
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (!world.isClient) {
|
||||
state = state.with(corner, false);
|
||||
if (SHAPE_CACHE.apply(state) == VoxelShapes.fullCube()) {
|
||||
world.removeBlock(pos, false);
|
||||
} else {
|
||||
world.setBlockState(pos, state);
|
||||
}
|
||||
}
|
||||
player.playSound(USounds.Vanilla.ENTITY_GENERIC_EAT, 1, 1);
|
||||
if (world.random.nextInt(10) == 0) {
|
||||
player.playSound(USounds.Vanilla.ENTITY_PLAYER_BURP, 1, player.getSoundPitch());
|
||||
}
|
||||
player.getHungerManager().add(4, 2.3F);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
static BooleanProperty getHitCorner(BlockHitResult hit, int direction) {
|
||||
Vec3d pos = hit.getPos().add(Vec3d.of(hit.getSide().getVector()).multiply(direction * 0.001F));
|
||||
|
||||
BlockPos bPos = hit.getBlockPos();
|
||||
|
||||
return SEGMENTS[
|
||||
(4 * getIndex(pos.y, bPos.getY()))
|
||||
+ (2 * getIndex(pos.z, bPos.getZ()))
|
||||
+ (1 - getIndex(pos.x, bPos.getX()))
|
||||
];
|
||||
}
|
||||
|
||||
static int getIndex(double axisHit, int tile) {
|
||||
axisHit = Math.abs(axisHit);
|
||||
tile = Math.abs(tile);
|
||||
return axisHit - ((int)axisHit) > 0.5 ? 1 : 0;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ import com.minelittlepony.unicopia.server.world.UTreeGen;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock.Settings;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
|
@ -224,6 +225,8 @@ public interface UBlocks {
|
|||
Block CRYSTAL_DOOR = register("crystal_door", new CrystalDoorBlock(Settings.copy(Blocks.IRON_DOOR), UWoodTypes.CRYSTAL), ItemGroups.FUNCTIONAL);
|
||||
Block CLOUD_DOOR = register("cloud_door", new CloudDoorBlock(Settings.copy(CLOUD), CLOUD.getDefaultState(), UWoodTypes.CLOUD), ItemGroups.FUNCTIONAL);
|
||||
|
||||
EdibleBlock HAY_BLOCK = register("hay_block", new EdibleBlock(new Identifier("hay_block"), true));
|
||||
|
||||
private static <T extends Block> T register(String name, T item) {
|
||||
return register(Unicopia.id(name), item);
|
||||
}
|
||||
|
@ -247,10 +250,15 @@ public interface UBlocks {
|
|||
if (block instanceof CloudLike || block instanceof SlimePustuleBlock || block instanceof PileBlock) {
|
||||
SEMI_TRANSPARENT_BLOCKS.add(block);
|
||||
}
|
||||
|
||||
return Registry.register(Registries.BLOCK, id, block);
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
if (FabricLoader.getInstance().isModLoaded("farmersdelight")) {
|
||||
register("rice_block", new EdibleBlock(new Identifier("farmersdelight", "rice_bale"), true));
|
||||
register("straw_block", new EdibleBlock(new Identifier("farmersdelight", "straw_bale"), true));
|
||||
}
|
||||
BlockEntityTypeSupportHelper.of(BlockEntityType.SIGN).addSupportedBlocks(PALM_SIGN, PALM_WALL_SIGN);
|
||||
BlockEntityTypeSupportHelper.of(BlockEntityType.HANGING_SIGN).addSupportedBlocks(PALM_HANGING_SIGN, PALM_WALL_HANGING_SIGN);
|
||||
|
||||
|
@ -276,5 +284,6 @@ public interface UBlocks {
|
|||
FlammableBlockRegistry.getDefaultInstance().add(BANANAS, 5, 20);
|
||||
|
||||
UBlockEntities.bootstrap();
|
||||
EdibleBlock.bootstrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -22,7 +24,7 @@ public class PoreousCloudBlock extends CloudBlock implements Soakable {
|
|||
@Override
|
||||
public BlockState getStateWithMoisture(BlockState state, int moisture) {
|
||||
if (moisture <= 0) {
|
||||
return Soakable.copyProperties(state, getDefaultState());
|
||||
return StateUtil.copyState(state, getDefaultState());
|
||||
}
|
||||
return soggyBlock == null ? null : soggyBlock.get().getStateWithMoisture(state, moisture);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
public class PoreousCloudStairsBlock extends CloudStairsBlock implements Soakable {
|
||||
|
@ -19,7 +21,7 @@ public class PoreousCloudStairsBlock extends CloudStairsBlock implements Soakabl
|
|||
@Override
|
||||
public BlockState getStateWithMoisture(BlockState state, int moisture) {
|
||||
if (moisture <= 0) {
|
||||
return Soakable.copyProperties(state, getDefaultState());
|
||||
return StateUtil.copyState(state, getDefaultState());
|
||||
}
|
||||
return soggyBlock.get().getStateWithMoisture(state, moisture);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.server.world.ServerWorld;
|
|||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
|
@ -105,15 +104,4 @@ public interface Soakable {
|
|||
world.setBlockState(pos, soakable.getStateWithMoisture(state, newMoisture));
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_SALMON_FLOP, SoundCategory.BLOCKS, 1, (float)world.random.nextTriangular(0.5, 0.3F));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
static BlockState copyProperties(BlockState from, @Nullable BlockState to) {
|
||||
if (to != null) {
|
||||
for (Property property : from.getProperties()) {
|
||||
to = to.withIfExists(property, from.get(property));
|
||||
}
|
||||
}
|
||||
return to;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -43,9 +45,9 @@ public class SoggyCloudBlock extends CloudBlock implements Soakable {
|
|||
@Override
|
||||
public BlockState getStateWithMoisture(BlockState state, int moisture) {
|
||||
if (moisture <= 0) {
|
||||
return Soakable.copyProperties(state, dryBlock.get().getDefaultState());
|
||||
return StateUtil.copyState(state, dryBlock.get().getDefaultState());
|
||||
}
|
||||
return Soakable.copyProperties(state, getDefaultState()).with(MOISTURE, moisture);
|
||||
return StateUtil.copyState(state, getDefaultState()).with(MOISTURE, moisture);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -43,9 +45,9 @@ public class SoggyCloudSlabBlock extends CloudSlabBlock {
|
|||
@Override
|
||||
public BlockState getStateWithMoisture(BlockState state, int moisture) {
|
||||
if (moisture <= 0) {
|
||||
return Soakable.copyProperties(state, dryBlock.get().getDefaultState());
|
||||
return StateUtil.copyState(state, dryBlock.get().getDefaultState());
|
||||
}
|
||||
return Soakable.copyProperties(state, getDefaultState()).with(MOISTURE, moisture);
|
||||
return StateUtil.copyState(state, getDefaultState()).with(MOISTURE, moisture);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.block.state.StateUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -36,8 +38,8 @@ public class SoggyCloudStairsBlock extends CloudStairsBlock implements Soakable
|
|||
@Override
|
||||
public BlockState getStateWithMoisture(BlockState state, int moisture) {
|
||||
if (moisture <= 0) {
|
||||
return Soakable.copyProperties(state, dryBlock.get().getDefaultState());
|
||||
return StateUtil.copyState(state, dryBlock.get().getDefaultState());
|
||||
}
|
||||
return Soakable.copyProperties(state, getDefaultState()).with(MOISTURE, moisture);
|
||||
return StateUtil.copyState(state, getDefaultState()).with(MOISTURE, moisture);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
@ -50,7 +49,7 @@ public abstract class StateChange {
|
|||
return state;
|
||||
}
|
||||
return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState)
|
||||
.map(newState -> merge(newState, state))
|
||||
.map(newState -> StateUtil.copyState(state, newState))
|
||||
.orElse(state);
|
||||
}
|
||||
};
|
||||
|
@ -101,17 +100,4 @@ public abstract class StateChange {
|
|||
return serializer.apply(json);
|
||||
}).orElseThrow(() -> new IllegalArgumentException("Invalid action " + action));
|
||||
}
|
||||
|
||||
private static BlockState merge(BlockState into, BlockState from) {
|
||||
for (var property : from.getProperties()) {
|
||||
if (into.contains(property)) {
|
||||
into = copy(into, from, property);
|
||||
}
|
||||
}
|
||||
return into;
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> BlockState copy(BlockState to, BlockState from, Property<T> property) {
|
||||
return to.with(property, from.get(property));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.minelittlepony.unicopia.block.state;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.Property;
|
||||
|
||||
public interface StateUtil {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
static BlockState copyState(BlockState from, @Nullable BlockState to) {
|
||||
if (to == null) {
|
||||
return to;
|
||||
}
|
||||
for (var property : from.getProperties()) {
|
||||
to = to.withIfExists((Property)property, from.get(property));
|
||||
}
|
||||
return to;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"multipart": [
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bne", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bnw", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bse", "x": 90, "y": 90 }, "when": { "axis": "x", "top_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bsw", "x": 90, "y": 90 }, "when": { "axis": "x", "top_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tne", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tnw", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tse", "x": 90, "y": 90 }, "when": { "axis": "x", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tsw", "x": 90, "y": 90 }, "when": { "axis": "x", "top_north_east": true } },
|
||||
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bne" }, "when": { "axis": "y", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bnw" }, "when": { "axis": "y", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bse" }, "when": { "axis": "y", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bsw" }, "when": { "axis": "y", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tne" }, "when": { "axis": "y", "top_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tnw" }, "when": { "axis": "y", "top_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tse" }, "when": { "axis": "y", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tsw" }, "when": { "axis": "y", "top_south_west": true } },
|
||||
|
||||
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bne", "x": 90 }, "when": { "axis": "z", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bnw", "x": 90 }, "when": { "axis": "z", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bse", "x": 90 }, "when": { "axis": "z", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_bsw", "x": 90 }, "when": { "axis": "z", "top_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tne", "x": 90 }, "when": { "axis": "z", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tnw", "x": 90 }, "when": { "axis": "z", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tse", "x": 90 }, "when": { "axis": "z", "top_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/hay_bale_tsw", "x": 90 }, "when": { "axis": "z", "top_north_west": true } }
|
||||
]
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"multipart": [
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bne", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bnw", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bse", "x": 90, "y": 90 }, "when": { "axis": "x", "top_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bsw", "x": 90, "y": 90 }, "when": { "axis": "x", "top_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tne", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tnw", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tse", "x": 90, "y": 90 }, "when": { "axis": "x", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tsw", "x": 90, "y": 90 }, "when": { "axis": "x", "top_north_east": true } },
|
||||
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bne" }, "when": { "axis": "y", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bnw" }, "when": { "axis": "y", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bse" }, "when": { "axis": "y", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bsw" }, "when": { "axis": "y", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tne" }, "when": { "axis": "y", "top_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tnw" }, "when": { "axis": "y", "top_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tse" }, "when": { "axis": "y", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tsw" }, "when": { "axis": "y", "top_south_west": true } },
|
||||
|
||||
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bne", "x": 90 }, "when": { "axis": "z", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bnw", "x": 90 }, "when": { "axis": "z", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bse", "x": 90 }, "when": { "axis": "z", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_bsw", "x": 90 }, "when": { "axis": "z", "top_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tne", "x": 90 }, "when": { "axis": "z", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tnw", "x": 90 }, "when": { "axis": "z", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tse", "x": 90 }, "when": { "axis": "z", "top_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/rice_bale_tsw", "x": 90 }, "when": { "axis": "z", "top_north_west": true } }
|
||||
]
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"multipart": [
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bne", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bnw", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bse", "x": 90, "y": 90 }, "when": { "axis": "x", "top_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bsw", "x": 90, "y": 90 }, "when": { "axis": "x", "top_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tne", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tnw", "x": 90, "y": 90 }, "when": { "axis": "x", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tse", "x": 90, "y": 90 }, "when": { "axis": "x", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tsw", "x": 90, "y": 90 }, "when": { "axis": "x", "top_north_east": true } },
|
||||
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bne" }, "when": { "axis": "y", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bnw" }, "when": { "axis": "y", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bse" }, "when": { "axis": "y", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bsw" }, "when": { "axis": "y", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tne" }, "when": { "axis": "y", "top_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tnw" }, "when": { "axis": "y", "top_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tse" }, "when": { "axis": "y", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tsw" }, "when": { "axis": "y", "top_south_west": true } },
|
||||
|
||||
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bne", "x": 90 }, "when": { "axis": "z", "bottom_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bnw", "x": 90 }, "when": { "axis": "z", "bottom_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bse", "x": 90 }, "when": { "axis": "z", "top_south_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_bsw", "x": 90 }, "when": { "axis": "z", "top_south_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tne", "x": 90 }, "when": { "axis": "z", "bottom_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tnw", "x": 90 }, "when": { "axis": "z", "bottom_north_west": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tse", "x": 90 }, "when": { "axis": "z", "top_north_east": true } },
|
||||
{ "apply": { "model": "unicopia:block/straw_bale_tsw", "x": 90 }, "when": { "axis": "z", "top_north_west": true } }
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "bottom_north_east",
|
||||
"from": [8, 0, 0],
|
||||
"to": [16, 8, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"east": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"south": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"west": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"up": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"down": {"uv": [8, 8, 16, 16], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "bottom_north_west",
|
||||
"from": [0, 0, 0],
|
||||
"to": [8, 8, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"east": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"south": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"west": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"up": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"down": {"uv": [0, 8, 8, 16], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "bottom_south_east",
|
||||
"from": [8, 0, 8],
|
||||
"to": [16, 8, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"east": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"south": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"west": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"up": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"down": {"uv": [8, 0, 16, 8], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "bottom_south_west",
|
||||
"from": [0, 0, 8],
|
||||
"to": [8, 8, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"east": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"south": {"uv": [0, 8, 8, 16], "texture": "#side"},
|
||||
"west": {"uv": [8, 8, 16, 16], "texture": "#side"},
|
||||
"up": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"down": {"uv": [0, 0, 8, 8], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "top_north_east",
|
||||
"from": [8, 8, 0],
|
||||
"to": [16, 16, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"east": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"south": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"west": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"up": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"down": {"uv": [8, 8, 16, 16], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "top_north_west",
|
||||
"from": [0, 8, 0],
|
||||
"to": [8, 16, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"east": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"south": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"west": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"up": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"down": {"uv": [0, 8, 8, 16], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "top_south_east",
|
||||
"from": [8, 8, 8],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"east": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"south": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"west": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"up": {"uv": [8, 8, 16, 16], "texture": "#top"},
|
||||
"down": {"uv": [8, 0, 16, 8], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"textures": {
|
||||
"top": "block/hay_block_top",
|
||||
"particle": "block/hay_block_side",
|
||||
"side": "block/hay_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "top_south_west",
|
||||
"from": [0, 8, 8],
|
||||
"to": [8, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#top"},
|
||||
"east": {"uv": [0, 0, 8, 8], "texture": "#top"},
|
||||
"south": {"uv": [0, 0, 8, 8], "texture": "#side"},
|
||||
"west": {"uv": [8, 0, 16, 8], "texture": "#side"},
|
||||
"up": {"uv": [0, 8, 8, 16], "texture": "#top"},
|
||||
"down": {"uv": [0, 0, 8, 8], "texture": "#top"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bne",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bnw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bse",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bsw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tne",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tnw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tse",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tsw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/rice_bale_top",
|
||||
"particle": "farmersdelight:block/rice_bale_side",
|
||||
"side": "farmersdelight:block/rice_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bne",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bnw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bse",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_bsw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tne",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tnw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tse",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "unicopia:block/hay_bale_tsw",
|
||||
"textures": {
|
||||
"top": "farmersdelight:block/straw_bale_end",
|
||||
"particle": "farmersdelight:block/straw_bale_side",
|
||||
"side": "farmersdelight:block/straw_bale_side"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
{ "id": "farmersdelight:horse_feed", "required": false }
|
||||
{ "id": "farmersdelight:horse_feed", "required": false },
|
||||
{ "id": "farmersdelight:rice_bale", "required": false },
|
||||
{ "id": "farmersdelight:straw_bale", "required": false }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"unicopia:sweet_apple_leaves",
|
||||
"unicopia:sour_apple_leaves",
|
||||
"unicopia:golden_oak_leaves",
|
||||
"unicopia:mango_leaves"
|
||||
"unicopia:mango_leaves",
|
||||
"unicopia:hay_block",
|
||||
{ "id": "unicopia:rice_block", "required": false },
|
||||
{ "id": "unicopia:straw_block", "required": false }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"top_north_east": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"top_north_west": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"top_south_east": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"top_south_west": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"bottom_north_east": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"bottom_north_west": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"bottom_south_east": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "unicopia:gold_root",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"bottom_south_west": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:binomial_with_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"extra": 3,
|
||||
"probability": 0.5714286
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
]
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
"values": [
|
||||
"minecraft:hay_block",
|
||||
"#minecraft:leaves",
|
||||
"#c:foraging/edibles_filling",
|
||||
{ "id": "farmersdelight:rice_bale", "required": false }
|
||||
"#c:foraging/edibles_filling"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue