Fix identity annihilation plane.

Added annihilation plane blacklist tags.
Moved to using loot-table item generation for annihilation plane.
Play fluid pickup sound rather than block break sound for fluid annihilation planes.
Do not play a second block break sound (the server already does).
This commit is contained in:
Sebastian Hartte
2020-06-19 21:51:24 +02:00
parent 0a9e53d78c
commit 2458f9c890
12 changed files with 457 additions and 196 deletions
@@ -23,6 +23,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.particles.BasicParticleType;
import net.minecraft.particles.ParticleType;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -34,7 +35,8 @@ import appeng.core.AppEng;
@OnlyIn(Dist.CLIENT)
public class EnergyFx extends SpriteTexturedParticle {
public static final BasicParticleType TYPE = new BasicParticleType(false);
public static final ParticleType<EnergyParticleData> TYPE = new ParticleType<>(false,
EnergyParticleData.DESERIALIZER);
static {
TYPE.setRegistryName(AppEng.MOD_ID, "energy_fx");
@@ -85,13 +87,6 @@ public class EnergyFx extends SpriteTexturedParticle {
}
}
public void fromItem(final AEPartLocation d) {
this.posX += 0.2 * d.xOffset;
this.posY += 0.2 * d.yOffset;
this.posZ += 0.2 * d.zOffset;
this.particleScale *= 0.8f;
}
@Override
public void tick() {
super.tick();
@@ -114,7 +109,7 @@ public class EnergyFx extends SpriteTexturedParticle {
}
@OnlyIn(Dist.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> {
public static class Factory implements IParticleFactory<EnergyParticleData> {
private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite spriteSet) {
@@ -122,12 +117,18 @@ public class EnergyFx extends SpriteTexturedParticle {
}
@Override
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z,
public Particle makeParticle(EnergyParticleData data, World worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) {
EnergyFx result = new EnergyFx(worldIn, x, y, z, spriteSet);
result.setMotionX((float) xSpeed);
result.setMotionY((float) ySpeed);
result.setMotionZ((float) zSpeed);
if (data.forItem) {
result.posX += -0.2 * data.direction.xOffset;
result.posY += -0.2 * data.direction.yOffset;
result.posZ += -0.2 * data.direction.zOffset;
result.particleScale *= 0.8f;
}
return result;
}
}
@@ -0,0 +1,80 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.effects;
import java.util.Locale;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.PacketBuffer;
import net.minecraft.particles.IParticleData;
import net.minecraft.particles.ParticleType;
import appeng.api.util.AEPartLocation;
public class EnergyParticleData implements IParticleData {
public static final EnergyParticleData FOR_BLOCK = new EnergyParticleData(false, AEPartLocation.INTERNAL);
public final boolean forItem;
public final AEPartLocation direction;
public EnergyParticleData(boolean forItem, AEPartLocation direction) {
this.forItem = forItem;
this.direction = direction;
}
public static final IDeserializer<EnergyParticleData> DESERIALIZER = new IDeserializer<EnergyParticleData>() {
@Override
public EnergyParticleData deserialize(ParticleType<EnergyParticleData> particleTypeIn, StringReader reader)
throws CommandSyntaxException {
reader.expect(' ');
boolean forItem = reader.readBoolean();
reader.expect(' ');
AEPartLocation direction = AEPartLocation.valueOf(reader.readString().toUpperCase());
return new EnergyParticleData(forItem, direction);
}
@Override
public EnergyParticleData read(ParticleType<EnergyParticleData> particleTypeIn, PacketBuffer buffer) {
boolean forItem = buffer.readBoolean();
AEPartLocation direction = AEPartLocation.values()[buffer.readByte()];
return new EnergyParticleData(forItem, direction);
}
};
@Override
public ParticleType<?> getType() {
return EnergyFx.TYPE;
}
@Override
public void write(PacketBuffer buffer) {
buffer.writeBoolean(forItem);
buffer.writeByte((byte) direction.ordinal());
}
@Override
public String getParameters() {
return String.format(Locale.ROOT, "%s %s", forItem ? "true" : "false", direction.name().toLowerCase());
}
}