Remove renderLaser call from ReconstructorRenderer

It's handled by the particle
This commit is contained in:
Mrbysco 2024-03-12 18:49:18 +01:00
parent 58b9cbc9d2
commit 337fbfb854
2 changed files with 3 additions and 27 deletions

View file

@ -22,9 +22,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -38,9 +36,6 @@ public class ReconstructorRenderer implements BlockEntityRenderer<TileEntityAtom
if(!tile.getLevel().getBlockState(tile.getBlockPos()).is(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get())) if(!tile.getLevel().getBlockState(tile.getBlockPos()).is(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()))
return; //TODO crash bandage return; //TODO crash bandage
ItemStack stack = tile.inv.getStackInSlot(0); ItemStack stack = tile.inv.getStackInSlot(0);
//default color 0x1b6dff
int color = tile.getBeamColor();
int length = 5;
Direction direction = tile.getOrientation(); Direction direction = tile.getOrientation();
float rot = 360.0f - direction.getOpposite().toYRot(); //Sigh... float rot = 360.0f - direction.getOpposite().toYRot(); //Sigh...
float pitch = 0; float pitch = 0;
@ -50,14 +45,6 @@ public class ReconstructorRenderer implements BlockEntityRenderer<TileEntityAtom
pitch = -90; pitch = -90;
} }
if (stack.getItem() instanceof ILensItem) {
length = ((ILensItem) stack.getItem()).getLens().getDistance();
}
if (tile.getProgress() > 0) {
AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, length, 0, color, 0.8f * tile.getProgress(), 0.2f);
tile.decTTL();
}
if (stack.isEmpty() || !(stack.getItem() instanceof ILensItem)) { if (stack.isEmpty() || !(stack.getItem() instanceof ILensItem)) {
return; return;
} }
@ -84,9 +71,6 @@ public class ReconstructorRenderer implements BlockEntityRenderer<TileEntityAtom
@Override @Override
public AABB getRenderBoundingBox(TileEntityAtomicReconstructor blockEntity) { public AABB getRenderBoundingBox(TileEntityAtomicReconstructor blockEntity) {
if (blockEntity.getProgress() > 0.0f)
return new AABB(Vec3.atCenterOf(blockEntity.getBlockPos()), Vec3.atCenterOf(blockEntity.getBlockPos()).add(1,1,1).relative(blockEntity.getBlockState().getValue(BlockStateProperties.FACING), 11));
else
return BlockEntityRenderer.super.getRenderBoundingBox(blockEntity); return BlockEntityRenderer.super.getRenderBoundingBox(blockEntity);
} }
} }

View file

@ -22,7 +22,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam; import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.minecraft.client.Camera; import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -37,14 +36,12 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.language.I18n; import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.api.distmarker.OnlyIn;
@ -244,15 +241,10 @@ public final class AssetUtil {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) { public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
BlockEntity tile = mc.level.getBlockEntity(BlockPos.containing(startX, startY, startZ));
if (tile instanceof TileEntityAtomicReconstructor) {
((TileEntityAtomicReconstructor) tile).resetBeam(maxAge, color);
} else {
if (mc.player != null && mc.player.distanceToSqr(startX, startY, startZ) <= 64 || mc.player.distanceToSqr(endX, endY, endZ) <= 64) { if (mc.player != null && mc.player.distanceToSqr(startX, startY, startZ) <= 64 || mc.player.distanceToSqr(endX, endY, endZ) <= 64) {
mc.level.addParticle(ParticleBeam.Factory.createData(endX, endY, endZ, color, alpha, maxAge, rotationTime, size), startX, startY, startZ, 0, 0, 0); mc.level.addParticle(ParticleBeam.Factory.createData(endX, endY, endZ, color, alpha, maxAge, rotationTime, size), startX, startY, startZ, 0, 0, 0);
} }
} }
}
/* @OnlyIn(Dist.CLIENT) /* @OnlyIn(Dist.CLIENT)
public static void renderLaser(MatrixStack matrixStack, IRenderTypeBuffer buffer, float x, float y, float z, float tx, float ty, float tz, float rotation, int color, float beamWidth) { public static void renderLaser(MatrixStack matrixStack, IRenderTypeBuffer buffer, float x, float y, float z, float tx, float ty, float tz, float rotation, int color, float beamWidth) {