9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 12:29:15 +00:00

添加蘑菇

This commit is contained in:
jhqwqmc
2025-09-24 15:35:41 +08:00
parent 403880d531
commit aad894c5f0
16 changed files with 432 additions and 16 deletions

View File

@@ -0,0 +1,99 @@
package net.momirealms.craftengine.bukkit.block.behavior;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.momirealms.craftengine.bukkit.block.BukkitBlockManager;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.*;
import net.momirealms.craftengine.bukkit.util.BlockStateUtils;
import net.momirealms.craftengine.bukkit.util.DirectionUtils;
import net.momirealms.craftengine.core.block.BlockBehavior;
import net.momirealms.craftengine.core.block.CustomBlock;
import net.momirealms.craftengine.core.block.ImmutableBlockState;
import net.momirealms.craftengine.core.block.behavior.BlockBehaviorFactory;
import net.momirealms.craftengine.core.block.properties.BooleanProperty;
import net.momirealms.craftengine.core.block.properties.Property;
import net.momirealms.craftengine.core.util.*;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
public class BuddingBlockBehavior extends BukkitBlockBehavior {
public static final Factory FACTORY = new Factory();
private final int growthChance;
private final List<Key> blocks;
public BuddingBlockBehavior(CustomBlock customBlock, int growthChance, List<Key> blocks) {
super(customBlock);
this.growthChance = growthChance;
this.blocks = blocks;
}
@Override
public void randomTick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
if (RandomUtils.generateRandomInt(0, this.growthChance) != 0) return;
Object nmsDirection = CoreReflections.instance$Direction$values[RandomUtils.generateRandomInt(0, 6)];
Direction direction = DirectionUtils.fromNMSDirection(nmsDirection);
Object blockPos = FastNMS.INSTANCE.method$BlockPos$relative(args[2], nmsDirection);
Object blockState = FastNMS.INSTANCE.method$BlockGetter$getBlockState(args[1], blockPos);
if (canClusterGrowAtState(blockState)) {
Key blockId = blocks.getFirst();
CustomBlock firstBlock = BukkitBlockManager.instance().blockById(blockId).orElse(null);
placeWithPropertyBlock(firstBlock, blockId, direction, nmsDirection, args[1], blockPos, blockState);
} else {
Key blockId = BlockStateUtils.getOptionalCustomBlockState(blockState)
.map(it -> it.owner().value().id())
.orElseGet(() -> BlockStateUtils.getBlockOwnerIdFromState(blockState));
int blockIdIndex = blocks.indexOf(blockId);
if (blockIdIndex < 0 || blockIdIndex == blocks.size() - 1) return;
Key nextBlockId = blocks.get(blockIdIndex + 1);
CustomBlock nextBlock = BukkitBlockManager.instance().blockById(nextBlockId).orElse(null);
placeWithPropertyBlock(nextBlock, nextBlockId, direction, nmsDirection, args[1], blockPos, blockState);
}
}
@SuppressWarnings("unchecked")
private void placeWithPropertyBlock(CustomBlock customBlock, Key blockId, Direction direction, Object nmsDirection, Object level, Object blockPos, Object blockState) {
if (customBlock != null) {
ImmutableBlockState newState = customBlock.defaultState();
Property<?> facing = customBlock.getProperty("facing");
if (facing != null) {
if (facing.valueClass() == Direction.class) {
newState = newState.with((Property<Direction>) facing, direction);
} else if (facing.valueClass() == HorizontalDirection.class) {
if (!direction.axis().isHorizontal()) return;
newState = newState.with((Property<HorizontalDirection>) facing, direction.toHorizontalDirection());
}
}
BooleanProperty waterlogged = (BooleanProperty) customBlock.getProperty("waterlogged");
if (waterlogged != null) {
newState = newState.with(waterlogged, FastNMS.INSTANCE.method$FluidState$getType(FastNMS.INSTANCE.field$BlockBehaviour$BlockStateBase$fluidState(blockState)) == MFluids.WATER);
}
FastNMS.INSTANCE.method$LevelWriter$setBlock(level, blockPos, newState.customBlockState().literalObject(), 3);
} else if (blockId.namespace().equals("minecraft")) {
Object block = FastNMS.INSTANCE.method$Registry$getValue(MBuiltInRegistries.BLOCK, FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", blockId.value()));
if (block == null) return;
Object newState = FastNMS.INSTANCE.method$Block$defaultState(block);
newState = FastNMS.INSTANCE.method$StateHolder$trySetValue(newState, MBlockStateProperties.WATERLOGGED, FastNMS.INSTANCE.method$FluidState$getType(FastNMS.INSTANCE.field$BlockBehaviour$BlockStateBase$fluidState(blockState)) == MFluids.WATER);
newState = FastNMS.INSTANCE.method$StateHolder$trySetValue(newState, MBlockStateProperties.FACING, (Comparable<?>) nmsDirection);
FastNMS.INSTANCE.method$LevelWriter$setBlock(level, blockPos, newState, 3);
}
}
public static boolean canClusterGrowAtState(Object state) {
return FastNMS.INSTANCE.method$BlockStateBase$isAir(state)
|| FastNMS.INSTANCE.method$BlockStateBase$isBlock(state, MBlocks.WATER)
&& FastNMS.INSTANCE.field$FluidState$amount(FastNMS.INSTANCE.field$BlockBehaviour$BlockStateBase$fluidState(state)) == 8;
}
public static class Factory implements BlockBehaviorFactory {
@Override
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
int growthChance = ResourceConfigUtils.getAsInt(arguments.getOrDefault("growth-chance", 5), "growth-chance");
List<Key> blocks = new ObjectArrayList<>();
MiscUtils.getAsStringList(arguments.get("blocks")).forEach(s -> blocks.add(Key.of(s)));
return new BuddingBlockBehavior(block, growthChance, blocks);
}
}
}

View File

@@ -42,6 +42,7 @@ public class BukkitBlockBehaviors extends BlockBehaviors {
public static final Key STEM_BLOCK = Key.from("craftengine:stem_block");
public static final Key ATTACHED_STEM_BLOCK = Key.from("craftengine:attached_stem_block");
public static final Key CHIME_BLOCK = Key.from("craftengine:chime_block");
public static final Key BUDDING_BLOCK = Key.from("craftengine:budding_block");
public static void init() {
register(EMPTY, (block, args) -> EmptyBlockBehavior.INSTANCE);
@@ -82,5 +83,6 @@ public class BukkitBlockBehaviors extends BlockBehaviors {
register(STEM_BLOCK, StemBlockBehavior.FACTORY);
register(ATTACHED_STEM_BLOCK, AttachedStemBlockBehavior.FACTORY);
register(CHIME_BLOCK, ChimeBlockBehavior.FACTORY);
register(BUDDING_BLOCK, BuddingBlockBehavior.FACTORY);
}
}

View File

@@ -1,6 +1,7 @@
package net.momirealms.craftengine.bukkit.plugin.reflection.minecraft;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.gson.JsonElement;
import com.mojang.serialization.Codec;
import com.mojang.serialization.DynamicOps;
@@ -4429,4 +4430,8 @@ public final class CoreReflections {
public static final Method method$BlockBehaviour$onProjectileHit = requireNonNull(
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, void.class, new String[]{"onProjectileHit", "a"}, clazz$Level, clazz$BlockState, clazz$BlockHitResult, clazz$Projectile)
);
public static final Field field$EnumProperty$values = requireNonNull(
ReflectionUtils.getDeclaredField(clazz$EnumProperty, VersionHelper.isOrAbove1_21_2() ? List.class : ImmutableSet.class, 0)
);
}

View File

@@ -4,24 +4,34 @@ import net.momirealms.craftengine.bukkit.plugin.reflection.ReflectionInitExcepti
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import static java.util.Objects.requireNonNull;
public final class MBlockStateProperties {
public static final Object WATERLOGGED;
public static final Object FACING;
static {
try {
Object waterlogged = null;
Object facing = null;
for (Field field : CoreReflections.clazz$BlockStateProperties.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) {
Object instance = field.get(null);
if (CoreReflections.clazz$Property.isInstance(instance) && CoreReflections.field$Property$name.get(instance).equals("waterlogged")) {
waterlogged = instance;
} else if (CoreReflections.clazz$EnumProperty.isInstance(instance) && CoreReflections.field$Property$name.get(instance).equals("facing")) {
@SuppressWarnings("unchecked")
Collection<Object> values = (Collection<Object>) CoreReflections.field$EnumProperty$values.get(instance);
if (values.size() == CoreReflections.instance$Direction$values.length) {
facing = instance;
}
}
}
}
WATERLOGGED = requireNonNull(waterlogged);
FACING = requireNonNull(facing);
} catch (ReflectiveOperationException e) {
throw new ReflectionInitException("Failed to init MBlockStateProperties", e);
}

View File

@@ -4340,10 +4340,10 @@ minecraft:heavy_weighted_pressure_plate[power=15]: minecraft:heavy_weighted_pres
# minecraft:dead_bubble_coral[waterlogged=true]: minecraft:bubble_coral[waterlogged=true]
# minecraft:dead_bubble_coral_fan[waterlogged=false]: minecraft:bubble_coral_fan[waterlogged=false]
# minecraft:dead_bubble_coral_fan[waterlogged=true]: minecraft:bubble_coral_fan[waterlogged=true]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=east]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=east]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=north]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=north]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=south]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=south]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=west]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=west]
minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=east]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=east]
minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=north]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=north]
minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=south]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=south]
minecraft:dead_bubble_coral_wall_fan[waterlogged=false,facing=west]: minecraft:bubble_coral_wall_fan[waterlogged=false,facing=west]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=true,facing=east]: minecraft:bubble_coral_wall_fan[waterlogged=true,facing=east]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=true,facing=north]: minecraft:bubble_coral_wall_fan[waterlogged=true,facing=north]
# minecraft:dead_bubble_coral_wall_fan[waterlogged=true,facing=south]: minecraft:bubble_coral_wall_fan[waterlogged=true,facing=south]
@@ -4352,10 +4352,10 @@ minecraft:heavy_weighted_pressure_plate[power=15]: minecraft:heavy_weighted_pres
# minecraft:dead_fire_coral[waterlogged=true]: minecraft:fire_coral[waterlogged=true]
# minecraft:dead_fire_coral_fan[waterlogged=false]: minecraft:fire_coral_fan[waterlogged=false]
# minecraft:dead_fire_coral_fan[waterlogged=true]: minecraft:fire_coral_fan[waterlogged=true]
# minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=east]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=east]
# minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=north]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=north]
# minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=south]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=south]
# minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=west]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=west]
minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=east]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=east]
minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=north]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=north]
minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=south]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=south]
minecraft:dead_fire_coral_wall_fan[waterlogged=false,facing=west]: minecraft:fire_coral_wall_fan[waterlogged=false,facing=west]
# minecraft:dead_fire_coral_wall_fan[waterlogged=true,facing=east]: minecraft:fire_coral_wall_fan[waterlogged=true,facing=east]
# minecraft:dead_fire_coral_wall_fan[waterlogged=true,facing=north]: minecraft:fire_coral_wall_fan[waterlogged=true,facing=north]
# minecraft:dead_fire_coral_wall_fan[waterlogged=true,facing=south]: minecraft:fire_coral_wall_fan[waterlogged=true,facing=south]
@@ -4364,10 +4364,10 @@ minecraft:heavy_weighted_pressure_plate[power=15]: minecraft:heavy_weighted_pres
# minecraft:dead_horn_coral[waterlogged=true]: minecraft:horn_coral[waterlogged=true]
# minecraft:dead_horn_coral_fan[waterlogged=false]: minecraft:horn_coral_fan[waterlogged=false]
# minecraft:dead_horn_coral_fan[waterlogged=true]: minecraft:horn_coral_fan[waterlogged=true]
# minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=east]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=east]
# minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=north]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=north]
# minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=south]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=south]
# minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=west]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=west]
minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=east]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=east]
minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=north]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=north]
minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=south]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=south]
minecraft:dead_horn_coral_wall_fan[waterlogged=false,facing=west]: minecraft:horn_coral_wall_fan[waterlogged=false,facing=west]
# minecraft:dead_horn_coral_wall_fan[waterlogged=true,facing=east]: minecraft:horn_coral_wall_fan[waterlogged=true,facing=east]
# minecraft:dead_horn_coral_wall_fan[waterlogged=true,facing=north]: minecraft:horn_coral_wall_fan[waterlogged=true,facing=north]
# minecraft:dead_horn_coral_wall_fan[waterlogged=true,facing=south]: minecraft:horn_coral_wall_fan[waterlogged=true,facing=south]

View File

@@ -0,0 +1,155 @@
items:
default:infected_palm_log:
material: nether_brick
custom-model-data: 3025
settings:
fuel-time: 300
tags:
- default:palm_logs
- minecraft:logs
- minecraft:logs_that_burn
data:
item-name: <!i><i18n:item.infected_palm_log>
model:
type: minecraft:model
path: minecraft:item/custom/palm_log
generation:
parent: minecraft:block/custom/palm_log
behavior:
type: block_item
block: default:infected_palm_log
default:small_mushroom:
material: nether_brick
custom-model-data: 3026
data:
item-name: <!i><i18n:item.small_mushroom>
model:
type: minecraft:model
path: minecraft:item/custom/small_mushroom
generation:
parent: minecraft:block/custom/small_mushroom
behavior:
type: block_item
block: default:small_mushroom
default:medium_mushroom:
material: nether_brick
custom-model-data: 3027
data:
item-name: <!i><i18n:item.medium_mushroom>
model:
type: minecraft:model
path: minecraft:item/custom/medium_mushroom
generation:
parent: minecraft:block/custom/medium_mushroom
behavior:
type: block_item
block: default:medium_mushroom
default:large_mushroom:
material: nether_brick
custom-model-data: 3028
data:
item-name: <!i><i18n:item.large_mushroom>
model:
type: minecraft:model
path: minecraft:item/custom/large_mushroom
generation:
parent: minecraft:block/custom/large_mushroom
behavior:
type: block_item
block: default:large_mushroom
blocks:
default:infected_palm_log:
behavior:
- type: strippable_block
stripped: default:stripped_palm_log
- type: budding_block
growth-chance: 5
blocks:
- default:small_mushroom
- default:medium_mushroom
- default:large_mushroom
loot:
template: default:loot_table/self
settings:
template: default:settings/wood
overrides:
is-randomly-ticking: true
map-color: 2
states:
template: default:block_state/pillar
arguments:
base_block: note_block
texture_top_path: minecraft:block/custom/palm_log_top
texture_side_path: minecraft:block/custom/palm_log
model_vertical_path: minecraft:block/custom/palm_log
model_horizontal_path: minecraft:block/custom/palm_log_horizontal
vanilla_id:
type: self_increase_int
from: 31
to: 33
internal_id:
type: self_increase_int
from: 31
to: 33
default:small_mushroom:
settings:
template:
- default:sound/crop
- default:hardness/none
overrides:
push-reaction: destroy
map-color: 26
luminance: 1
tags:
- minecraft:enderman_holdable
- minecraft:replaceable_by_mushrooms
behavior:
type: directional_attached_block
states:
template: default:block_state/mushroom
arguments:
base_block: dead_bubble_coral_wall_fan
model_path: minecraft:block/custom/small_mushroom
default:medium_mushroom:
behavior:
type: directional_attached_block
settings:
template:
- default:sound/crop
- default:hardness/none
overrides:
push-reaction: destroy
map-color: 26
luminance: 1
tags:
- minecraft:enderman_holdable
- minecraft:replaceable_by_mushrooms
states:
template: default:block_state/mushroom
arguments:
base_block: dead_horn_coral_wall_fan
model_path: minecraft:block/custom/medium_mushroom
default:large_mushroom:
loot:
template: default:loot_table/basic
arguments:
item: minecraft:brown_mushroom
behavior:
type: directional_attached_block
settings:
template:
- default:sound/crop
- default:hardness/none
overrides:
push-reaction: destroy
map-color: 26
luminance: 1
tags:
- minecraft:enderman_holdable
- minecraft:replaceable_by_mushrooms
states:
template: default:block_state/mushroom
arguments:
base_block: dead_fire_coral_wall_fan
model_path: minecraft:block/custom/large_mushroom

View File

@@ -297,6 +297,8 @@ blocks:
template: default:loot_table/self
settings:
template: default:settings/wood
overrides:
map-color: 2
states:
template: default:block_state/pillar
arguments:
@@ -318,6 +320,8 @@ blocks:
template: default:loot_table/self
settings:
template: default:settings/wood
overrides:
map-color: 2
states:
template: default:block_state/pillar
arguments:
@@ -342,6 +346,8 @@ blocks:
template: default:loot_table/self
settings:
template: default:settings/wood
overrides:
map-color: 2
states:
template: default:block_state/pillar
arguments:
@@ -363,6 +369,8 @@ blocks:
template: default:loot_table/self
settings:
template: default:settings/wood
overrides:
map-color: 2
states:
template: default:block_state/pillar
arguments:
@@ -382,6 +390,8 @@ blocks:
default:palm_planks:
settings:
template: default:settings/planks
overrides:
map-color: 2
loot:
template: default:loot_table/self
state:
@@ -437,6 +447,8 @@ blocks:
sapling: default:palm_sapling
settings:
template: default:settings/leaves
overrides:
map-color: 19
states:
template: default:block_state/leaves
arguments:

View File

@@ -29,6 +29,7 @@ categories:
- default:palm_pressure_plate
- default:palm_button
- default:palm_fence
- default:infected_palm_log
default:topaz:
name: <!i><#FF8C00><i18n:category.topaz></#FF8C00>
hidden: true
@@ -83,4 +84,7 @@ categories:
- default:amethyst_torch
- default:hami_melon_seeds
- default:hami_melon_slice
- default:hami_melon
- default:hami_melon
- default:small_mushroom
- default:medium_mushroom
- default:large_mushroom

View File

@@ -54,6 +54,10 @@ i18n:
item.hami_melon_seeds: Hami Melon Seeds
item.palm_button: Palm Button
item.palm_fence: Palm Fence
item.infected_palm_log: Infected Palm Log
item.small_mushroom: Small Mushroom
item.medium_mushroom: Medium Mushroom
item.large_mushroom: Large Mushroom
category.default.name: Default Assets
category.default.lore: Contains the default configuration of CraftEngine
category.palm_tree: Palm Tree
@@ -117,6 +121,10 @@ i18n:
item.hami_melon_seeds: 哈密瓜种子
item.palm_button: 棕榈木按钮
item.palm_fence: 棕榈木栅栏
item.infected_palm_log: 菌蚀棕榈原木
item.small_mushroom: 小型蘑菇
item.medium_mushroom: 中型蘑菇
item.large_mushroom: 大型蘑菇
category.default.name: 默认资产
category.default.lore: 包含了CraftEngine的默认配置
category.palm_tree: 棕榈树
@@ -164,6 +172,10 @@ lang:
block_name:default:default:attached_hami_melon_stem: Hami Melon Stem
block_name:default:palm_button: Palm Button
block_name:default:palm_fence: Palm Fence
block_name:default:infected_palm_log: Infected Palm Log
block_name:default:small_mushroom: Small Mushroom
block_name:default:medium_mushroom: Medium Mushroom
block_name:default:large_mushroom: Large Mushroom
zh_cn:
block_name:default:chinese_lantern: 灯笼
block_name:default:netherite_anvil: 下界合金砧
@@ -199,3 +211,7 @@ lang:
block_name:default:default:attached_hami_melon_stem: 哈密瓜茎
block_name:default:palm_button: 棕榈木按钮
block_name:default:palm_fence: 棕榈木栅栏
block_name:default:infected_palm_log: 菌蚀棕榈原木
block_name:default:small_mushroom: 小型蘑菇
block_name:default:medium_mushroom: 中型蘑菇
block_name:default:large_mushroom: 大型蘑菇

View File

@@ -2,6 +2,7 @@ items:
default:gui_head_size_1:
material: player_head
custom-model-data: 1000
item-model: default:gui_head_size_1
model:
type: minecraft:special
path: minecraft:item/custom/gui_head_size_1
@@ -17,6 +18,7 @@ items:
default:gui_head_size_4:
material: player_head
custom-model-data: 1001
item-model: default:gui_head_size_4
model:
type: minecraft:special
path: minecraft:item/custom/gui_head_size_4

View File

@@ -3930,6 +3930,43 @@ templates#block_states:
resistance: 1200.0
burnable: false
fluid-state: water
default:block_state/mushroom:
properties:
facing:
type: horizontal_direction
appearances:
north:
state: ${base_block}[waterlogged=false,facing=north]
model:
path: ${model_path}
east:
state: ${base_block}[waterlogged=false,facing=east]
model:
path: ${model_path}
y: 90
west:
state: ${base_block}[waterlogged=false,facing=west]
model:
path: ${model_path}
y: 270
south:
state: ${base_block}[waterlogged=false,facing=south]
model:
path: ${model_path}
y: 180
variants:
facing=north:
appearance: north
id: 0
facing=east:
appearance: east
id: 1
facing=west:
appearance: west
id: 2
facing=south:
appearance: south
id: 3
# recipes
templates#recipes:
default:recipe/planks:

View File

@@ -1,6 +1,7 @@
{
"textures": {
"0": "block/custom/mushroom"
"0": "block/custom/mushroom",
"particle": "block/custom/mushroom"
},
"elements": [
{
@@ -146,6 +147,26 @@
"fixed": {
"translation": [0, 0, -16],
"scale": [2, 2, 2]
},
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"translation": [-1.5, 2.5, 1],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 45, 0],
"translation": [-1.5, 2.5, 1],
"scale": [0.4, 0.4, 0.4]
}
}
}

View File

@@ -1,6 +1,7 @@
{
"textures": {
"0": "block/custom/mushroom"
"0": "block/custom/mushroom",
"particle": "block/custom/mushroom"
},
"elements": [
{
@@ -81,6 +82,26 @@
"fixed": {
"translation": [0, 0, -16],
"scale": [2, 2, 2]
},
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"translation": [-1.5, 2.5, 1],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 45, 0],
"translation": [-1.5, 2.5, 1],
"scale": [0.4, 0.4, 0.4]
}
}
}

View File

@@ -1,7 +1,8 @@
{
"texture_size": [32, 32],
"textures": {
"0": "block/custom/mushroom"
"0": "block/custom/mushroom",
"particle": "block/custom/mushroom"
},
"elements": [
{
@@ -69,6 +70,26 @@
"fixed": {
"translation": [0, 0, -16.25],
"scale": [2, 2, 2]
},
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"translation": [-1.5, 2.5, 1],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 45, 0],
"translation": [-1.5, 2.5, 1],
"scale": [0.4, 0.4, 0.4]
}
}
}

View File

@@ -1,5 +1,6 @@
package net.momirealms.craftengine.core.block.properties;
import com.google.common.base.MoreObjects;
import net.momirealms.craftengine.core.block.ImmutableBlockState;
import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
import net.momirealms.craftengine.core.util.Direction;
@@ -167,4 +168,9 @@ public abstract class Property<T extends Comparable<T>> {
public static <T extends Comparable<T>> String formatValue(Property<T> property, Comparable<?> value) {
return property.valueName((T) value);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("name", this.name).add("clazz", this.clazz).add("values", this.possibleValues()).toString();
}
}

View File

@@ -432,6 +432,7 @@ public abstract class AbstractPackManager implements PackManager {
plugin.saveResource("resources/default/configuration/blocks/netherite_anvil.yml");
plugin.saveResource("resources/default/configuration/blocks/amethyst_torch.yml");
plugin.saveResource("resources/default/configuration/blocks/hami_melon.yml");
plugin.saveResource("resources/default/configuration/blocks/mushroom.yml");
// assets
plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/font/image/emojis.png");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/chinese_lantern.png");
@@ -544,6 +545,10 @@ public abstract class AbstractPackManager implements PackManager {
plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/hami_melon_slice.png");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/hami_melon_seeds.png");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/fence_side.json");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/mushroom.png");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/small_mushroom.json");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/medium_mushroom.json");
plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/large_mushroom.json");
}
private TreeMap<ConfigParser, List<CachedConfigSection>> updateCachedConfigFiles() {