mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
添加自定义简单状态提供者
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
package net.momirealms.craftengine.bukkit.block;
|
||||
|
||||
import net.momirealms.craftengine.bukkit.util.BlockStateUtils;
|
||||
import net.momirealms.craftengine.bukkit.util.LocationUtils;
|
||||
import net.momirealms.craftengine.core.block.AbstractCustomBlock;
|
||||
import net.momirealms.craftengine.core.block.BlockStateVariantProvider;
|
||||
import net.momirealms.craftengine.core.block.CustomBlock;
|
||||
import net.momirealms.craftengine.core.block.ImmutableBlockState;
|
||||
import net.momirealms.craftengine.core.entity.player.Player;
|
||||
import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
|
||||
import net.momirealms.craftengine.core.loot.LootTable;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
import net.momirealms.craftengine.core.plugin.context.Context;
|
||||
import net.momirealms.craftengine.core.plugin.context.event.EventTrigger;
|
||||
import net.momirealms.craftengine.core.plugin.context.function.Function;
|
||||
@@ -13,6 +19,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class BukkitCustomBlock extends AbstractCustomBlock {
|
||||
|
||||
@@ -24,4 +31,19 @@ public final class BukkitCustomBlock extends AbstractCustomBlock {
|
||||
) {
|
||||
super(holder, variantProvider, events, lootTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
try {
|
||||
this.behavior.setPlacedBy(BlockStateUtils.getBlockOwner(state.customBlockState().literalObject()), new Object[]{
|
||||
context.getLevel().serverWorld(),
|
||||
LocationUtils.toBlockPos(context.getClickedPos()),
|
||||
state.customBlockState().literalObject(),
|
||||
Optional.ofNullable(context.getPlayer()).map(Player::serverPlayer).orElse(null),
|
||||
context.getItem().getLiteralObject()
|
||||
}, () -> null);
|
||||
} catch (Throwable t) {
|
||||
CraftEngine.instance().logger().warn("Failed to run setPlacedBy ", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.momirealms.craftengine.bukkit.util.LocationUtils;
|
||||
import net.momirealms.craftengine.core.block.BlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.CustomBlock;
|
||||
import net.momirealms.craftengine.core.block.behavior.BlockBehaviorFactory;
|
||||
import net.momirealms.craftengine.core.block.behavior.special.FallOnBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.FallOnBlockBehavior;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||
import net.momirealms.craftengine.core.util.VersionHelper;
|
||||
|
||||
@@ -169,9 +169,11 @@ public class DoorBlockBehavior extends AbstractCanSurviveBlockBehavior {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
BlockPos pos = context.getClickedPos();
|
||||
context.getLevel().setBlockAt(pos.x(), pos.y() + 1, pos.z(), state.with(this.halfProperty, DoubleBlockHalf.UPPER).customBlockState(), UpdateOption.UPDATE_ALL.flags());
|
||||
public void setPlacedBy(Object thisBlock, Object[] args, Callable<Object> superMethod) {
|
||||
Object blockState = args[2];
|
||||
Object pos = args[1];
|
||||
Optional<ImmutableBlockState> immutableBlockState = BlockStateUtils.getOptionalCustomBlockState(blockState);
|
||||
immutableBlockState.ifPresent(state -> FastNMS.INSTANCE.method$LevelWriter$setBlock(args[0], LocationUtils.above(pos), state.with(this.halfProperty, DoubleBlockHalf.UPPER).customBlockState().literalObject(), UpdateOption.UPDATE_ALL.flags()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,9 +111,11 @@ public class DoubleHighBlockBehavior extends AbstractCanSurviveBlockBehavior {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
BlockPos pos = context.getClickedPos();
|
||||
context.getLevel().setBlockAt(pos.x(), pos.y() + 1, pos.z(), state.with(this.halfProperty, DoubleBlockHalf.UPPER).customBlockState(), UpdateOption.UPDATE_ALL.flags());
|
||||
public void setPlacedBy(Object thisBlock, Object[] args, Callable<Object> superMethod) {
|
||||
Object blockState = args[2];
|
||||
Object pos = args[1];
|
||||
Optional<ImmutableBlockState> immutableBlockState = BlockStateUtils.getOptionalCustomBlockState(blockState);
|
||||
immutableBlockState.ifPresent(state -> FastNMS.INSTANCE.method$LevelWriter$setBlock(args[0], LocationUtils.above(pos), state.with(this.halfProperty, DoubleBlockHalf.UPPER).customBlockState().literalObject(), UpdateOption.UPDATE_ALL.flags()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.momirealms.craftengine.core.block.BlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.CustomBlock;
|
||||
import net.momirealms.craftengine.core.block.UpdateOption;
|
||||
import net.momirealms.craftengine.core.block.behavior.BlockBehaviorFactory;
|
||||
import net.momirealms.craftengine.core.block.behavior.special.PlaceLiquidBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.PlaceLiquidBlockBehavior;
|
||||
import net.momirealms.craftengine.core.world.WorldEvents;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -8,12 +8,15 @@ import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MTagKeys;
|
||||
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.UpdateOption;
|
||||
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.LazyReference;
|
||||
import net.momirealms.craftengine.core.util.RandomUtils;
|
||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||
import net.momirealms.craftengine.core.util.VersionHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -23,10 +26,12 @@ public class SurfaceSpreadingBlockBehavior extends BukkitBlockBehavior {
|
||||
public static final Factory FACTORY = new Factory();
|
||||
private final int requiredLight;
|
||||
private final LazyReference<Object> baseBlock;
|
||||
private final Property<Boolean> snowyProperty;
|
||||
|
||||
public SurfaceSpreadingBlockBehavior(CustomBlock customBlock, int requiredLight, String baseBlock) {
|
||||
public SurfaceSpreadingBlockBehavior(CustomBlock customBlock, int requiredLight, String baseBlock, @Nullable Property<Boolean> snowyProperty) {
|
||||
super(customBlock);
|
||||
this.requiredLight = requiredLight;
|
||||
this.snowyProperty = snowyProperty;
|
||||
this.baseBlock = LazyReference.lazyReference(() -> Objects.requireNonNull(BukkitBlockManager.instance().createBlockState(baseBlock)).literalObject());
|
||||
}
|
||||
|
||||
@@ -40,9 +45,7 @@ public class SurfaceSpreadingBlockBehavior extends BukkitBlockBehavior {
|
||||
return;
|
||||
}
|
||||
if (FastNMS.INSTANCE.method$LevelReader$getMaxLocalRawBrightness(level, FastNMS.INSTANCE.method$BlockPos$relative(pos, CoreReflections.instance$Direction$UP)) < this.requiredLight) return;
|
||||
|
||||
BooleanProperty snowy = (BooleanProperty) this.block().getProperty("snowy");
|
||||
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Object blockPos = FastNMS.INSTANCE.method$BlockPos$offset(
|
||||
pos,
|
||||
@@ -58,16 +61,16 @@ public class SurfaceSpreadingBlockBehavior extends BukkitBlockBehavior {
|
||||
|
||||
ImmutableBlockState newState = this.block().defaultState();
|
||||
|
||||
if (snowy != null) {
|
||||
if (this.snowyProperty != null) {
|
||||
boolean hasSnow = FastNMS.INSTANCE.method$BlockStateBase$isBlock(
|
||||
FastNMS.INSTANCE.method$BlockGetter$getBlockState(level,
|
||||
FastNMS.INSTANCE.method$BlockPos$relative(blockPos, CoreReflections.instance$Direction$UP)),
|
||||
MBlocks.SNOW
|
||||
);
|
||||
newState = newState.with(snowy, hasSnow);
|
||||
newState = newState.with(this.snowyProperty, hasSnow);
|
||||
}
|
||||
|
||||
FastNMS.INSTANCE.method$LevelWriter$setBlock(level, blockPos, newState.customBlockState().literalObject(), 3);
|
||||
FastNMS.INSTANCE.method$LevelWriter$setBlock(level, blockPos, newState.customBlockState().literalObject(), UpdateOption.UPDATE_ALL.flags());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,11 +104,12 @@ public class SurfaceSpreadingBlockBehavior extends BukkitBlockBehavior {
|
||||
|
||||
public static class Factory implements BlockBehaviorFactory {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
|
||||
int requiredLight = ResourceConfigUtils.getAsInt(arguments.getOrDefault("required-light", 9), "required-light");
|
||||
String baseBlock = ResourceConfigUtils.requireNonEmptyStringOrThrow(arguments.getOrDefault("base-block", "minecraft:dirt"), "warning.config.block.behavior.surface_spreading.missing_base_block");
|
||||
return new SurfaceSpreadingBlockBehavior(block, requiredLight, baseBlock);
|
||||
return new SurfaceSpreadingBlockBehavior(block, requiredLight, baseBlock, (Property<Boolean>) block.getProperty("snowy"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import net.momirealms.craftengine.core.block.CustomBlock;
|
||||
import net.momirealms.craftengine.core.block.ImmutableBlockState;
|
||||
import net.momirealms.craftengine.core.block.behavior.AbstractBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.EntityBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.special.FallOnBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.special.PlaceLiquidBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.FallOnBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.PlaceLiquidBlockBehavior;
|
||||
import net.momirealms.craftengine.core.entity.player.InteractionResult;
|
||||
import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
|
||||
import net.momirealms.craftengine.core.item.context.UseOnContext;
|
||||
@@ -251,13 +251,6 @@ public class UnsafeCompositeBlockBehavior extends BukkitBlockBehavior
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
for (AbstractBlockBehavior behavior : this.behaviors) {
|
||||
behavior.setPlacedBy(context, state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplaced(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
for (AbstractBlockBehavior behavior : this.behaviors) {
|
||||
@@ -399,4 +392,11 @@ public class UnsafeCompositeBlockBehavior extends BukkitBlockBehavior
|
||||
behavior.onProjectileHit(thisBlock, args, superMethod);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlacedBy(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
for (AbstractBlockBehavior behavior : this.behaviors) {
|
||||
behavior.setPlacedBy(thisBlock, args, superMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.momirealms.craftengine.bukkit.item.factory;
|
||||
|
||||
import net.momirealms.craftengine.bukkit.item.ComponentItemWrapper;
|
||||
import net.momirealms.craftengine.bukkit.item.DataComponentTypes;
|
||||
import net.momirealms.craftengine.bukkit.util.EnchantmentUtils;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -129,6 +129,11 @@ public class BukkitCraftEngine extends CraftEngine {
|
||||
} catch (Exception e) {
|
||||
throw new InjectionException("Error injecting loot entries", e);
|
||||
}
|
||||
try {
|
||||
BlockStateProviderInjector.init();
|
||||
} catch (Exception e) {
|
||||
throw new InjectionException("Error injecting block state providers", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.momirealms.craftengine.core.block.BlockKeys;
|
||||
import net.momirealms.craftengine.core.block.BlockShape;
|
||||
import net.momirealms.craftengine.core.block.DelegatingBlock;
|
||||
import net.momirealms.craftengine.core.block.behavior.EmptyBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.special.FallOnBlockBehavior;
|
||||
import net.momirealms.craftengine.core.block.behavior.FallOnBlockBehavior;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
import net.momirealms.craftengine.core.plugin.config.Config;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
@@ -175,6 +175,9 @@ public final class BlockGenerator {
|
||||
// onProjectileHit
|
||||
.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$onProjectileHit))
|
||||
.intercept(MethodDelegation.to(OnProjectileHitInterceptor.INSTANCE))
|
||||
// setPlaceBy
|
||||
.method(ElementMatchers.is(CoreReflections.method$Block$setPlacedBy))
|
||||
.intercept(MethodDelegation.to(SetPlaceByInterceptor.INSTANCE))
|
||||
;
|
||||
// 1.21.5+
|
||||
if (CoreReflections.method$BlockBehaviour$affectNeighborsAfterRemoval != null) {
|
||||
@@ -811,4 +814,18 @@ public final class BlockGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SetPlaceByInterceptor {
|
||||
public static final SetPlaceByInterceptor INSTANCE = new SetPlaceByInterceptor();
|
||||
|
||||
@RuntimeType
|
||||
public void intercept(@This Object thisObj, @AllArguments Object[] args, @SuperCall Callable<Object> superMethod) {
|
||||
ObjectHolder<BlockBehavior> holder = ((DelegatingBlock) thisObj).behaviorDelegate();
|
||||
try {
|
||||
holder.value().setPlacedBy(thisObj, args, superMethod);
|
||||
} catch (Exception e) {
|
||||
CraftEngine.instance().logger().severe("Failed to run setPlaceBy", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package net.momirealms.craftengine.bukkit.plugin.injector;
|
||||
|
||||
import net.momirealms.craftengine.bukkit.nms.FastNMS;
|
||||
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.CoreReflections;
|
||||
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MBuiltInRegistries;
|
||||
import net.momirealms.craftengine.bukkit.util.KeyUtils;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public final class BlockStateProviderInjector {
|
||||
|
||||
public static void init() throws ReflectiveOperationException {
|
||||
Object registry = MBuiltInRegistries.BLOCKSTATE_PROVIDER_TYPE;
|
||||
CoreReflections.field$MappedRegistry$frozen.set(registry, false);
|
||||
|
||||
Object rl1 = KeyUtils.toResourceLocation(Key.of("craftengine:simple_state_provider"));
|
||||
Object type1 = FastNMS.INSTANCE.getCraftEngineCustomSimpleStateProviderType();
|
||||
Object holder1 = CoreReflections.method$Registry$registerForHolder.invoke(null, registry, rl1, type1);
|
||||
CoreReflections.method$Holder$Reference$bindValue.invoke(holder1, type1);
|
||||
CoreReflections.field$Holder$Reference$tags.set(holder1, Set.of());
|
||||
|
||||
CoreReflections.field$MappedRegistry$frozen.set(registry, true);
|
||||
}
|
||||
}
|
||||
@@ -4485,6 +4485,10 @@ public final class CoreReflections {
|
||||
ReflectionUtils.getDeclaredField(clazz$EnumProperty, VersionHelper.isOrAbove1_21_2() ? List.class : ImmutableSet.class, 0)
|
||||
);
|
||||
|
||||
public static final Method method$Block$setPlacedBy = requireNonNull(
|
||||
ReflectionUtils.getMethod(clazz$Block, void.class, clazz$Level, clazz$BlockPos, clazz$BlockState, clazz$LivingEntity, clazz$ItemStack)
|
||||
);
|
||||
|
||||
public static final Class<?> clazz$ItemCost = MiscUtils.requireNonNullIf(
|
||||
BukkitReflectionUtils.findReobfOrMojmapClass(
|
||||
"world.item.trading.ItemCost",
|
||||
@@ -4548,4 +4552,18 @@ public final class CoreReflections {
|
||||
public static final Field field$ChunkMap$chunkGenerator = MiscUtils.requireNonNullIf(
|
||||
ReflectionUtils.getDeclaredField(clazz$ChunkMap, clazz$ChunkGenerator, 0), !VersionHelper.isOrAbove1_20_5()
|
||||
);
|
||||
|
||||
public static final Class<?> clazz$BlockStateProvider = requireNonNull(
|
||||
BukkitReflectionUtils.findReobfOrMojmapClass(
|
||||
"world.level.levelgen.feature.stateproviders.WorldGenFeatureStateProvider",
|
||||
"world.level.levelgen.feature.stateproviders.BlockStateProvider"
|
||||
)
|
||||
);
|
||||
|
||||
public static final Class<?> clazz$BlockStateProviderType = requireNonNull(
|
||||
BukkitReflectionUtils.findReobfOrMojmapClass(
|
||||
"world.level.levelgen.feature.stateproviders.WorldGenFeatureStateProviders",
|
||||
"world.level.levelgen.feature.stateproviders.BlockStateProviderType"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public final class MBuiltInRegistries {
|
||||
public static final Object DATA_COMPONENT_PREDICATE_TYPE;
|
||||
public static final Object LOOT_POOL_ENTRY_TYPE;
|
||||
public static final Object GAME_EVENT;
|
||||
public static final Object BLOCKSTATE_PROVIDER_TYPE;
|
||||
|
||||
static {
|
||||
Field[] fields = CoreReflections.clazz$BuiltInRegistries.getDeclaredFields();
|
||||
@@ -44,6 +45,7 @@ public final class MBuiltInRegistries {
|
||||
Object registries$DataComponentPredicateType = null;
|
||||
Object registries$LootPoolEntryType = null;
|
||||
Object registries$GameEvent = null;
|
||||
Object registries$BlockStateProviderType = null;
|
||||
|
||||
for (Field field : fields) {
|
||||
Type fieldType = field.getGenericType();
|
||||
@@ -59,6 +61,8 @@ public final class MBuiltInRegistries {
|
||||
registries$RecipeType = field.get(null);
|
||||
} else if (rawType == CoreReflections.clazz$BlockEntityType) {
|
||||
registries$BlockEntityType = field.get(null);
|
||||
} else if (rawType == CoreReflections.clazz$BlockStateProviderType) {
|
||||
registries$BlockStateProviderType = field.get(null);
|
||||
} else if (VersionHelper.isOrAbove1_20_5() && rawType == CoreReflections.clazz$DataComponentType && registries$DataComponentType == null) {
|
||||
registries$DataComponentType = field.get(null);
|
||||
} else if (VersionHelper.isOrAbove1_21_5() && rawType == CoreReflections.clazz$DataComponentPredicate$Type) {
|
||||
@@ -98,6 +102,7 @@ public final class MBuiltInRegistries {
|
||||
LOOT_POOL_ENTRY_TYPE = requireNonNull(registries$LootPoolEntryType);
|
||||
DATA_COMPONENT_TYPE = registries$DataComponentType;
|
||||
GAME_EVENT = requireNonNull(registries$GameEvent);
|
||||
BLOCKSTATE_PROVIDER_TYPE = requireNonNull(registries$BlockStateProviderType);
|
||||
DATA_COMPONENT_PREDICATE_TYPE = registries$DataComponentPredicateType;
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new ReflectionInitException("Failed to init BuiltInRegistries", e);
|
||||
|
||||
@@ -138,6 +138,5 @@ public abstract class AbstractCustomBlock implements CustomBlock {
|
||||
|
||||
@Override
|
||||
public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
this.behavior.setPlacedBy(context, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +187,10 @@ public abstract class BlockBehavior {
|
||||
public void onProjectileHit(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
}
|
||||
|
||||
// Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack
|
||||
public void setPlacedBy(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
}
|
||||
|
||||
public ImmutableBlockState updateStateForPlacement(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
return state;
|
||||
}
|
||||
@@ -208,9 +212,6 @@ public abstract class BlockBehavior {
|
||||
return state.settings().replaceable();
|
||||
}
|
||||
|
||||
public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
}
|
||||
|
||||
public InteractionResult useOnBlock(UseOnContext context, ImmutableBlockState state) {
|
||||
return InteractionResult.TRY_EMPTY_HAND;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.momirealms.craftengine.core.block.behavior.special;
|
||||
package net.momirealms.craftengine.core.block.behavior;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.momirealms.craftengine.core.block.behavior.special;
|
||||
package net.momirealms.craftengine.core.block.behavior;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@@ -19,7 +19,10 @@ import net.momirealms.craftengine.core.util.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
@@ -505,12 +505,12 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FriendlyByteBuf writeNbt(@Nullable Tag compound, boolean named) {
|
||||
if (compound == null) {
|
||||
public FriendlyByteBuf writeNbt(@Nullable Tag tag, boolean named) {
|
||||
if (tag == null) {
|
||||
this.writeByte(0);
|
||||
} else {
|
||||
try {
|
||||
NBT.writeUnnamedTag(compound, new ByteBufOutputStream(this), named);
|
||||
NBT.writeUnnamedTag(tag, new ByteBufOutputStream(this), named);
|
||||
} catch (IOException e) {
|
||||
throw new EncoderException("Failed to write NBT compound: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Project settings
|
||||
# Rule: [major update].[feature update].[bug fix]
|
||||
project_version=0.0.65.7
|
||||
project_version=0.0.65.8
|
||||
config_version=54
|
||||
lang_version=38
|
||||
project_group=net.momirealms
|
||||
@@ -49,7 +48,7 @@ byte_buddy_version=1.17.8
|
||||
ahocorasick_version=0.6.3
|
||||
snake_yaml_version=2.5
|
||||
anti_grief_version=1.0.4
|
||||
nms_helper_version=1.0.129
|
||||
nms_helper_version=1.0.132
|
||||
evalex_version=3.5.0
|
||||
reactive_streams_version=1.0.4
|
||||
amazon_awssdk_version=2.34.5
|
||||
|
||||
Reference in New Issue
Block a user