Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -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" }
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static record FrameModel(
float rearAttachmentPos,
float frontAttachmentPos
) {
@Environment(EnvType.CLIENT)

public Function<EntityRendererFactory.Context, Model> model() {
return AutomobilityModels.MODELS.get(modelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static record WheelModel(
Identifier texture,
Identifier modelId
) {
@Environment(EnvType.CLIENT)

public Function<EntityRendererFactory.Context, Model> model() {
return AutomobilityModels.MODELS.get(modelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static <T extends FrontAttachment> FrontAttachmentType<T> register(Front
}

public record FrontAttachmentModel(Identifier texture, Identifier modelId, float scale) {
@Environment(EnvType.CLIENT)

public Function<EntityRendererFactory.Context, Model> model() {
return AutomobilityModels.MODELS.get(modelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static <T extends RearAttachment> RearAttachmentType<T> register(RearAtt
}

public record RearAttachmentModel(Identifier texture, Identifier modelId, float pivotDistPx) {
@Environment(EnvType.CLIENT)

public Function<EntityRendererFactory.Context, Model> model() {
return AutomobilityModels.MODELS.get(modelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 (!(
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum AutomobilityEntities {;
public static void init() {
}

@Environment(EnvType.CLIENT)

public static void initClient() {
EntityRendererRegistry.INSTANCE.register(AUTOMOBILE, AutomobileEntityRenderer::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
}
}

@Environment(EnvType.CLIENT)

protected boolean renders(T component) {
return !component.isEmpty();
}
Expand All @@ -84,7 +84,7 @@ protected boolean addToCreative(T component) {
return !component.isEmpty();
}

@Environment(EnvType.CLIENT)

public void registerItemRenderer(Function<T, Model> modelProvider, Function<T, Identifier> textureProvider, ToFloatFunction<T> scaleProvider) {
BuiltinItemRendererRegistry.INSTANCE.register(this, (stack, mode, matrices, vertexConsumers, light, overlay) -> {
var component = this.getComponent(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ public static void init() {
);
}

@Environment(EnvType.CLIENT) private static EntityRendererFactory.Context cachedCtx;
@Environment(EnvType.CLIENT) private static final Map<AutomobileFrame, Model> frameModelPool = new HashMap<>();
@Environment(EnvType.CLIENT) private static final Map<AutomobileWheel, Model> wheelModelPool = new HashMap<>();
@Environment(EnvType.CLIENT) private static final Map<AutomobileEngine, Model> engineModelPool = new HashMap<>();
@Environment(EnvType.CLIENT) private static final Map<RearAttachmentType<?>, Model> rearAttModelPool = new HashMap<>();
@Environment(EnvType.CLIENT) private static final Map<FrontAttachmentType<?>, Model> frontAttModelPool = new HashMap<>();
private static EntityRendererFactory.Context cachedCtx;
private static final Map<AutomobileFrame, Model> frameModelPool = new HashMap<>();
private static final Map<AutomobileWheel, Model> wheelModelPool = new HashMap<>();
private static final Map<AutomobileEngine, Model> engineModelPool = new HashMap<>();
private static final Map<RearAttachmentType<?>, Model> rearAttModelPool = new HashMap<>();
private static final Map<FrontAttachmentType<?>, 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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

@Environment(EnvType.CLIENT)

public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider sprites;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
import java.util.Map;
import java.util.function.Function;

@Environment(EnvType.CLIENT)

public enum AutomobilityModels {;
public static final Map<Identifier, Function<EntityRendererFactory.Context, Model>> MODELS = new HashMap<>();

@Environment(EnvType.CLIENT)

public static void init() {
MODELS.put(Automobility.id("empty"), EmptyModel::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand Down Expand Up @@ -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);
Expand Down