Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CustomParticleManager #6079

Open
wants to merge 1 commit into
base: 1.21.1
Choose a base branch
from
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public void render(ChargingStationBlockEntity te, float partialTicks, PoseStack
{
if(te.getLevelNonnull().hasChunkAt(te.getBlockPos()))
{
te.particles.getValue().render(matrixStack, bufferIn, partialTicks);
matrixStack.pushPose();
matrixStack.translate(.5, .3125, .5);
matrixStack.scale(.75f, .75f, .75f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void render(ClocheBlockEntity tile, float partialTicks, PoseStack matrixS

// Render particles in the TER rather than using the standard particle engine to avoid depth issues/the
// particles not rendering at all outside of fabulous mode
tile.particles.getValue().render(matrixStack, bufferIn, partialTicks);

ClocheRecipe recipe = tile.cachedRecipe.get();
if(recipe!=null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import blusunrize.immersiveengineering.api.IEProperties;
import blusunrize.immersiveengineering.api.energy.AveragingEnergyStorage;
import blusunrize.immersiveengineering.client.fx.CustomParticleManager;
import blusunrize.immersiveengineering.common.blocks.BlockCapabilityRegistration.BECapabilityRegistrar;
import blusunrize.immersiveengineering.common.blocks.IEBaseBlockEntity;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IBlockBounds;
Expand Down Expand Up @@ -58,25 +57,18 @@ public class ChargingStationBlockEntity extends IEBaseBlockEntity implements IEC
{
public AveragingEnergyStorage energyStorage = new AveragingEnergyStorage(32000);
public NonNullList<ItemStack> inventory = NonNullList.withSize(1, ItemStack.EMPTY);
// Using Mutable to "hide" the reference to a client-only type behind generics type erasure
public final Mutable<CustomParticleManager> particles;
private boolean charging = true;
public int comparatorOutput = 0;
private final IEnergyStorage energyCap = makeEnergyInput(energyStorage);

public ChargingStationBlockEntity(BlockPos pos, BlockState state)
{
super(IEBlockEntities.CHARGING_STATION.get(), pos, state);
if(FMLLoader.getDist().isClient())
this.particles = new MutableObject<>(new CustomParticleManager());
else
this.particles = new MutableObject<>();
}

@Override
public void tickClient()
{
particles.getValue().clientTick();
IEnergyStorage itemEnergy = inventory.get(0).getCapability(EnergyStorage.ITEM);
if(itemEnergy!=null&&charging)
{
Expand All @@ -91,12 +83,10 @@ public void tickClient()
if(charge >= 1||(time%12 >= i*4&&time%12 <= i*4+2))
{
int shift = i-1;
double x = .5+(getFacing()==Direction.WEST?-.46875: getFacing()==Direction.EAST?.46875: getFacing()==Direction.NORTH?(-.1875*shift): (.1875*shift));
double y = .25;
double z = .5+(getFacing()==Direction.NORTH?-.46875: getFacing()==Direction.SOUTH?.46875: getFacing()==Direction.EAST?(-.1875*shift): (.1875*shift));
particles.getValue().add(
new DustParticleOptions(new Vector3f(1-charge, charge, 0), .5f), x, y, z, .25, .25, .25, -1
);
double x = getBlockPos().getX()+.5+(getFacing()==Direction.WEST?-.46875: getFacing()==Direction.EAST?.46875: getFacing()==Direction.NORTH?(-.1875*shift): (.1875*shift));
double y = getBlockPos().getY()+.25;
double z = getBlockPos().getZ()+.5+(getFacing()==Direction.NORTH?-.46875: getFacing()==Direction.SOUTH?.46875: getFacing()==Direction.EAST?(-.1875*shift): (.1875*shift));
level.addParticle(new DustParticleOptions(new Vector3f(1-charge, charge, 0), .5f), x, y, z, .25, .25, .25);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import blusunrize.immersiveengineering.api.crafting.ClocheRecipe;
import blusunrize.immersiveengineering.api.crafting.TagOutputList;
import blusunrize.immersiveengineering.api.energy.MutableEnergyStorage;
import blusunrize.immersiveengineering.client.fx.CustomParticleManager;
import blusunrize.immersiveengineering.common.blocks.BlockCapabilityRegistration.BECapabilityRegistrar;
import blusunrize.immersiveengineering.common.blocks.IEBaseBlockEntity;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IHasDummyBlocks;
Expand All @@ -33,6 +32,9 @@
import blusunrize.immersiveengineering.common.util.IEBlockCapabilityCaches.IEBlockCapabilityCache;
import blusunrize.immersiveengineering.common.util.inventory.IEInventoryHandler;
import blusunrize.immersiveengineering.common.util.inventory.IIEInventory;
import blusunrize.immersiveengineering.mixin.accessors.client.ParticleManagerAccess;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup.Provider;
Expand Down Expand Up @@ -100,8 +102,6 @@ public boolean isFluidValid(FluidStack fluid)
public MutableEnergyStorage energyStorage = new MutableEnergyStorage(
ENERGY_CAPACITY, Math.max(256, getOrDefault(IEServerConfig.MACHINES.cloche_consumption))
);
// Using Mutable to "hide" the reference to a client-only type behind generics type erasure
public final Mutable<CustomParticleManager> particles;
public final Supplier<ClocheRecipe> cachedRecipe = CachedRecipe.cached(
ClocheRecipe::findRecipe, () -> level, () -> inventory.get(SLOT_SEED), () -> inventory.get(SLOT_SOIL)
);
Expand All @@ -122,10 +122,6 @@ public boolean isFluidValid(FluidStack fluid)
public ClocheBlockEntity(BlockEntityType<ClocheBlockEntity> type, BlockPos pos, BlockState state)
{
super(type, pos, state);
if(FMLLoader.getDist().isClient())
this.particles = new MutableObject<>(new CustomParticleManager());
else
this.particles = new MutableObject<>();
}

@Override
Expand All @@ -137,7 +133,6 @@ public boolean canTickAny()
@Override
public void tickClient()
{
particles.getValue().clientTick();
ItemStack seed = inventory.get(SLOT_SEED);
ItemStack soil = inventory.get(SLOT_SOIL);
if(renderActive)
Expand All @@ -151,7 +146,11 @@ public void tickClient()
else
renderGrowth = 0;
if(ApiUtils.RANDOM.nextInt(8)==0)
particles.getValue().add(new DustParticleOptions(new Vector3f(.55f, .1f, .1f), 1), .5, 2.6875, .5, .25, .25, .25, 20);
{
Particle p = ((ParticleManagerAccess)Minecraft.getInstance().particleEngine).invokeMakeParticle(new DustParticleOptions(new Vector3f(.55f, .1f, .1f), 1), getBlockPos().getX() + .5, getBlockPos().getY() + 2.6875, getBlockPos().getZ() + .5, .25, .25, .25);
p.setLifetime(20);
Minecraft.getInstance().particleEngine.add(p);
}
}
}
}
Expand Down