diff --git a/build.gradle b/build.gradle index ff3e4d00..a51a8d5f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.10-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } @@ -11,6 +11,7 @@ version = project.mod_version group = project.maven_group repositories { + mavenLocal() maven { url = "https://maven.gegy.dev/" } maven { url = "https://maven.terraformersmc.com/" } maven { url = "https://aperlambda.github.io/maven" } diff --git a/gradle.properties b/gradle.properties index 2cc02260..5464ba31 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx3G minecraft_version=1.18.2 -yarn_mappings=1.18.2+build.3 -loader_version=0.14.8 +yarn_mappings=1.18.2+build.4 +loader_version=0.16.5 #Fabric api -fabric_version=0.56.0+1.18.2 +fabric_version=0.77.0+1.18.2 # Other Dependencies midnightcontrols_version=1.4.1-1.18 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a25..1e2fbf0d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileFrame.java b/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileFrame.java index 1ddc7c69..828daa02 100644 --- a/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileFrame.java +++ b/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileFrame.java @@ -256,7 +256,7 @@ public static record FrameModel( float rearAttachmentPos, float frontAttachmentPos ) { - @Environment(EnvType.CLIENT) + public Function model() { return AutomobilityModels.MODELS.get(modelId); } diff --git a/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileWheel.java b/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileWheel.java index c2ef44bc..fe42ea0c 100644 --- a/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileWheel.java +++ b/src/main/java/io/github/foundationgames/automobility/automobile/AutomobileWheel.java @@ -93,7 +93,7 @@ public static record WheelModel( Identifier texture, Identifier modelId ) { - @Environment(EnvType.CLIENT) + public Function model() { return AutomobilityModels.MODELS.get(modelId); } diff --git a/src/main/java/io/github/foundationgames/automobility/automobile/attachment/FrontAttachmentType.java b/src/main/java/io/github/foundationgames/automobility/automobile/attachment/FrontAttachmentType.java index e236c4e5..f0c099ed 100644 --- a/src/main/java/io/github/foundationgames/automobility/automobile/attachment/FrontAttachmentType.java +++ b/src/main/java/io/github/foundationgames/automobility/automobile/attachment/FrontAttachmentType.java @@ -71,7 +71,7 @@ private static FrontAttachmentType register(Front } public record FrontAttachmentModel(Identifier texture, Identifier modelId, float scale) { - @Environment(EnvType.CLIENT) + public Function model() { return AutomobilityModels.MODELS.get(modelId); } diff --git a/src/main/java/io/github/foundationgames/automobility/automobile/attachment/RearAttachmentType.java b/src/main/java/io/github/foundationgames/automobility/automobile/attachment/RearAttachmentType.java index a9bf4fd1..16bf5857 100644 --- a/src/main/java/io/github/foundationgames/automobility/automobile/attachment/RearAttachmentType.java +++ b/src/main/java/io/github/foundationgames/automobility/automobile/attachment/RearAttachmentType.java @@ -106,7 +106,7 @@ private static RearAttachmentType register(RearAtt } public record RearAttachmentModel(Identifier texture, Identifier modelId, float pivotDistPx) { - @Environment(EnvType.CLIENT) + public Function model() { return AutomobilityModels.MODELS.get(modelId); } diff --git a/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java b/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java index 4a557a79..429aa0e7 100644 --- a/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java +++ b/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java @@ -59,7 +59,7 @@ public static void init() { registerSlopes("minecraft"); } - @Environment(EnvType.CLIENT) + public static void initClient() { ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : GrassColors.getColor(0.5D, 1.0D), GRASS_OFF_ROAD); ColorProviderRegistry.ITEM.register((stack, tintIndex) -> GrassColors.getColor(0.5D, 1.0D), GRASS_OFF_ROAD.asItem()); diff --git a/src/main/java/io/github/foundationgames/automobility/block/entity/AutomobileAssemblerBlockEntity.java b/src/main/java/io/github/foundationgames/automobility/block/entity/AutomobileAssemblerBlockEntity.java index ee7be974..02cdd22c 100644 --- a/src/main/java/io/github/foundationgames/automobility/block/entity/AutomobileAssemblerBlockEntity.java +++ b/src/main/java/io/github/foundationgames/automobility/block/entity/AutomobileAssemblerBlockEntity.java @@ -49,11 +49,11 @@ import java.util.List; public class AutomobileAssemblerBlockEntity extends BlockEntity implements RenderableAutomobile { - @Environment(EnvType.CLIENT) private Model frameModel = null; - @Environment(EnvType.CLIENT) private Model engineModel = null; - @Environment(EnvType.CLIENT) private Model wheelModel = null; - @Environment(EnvType.CLIENT) private Model emptyRearAttModel = null; - @Environment(EnvType.CLIENT) private Model emptyFrontAttModel = null; + private Model frameModel = null; + private Model engineModel = null; + private Model wheelModel = null; + private Model emptyRearAttModel = null; + private Model emptyFrontAttModel = null; private boolean componentsUpdated = true; protected AutomobileFrame frame = AutomobileFrame.EMPTY; diff --git a/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 5fe019da..c7f2c03c 100644 --- a/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -91,15 +91,15 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En private final AutomobileStats stats = new AutomobileStats(); - @Environment(EnvType.CLIENT) + private Model frameModel = null; - @Environment(EnvType.CLIENT) + private Model wheelModel = null; - @Environment(EnvType.CLIENT) + private Model engineModel = null; - @Environment(EnvType.CLIENT) + private @Nullable Model rearAttachmentModel = null; - @Environment(EnvType.CLIENT) + private @Nullable Model frontAttachmentModel = null; public static final int SMALL_TURBO_TIME = 35; @@ -310,7 +310,7 @@ public void readCompactedInputData(byte data) { accelerating = (1 & d) > 0; } - @Environment(EnvType.CLIENT) + public boolean updateModels = true; public AutomobileEntity(EntityType type, World world) { @@ -1116,7 +1116,7 @@ private float calculateAcceleration(float speed, AutomobileStats stats) { return (1 / ((300 * speed) + (18.5f - (stats.getAcceleration() * 5.3f)))) * (0.9f * ((stats.getAcceleration() + 1) / 2)); } - @Environment(EnvType.CLIENT) + public void provideClientInput(boolean fwd, boolean back, boolean left, boolean right, boolean space) { // Receives inputs client-side and sends them to the server if (!( @@ -1250,7 +1250,7 @@ private static boolean inLockedViewMode() { return ControllerUtils.inControllerMode(); } - @Environment(EnvType.CLIENT) + private void updateModels(EntityRendererFactory.Context ctx) { if (updateModels) { this.frameModel = frame.model().model().apply(ctx); @@ -1263,19 +1263,19 @@ private void updateModels(EntityRendererFactory.Context ctx) { } } - @Environment(EnvType.CLIENT) + public Model getWheelModel(EntityRendererFactory.Context ctx) { updateModels(ctx); return wheelModel; } - @Environment(EnvType.CLIENT) + public Model getFrameModel(EntityRendererFactory.Context ctx) { updateModels(ctx); return frameModel; } - @Environment(EnvType.CLIENT) + public Model getEngineModel(EntityRendererFactory.Context ctx) { updateModels(ctx); return engineModel; diff --git a/src/main/java/io/github/foundationgames/automobility/entity/AutomobilityEntities.java b/src/main/java/io/github/foundationgames/automobility/entity/AutomobilityEntities.java index d827e5b6..425b49c9 100644 --- a/src/main/java/io/github/foundationgames/automobility/entity/AutomobilityEntities.java +++ b/src/main/java/io/github/foundationgames/automobility/entity/AutomobilityEntities.java @@ -57,7 +57,7 @@ public enum AutomobilityEntities {; public static void init() { } - @Environment(EnvType.CLIENT) + public static void initClient() { EntityRendererRegistry.INSTANCE.register(AUTOMOBILE, AutomobileEntityRenderer::new); diff --git a/src/main/java/io/github/foundationgames/automobility/item/AutomobileComponentItem.java b/src/main/java/io/github/foundationgames/automobility/item/AutomobileComponentItem.java index cf0c9345..2c1b21a3 100644 --- a/src/main/java/io/github/foundationgames/automobility/item/AutomobileComponentItem.java +++ b/src/main/java/io/github/foundationgames/automobility/item/AutomobileComponentItem.java @@ -75,7 +75,7 @@ public void appendStacks(ItemGroup group, DefaultedList stacks) { } } - @Environment(EnvType.CLIENT) + protected boolean renders(T component) { return !component.isEmpty(); } @@ -84,7 +84,7 @@ protected boolean addToCreative(T component) { return !component.isEmpty(); } - @Environment(EnvType.CLIENT) + public void registerItemRenderer(Function modelProvider, Function textureProvider, ToFloatFunction scaleProvider) { BuiltinItemRendererRegistry.INSTANCE.register(this, (stack, mode, matrices, vertexConsumers, light, overlay) -> { var component = this.getComponent(stack); diff --git a/src/main/java/io/github/foundationgames/automobility/item/AutomobilityItems.java b/src/main/java/io/github/foundationgames/automobility/item/AutomobilityItems.java index 329c1ffe..d280fead 100644 --- a/src/main/java/io/github/foundationgames/automobility/item/AutomobilityItems.java +++ b/src/main/java/io/github/foundationgames/automobility/item/AutomobilityItems.java @@ -68,16 +68,16 @@ public static void init() { ); } - @Environment(EnvType.CLIENT) private static EntityRendererFactory.Context cachedCtx; - @Environment(EnvType.CLIENT) private static final Map frameModelPool = new HashMap<>(); - @Environment(EnvType.CLIENT) private static final Map wheelModelPool = new HashMap<>(); - @Environment(EnvType.CLIENT) private static final Map engineModelPool = new HashMap<>(); - @Environment(EnvType.CLIENT) private static final Map, Model> rearAttModelPool = new HashMap<>(); - @Environment(EnvType.CLIENT) private static final Map, Model> frontAttModelPool = new HashMap<>(); + private static EntityRendererFactory.Context cachedCtx; + private static final Map frameModelPool = new HashMap<>(); + private static final Map wheelModelPool = new HashMap<>(); + private static final Map engineModelPool = new HashMap<>(); + private static final Map, Model> rearAttModelPool = new HashMap<>(); + private static final Map, Model> frontAttModelPool = new HashMap<>(); private static final AutomobileData reader = new AutomobileData(); - @Environment(EnvType.CLIENT) + public static void initClient() { var itemAutomobile = new ItemRenderableAutomobile(reader); EntityRenderHelper.registerContextListener(ctx -> { diff --git a/src/main/java/io/github/foundationgames/automobility/particle/DriftSmokeParticle.java b/src/main/java/io/github/foundationgames/automobility/particle/DriftSmokeParticle.java index db81bc94..1ee3acec 100644 --- a/src/main/java/io/github/foundationgames/automobility/particle/DriftSmokeParticle.java +++ b/src/main/java/io/github/foundationgames/automobility/particle/DriftSmokeParticle.java @@ -32,7 +32,7 @@ public ParticleTextureSheet getType() { return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT; } - @Environment(EnvType.CLIENT) + public static class Factory implements ParticleFactory { private final SpriteProvider sprites; diff --git a/src/main/java/io/github/foundationgames/automobility/render/AutomobilityModels.java b/src/main/java/io/github/foundationgames/automobility/render/AutomobilityModels.java index aa2c68d4..d8fa87d4 100644 --- a/src/main/java/io/github/foundationgames/automobility/render/AutomobilityModels.java +++ b/src/main/java/io/github/foundationgames/automobility/render/AutomobilityModels.java @@ -41,11 +41,11 @@ import java.util.Map; import java.util.function.Function; -@Environment(EnvType.CLIENT) + public enum AutomobilityModels {; public static final Map> MODELS = new HashMap<>(); - @Environment(EnvType.CLIENT) + public static void init() { MODELS.put(Automobility.id("empty"), EmptyModel::new); diff --git a/src/main/java/io/github/foundationgames/automobility/util/network/PayloadPackets.java b/src/main/java/io/github/foundationgames/automobility/util/network/PayloadPackets.java index 2c27270e..ec92fb64 100644 --- a/src/main/java/io/github/foundationgames/automobility/util/network/PayloadPackets.java +++ b/src/main/java/io/github/foundationgames/automobility/util/network/PayloadPackets.java @@ -23,7 +23,7 @@ import net.minecraft.util.Identifier; public enum PayloadPackets {; - @Environment(EnvType.CLIENT) + public static void sendSyncAutomobileInputPacket(AutomobileEntity entity, boolean fwd, boolean back, boolean left, boolean right, boolean space) { var buf = new PacketByteBuf(Unpooled.buffer()); buf.writeBoolean(fwd); @@ -35,7 +35,7 @@ public static void sendSyncAutomobileInputPacket(AutomobileEntity entity, boolea ClientPlayNetworking.send(Automobility.id("sync_automobile_inputs"), buf); } - @Environment(EnvType.CLIENT) + public static void requestSyncAutomobileComponentsPacket(AutomobileEntity entity) { var buf = new PacketByteBuf(Unpooled.buffer()); buf.writeInt(entity.getId()); @@ -118,7 +118,7 @@ public static void init() { }); } - @Environment(EnvType.CLIENT) + public static void initClient() { ClientPlayNetworking.registerGlobalReceiver(Automobility.id("sync_automobile_data"), (client, handler, buf, responseSender) -> { PacketByteBuf dup = PacketByteBufs.copy(buf);