All GUI compile errors fixed, switched to excludes over includes in gradle build and lots, LOTS of more fixes.
This commit is contained in:
@@ -20,12 +20,24 @@ package appeng.client.render.effects;
|
||||
|
||||
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.client.particle.IAnimatedSprite;
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.command.arguments.ItemInput;
|
||||
import net.minecraft.command.arguments.ItemParser;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
import net.minecraft.particles.ItemParticleData;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -33,23 +45,32 @@ import appeng.client.EffectType;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.entity.EntityFloatingItem;
|
||||
import appeng.entity.ICanDie;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class AssemblerFX extends Particle implements ICanDie
|
||||
{
|
||||
|
||||
public static final ParticleType<AssemblerParticleData> TYPE = new ParticleType<>(false, new AssemblerParticleData.Deserializer());
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "assembler_fx");
|
||||
}
|
||||
|
||||
private final EntityFloatingItem fi;
|
||||
private final float speed;
|
||||
private float time = 0;
|
||||
|
||||
public AssemblerFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b, final float speed, final IAEItemStack is )
|
||||
public AssemblerFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b, final float speed, final ItemStack displayItem )
|
||||
{
|
||||
super( w, x, y, z, r, g, b );
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
this.speed = speed;
|
||||
final ItemStack displayItem = is.asItemStackRepresentation();
|
||||
this.fi = new EntityFloatingItem( this, w, x, y, z, displayItem );
|
||||
w.addEntity( this.fi );
|
||||
this.maxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
|
||||
@@ -99,7 +120,6 @@ public class AssemblerFX extends Particle implements ICanDie
|
||||
|
||||
@Override
|
||||
public IParticleRenderType getRenderType() {
|
||||
// TODO: FIXME
|
||||
return IParticleRenderType.NO_RENDER;
|
||||
}
|
||||
|
||||
@@ -117,4 +137,102 @@ public class AssemblerFX extends Particle implements ICanDie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AssemblerParticleData implements IParticleData {
|
||||
|
||||
private final float r;
|
||||
private final float g;
|
||||
private final float b;
|
||||
private final float speed;
|
||||
private final ItemStack itemStack;
|
||||
|
||||
public AssemblerParticleData(float r, float g, float b, float speed, ItemStack itemStack) {
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
this.speed = speed;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleType<?> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer) {
|
||||
buffer.writeFloat(r);
|
||||
buffer.writeFloat(g);
|
||||
buffer.writeFloat(b);
|
||||
buffer.writeFloat(speed);
|
||||
buffer.writeItemStack(itemStack);
|
||||
}
|
||||
|
||||
public static class Deserializer implements IDeserializer<AssemblerParticleData> {
|
||||
|
||||
@Override
|
||||
public AssemblerParticleData deserialize(ParticleType<AssemblerParticleData> particleTypeIn, StringReader reader) throws CommandSyntaxException {
|
||||
reader.expect(' ');
|
||||
float r = reader.readFloat();
|
||||
reader.expect(' ');
|
||||
float g = reader.readFloat();
|
||||
reader.expect(' ');
|
||||
float b = reader.readFloat();
|
||||
reader.expect(' ');
|
||||
float speed = reader.readFloat();
|
||||
reader.expect(' ');
|
||||
ItemParser itemparser = (new ItemParser(reader, false)).parse();
|
||||
ItemStack itemstack = (new ItemInput(itemparser.getItem(), itemparser.getNbt())).createStack(1, false);
|
||||
return new AssemblerParticleData(r, g, b, speed, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssemblerParticleData read(ParticleType<AssemblerParticleData> particleTypeIn, PacketBuffer buffer) {
|
||||
float r = buffer.readFloat();
|
||||
float g = buffer.readFloat();
|
||||
float b = buffer.readFloat();
|
||||
float speed = buffer.readFloat();
|
||||
ItemStack itemStack = buffer.readItemStack();
|
||||
return new AssemblerParticleData(r, g, b, speed, itemStack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameters() {
|
||||
return String.format(Locale.ROOT, "%s %.2f %.2f %.2f %.2f ", Registry.PARTICLE_TYPE.getKey(this.getType()), this.r, this.g, this.b, this.speed)
|
||||
+ (new ItemInput(this.itemStack.getItem(), this.itemStack.getTag())).serialize();
|
||||
}
|
||||
|
||||
public float getR() {
|
||||
return r;
|
||||
}
|
||||
|
||||
public float getG() {
|
||||
return g;
|
||||
}
|
||||
|
||||
public float getB() {
|
||||
return b;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Factory implements IParticleFactory<AssemblerParticleData> {
|
||||
public Factory(IAnimatedSprite spriteSet) {
|
||||
}
|
||||
|
||||
public Particle makeParticle(AssemblerParticleData data, World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new AssemblerFX(world, x, y, z, data.r, data.g, data.b, data.speed, data.itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user