From 19ca9dd7d677db8ff3084d9f0efb5ec89ae4c6d2 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 19 Jul 2020 13:53:27 +0200 Subject: [PATCH] Fix build and dist issues - Fixed javac not inferring type vars correctly - Fixed client particle classes being loaded on server dist --- .../java/com/simibubi/create/AllBlocks.java | 2 +- .../com/simibubi/create/AllParticleTypes.java | 22 +++++++++++++------ .../particle/CubeParticleData.java | 8 +++++-- .../particle/HeaterParticleData.java | 4 ++++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 474c7f6b1..8d99a583a 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -467,7 +467,7 @@ public class AllBlocks { .onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::new)) .addLayer(() -> RenderType::getCutoutMipped) .item(FluidTankItem::new) - .model(AssetLookup.customItemModel("_", "block_single_window")) + .model(AssetLookup.customItemModel("_", "block_single_window")) .build() .register(); diff --git a/src/main/java/com/simibubi/create/AllParticleTypes.java b/src/main/java/com/simibubi/create/AllParticleTypes.java index c47062d0b..387933851 100644 --- a/src/main/java/com/simibubi/create/AllParticleTypes.java +++ b/src/main/java/com/simibubi/create/AllParticleTypes.java @@ -2,7 +2,12 @@ package com.simibubi.create; import java.util.function.Supplier; -import com.simibubi.create.content.contraptions.particle.*; +import com.simibubi.create.content.contraptions.particle.AirFlowParticleData; +import com.simibubi.create.content.contraptions.particle.CubeParticle; +import com.simibubi.create.content.contraptions.particle.CubeParticleData; +import com.simibubi.create.content.contraptions.particle.HeaterParticleData; +import com.simibubi.create.content.contraptions.particle.ICustomParticle; +import com.simibubi.create.content.contraptions.particle.RotationIndicatorParticleData; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.client.Minecraft; @@ -22,7 +27,7 @@ public enum AllParticleTypes { ROTATION_INDICATOR(RotationIndicatorParticleData::new), AIR_FLOW(AirFlowParticleData::new), HEATER_PARTICLE(HeaterParticleData::new), - CUBE(CubeParticleData::dummy, CubeParticle.Factory::new) + CUBE(CubeParticleData::dummy, () -> CubeParticle.Factory::new) ; @@ -33,7 +38,8 @@ public enum AllParticleTypes { entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory); } - AllParticleTypes(Supplier> typeFactory, Supplier> particleMetaFactory) { + AllParticleTypes(Supplier> typeFactory, + Supplier>> particleMetaFactory) { String asId = Lang.asId(this.name()); entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory, particleMetaFactory); } @@ -60,11 +66,12 @@ public enum AllParticleTypes { private class ParticleEntry { Supplier> typeFactory; - Supplier> particleMetaFactory; + Supplier>> particleMetaFactory; ParticleType type; ResourceLocation id; - public ParticleEntry(ResourceLocation id, Supplier> typeFactory, Supplier> particleMetaFactory) { + public ParticleEntry(ResourceLocation id, Supplier> typeFactory, + Supplier>> particleMetaFactory) { this.id = id; this.typeFactory = typeFactory; this.particleMetaFactory = particleMetaFactory; @@ -96,9 +103,10 @@ public enum AllParticleTypes { void registerFactory(ParticleManager particles) { makeType(); if (particleMetaFactory == null) - particles.registerFactory(type, typeFactory.get().getFactory()); + particles.registerFactory(type, typeFactory.get() + .getFactory()); else - particles.registerFactory(type, particleMetaFactory.get()); + particles.registerFactory(type, particleMetaFactory.get().get()); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticleData.java b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticleData.java index fc198fd2e..7e2ec3279 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticleData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticleData.java @@ -1,14 +1,17 @@ package com.simibubi.create.content.contraptions.particle; +import java.util.Locale; + import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.simibubi.create.AllParticleTypes; + import net.minecraft.client.particle.ParticleManager; import net.minecraft.network.PacketBuffer; import net.minecraft.particles.IParticleData; import net.minecraft.particles.ParticleType; - -import java.util.Locale; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class CubeParticleData implements IParticleData, ICustomParticle { @@ -58,6 +61,7 @@ public class CubeParticleData implements IParticleData, ICustomParticle getFactory() { return null; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticleData.java b/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticleData.java index 26cdca946..54d5e1626 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticleData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticleData.java @@ -13,10 +13,13 @@ import net.minecraft.client.particle.ParticleManager.IParticleMetaFactory; import net.minecraft.network.PacketBuffer; import net.minecraft.particles.IParticleData; import net.minecraft.particles.ParticleType; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class HeaterParticleData implements IParticleData, ICustomParticle { + public static final IParticleData.IDeserializer DESERIALIZER = new IParticleData.IDeserializer() { @Override @@ -57,6 +60,7 @@ public class HeaterParticleData implements IParticleData, ICustomParticle getFactory() { return HeaterParticle.Factory::new; }