Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Rename some stuff
Dieser Commit ist enthalten in:
Ursprung
0eb7218582
Commit
c2a6e8ce70
@ -25,8 +25,6 @@
|
||||
|
||||
package org.geysermc.geyser.api.block.custom.component;
|
||||
|
||||
public enum RenderMethod {
|
||||
BLEND,
|
||||
OPAQUE,
|
||||
ALPHA_TEST
|
||||
public record BoxComponent(float originX, float originY, float originZ,
|
||||
float sizeX, float sizeY, float sizeZ) {
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.api.block.custom.component;
|
||||
|
||||
public record CollisionComponent(float originX, float originY, float originZ,
|
||||
float sizeX, float sizeY, float sizeZ) {
|
||||
}
|
@ -28,9 +28,9 @@ package org.geysermc.geyser.api.block.custom.component;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CustomBlockComponents {
|
||||
CollisionComponent aimCollision();
|
||||
BoxComponent selectionBox();
|
||||
|
||||
CollisionComponent entityCollision();
|
||||
BoxComponent collisionBox();
|
||||
|
||||
String geometry();
|
||||
|
||||
@ -40,16 +40,16 @@ public interface CustomBlockComponents {
|
||||
|
||||
Float friction();
|
||||
|
||||
Float lightEmission();
|
||||
Integer lightEmission();
|
||||
|
||||
Integer lightFilter();
|
||||
Integer lightDampening();
|
||||
|
||||
RotationComponent rotation();
|
||||
|
||||
interface Builder {
|
||||
Builder aimCollision(CollisionComponent aimCollision);
|
||||
Builder aimCollision(BoxComponent aimCollision);
|
||||
|
||||
Builder entityCollision(CollisionComponent entityCollision);
|
||||
Builder entityCollision(BoxComponent entityCollision);
|
||||
|
||||
Builder geometry(String geometry);
|
||||
|
||||
@ -59,7 +59,7 @@ public interface CustomBlockComponents {
|
||||
|
||||
Builder friction(Float friction);
|
||||
|
||||
Builder lightEmission(Float lightEmission);
|
||||
Builder lightEmission(Integer lightEmission);
|
||||
|
||||
Builder lightFilter(Integer lightFilter);
|
||||
|
||||
|
@ -27,6 +27,6 @@ package org.geysermc.geyser.api.block.custom.component;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public record MaterialInstance(@NonNull String texture, @NonNull RenderMethod renderMethod, boolean faceDimming, boolean ambientOcclusion) {
|
||||
public record MaterialInstance(@NonNull String texture, @NonNull String renderMethod, boolean faceDimming, boolean ambientOcclusion) {
|
||||
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ public class GeyserImpl implements GeyserApi {
|
||||
@Override
|
||||
public boolean isProductionEnvironment() {
|
||||
// noinspection ConstantConditions - changes in production
|
||||
return !"git-local/dev-0000000".equals(GeyserImpl.GIT_VERSION);
|
||||
return !"${gitVersion}".equals(GeyserImpl.GIT_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.geyser.level.block;
|
||||
|
||||
import org.geysermc.geyser.api.block.custom.component.CollisionComponent;
|
||||
import org.geysermc.geyser.api.block.custom.component.BoxComponent;
|
||||
import org.geysermc.geyser.api.block.custom.component.CustomBlockComponents;
|
||||
import org.geysermc.geyser.api.block.custom.component.MaterialInstance;
|
||||
import org.geysermc.geyser.api.block.custom.component.RotationComponent;
|
||||
@ -33,17 +33,17 @@ import org.geysermc.geyser.api.block.custom.component.RotationComponent;
|
||||
import java.util.Map;
|
||||
|
||||
public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
||||
private final CollisionComponent aimCollision;
|
||||
private final CollisionComponent entityCollision;
|
||||
private final BoxComponent aimCollision;
|
||||
private final BoxComponent entityCollision;
|
||||
private final String geometry;
|
||||
private final Map<String, MaterialInstance> materialInstances;
|
||||
private final Float destroyTime;
|
||||
private final Float friction;
|
||||
private final Float lightEmission;
|
||||
private final Integer lightFilter;
|
||||
private final Integer lightEmission;
|
||||
private final Integer lightDampening;
|
||||
private final RotationComponent rotation;
|
||||
|
||||
public GeyserCustomBlockComponents(BuilderImpl builder) {
|
||||
private GeyserCustomBlockComponents(CustomBlockComponentsBuilder builder) {
|
||||
this.aimCollision = builder.aimCollision;
|
||||
this.entityCollision = builder.entityCollision;
|
||||
this.geometry = builder.geometry;
|
||||
@ -51,17 +51,17 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
||||
this.destroyTime = builder.destroyTime;
|
||||
this.friction = builder.friction;
|
||||
this.lightEmission = builder.lightEmission;
|
||||
this.lightFilter = builder.lightFilter;
|
||||
this.lightDampening = builder.lightFilter;
|
||||
this.rotation = builder.rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollisionComponent aimCollision() {
|
||||
public BoxComponent selectionBox() {
|
||||
return aimCollision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollisionComponent entityCollision() {
|
||||
public BoxComponent collisionBox() {
|
||||
return entityCollision;
|
||||
}
|
||||
|
||||
@ -86,13 +86,13 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float lightEmission() {
|
||||
public Integer lightEmission() {
|
||||
return lightEmission;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer lightFilter() {
|
||||
return lightFilter;
|
||||
public Integer lightDampening() {
|
||||
return lightDampening;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,25 +100,25 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public static class BuilderImpl implements Builder {
|
||||
protected CollisionComponent aimCollision;
|
||||
protected CollisionComponent entityCollision;
|
||||
public static class CustomBlockComponentsBuilder implements Builder {
|
||||
protected BoxComponent aimCollision;
|
||||
protected BoxComponent entityCollision;
|
||||
protected String geometry;
|
||||
protected Map<String, MaterialInstance> materialInstances;
|
||||
protected Float destroyTime;
|
||||
protected Float friction;
|
||||
protected Float lightEmission;
|
||||
protected Integer lightEmission;
|
||||
protected Integer lightFilter;
|
||||
protected RotationComponent rotation;
|
||||
|
||||
@Override
|
||||
public Builder aimCollision(CollisionComponent aimCollision) {
|
||||
public Builder aimCollision(BoxComponent aimCollision) {
|
||||
this.aimCollision = aimCollision;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder entityCollision(CollisionComponent entityCollision) {
|
||||
public Builder entityCollision(BoxComponent entityCollision) {
|
||||
this.entityCollision = entityCollision;
|
||||
return this;
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder lightEmission(Float lightEmission) {
|
||||
public Builder lightEmission(Integer lightEmission) {
|
||||
this.lightEmission = lightEmission;
|
||||
return this;
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ public class GeyserCustomBlockData implements CustomBlockData {
|
||||
|
||||
@Override
|
||||
public CustomBlockState.Builder blockStateBuilder() {
|
||||
return new GeyserCustomBlockState.BuilderImpl(this);
|
||||
return new GeyserCustomBlockState.CustomBlockStateBuilder(this);
|
||||
}
|
||||
|
||||
public static class BuilderImpl implements Builder {
|
||||
public static class CustomBlockDataBuilder implements Builder {
|
||||
private String name;
|
||||
private CustomBlockComponents components;
|
||||
private Map<String, CustomBlockProperty<?>> properties = new Object2ObjectOpenHashMap<>();
|
||||
|
@ -49,7 +49,7 @@ public class GeyserCustomBlockPermutation implements CustomBlockPermutation {
|
||||
return components;
|
||||
}
|
||||
|
||||
public static class BuilderImpl implements Builder {
|
||||
public static class CustomBlockPermutationBuilder implements Builder {
|
||||
private String condition;
|
||||
private CustomBlockComponents components;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class GeyserCustomBlockState implements CustomBlockState {
|
||||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public static class BuilderImpl implements CustomBlockState.Builder {
|
||||
public static class CustomBlockStateBuilder implements CustomBlockState.Builder {
|
||||
private final CustomBlockData blockData;
|
||||
private final Object2ObjectMap<String, Object> properties = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
|
@ -38,7 +38,7 @@ import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.block.custom.CustomBlockData;
|
||||
import org.geysermc.geyser.api.block.custom.CustomBlockPermutation;
|
||||
import org.geysermc.geyser.api.block.custom.CustomBlockState;
|
||||
import org.geysermc.geyser.api.block.custom.component.CollisionComponent;
|
||||
import org.geysermc.geyser.api.block.custom.component.BoxComponent;
|
||||
import org.geysermc.geyser.api.block.custom.component.CustomBlockComponents;
|
||||
import org.geysermc.geyser.api.block.custom.component.MaterialInstance;
|
||||
import org.geysermc.geyser.api.block.custom.property.CustomBlockProperty;
|
||||
@ -347,20 +347,20 @@ public class BlockRegistryPopulator {
|
||||
return NbtMap.EMPTY;
|
||||
}
|
||||
NbtMapBuilder builder = NbtMap.builder();
|
||||
if (components.aimCollision() != null) {
|
||||
CollisionComponent collisionComponent = components.aimCollision();
|
||||
if (components.selectionBox() != null) {
|
||||
BoxComponent selectionBox = components.selectionBox();
|
||||
builder.putCompound("minecraft:aim_collision", NbtMap.builder()
|
||||
.putBoolean("enabled", true)
|
||||
.putList("origin", NbtType.FLOAT, collisionComponent.originX(), collisionComponent.originY(), collisionComponent.originZ())
|
||||
.putList("size", NbtType.FLOAT, collisionComponent.sizeX(), collisionComponent.sizeY(), collisionComponent.sizeZ())
|
||||
.putList("origin", NbtType.FLOAT, selectionBox.originX(), selectionBox.originY(), selectionBox.originZ())
|
||||
.putList("size", NbtType.FLOAT, selectionBox.sizeX(), selectionBox.sizeY(), selectionBox.sizeZ())
|
||||
.build());
|
||||
}
|
||||
if (components.entityCollision() != null) {
|
||||
CollisionComponent collisionComponent = components.entityCollision();
|
||||
if (components.collisionBox() != null) {
|
||||
BoxComponent collisionBox = components.collisionBox();
|
||||
builder.putCompound("minecraft:block_collision", NbtMap.builder()
|
||||
.putBoolean("enabled", true)
|
||||
.putList("origin", NbtType.FLOAT, collisionComponent.originX(), collisionComponent.originY(), collisionComponent.originZ())
|
||||
.putList("size", NbtType.FLOAT, collisionComponent.sizeX(), collisionComponent.sizeY(), collisionComponent.sizeZ())
|
||||
.putList("origin", NbtType.FLOAT, collisionBox.originX(), collisionBox.originY(), collisionBox.originZ())
|
||||
.putList("size", NbtType.FLOAT, collisionBox.sizeX(), collisionBox.sizeY(), collisionBox.sizeZ())
|
||||
.build());
|
||||
}
|
||||
if (components.geometry() != null) {
|
||||
@ -374,7 +374,7 @@ public class BlockRegistryPopulator {
|
||||
MaterialInstance materialInstance = entry.getValue();
|
||||
materialsBuilder.putCompound(entry.getKey(), NbtMap.builder()
|
||||
.putString("texture", materialInstance.texture())
|
||||
.putString("render_method", materialInstance.renderMethod().toString().toLowerCase(Locale.ROOT))
|
||||
.putString("render_method", materialInstance.renderMethod())
|
||||
.putBoolean("face_dimming", materialInstance.faceDimming())
|
||||
.putBoolean("ambient_occlusion", materialInstance.faceDimming())
|
||||
.build());
|
||||
@ -396,12 +396,12 @@ public class BlockRegistryPopulator {
|
||||
}
|
||||
if (components.lightEmission() != null) {
|
||||
builder.putCompound("minecraft:block_light_emission", NbtMap.builder()
|
||||
.putFloat("value", components.lightEmission())
|
||||
.putFloat("value", ((float) components.lightEmission()) / 15f)
|
||||
.build());
|
||||
}
|
||||
if (components.lightFilter() != null) {
|
||||
if (components.lightDampening() != null) {
|
||||
builder.putCompound("minecraft:block_light_filter", NbtMap.builder()
|
||||
.putByte("value", components.lightFilter().byteValue())
|
||||
.putByte("value", components.lightDampening().byteValue())
|
||||
.build());
|
||||
}
|
||||
if (components.rotation() != null) {
|
||||
|
@ -59,9 +59,9 @@ public class GeyserBuilderProvider extends AbstractProvider implements BuilderPr
|
||||
public void registerProviders(Map<Class<?>, ProviderSupplier> providers) {
|
||||
providers.put(Command.Builder.class, args -> new GeyserCommandManager.CommandBuilder<>((Class<? extends CommandSource>) args[0]));
|
||||
|
||||
providers.put(CustomBlockComponents.Builder.class, args -> new GeyserCustomBlockComponents.BuilderImpl());
|
||||
providers.put(CustomBlockData.Builder.class, args -> new GeyserCustomBlockData.BuilderImpl());
|
||||
providers.put(CustomBlockPermutation.Builder.class, args -> new GeyserCustomBlockPermutation.BuilderImpl());
|
||||
providers.put(CustomBlockComponents.Builder.class, args -> new GeyserCustomBlockComponents.CustomBlockComponentsBuilder());
|
||||
providers.put(CustomBlockData.Builder.class, args -> new GeyserCustomBlockData.CustomBlockDataBuilder());
|
||||
providers.put(CustomBlockPermutation.Builder.class, args -> new GeyserCustomBlockPermutation.CustomBlockPermutationBuilder());
|
||||
|
||||
providers.put(CustomItemData.Builder.class, args -> new GeyserCustomItemData.CustomItemDataBuilder());
|
||||
providers.put(CustomItemOptions.Builder.class, args -> new GeyserCustomItemOptions.CustomItemOptionsBuilder());
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren