mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
修改
This commit is contained in:
@@ -27,7 +27,9 @@ public class MMOItemsSource implements ExternalItemSource<ItemStack> {
|
|||||||
split = split[0].split("_", 2);
|
split = split[0].split("_", 2);
|
||||||
}
|
}
|
||||||
if (split.length == 1) return new ItemStack(Material.AIR);
|
if (split.length == 1) return new ItemStack(Material.AIR);
|
||||||
MMOItem mmoItem = MMOItems.plugin.getMMOItem(Type.get(split[0]), split[1].toUpperCase(Locale.ROOT));
|
// 这里与使用和mmoitems相同的转换id方法
|
||||||
|
String mmoItemId = split[1].toUpperCase().replace("-", "_").replace(" ", "_");
|
||||||
|
MMOItem mmoItem = MMOItems.plugin.getMMOItem(Type.get(split[0]), mmoItemId);
|
||||||
return mmoItem == null ? new ItemStack(Material.AIR) : requireNonNull(mmoItem.newBuilder().build());
|
return mmoItem == null ? new ItemStack(Material.AIR) : requireNonNull(mmoItem.newBuilder().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,13 @@ public class ItemDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(xRot, yRot, position, translation, rotation);
|
int result = 17;
|
||||||
|
result = 31 * result + Double.hashCode(xRot);
|
||||||
|
result = 31 * result + Double.hashCode(yRot);
|
||||||
|
result = 31 * result + (position != null ? position.hashCode() : 0);
|
||||||
|
result = 31 * result + (translation != null ? translation.hashCode() : 0);
|
||||||
|
result = 31 * result + (rotation != null ? rotation.hashCode() : 0);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Factory implements BlockEntityElementConfigFactory<ItemDisplayBlockEntityElement> {
|
public static class Factory implements BlockEntityElementConfigFactory<ItemDisplayBlockEntityElement> {
|
||||||
|
|||||||
@@ -156,7 +156,13 @@ public class TextDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(xRot, yRot, position, translation, rotation);
|
int result = 17;
|
||||||
|
result = 31 * result + Double.hashCode(xRot);
|
||||||
|
result = 31 * result + Double.hashCode(yRot);
|
||||||
|
result = 31 * result + (position != null ? position.hashCode() : 0);
|
||||||
|
result = 31 * result + (translation != null ? translation.hashCode() : 0);
|
||||||
|
result = 31 * result + (rotation != null ? rotation.hashCode() : 0);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Factory implements BlockEntityElementConfigFactory<TextDisplayBlockEntityElement> {
|
public static class Factory implements BlockEntityElementConfigFactory<TextDisplayBlockEntityElement> {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ItemDisplayFurnitureElement implements FurnitureElement {
|
|||||||
this.position.x, this.position.y, this.position.z, 0, this.position.yRot,
|
this.position.x, this.position.y, this.position.z, 0, this.position.yRot,
|
||||||
MEntityTypes.ITEM_DISPLAY, 0, CoreReflections.instance$Vec3$Zero, 0
|
MEntityTypes.ITEM_DISPLAY, 0, CoreReflections.instance$Vec3$Zero, 0
|
||||||
),
|
),
|
||||||
FastNMS.INSTANCE.constructor$ClientboundSetEntityDataPacket(this.entityId, this.config.metadata().apply(player, this.colorSource))
|
FastNMS.INSTANCE.constructor$ClientboundSetEntityDataPacket(this.entityId, this.config.metadata.apply(player, this.colorSource))
|
||||||
)), false);
|
)), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,23 +31,23 @@ import java.util.function.BiFunction;
|
|||||||
|
|
||||||
public class ItemDisplayFurnitureElementConfig implements FurnitureElementConfig<ItemDisplayFurnitureElement> {
|
public class ItemDisplayFurnitureElementConfig implements FurnitureElementConfig<ItemDisplayFurnitureElement> {
|
||||||
public static final Factory FACTORY = new Factory();
|
public static final Factory FACTORY = new Factory();
|
||||||
private final BiFunction<Player, FurnitureColorSource, List<Object>> metadata;
|
public final BiFunction<Player, FurnitureColorSource, List<Object>> metadata;
|
||||||
private final Key itemId;
|
public final Key itemId;
|
||||||
private final Vector3f scale;
|
public final Vector3f scale;
|
||||||
private final Vector3f position;
|
public final Vector3f position;
|
||||||
private final Vector3f translation;
|
public final Vector3f translation;
|
||||||
private final float xRot;
|
public final float xRot;
|
||||||
private final float yRot;
|
public final float yRot;
|
||||||
private final Quaternionf rotation;
|
public final Quaternionf rotation;
|
||||||
private final ItemDisplayContext displayContext;
|
public final ItemDisplayContext displayContext;
|
||||||
private final Billboard billboard;
|
public final Billboard billboard;
|
||||||
private final float shadowRadius;
|
public final float shadowRadius;
|
||||||
private final float shadowStrength;
|
public final float shadowStrength;
|
||||||
private final boolean applyDyedColor;
|
public final boolean applyDyedColor;
|
||||||
private final Color glowColor;
|
public final Color glowColor;
|
||||||
private final int blockLight;
|
public final int blockLight;
|
||||||
private final int skyLight;
|
public final int skyLight;
|
||||||
private final float viewRange;
|
public final float viewRange;
|
||||||
|
|
||||||
public ItemDisplayFurnitureElementConfig(Key itemId,
|
public ItemDisplayFurnitureElementConfig(Key itemId,
|
||||||
Vector3f scale,
|
Vector3f scale,
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public final class BlockStateGenerator {
|
|||||||
if (state == null) return thisObj;
|
if (state == null) return thisObj;
|
||||||
Property<Boolean> waterloggedProperty = (Property<Boolean>) state.owner().value().getProperty("waterlogged");
|
Property<Boolean> waterloggedProperty = (Property<Boolean>) state.owner().value().getProperty("waterlogged");
|
||||||
if (waterloggedProperty == null) return thisObj;
|
if (waterloggedProperty == null) return thisObj;
|
||||||
return state.with(waterloggedProperty, (Boolean) args[1]).customBlockState().literalObject();
|
return state.with(waterloggedProperty, (boolean) args[1]).customBlockState().literalObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
public final class SelfHostHttpServer {
|
public final class SelfHostHttpServer {
|
||||||
private static volatile SelfHostHttpServer instance;
|
private static SelfHostHttpServer instance;
|
||||||
private final Cache<String, String> oneTimePackUrls = Caffeine.newBuilder()
|
private final Cache<String, String> oneTimePackUrls = Caffeine.newBuilder()
|
||||||
.maximumSize(1024)
|
.maximumSize(1024)
|
||||||
.scheduler(Scheduler.systemScheduler())
|
.scheduler(Scheduler.systemScheduler())
|
||||||
@@ -94,11 +94,7 @@ public final class SelfHostHttpServer {
|
|||||||
|
|
||||||
public static SelfHostHttpServer instance() {
|
public static SelfHostHttpServer instance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized (SelfHostHttpServer.class) {
|
instance = new SelfHostHttpServer();
|
||||||
if (instance == null) {
|
|
||||||
instance = new SelfHostHttpServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ package net.momirealms.craftengine.core.util;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class MarkedArrayList<T> extends ArrayList<T> {
|
public class MarkedArrayList<T> extends ArrayList<T> {
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public MarkedArrayList() {
|
public MarkedArrayList() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package net.momirealms.craftengine.core.util;
|
package net.momirealms.craftengine.core.util;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class MarkedHashMap<K, V> extends HashMap<K, V> {
|
public class MarkedHashMap<K, V> extends HashMap<K, V> {
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user