Formatting fixes
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
@@ -30,6 +30,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class CraftingFx extends SpriteTexturedParticle {
|
||||
|
||||
@@ -39,7 +41,8 @@ public class CraftingFx extends SpriteTexturedParticle {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "crafting_fx");
|
||||
}
|
||||
|
||||
// Offset relative to center of block, is the starting point of the particle movement
|
||||
// Offset relative to center of block, is the starting point of the particle
|
||||
// movement
|
||||
private final float offsetX;
|
||||
private final float offsetY;
|
||||
private final float offsetZ;
|
||||
@@ -49,11 +52,7 @@ public class CraftingFx extends SpriteTexturedParticle {
|
||||
super(par1World, x, y, z);
|
||||
|
||||
// Pick a random normal, offset it by 0.35 and use that as the particle origin
|
||||
Vector3f off = new Vector3f(
|
||||
rand.nextFloat() - 0.5f,
|
||||
rand.nextFloat() - 0.5f,
|
||||
rand.nextFloat() - 0.5f
|
||||
);
|
||||
Vector3f off = new Vector3f(rand.nextFloat() - 0.5f, rand.nextFloat() - 0.5f, rand.nextFloat() - 0.5f);
|
||||
off.normalize();
|
||||
off.mul(0.35f);
|
||||
offsetX = off.getX();
|
||||
@@ -104,17 +103,13 @@ public class CraftingFx extends SpriteTexturedParticle {
|
||||
float maxV = this.getMaxV();
|
||||
int j = 15728880; // full brightness
|
||||
buffer.pos(avector3f[0].getX(), avector3f[0].getY(), avector3f[0].getZ()).tex(maxU, maxV)
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j)
|
||||
.endVertex();
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j).endVertex();
|
||||
buffer.pos(avector3f[1].getX(), avector3f[1].getY(), avector3f[1].getZ()).tex(maxU, minV)
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j)
|
||||
.endVertex();
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j).endVertex();
|
||||
buffer.pos(avector3f[2].getX(), avector3f[2].getY(), avector3f[2].getZ()).tex(minU, minV)
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j)
|
||||
.endVertex();
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j).endVertex();
|
||||
buffer.pos(avector3f[3].getX(), avector3f[3].getY(), avector3f[3].getZ()).tex(minU, maxV)
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j)
|
||||
.endVertex();
|
||||
.color(this.particleRed, this.particleGreen, this.particleBlue, alpha).lightmap(j).endVertex();
|
||||
}
|
||||
|
||||
// https://easings.net/#easeOutCirc
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import appeng.tile.crafting.MolecularAssemblerRenderer;
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -105,6 +104,7 @@ import appeng.server.AECommand;
|
||||
import appeng.spatial.StorageCellBiome;
|
||||
import appeng.spatial.StorageCellModDimension;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.crafting.MolecularAssemblerRenderer;
|
||||
import appeng.worldgen.MeteoriteWorldGen;
|
||||
|
||||
final class Registration {
|
||||
|
||||
@@ -22,7 +22,6 @@ import static appeng.block.AEBaseBlock.defaultProps;
|
||||
import static appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
|
||||
import static appeng.decorative.solid.BlockSkyStone.SkystoneType;
|
||||
|
||||
import appeng.tile.crafting.*;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
@@ -70,6 +69,7 @@ import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.fluids.block.BlockFluidInterface;
|
||||
import appeng.fluids.tile.TileFluidInterface;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
import appeng.tile.crafting.*;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.misc.*;
|
||||
@@ -467,8 +467,7 @@ public final class ApiBlocks implements IBlocks {
|
||||
public void customize(TileEntityRendering<TileMolecularAssembler> rendering) {
|
||||
rendering.tileEntityRenderer(MolecularAssemblerRenderer::new);
|
||||
}
|
||||
})
|
||||
.build())
|
||||
}).build())
|
||||
.build();
|
||||
|
||||
this.lightDetector = registry.block("light_detector", BlockLightDetector::new)
|
||||
|
||||
@@ -18,13 +18,8 @@
|
||||
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.tile.crafting.AssemblerAnimationStatus;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -32,6 +27,13 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.tile.crafting.AssemblerAnimationStatus;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class PacketAssemblerAnimation extends AppEngPacket {
|
||||
|
||||
private final BlockPos pos;
|
||||
|
||||
@@ -3,7 +3,8 @@ package appeng.tile.crafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Stores client-side only state about the ongoing animation for a molecular assembler.
|
||||
* Stores client-side only state about the ongoing animation for a molecular
|
||||
* assembler.
|
||||
*/
|
||||
public class AssemblerAnimationStatus {
|
||||
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
|
||||
package appeng.tile.crafting;
|
||||
|
||||
import appeng.client.render.effects.CraftingFx;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
@@ -41,18 +44,19 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Random;
|
||||
import appeng.client.render.effects.CraftingFx;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* Renders the item currently being crafted by the molecular assembler, as well as
|
||||
* the light strip when it's powered.
|
||||
* Renders the item currently being crafted by the molecular assembler, as well
|
||||
* as the light strip when it's powered.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class MolecularAssemblerRenderer extends TileEntityRenderer<TileMolecularAssembler> {
|
||||
|
||||
public static final ResourceLocation LIGHTS_MODEL = new ResourceLocation(AppEng.MOD_ID, "block/molecular_assembler_lights");
|
||||
public static final ResourceLocation LIGHTS_MODEL = new ResourceLocation(AppEng.MOD_ID,
|
||||
"block/molecular_assembler_lights");
|
||||
|
||||
private static final RenderType MC_161917_RENDERTYPE_FIX = createRenderType();
|
||||
|
||||
@@ -63,7 +67,8 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<TileMolecular
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileMolecularAssembler molecularAssembler, float partialTicks, MatrixStack ms, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
public void render(TileMolecularAssembler molecularAssembler, float partialTicks, MatrixStack ms,
|
||||
IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
|
||||
AssemblerAnimationStatus status = molecularAssembler.getAnimationStatus();
|
||||
if (status != null) {
|
||||
@@ -84,21 +89,24 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<TileMolecular
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPowerLight(MatrixStack ms, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
// Render the translucent light overlay here instead of in the block, because thanks to the following MC
|
||||
// bug, our particles would otherwise not be visible (because the glass pane would also render as translucent,
|
||||
private void renderPowerLight(MatrixStack ms, IRenderTypeBuffer bufferIn, int combinedLightIn,
|
||||
int combinedOverlayIn) {
|
||||
// Render the translucent light overlay here instead of in the block, because
|
||||
// thanks to the following MC
|
||||
// bug, our particles would otherwise not be visible (because the glass pane
|
||||
// would also render as translucent,
|
||||
// even the fully transparent part)
|
||||
// https://bugs.mojang.com/browse/MC-161917
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
IBakedModel lightsModel = minecraft.getModelManager().getModel(LIGHTS_MODEL);
|
||||
IVertexBuilder buffer = bufferIn.getBuffer(MC_161917_RENDERTYPE_FIX);
|
||||
|
||||
minecraft.getBlockRendererDispatcher().getBlockModelRenderer().renderModel(
|
||||
ms.getLast(), buffer, null, lightsModel, 1, 1, 1, combinedLightIn, combinedOverlayIn, EmptyModelData.INSTANCE
|
||||
);
|
||||
minecraft.getBlockRendererDispatcher().getBlockModelRenderer().renderModel(ms.getLast(), buffer, null,
|
||||
lightsModel, 1, 1, 1, combinedLightIn, combinedOverlayIn, EmptyModelData.INSTANCE);
|
||||
}
|
||||
|
||||
private void renderStatus(TileMolecularAssembler molecularAssembler, MatrixStack ms, IRenderTypeBuffer bufferIn, int combinedLightIn, AssemblerAnimationStatus status) {
|
||||
private void renderStatus(TileMolecularAssembler molecularAssembler, MatrixStack ms, IRenderTypeBuffer bufferIn,
|
||||
int combinedLightIn, AssemblerAnimationStatus status) {
|
||||
double centerX = molecularAssembler.getPos().getX() + 0.5f;
|
||||
double centerY = molecularAssembler.getPos().getY() + 0.5f;
|
||||
double centerZ = molecularAssembler.getPos().getZ() + 0.5f;
|
||||
@@ -110,11 +118,7 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<TileMolecular
|
||||
|
||||
if (AppEng.proxy.shouldAddParticles(particleRandom)) {
|
||||
for (int x = 0; x < (int) Math.ceil(status.getSpeed() / 5.0); x++) {
|
||||
minecraft.particles.addParticle(
|
||||
CraftingFx.TYPE,
|
||||
centerX, centerY, centerZ,
|
||||
0, 0, 0
|
||||
);
|
||||
minecraft.particles.addParticle(CraftingFx.TYPE, centerX, centerY, centerZ, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,24 +135,29 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<TileMolecular
|
||||
ms.translate(0, -0.2f, 0);
|
||||
}
|
||||
|
||||
itemRenderer.renderItem(is, ItemCameraTransforms.TransformType.GROUND, combinedLightIn, OverlayTexture.NO_OVERLAY,
|
||||
ms, bufferIn);
|
||||
itemRenderer.renderItem(is, ItemCameraTransforms.TransformType.GROUND, combinedLightIn,
|
||||
OverlayTexture.NO_OVERLAY, ms, bufferIn);
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
/**
|
||||
* See above for when this can be removed.
|
||||
* It creates a RenderType that is equivalent to {@link RenderType#getTranslucent()}, but enables
|
||||
* alpha testing. This prevents the fully transparents parts of the rendered block model from
|
||||
* See above for when this can be removed. It creates a RenderType that is
|
||||
* equivalent to {@link RenderType#getTranslucent()}, but enables alpha testing.
|
||||
* This prevents the fully transparents parts of the rendered block model from
|
||||
* occluding our particles.
|
||||
*/
|
||||
private static RenderType createRenderType() {
|
||||
RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
RenderState.TextureState mipmapBlockAtlasTexture = new RenderState.TextureState(AtlasTexture.LOCATION_BLOCKS_TEXTURE, false, true);
|
||||
RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper
|
||||
.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
RenderState.TextureState mipmapBlockAtlasTexture = new RenderState.TextureState(
|
||||
AtlasTexture.LOCATION_BLOCKS_TEXTURE, false, true);
|
||||
RenderState.LightmapState disableLightmap = new RenderState.LightmapState(false);
|
||||
RenderType.State glState = RenderType.State.getBuilder().texture(mipmapBlockAtlasTexture).transparency(TRANSLUCENT_TRANSPARENCY).alpha(new RenderState.AlphaState(0.05F)).lightmap(disableLightmap).build(true);
|
||||
RenderType.State glState = RenderType.State.getBuilder().texture(mipmapBlockAtlasTexture)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY).alpha(new RenderState.AlphaState(0.05F))
|
||||
.lightmap(disableLightmap).build(true);
|
||||
|
||||
return RenderType.makeType("ae2_translucent_alphatest", DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP, GL11.GL_QUADS, 256, glState);
|
||||
return RenderType.makeType("ae2_translucent_alphatest", DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP,
|
||||
GL11.GL_QUADS, 256, glState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ package appeng.tile.crafting;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -79,8 +81,6 @@ import appeng.util.inv.WrapperFilteredItemHandler;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TileMolecularAssembler extends AENetworkInvTile
|
||||
implements IUpgradeableHost, IConfigManagerHost, IGridTickable, ICraftingMachine, IPowerChannelState {
|
||||
|
||||
@@ -428,8 +428,8 @@ public class TileMolecularAssembler extends AENetworkInvTile
|
||||
if (item != null) {
|
||||
final TargetPoint where = new TargetPoint(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32,
|
||||
this.world.getDimension().getType());
|
||||
NetworkHandler.instance().sendToAllAround(new PacketAssemblerAnimation(this.pos, (byte) speed, item),
|
||||
where);
|
||||
NetworkHandler.instance()
|
||||
.sendToAllAround(new PacketAssemblerAnimation(this.pos, (byte) speed, item), where);
|
||||
}
|
||||
|
||||
this.saveChanges();
|
||||
|
||||
Reference in New Issue
Block a user