mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-10-31 22:50:50 +01:00
Colorful lasers
This commit is contained in:
parent
70b0131f88
commit
011834c732
4 changed files with 16 additions and 2 deletions
|
@ -26,5 +26,6 @@ public interface IAtomicReconstructor extends IEnergyTile {
|
||||||
Direction getOrientation();
|
Direction getOrientation();
|
||||||
|
|
||||||
void resetBeam(int maxAge);
|
void resetBeam(int maxAge);
|
||||||
|
void resetBeam(int maxAge, int color);
|
||||||
int getTTL();
|
int getTTL();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicRe
|
||||||
public void render(TileEntityAtomicReconstructor tile, float partialTicks, @Nonnull MatrixStack matrices, @Nonnull IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) {
|
public void render(TileEntityAtomicReconstructor tile, float partialTicks, @Nonnull MatrixStack matrices, @Nonnull IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) {
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
//default color 0x1b6dff
|
//default color 0x1b6dff
|
||||||
|
int color = tile.getBeamColor();
|
||||||
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;
|
||||||
|
@ -49,7 +50,7 @@ public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicRe
|
||||||
pitch = -90;
|
pitch = -90;
|
||||||
}
|
}
|
||||||
if (tile.getProgress() > 0) {
|
if (tile.getProgress() > 0) {
|
||||||
AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, 5, 0, 0x1b6dff, 0.8f * tile.getProgress(), 0.2f);
|
AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, 5, 0, color, 0.8f * tile.getProgress(), 0.2f);
|
||||||
tile.decTTL();
|
tile.decTTL();
|
||||||
}
|
}
|
||||||
if (stack.isEmpty() || !(stack.getItem() instanceof ILensItem)) {
|
if (stack.isEmpty() || !(stack.getItem() instanceof ILensItem)) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
private int oldEnergy;
|
private int oldEnergy;
|
||||||
private int ttl = 0;
|
private int ttl = 0;
|
||||||
private int maxAge = 0;
|
private int maxAge = 0;
|
||||||
|
private int beamColor = 0x1b6dff;
|
||||||
|
|
||||||
public TileEntityAtomicReconstructor() {
|
public TileEntityAtomicReconstructor() {
|
||||||
super(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), 1);
|
super(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), 1);
|
||||||
|
@ -62,8 +63,18 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resetBeam(int maxAge) {
|
public void resetBeam(int maxAge) {
|
||||||
|
this.resetBeam(maxAge, 0x1b6dff);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetBeam(int maxAge, int color) {
|
||||||
this.ttl = maxAge;
|
this.ttl = maxAge;
|
||||||
this.maxAge = maxAge;
|
this.maxAge = maxAge;
|
||||||
|
this.beamColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBeamColor() {
|
||||||
|
return this.beamColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getProgress(){
|
public float getProgress(){
|
||||||
|
|
|
@ -230,7 +230,7 @@ public final class AssetUtil {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
TileEntity tile = mc.level.getBlockEntity(new BlockPos(startX, startY, startZ));
|
TileEntity tile = mc.level.getBlockEntity(new BlockPos(startX, startY, startZ));
|
||||||
if(tile instanceof TileEntityAtomicReconstructor)
|
if(tile instanceof TileEntityAtomicReconstructor)
|
||||||
((TileEntityAtomicReconstructor) tile).resetBeam(maxAge);
|
((TileEntityAtomicReconstructor) tile).resetBeam(maxAge, color);
|
||||||
|
|
||||||
|
|
||||||
/* if (mc.player.distanceToSqr(startX, startY, startZ) <= 64 || mc.player.distanceToSqr(endX, endY, endZ) <= 64) {
|
/* if (mc.player.distanceToSqr(startX, startY, startZ) <= 64 || mc.player.distanceToSqr(endX, endY, endZ) <= 64) {
|
||||||
|
@ -251,6 +251,7 @@ public final class AssetUtil {
|
||||||
int g = (color >> 8) & 0xFF;
|
int g = (color >> 8) & 0xFF;
|
||||||
int b = color & 0xFF;
|
int b = color & 0xFF;
|
||||||
int a = (int) (alpha * 255);
|
int a = (int) (alpha * 255);
|
||||||
|
ActuallyAdditions.LOGGER.info("Laser: " + a);
|
||||||
|
|
||||||
int lightmap = LightTexture.pack(MAX_LIGHT_X, MAX_LIGHT_Y);
|
int lightmap = LightTexture.pack(MAX_LIGHT_X, MAX_LIGHT_Y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue