mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 09:59:20 +00:00
修复folia上初始化家具碰撞的问题
This commit is contained in:
@@ -267,18 +267,23 @@ public class DoorBlockBehavior extends AbstractCanSurviveBlockBehavior {
|
||||
|
||||
@Override
|
||||
public boolean canSurvive(Object thisBlock, Object state, Object world, Object blockPos) throws Exception {
|
||||
ImmutableBlockState immutableBlockState = BukkitBlockManager.instance().getImmutableBlockState(BlockStateUtils.blockStateToId(state));
|
||||
if (immutableBlockState == null || immutableBlockState.isEmpty()) return false;
|
||||
if (immutableBlockState.get(this.halfProperty) == DoubleBlockHalf.UPPER) return true;
|
||||
ImmutableBlockState customBlockState = BukkitBlockManager.instance().getImmutableBlockState(BlockStateUtils.blockStateToId(state));
|
||||
if (customBlockState == null || customBlockState.isEmpty()) return false;
|
||||
int x = FastNMS.INSTANCE.field$Vec3i$x(blockPos);
|
||||
int y = FastNMS.INSTANCE.field$Vec3i$y(blockPos) - 1;
|
||||
int z = FastNMS.INSTANCE.field$Vec3i$z(blockPos);
|
||||
Object targetPos = FastNMS.INSTANCE.constructor$BlockPos(x, y, z);
|
||||
Object blockState = FastNMS.INSTANCE.method$BlockGetter$getBlockState(world, targetPos);
|
||||
return (boolean) CoreReflections.method$BlockStateBase$isFaceSturdy.invoke(
|
||||
blockState, world, targetPos, CoreReflections.instance$Direction$UP,
|
||||
CoreReflections.instance$SupportType$FULL
|
||||
);
|
||||
Object belowPos = FastNMS.INSTANCE.constructor$BlockPos(x, y, z);
|
||||
Object belowState = FastNMS.INSTANCE.method$BlockGetter$getBlockState(world, belowPos);
|
||||
if (customBlockState.get(this.halfProperty) == DoubleBlockHalf.UPPER) {
|
||||
ImmutableBlockState belowCustomState = BukkitBlockManager.instance().getImmutableBlockState(BlockStateUtils.blockStateToId(belowState));
|
||||
if (belowCustomState == null || belowCustomState.isEmpty()) return false;
|
||||
return belowCustomState.owner().value() == super.customBlock;
|
||||
} else {
|
||||
return (boolean) CoreReflections.method$BlockStateBase$isFaceSturdy.invoke(
|
||||
belowState, world, belowPos, CoreReflections.instance$Direction$UP,
|
||||
CoreReflections.instance$SupportType$FULL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -266,12 +266,6 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
|
||||
}
|
||||
|
||||
public void handleCollisionEntityLoadOnEntitiesLoad(Entity collisionEntity) {
|
||||
// faster
|
||||
if (FastNMS.INSTANCE.method$CraftEntity$getHandle(collisionEntity) instanceof CollisionEntity) {
|
||||
collisionEntity.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// not a collision entity
|
||||
Byte flag = collisionEntity.getPersistentDataContainer().get(FURNITURE_COLLISION, PersistentDataType.BYTE);
|
||||
if (flag == null || flag != 1) {
|
||||
|
||||
@@ -197,6 +197,7 @@ public final class BlockGenerator {
|
||||
public Object intercept(@This Object thisObj, @AllArguments Object[] args, @SuperCall Callable<Object> superMethod) {
|
||||
ObjectHolder<BlockBehavior> holder = ((BehaviorHolder) thisObj).getBehaviorHolder();
|
||||
ChainUpdateBlockIndicator indicator = (ChainUpdateBlockIndicator) thisObj;
|
||||
// todo chain updater
|
||||
if (indicator.isNoteBlock()) {
|
||||
if (CoreReflections.clazz$ServerLevel.isInstance(args[levelIndex])) {
|
||||
startNoteBlockChain(args);
|
||||
|
||||
@@ -363,17 +363,13 @@ items:
|
||||
resistance: 3.0
|
||||
burnable: true
|
||||
tags:
|
||||
- minecraft:wooden_doors
|
||||
- minecraft:doors
|
||||
- minecraft:mineable/axe
|
||||
- minecraft:mob_interactable_doors
|
||||
states:
|
||||
template: default:block_state/door
|
||||
arguments:
|
||||
base_block: oak_door
|
||||
internal_id:
|
||||
type: self_increase_int
|
||||
from: 0
|
||||
to: 63
|
||||
model_top_left_path: minecraft:block/custom/palm_door_top_left
|
||||
model_top_left_generation:
|
||||
parent: minecraft:block/door_top_left
|
||||
|
||||
@@ -1641,196 +1641,196 @@ templates#block_states:
|
||||
variants:
|
||||
facing=east,half=lower,hinge=left,open=false,powered=true:
|
||||
appearance: facing=east,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 0
|
||||
facing=east,half=lower,hinge=left,open=false,powered=false:
|
||||
appearance: facing=east,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 1
|
||||
facing=east,half=lower,hinge=right,open=false,powered=true:
|
||||
appearance: facing=east,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 2
|
||||
facing=east,half=lower,hinge=right,open=false,powered=false:
|
||||
appearance: facing=east,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 3
|
||||
facing=east,half=upper,hinge=left,open=false,powered=true:
|
||||
appearance: facing=east,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 4
|
||||
facing=east,half=upper,hinge=left,open=false,powered=false:
|
||||
appearance: facing=east,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 5
|
||||
facing=east,half=upper,hinge=right,open=false,powered=true:
|
||||
appearance: facing=east,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 6
|
||||
facing=east,half=upper,hinge=right,open=false,powered=false:
|
||||
appearance: facing=east,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 7
|
||||
facing=north,half=lower,hinge=left,open=false,powered=true:
|
||||
appearance: facing=north,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 8
|
||||
facing=north,half=lower,hinge=left,open=false,powered=false:
|
||||
appearance: facing=north,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 9
|
||||
facing=north,half=lower,hinge=right,open=false,powered=true:
|
||||
appearance: facing=north,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 10
|
||||
facing=north,half=lower,hinge=right,open=false,powered=false:
|
||||
appearance: facing=north,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 11
|
||||
facing=north,half=upper,hinge=left,open=false,powered=true:
|
||||
appearance: facing=north,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 12
|
||||
facing=north,half=upper,hinge=left,open=false,powered=false:
|
||||
appearance: facing=north,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 13
|
||||
facing=north,half=upper,hinge=right,open=false,powered=true:
|
||||
appearance: facing=north,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 14
|
||||
facing=north,half=upper,hinge=right,open=false,powered=false:
|
||||
appearance: facing=north,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 15
|
||||
facing=south,half=lower,hinge=left,open=false,powered=true:
|
||||
appearance: facing=south,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 16
|
||||
facing=south,half=lower,hinge=left,open=false,powered=false:
|
||||
appearance: facing=south,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 17
|
||||
facing=south,half=lower,hinge=right,open=false,powered=true:
|
||||
appearance: facing=south,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 18
|
||||
facing=south,half=lower,hinge=right,open=false,powered=false:
|
||||
appearance: facing=south,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 19
|
||||
facing=south,half=upper,hinge=left,open=false,powered=true:
|
||||
appearance: facing=south,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 20
|
||||
facing=south,half=upper,hinge=left,open=false,powered=false:
|
||||
appearance: facing=south,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 21
|
||||
facing=south,half=upper,hinge=right,open=false,powered=true:
|
||||
appearance: facing=south,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 22
|
||||
facing=south,half=upper,hinge=right,open=false,powered=false:
|
||||
appearance: facing=south,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 23
|
||||
facing=west,half=lower,hinge=left,open=false,powered=true:
|
||||
appearance: facing=west,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 24
|
||||
facing=west,half=lower,hinge=left,open=false,powered=false:
|
||||
appearance: facing=west,half=lower,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 25
|
||||
facing=west,half=lower,hinge=right,open=false,powered=true:
|
||||
appearance: facing=west,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 26
|
||||
facing=west,half=lower,hinge=right,open=false,powered=false:
|
||||
appearance: facing=west,half=lower,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 27
|
||||
facing=west,half=upper,hinge=left,open=false,powered=true:
|
||||
appearance: facing=west,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 28
|
||||
facing=west,half=upper,hinge=left,open=false,powered=false:
|
||||
appearance: facing=west,half=upper,hinge=left,open=false
|
||||
id: ${internal_id}
|
||||
id: 29
|
||||
facing=west,half=upper,hinge=right,open=false,powered=true:
|
||||
appearance: facing=west,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 30
|
||||
facing=west,half=upper,hinge=right,open=false,powered=false:
|
||||
appearance: facing=west,half=upper,hinge=right,open=false
|
||||
id: ${internal_id}
|
||||
id: 31
|
||||
facing=east,half=lower,hinge=left,open=true,powered=true:
|
||||
appearance: facing=east,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 32
|
||||
facing=east,half=lower,hinge=left,open=true,powered=false:
|
||||
appearance: facing=east,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 33
|
||||
facing=east,half=lower,hinge=right,open=true,powered=true:
|
||||
appearance: facing=east,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 34
|
||||
facing=east,half=lower,hinge=right,open=true,powered=false:
|
||||
appearance: facing=east,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 35
|
||||
facing=east,half=upper,hinge=left,open=true,powered=true:
|
||||
appearance: facing=east,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 36
|
||||
facing=east,half=upper,hinge=left,open=true,powered=false:
|
||||
appearance: facing=east,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 37
|
||||
facing=east,half=upper,hinge=right,open=true,powered=true:
|
||||
appearance: facing=east,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 38
|
||||
facing=east,half=upper,hinge=right,open=true,powered=false:
|
||||
appearance: facing=east,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 39
|
||||
facing=north,half=lower,hinge=left,open=true,powered=true:
|
||||
appearance: facing=north,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 40
|
||||
facing=north,half=lower,hinge=left,open=true,powered=false:
|
||||
appearance: facing=north,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 41
|
||||
facing=north,half=lower,hinge=right,open=true,powered=true:
|
||||
appearance: facing=north,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 42
|
||||
facing=north,half=lower,hinge=right,open=true,powered=false:
|
||||
appearance: facing=north,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 43
|
||||
facing=north,half=upper,hinge=left,open=true,powered=true:
|
||||
appearance: facing=north,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 44
|
||||
facing=north,half=upper,hinge=left,open=true,powered=false:
|
||||
appearance: facing=north,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 45
|
||||
facing=north,half=upper,hinge=right,open=true,powered=true:
|
||||
appearance: facing=north,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 46
|
||||
facing=north,half=upper,hinge=right,open=true,powered=false:
|
||||
appearance: facing=north,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 47
|
||||
facing=south,half=lower,hinge=left,open=true,powered=true:
|
||||
appearance: facing=south,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 48
|
||||
facing=south,half=lower,hinge=left,open=true,powered=false:
|
||||
appearance: facing=south,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 49
|
||||
facing=south,half=lower,hinge=right,open=true,powered=true:
|
||||
appearance: facing=south,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 50
|
||||
facing=south,half=lower,hinge=right,open=true,powered=false:
|
||||
appearance: facing=south,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 51
|
||||
facing=south,half=upper,hinge=left,open=true,powered=true:
|
||||
appearance: facing=south,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 52
|
||||
facing=south,half=upper,hinge=left,open=true,powered=false:
|
||||
appearance: facing=south,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 53
|
||||
facing=south,half=upper,hinge=right,open=true,powered=true:
|
||||
appearance: facing=south,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 54
|
||||
facing=south,half=upper,hinge=right,open=true,powered=false:
|
||||
appearance: facing=south,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 55
|
||||
facing=west,half=lower,hinge=left,open=true,powered=true:
|
||||
appearance: facing=west,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 56
|
||||
facing=west,half=lower,hinge=left,open=true,powered=false:
|
||||
appearance: facing=west,half=lower,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 57
|
||||
facing=west,half=lower,hinge=right,open=true,powered=true:
|
||||
appearance: facing=west,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 58
|
||||
facing=west,half=lower,hinge=right,open=true,powered=false:
|
||||
appearance: facing=west,half=lower,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 59
|
||||
facing=west,half=upper,hinge=left,open=true,powered=true:
|
||||
appearance: facing=west,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 60
|
||||
facing=west,half=upper,hinge=left,open=true,powered=false:
|
||||
appearance: facing=west,half=upper,hinge=left,open=true
|
||||
id: ${internal_id}
|
||||
id: 61
|
||||
facing=west,half=upper,hinge=right,open=true,powered=true:
|
||||
appearance: facing=west,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 62
|
||||
facing=west,half=upper,hinge=right,open=true,powered=false:
|
||||
appearance: facing=west,half=upper,hinge=right,open=true
|
||||
id: ${internal_id}
|
||||
id: 63
|
||||
|
||||
# recipes
|
||||
templates#recipes:
|
||||
|
||||
@@ -662,7 +662,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
JsonObject fontJson;
|
||||
try {
|
||||
fontJson = GsonHelper.readJsonFile(file).getAsJsonObject();
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
} catch (IOException | JsonParseException e) {
|
||||
TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", file.toAbsolutePath().toString());
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
@@ -698,7 +698,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
JsonObject itemJson;
|
||||
try {
|
||||
itemJson = GsonHelper.readJsonFile(file).getAsJsonObject();
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
} catch (IOException | JsonParseException e) {
|
||||
TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", file.toAbsolutePath().toString());
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
@@ -723,7 +723,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
JsonObject blockStateJson;
|
||||
try {
|
||||
blockStateJson = GsonHelper.readJsonFile(file).getAsJsonObject();
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
} catch (IOException | JsonParseException e) {
|
||||
TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", file.toAbsolutePath().toString());
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
@@ -764,7 +764,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
JsonObject jsonObject;
|
||||
try {
|
||||
jsonObject = GsonHelper.readJsonFile(modelJsonPath).getAsJsonObject();
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
} catch (IOException | JsonParseException e) {
|
||||
TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", modelJsonPath.toAbsolutePath().toString());
|
||||
continue;
|
||||
}
|
||||
@@ -785,7 +785,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
JsonObject jsonObject;
|
||||
try {
|
||||
jsonObject = GsonHelper.readJsonFile(modelJsonPath).getAsJsonObject();
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
} catch (IOException | JsonParseException e) {
|
||||
TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", modelJsonPath.toAbsolutePath().toString());
|
||||
continue;
|
||||
}
|
||||
@@ -821,7 +821,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
JsonObject jsonObject;
|
||||
try {
|
||||
jsonObject = GsonHelper.readJsonFile(modelJsonPath).getAsJsonObject();
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
} catch (IOException | JsonParseException e) {
|
||||
TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", modelJsonPath.toAbsolutePath().toString());
|
||||
break label;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GsonHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonElement readJsonFile(Path path) throws IOException, JsonSyntaxException {
|
||||
public static JsonElement readJsonFile(Path path) throws IOException, JsonParseException {
|
||||
try (BufferedReader reader = Files.newBufferedReader(path)) {
|
||||
return JsonParser.parseReader(reader);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user