mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
goodbye arrays of float arrays...
This commit is contained in:
parent
26dfa7cb75
commit
70b0131f88
12 changed files with 33 additions and 54 deletions
|
@ -33,7 +33,7 @@ public abstract class Lens {
|
||||||
/**
|
/**
|
||||||
* Returns the color in an array of 3 float values that are r, g, b
|
* Returns the color in an array of 3 float values that are r, g, b
|
||||||
*/
|
*/
|
||||||
public abstract float[] getColor();
|
public abstract int getColor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum distance the beam goes with this lens
|
* Gets the maximum distance the beam goes with this lens
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class LensConversion extends Lens {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor() {
|
public int getColor() {
|
||||||
return new float[]{27F / 255F, 109F / 255F, 1F};
|
return 0x1B6FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,20 +31,22 @@ import java.util.Random;
|
||||||
|
|
||||||
public class LensColor extends Lens {
|
public class LensColor extends Lens {
|
||||||
|
|
||||||
|
//1k to fire, 200 per item
|
||||||
public static final int ENERGY_USE = 200;
|
public static final int ENERGY_USE = 200;
|
||||||
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
||||||
public static final float[][] POSSIBLE_COLORS = {{158F, 43F, 39F}, //Red
|
public static final int[] POSSIBLE_COLORS = new int[]{
|
||||||
{234F, 126F, 53F}, //Orange
|
0x9E2B27, //Red
|
||||||
{194F, 181F, 28F}, //Yellow
|
0xEA7E35, //Orange
|
||||||
{57F, 186F, 46F}, //Lime Green
|
0xC2B41C, //Yellow
|
||||||
{54F, 75F, 24F}, //Green
|
0x39BA2E, //Lime Green
|
||||||
{99F, 135F, 210F}, //Light Blue
|
0x364B18, //Green
|
||||||
{38F, 113F, 145F}, //Cyan
|
0x6387D2, //Light Blue
|
||||||
{37F, 49F, 147F}, //Blue
|
0x267191, //Cyan
|
||||||
{126F, 52F, 191F}, //Purple
|
0x253293, //Blue
|
||||||
{190F, 73F, 201F}, //Magenta
|
0x7E34BF, //Purple
|
||||||
{217F, 129F, 153F}, //Pink
|
0xBE49C9, //Magenta
|
||||||
{86F, 51F, 28F}, //Brown
|
0xD98199, //Pink
|
||||||
|
0x56331C, //Brown
|
||||||
};
|
};
|
||||||
private final Random rand = new Random();
|
private final Random rand = new Random();
|
||||||
|
|
||||||
|
@ -96,9 +98,8 @@ public class LensColor extends Lens {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor() {
|
public int getColor() {
|
||||||
float[] colors = POSSIBLE_COLORS[this.rand.nextInt(POSSIBLE_COLORS.length)];
|
return POSSIBLE_COLORS[this.rand.nextInt(POSSIBLE_COLORS.length)];
|
||||||
return new float[]{colors[0] / 255F, colors[1] / 255F, colors[2] / 255F};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class LensDeath extends Lens {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor() {
|
public int getColor() {
|
||||||
return new float[]{188F / 255F, 222F / 255F, 1F};
|
return 0xBCDEFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class LensDetonation extends Lens {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor() {
|
public int getColor() {
|
||||||
return new float[]{158F / 255F, 43F / 255F, 39F / 255F};
|
return 0x9E2B27;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -104,8 +104,8 @@ public class LensDisenchanting extends Lens {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor() {
|
public int getColor() {
|
||||||
return new float[]{234F / 255F, 173F / 255F, 1.0f};
|
return 0xEBADFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -171,8 +171,8 @@ public class LensMining extends Lens {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor() {
|
public int getColor() {
|
||||||
return new float[]{76F / 255F, 76F / 255F, 76F / 255F};
|
return 0x4C4C4C;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,21 +32,6 @@ public final class LensRecipeHandler {
|
||||||
// ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(InitBlocks.blockColoredLampOn), changer);
|
// ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(InitBlocks.blockColoredLampOn), changer);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// @Deprecated //Use lens-checking method below.
|
|
||||||
// public static List<LensConversionRecipe> getRecipesFor(ItemStack input) {
|
|
||||||
// List<LensConversionRecipe> possibleRecipes = new ArrayList<>();
|
|
||||||
// for (LensConversionRecipe recipe : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES)
|
|
||||||
// if (recipe.getInput().apply(input)) possibleRecipes.add(recipe);
|
|
||||||
// return possibleRecipes;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Nullable
|
|
||||||
// public static LensConversionRecipe findMatchingRecipe(ItemStack input, Lens lens) {
|
|
||||||
// for (LensConversionRecipe recipe : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES)
|
|
||||||
// if (recipe.matches(input, lens)) return recipe;
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static Ingredient fromBlock(Block b) {
|
// private static Ingredient fromBlock(Block b) {
|
||||||
// return Ingredient.fromItems(Item.getItemFromBlock(b));
|
// return Ingredient.fromItems(Item.getItemFromBlock(b));
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -53,7 +53,7 @@ public final class PacketHandler {
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void handleData(CompoundNBT compound, NetworkEvent.Context context) {
|
public void handleData(CompoundNBT compound, NetworkEvent.Context context) {
|
||||||
AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), new float[]{compound.getFloat("Color1"), compound.getFloat("Color2"), compound.getFloat("Color3")}, compound.getInt("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha"));
|
AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), compound.getInt("Color"), compound.getInt("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler() {
|
public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler() {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
|
||||||
|
|
||||||
this.storage.receiveEnergyInternal(energyProduced, false);
|
this.storage.receiveEnergyInternal(energyProduced, false);
|
||||||
|
|
||||||
AssetUtil.spawnLaserWithTimeServer(this.level, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F / 255F, 163F / 255F, 74F / 255F}, 25, 0, 0.075F, 0.8F);
|
AssetUtil.spawnLaserWithTimeServer(this.level, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shootParticles(int endX, int endY, int endZ) {
|
private void shootParticles(int endX, int endY, int endZ) {
|
||||||
AssetUtil.spawnLaserWithTimeServer(this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F);
|
AssetUtil.spawnLaserWithTimeServer(this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), endX, endY, endZ, 0x429602, 10, 120, 0.1F, 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBlacklisted(Block block) {
|
private boolean isBlacklisted(Block block) {
|
||||||
|
|
|
@ -17,12 +17,10 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
|
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.tile.TileEntityAtomicReconstructor;
|
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.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.particle.Particle;
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
@ -30,7 +28,6 @@ import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.particles.IParticleData;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -41,8 +38,6 @@ import net.minecraft.util.math.vector.Vector3f;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
|
||||||
import net.minecraftforge.fml.network.PacketDispatcher;
|
|
||||||
import net.minecraftforge.fml.network.PacketDistributor;
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
|
|
||||||
public final class AssetUtil {
|
public final class AssetUtil {
|
||||||
|
@ -212,7 +207,7 @@ public final class AssetUtil {
|
||||||
// GlStateManager._popMatrix();
|
// GlStateManager._popMatrix();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) {
|
public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
CompoundNBT data = new CompoundNBT();
|
CompoundNBT data = new CompoundNBT();
|
||||||
data.putDouble("StartX", startX);
|
data.putDouble("StartX", startX);
|
||||||
|
@ -221,9 +216,7 @@ public final class AssetUtil {
|
||||||
data.putDouble("EndX", endX);
|
data.putDouble("EndX", endX);
|
||||||
data.putDouble("EndY", endY);
|
data.putDouble("EndY", endY);
|
||||||
data.putDouble("EndZ", endZ);
|
data.putDouble("EndZ", endZ);
|
||||||
data.putFloat("Color1", color[0]);
|
data.putInt("Color", color);
|
||||||
data.putFloat("Color2", color[1]);
|
|
||||||
data.putFloat("Color3", color[2]);
|
|
||||||
data.putDouble("RotationTime", rotationTime);
|
data.putDouble("RotationTime", rotationTime);
|
||||||
data.putFloat("Size", size);
|
data.putFloat("Size", size);
|
||||||
data.putInt("MaxAge", maxAge);
|
data.putInt("MaxAge", maxAge);
|
||||||
|
@ -233,7 +226,7 @@ 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, float[] 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();
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue