Added Particles To Bogey Style (And Respective Builder)

This commit is contained in:
Rabbitminers 2023-04-30 21:12:14 +01:00
parent 08c000b8ba
commit da30e78815
2 changed files with 14 additions and 3 deletions

View File

@ -11,6 +11,8 @@ import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.TranslatableComponent;
@ -52,6 +54,7 @@ public class AllBogeyStyles {
protected Component displayName = Lang.translateDirect("create.bogeys.invalid"); protected Component displayName = Lang.translateDirect("create.bogeys.invalid");
protected ResourceLocation soundType = AllSoundEvents.TRAIN2.getId(); protected ResourceLocation soundType = AllSoundEvents.TRAIN2.getId();
protected CompoundTag defaultData = new CompoundTag(); protected CompoundTag defaultData = new CompoundTag();
protected ParticleType<?> particleType = ParticleTypes.CRIT;
protected Optional<CommonRenderer> commonRenderer = Optional.empty(); protected Optional<CommonRenderer> commonRenderer = Optional.empty();
public BogeyStyleBuilder(ResourceLocation name) { public BogeyStyleBuilder(ResourceLocation name) {
@ -85,6 +88,11 @@ public class AllBogeyStyles {
return this; return this;
} }
public BogeyStyleBuilder particle(ParticleType<?> particleType) {
this.particleType = particleType;
return this;
}
public BogeyStyleBuilder commonRenderer(Supplier<? extends CommonRenderer> commonRenderer) { public BogeyStyleBuilder commonRenderer(Supplier<? extends CommonRenderer> commonRenderer) {
this.commonRenderer = Optional.of(commonRenderer.get()); this.commonRenderer = Optional.of(commonRenderer.get());
return this; return this;
@ -92,7 +100,7 @@ public class AllBogeyStyles {
public BogeyStyle build() { public BogeyStyle build() {
BogeyStyle entry = BogeyStyle entry =
new BogeyStyle(name, displayName, soundType, defaultData, sizes, commonRenderer); new BogeyStyle(name, displayName, soundType, particleType, defaultData, sizes, commonRenderer);
BOGEY_STYLES.put(name, entry); BOGEY_STYLES.put(name, entry);
return entry; return entry;
} }

View File

@ -7,6 +7,7 @@ import com.simibubi.create.content.logistics.trains.BogeyRenderer;
import com.simibubi.create.content.logistics.trains.BogeyRenderer.CommonRenderer; import com.simibubi.create.content.logistics.trains.BogeyRenderer.CommonRenderer;
import com.simibubi.create.content.logistics.trains.BogeySizes; import com.simibubi.create.content.logistics.trains.BogeySizes;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -28,13 +29,15 @@ public class BogeyStyle {
private final Map<BogeySizes.BogeySize, SizeData> sizes; private final Map<BogeySizes.BogeySize, SizeData> sizes;
public final Component displayName; public final Component displayName;
public final ResourceLocation soundType; public final ResourceLocation soundType;
public final ParticleType<?> particleType;
public final CompoundTag defaultData; public final CompoundTag defaultData;
public BogeyStyle(ResourceLocation name, Component displayName, ResourceLocation soundType, CompoundTag defaultData, public BogeyStyle(ResourceLocation name, Component displayName, ResourceLocation soundType, ParticleType<?> particleType,
Map<BogeySizes.BogeySize, SizeData> sizes, Optional<CommonRenderer> commonRenderer) { CompoundTag defaultData, Map<BogeySizes.BogeySize, SizeData> sizes, Optional<CommonRenderer> commonRenderer) {
this.name = name; this.name = name;
this.displayName = displayName; this.displayName = displayName;
this.soundType = soundType; this.soundType = soundType;
this.particleType = particleType;
this.defaultData = defaultData; this.defaultData = defaultData;
this.sizes = sizes; this.sizes = sizes;