mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-27 02:49:15 +00:00
初步实现活板门
This commit is contained in:
@@ -17,59 +17,80 @@ public abstract class BlockBehavior {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
// BlockState state, Rotation rotation
|
||||
public Object rotate(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return superMethod.call();
|
||||
}
|
||||
|
||||
// BlockState state, Mirror mirror
|
||||
public Object mirror(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return superMethod.call();
|
||||
}
|
||||
|
||||
// 1.20.1-1.21.1 Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos
|
||||
// 1.21.2+ LevelReader level, ScheduledTickAccess scheduledTickAccess, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random
|
||||
public Object updateShape(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return args[0];
|
||||
}
|
||||
|
||||
// BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston
|
||||
public void neighborChanged(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
// ServerLevel level, BlockPos pos, RandomSource random
|
||||
public void tick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
// ServerLevel level, BlockPos pos, RandomSource random
|
||||
public void randomTick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
// 1.20-1.20.4 BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, UseOnContext context
|
||||
// 1.20.5+ Level level, BlockPos pos, BlockState oldState, boolean movedByPiston
|
||||
public void onPlace(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
// 1.20+ BlockState state, LevelReader world, BlockPos pos
|
||||
public boolean canSurvive(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return (boolean) superMethod.call();
|
||||
}
|
||||
|
||||
// 1.20-1.20.4 BlockState state, BlockGetter world, BlockPos pos, PathComputationType type
|
||||
// 1.20.5+ BlockState state, PathComputationType pathComputationType
|
||||
public boolean isPathFindable(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return (boolean) superMethod.call();
|
||||
}
|
||||
|
||||
// Level level, BlockPos pos, FallingBlockEntity fallingBlock
|
||||
public void onBrokenAfterFall(Object thisBlock, Object[] args) throws Exception {
|
||||
}
|
||||
|
||||
// Level level, BlockPos pos, BlockState state, BlockState replaceableState, FallingBlockEntity fallingBlock
|
||||
public void onLand(Object thisBlock, Object[] args) throws Exception {
|
||||
}
|
||||
|
||||
// LevelReader level, BlockPos pos, BlockState state
|
||||
public boolean isValidBoneMealTarget(Object thisBlock, Object[] args) throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Level level, RandomSource random, BlockPos pos, BlockState state
|
||||
public boolean isBoneMealSuccess(Object thisBlock, Object[] args) throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ServerLevel level, RandomSource random, BlockPos pos, BlockState state
|
||||
public void performBoneMeal(Object thisBlock, Object[] args) throws Exception {
|
||||
}
|
||||
|
||||
// 1.21+ BlockState state, ServerLevel level, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> dropConsumer
|
||||
public void onExplosionHit(Object thisBlock, Object[] args, Callable<Object> superMethod) {
|
||||
}
|
||||
|
||||
public ImmutableBlockState updateStateForPlacement(BlockPlaceContext context, ImmutableBlockState state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.momirealms.craftengine.core.plugin.network.NetWorkUser;
|
||||
import net.momirealms.craftengine.core.sound.SoundSource;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import net.momirealms.craftengine.core.world.BlockPos;
|
||||
import net.momirealms.craftengine.core.world.Position;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,7 +9,6 @@ import net.momirealms.craftengine.core.plugin.context.function.Function;
|
||||
import net.momirealms.craftengine.core.registry.Holder;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,6 +32,7 @@ public class ItemKeys {
|
||||
public static final Key TOTEM_OF_UNDYING = Key.of("minecraft:totem_of_undying");
|
||||
public static final Key BARRIER = Key.of("minecraft:barrier");
|
||||
public static final Key CACTUS = Key.of("minecraft:cactus");
|
||||
public static final Key REDSTONE = Key.of("minecraft:redstone");
|
||||
|
||||
public static final Key[] AXES = new Key[] {
|
||||
WOODEN_AXE, STONE_AXE, IRON_AXE, GOLDEN_AXE, DIAMOND_AXE, NETHERITE_AXE
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.momirealms.craftengine.core.plugin.context;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.momirealms.craftengine.core.entity.player.Player;
|
||||
import net.momirealms.craftengine.core.plugin.text.minimessage.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.momirealms.craftengine.core.entity.player.Player;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
import net.momirealms.craftengine.core.plugin.context.PlayerOptionalContext;
|
||||
import net.momirealms.craftengine.core.plugin.context.RelationalContext;
|
||||
import net.momirealms.craftengine.core.util.AdventureHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -5,7 +5,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public enum DamageSource {
|
||||
BLOCK_EXPLOSION,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.momirealms.craftengine.core.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum HorizontalDirection {
|
||||
NORTH,
|
||||
SOUTH,
|
||||
@@ -14,4 +16,14 @@ public enum HorizontalDirection {
|
||||
case EAST -> Direction.EAST;
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public HorizontalDirection opposite() {
|
||||
return switch (this) {
|
||||
case EAST -> WEST;
|
||||
case WEST -> EAST;
|
||||
case NORTH -> SOUTH;
|
||||
case SOUTH -> NORTH;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user