Fix build and dist issues
- Fixed javac not inferring type vars correctly - Fixed client particle classes being loaded on server dist
This commit is contained in:
parent
6076dc22a2
commit
19ca9dd7d6
4 changed files with 26 additions and 10 deletions
|
@ -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.<FluidTankItem>customItemModel("_", "block_single_window"))
|
||||
.build()
|
||||
.register();
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
<D extends IParticleData> AllParticleTypes(Supplier<? extends ICustomParticle<D>> typeFactory, Supplier<IParticleFactory<D>> particleMetaFactory) {
|
||||
<D extends IParticleData> AllParticleTypes(Supplier<? extends ICustomParticle<D>> typeFactory,
|
||||
Supplier<Supplier<IParticleFactory<D>>> 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<D extends IParticleData> {
|
||||
Supplier<? extends ICustomParticle<D>> typeFactory;
|
||||
Supplier<IParticleFactory<D>> particleMetaFactory;
|
||||
Supplier<Supplier<IParticleFactory<D>>> particleMetaFactory;
|
||||
ParticleType<D> type;
|
||||
ResourceLocation id;
|
||||
|
||||
public ParticleEntry(ResourceLocation id, Supplier<? extends ICustomParticle<D>> typeFactory, Supplier<IParticleFactory<D>> particleMetaFactory) {
|
||||
public ParticleEntry(ResourceLocation id, Supplier<? extends ICustomParticle<D>> typeFactory,
|
||||
Supplier<Supplier<IParticleFactory<D>>> 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<CubeParticleData> {
|
||||
|
||||
|
@ -58,6 +61,7 @@ public class CubeParticleData implements IParticleData, ICustomParticle<CubePart
|
|||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ParticleManager.IParticleMetaFactory<CubeParticleData> getFactory() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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<HeaterParticleData> {
|
||||
|
||||
public static final IParticleData.IDeserializer<HeaterParticleData> DESERIALIZER =
|
||||
new IParticleData.IDeserializer<HeaterParticleData>() {
|
||||
@Override
|
||||
|
@ -57,6 +60,7 @@ public class HeaterParticleData implements IParticleData, ICustomParticle<Heater
|
|||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IParticleMetaFactory<HeaterParticleData> getFactory() {
|
||||
return HeaterParticle.Factory::new;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue