3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-02 16:10:10 +02:00

Rename some stuff

Dieser Commit ist enthalten in:
davchoo 2022-07-06 09:12:52 -04:00
Ursprung 0eb7218582
Commit c2a6e8ce70
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A0168C8E45799B7D
11 geänderte Dateien mit 50 neuen und 82 gelöschten Zeilen

Datei anzeigen

@ -25,8 +25,6 @@
package org.geysermc.geyser.api.block.custom.component; package org.geysermc.geyser.api.block.custom.component;
public enum RenderMethod { public record BoxComponent(float originX, float originY, float originZ,
BLEND, float sizeX, float sizeY, float sizeZ) {
OPAQUE,
ALPHA_TEST
} }

Datei anzeigen

@ -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) {
}

Datei anzeigen

@ -28,9 +28,9 @@ package org.geysermc.geyser.api.block.custom.component;
import java.util.Map; import java.util.Map;
public interface CustomBlockComponents { public interface CustomBlockComponents {
CollisionComponent aimCollision(); BoxComponent selectionBox();
CollisionComponent entityCollision(); BoxComponent collisionBox();
String geometry(); String geometry();
@ -40,16 +40,16 @@ public interface CustomBlockComponents {
Float friction(); Float friction();
Float lightEmission(); Integer lightEmission();
Integer lightFilter(); Integer lightDampening();
RotationComponent rotation(); RotationComponent rotation();
interface Builder { interface Builder {
Builder aimCollision(CollisionComponent aimCollision); Builder aimCollision(BoxComponent aimCollision);
Builder entityCollision(CollisionComponent entityCollision); Builder entityCollision(BoxComponent entityCollision);
Builder geometry(String geometry); Builder geometry(String geometry);
@ -59,7 +59,7 @@ public interface CustomBlockComponents {
Builder friction(Float friction); Builder friction(Float friction);
Builder lightEmission(Float lightEmission); Builder lightEmission(Integer lightEmission);
Builder lightFilter(Integer lightFilter); Builder lightFilter(Integer lightFilter);

Datei anzeigen

@ -27,6 +27,6 @@ package org.geysermc.geyser.api.block.custom.component;
import org.checkerframework.checker.nullness.qual.NonNull; 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) {
} }

Datei anzeigen

@ -595,7 +595,7 @@ public class GeyserImpl implements GeyserApi {
@Override @Override
public boolean isProductionEnvironment() { public boolean isProductionEnvironment() {
// noinspection ConstantConditions - changes in production // noinspection ConstantConditions - changes in production
return !"git-local/dev-0000000".equals(GeyserImpl.GIT_VERSION); return !"${gitVersion}".equals(GeyserImpl.GIT_VERSION);
} }
@Override @Override

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.geyser.level.block; 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.CustomBlockComponents;
import org.geysermc.geyser.api.block.custom.component.MaterialInstance; import org.geysermc.geyser.api.block.custom.component.MaterialInstance;
import org.geysermc.geyser.api.block.custom.component.RotationComponent; 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; import java.util.Map;
public class GeyserCustomBlockComponents implements CustomBlockComponents { public class GeyserCustomBlockComponents implements CustomBlockComponents {
private final CollisionComponent aimCollision; private final BoxComponent aimCollision;
private final CollisionComponent entityCollision; private final BoxComponent entityCollision;
private final String geometry; private final String geometry;
private final Map<String, MaterialInstance> materialInstances; private final Map<String, MaterialInstance> materialInstances;
private final Float destroyTime; private final Float destroyTime;
private final Float friction; private final Float friction;
private final Float lightEmission; private final Integer lightEmission;
private final Integer lightFilter; private final Integer lightDampening;
private final RotationComponent rotation; private final RotationComponent rotation;
public GeyserCustomBlockComponents(BuilderImpl builder) { private GeyserCustomBlockComponents(CustomBlockComponentsBuilder builder) {
this.aimCollision = builder.aimCollision; this.aimCollision = builder.aimCollision;
this.entityCollision = builder.entityCollision; this.entityCollision = builder.entityCollision;
this.geometry = builder.geometry; this.geometry = builder.geometry;
@ -51,17 +51,17 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
this.destroyTime = builder.destroyTime; this.destroyTime = builder.destroyTime;
this.friction = builder.friction; this.friction = builder.friction;
this.lightEmission = builder.lightEmission; this.lightEmission = builder.lightEmission;
this.lightFilter = builder.lightFilter; this.lightDampening = builder.lightFilter;
this.rotation = builder.rotation; this.rotation = builder.rotation;
} }
@Override @Override
public CollisionComponent aimCollision() { public BoxComponent selectionBox() {
return aimCollision; return aimCollision;
} }
@Override @Override
public CollisionComponent entityCollision() { public BoxComponent collisionBox() {
return entityCollision; return entityCollision;
} }
@ -86,13 +86,13 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
} }
@Override @Override
public Float lightEmission() { public Integer lightEmission() {
return lightEmission; return lightEmission;
} }
@Override @Override
public Integer lightFilter() { public Integer lightDampening() {
return lightFilter; return lightDampening;
} }
@Override @Override
@ -100,25 +100,25 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
return rotation; return rotation;
} }
public static class BuilderImpl implements Builder { public static class CustomBlockComponentsBuilder implements Builder {
protected CollisionComponent aimCollision; protected BoxComponent aimCollision;
protected CollisionComponent entityCollision; protected BoxComponent entityCollision;
protected String geometry; protected String geometry;
protected Map<String, MaterialInstance> materialInstances; protected Map<String, MaterialInstance> materialInstances;
protected Float destroyTime; protected Float destroyTime;
protected Float friction; protected Float friction;
protected Float lightEmission; protected Integer lightEmission;
protected Integer lightFilter; protected Integer lightFilter;
protected RotationComponent rotation; protected RotationComponent rotation;
@Override @Override
public Builder aimCollision(CollisionComponent aimCollision) { public Builder aimCollision(BoxComponent aimCollision) {
this.aimCollision = aimCollision; this.aimCollision = aimCollision;
return this; return this;
} }
@Override @Override
public Builder entityCollision(CollisionComponent entityCollision) { public Builder entityCollision(BoxComponent entityCollision) {
this.entityCollision = entityCollision; this.entityCollision = entityCollision;
return this; return this;
} }
@ -148,7 +148,7 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
} }
@Override @Override
public Builder lightEmission(Float lightEmission) { public Builder lightEmission(Integer lightEmission) {
this.lightEmission = lightEmission; this.lightEmission = lightEmission;
return this; return this;
} }

Datei anzeigen

@ -69,10 +69,10 @@ public class GeyserCustomBlockData implements CustomBlockData {
@Override @Override
public CustomBlockState.Builder blockStateBuilder() { 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 String name;
private CustomBlockComponents components; private CustomBlockComponents components;
private Map<String, CustomBlockProperty<?>> properties = new Object2ObjectOpenHashMap<>(); private Map<String, CustomBlockProperty<?>> properties = new Object2ObjectOpenHashMap<>();

Datei anzeigen

@ -49,7 +49,7 @@ public class GeyserCustomBlockPermutation implements CustomBlockPermutation {
return components; return components;
} }
public static class BuilderImpl implements Builder { public static class CustomBlockPermutationBuilder implements Builder {
private String condition; private String condition;
private CustomBlockComponents components; private CustomBlockComponents components;

Datei anzeigen

@ -59,7 +59,7 @@ public class GeyserCustomBlockState implements CustomBlockState {
} }
@RequiredArgsConstructor @RequiredArgsConstructor
public static class BuilderImpl implements CustomBlockState.Builder { public static class CustomBlockStateBuilder implements CustomBlockState.Builder {
private final CustomBlockData blockData; private final CustomBlockData blockData;
private final Object2ObjectMap<String, Object> properties = new Object2ObjectOpenHashMap<>(); private final Object2ObjectMap<String, Object> properties = new Object2ObjectOpenHashMap<>();

Datei anzeigen

@ -38,7 +38,7 @@ import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.block.custom.CustomBlockData; import org.geysermc.geyser.api.block.custom.CustomBlockData;
import org.geysermc.geyser.api.block.custom.CustomBlockPermutation; import org.geysermc.geyser.api.block.custom.CustomBlockPermutation;
import org.geysermc.geyser.api.block.custom.CustomBlockState; 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.CustomBlockComponents;
import org.geysermc.geyser.api.block.custom.component.MaterialInstance; import org.geysermc.geyser.api.block.custom.component.MaterialInstance;
import org.geysermc.geyser.api.block.custom.property.CustomBlockProperty; import org.geysermc.geyser.api.block.custom.property.CustomBlockProperty;
@ -347,20 +347,20 @@ public class BlockRegistryPopulator {
return NbtMap.EMPTY; return NbtMap.EMPTY;
} }
NbtMapBuilder builder = NbtMap.builder(); NbtMapBuilder builder = NbtMap.builder();
if (components.aimCollision() != null) { if (components.selectionBox() != null) {
CollisionComponent collisionComponent = components.aimCollision(); BoxComponent selectionBox = components.selectionBox();
builder.putCompound("minecraft:aim_collision", NbtMap.builder() builder.putCompound("minecraft:aim_collision", NbtMap.builder()
.putBoolean("enabled", true) .putBoolean("enabled", true)
.putList("origin", NbtType.FLOAT, collisionComponent.originX(), collisionComponent.originY(), collisionComponent.originZ()) .putList("origin", NbtType.FLOAT, selectionBox.originX(), selectionBox.originY(), selectionBox.originZ())
.putList("size", NbtType.FLOAT, collisionComponent.sizeX(), collisionComponent.sizeY(), collisionComponent.sizeZ()) .putList("size", NbtType.FLOAT, selectionBox.sizeX(), selectionBox.sizeY(), selectionBox.sizeZ())
.build()); .build());
} }
if (components.entityCollision() != null) { if (components.collisionBox() != null) {
CollisionComponent collisionComponent = components.entityCollision(); BoxComponent collisionBox = components.collisionBox();
builder.putCompound("minecraft:block_collision", NbtMap.builder() builder.putCompound("minecraft:block_collision", NbtMap.builder()
.putBoolean("enabled", true) .putBoolean("enabled", true)
.putList("origin", NbtType.FLOAT, collisionComponent.originX(), collisionComponent.originY(), collisionComponent.originZ()) .putList("origin", NbtType.FLOAT, collisionBox.originX(), collisionBox.originY(), collisionBox.originZ())
.putList("size", NbtType.FLOAT, collisionComponent.sizeX(), collisionComponent.sizeY(), collisionComponent.sizeZ()) .putList("size", NbtType.FLOAT, collisionBox.sizeX(), collisionBox.sizeY(), collisionBox.sizeZ())
.build()); .build());
} }
if (components.geometry() != null) { if (components.geometry() != null) {
@ -374,7 +374,7 @@ public class BlockRegistryPopulator {
MaterialInstance materialInstance = entry.getValue(); MaterialInstance materialInstance = entry.getValue();
materialsBuilder.putCompound(entry.getKey(), NbtMap.builder() materialsBuilder.putCompound(entry.getKey(), NbtMap.builder()
.putString("texture", materialInstance.texture()) .putString("texture", materialInstance.texture())
.putString("render_method", materialInstance.renderMethod().toString().toLowerCase(Locale.ROOT)) .putString("render_method", materialInstance.renderMethod())
.putBoolean("face_dimming", materialInstance.faceDimming()) .putBoolean("face_dimming", materialInstance.faceDimming())
.putBoolean("ambient_occlusion", materialInstance.faceDimming()) .putBoolean("ambient_occlusion", materialInstance.faceDimming())
.build()); .build());
@ -396,12 +396,12 @@ public class BlockRegistryPopulator {
} }
if (components.lightEmission() != null) { if (components.lightEmission() != null) {
builder.putCompound("minecraft:block_light_emission", NbtMap.builder() builder.putCompound("minecraft:block_light_emission", NbtMap.builder()
.putFloat("value", components.lightEmission()) .putFloat("value", ((float) components.lightEmission()) / 15f)
.build()); .build());
} }
if (components.lightFilter() != null) { if (components.lightDampening() != null) {
builder.putCompound("minecraft:block_light_filter", NbtMap.builder() builder.putCompound("minecraft:block_light_filter", NbtMap.builder()
.putByte("value", components.lightFilter().byteValue()) .putByte("value", components.lightDampening().byteValue())
.build()); .build());
} }
if (components.rotation() != null) { if (components.rotation() != null) {

Datei anzeigen

@ -59,9 +59,9 @@ public class GeyserBuilderProvider extends AbstractProvider implements BuilderPr
public void registerProviders(Map<Class<?>, ProviderSupplier> providers) { public void registerProviders(Map<Class<?>, ProviderSupplier> providers) {
providers.put(Command.Builder.class, args -> new GeyserCommandManager.CommandBuilder<>((Class<? extends CommandSource>) args[0])); 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(CustomBlockComponents.Builder.class, args -> new GeyserCustomBlockComponents.CustomBlockComponentsBuilder());
providers.put(CustomBlockData.Builder.class, args -> new GeyserCustomBlockData.BuilderImpl()); providers.put(CustomBlockData.Builder.class, args -> new GeyserCustomBlockData.CustomBlockDataBuilder());
providers.put(CustomBlockPermutation.Builder.class, args -> new GeyserCustomBlockPermutation.BuilderImpl()); providers.put(CustomBlockPermutation.Builder.class, args -> new GeyserCustomBlockPermutation.CustomBlockPermutationBuilder());
providers.put(CustomItemData.Builder.class, args -> new GeyserCustomItemData.CustomItemDataBuilder()); providers.put(CustomItemData.Builder.class, args -> new GeyserCustomItemData.CustomItemDataBuilder());
providers.put(CustomItemOptions.Builder.class, args -> new GeyserCustomItemOptions.CustomItemOptionsBuilder()); providers.put(CustomItemOptions.Builder.class, args -> new GeyserCustomItemOptions.CustomItemOptionsBuilder());