Skip to content

Commit

Permalink
Merge branch 'v1.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Aug 14, 2020
2 parents d66f75a + 23e9cac commit 0ab91d0
Show file tree
Hide file tree
Showing 34 changed files with 227 additions and 189 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ repositories {
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
maven {
url 'https://www.dogforce-games.com/maven/'
}
}
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
Expand Down
10 changes: 4 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

#Mod Info
mod_version=1.3.5

mod_version=1.4.0
#Dependencies
forge_version=1.15.2-31.1.30
mcp_version=20200323-1.15.1
jei_version=1.15.2:6.0.0.2
forge_version=1.16.1-32.0.63
mcp_version=20200712-1.16.1
jei_version=1.16.1:7.0.0.6
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ObjectHolder;

// TODO: 12/07/2020 Replaces this with a deffered register
@Mod.EventBusSubscriber(modid = MiningGadgets.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
@ObjectHolder(MiningGadgets.MOD_ID)
public class ModParticles {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import net.minecraft.client.particle.BreakingParticle;
import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;

import java.util.UUID;

Expand All @@ -36,14 +36,14 @@ public class LaserParticle extends BreakingParticle {
private boolean voiding = false;
private float originalSize;

public LaserParticle(World world, double d, double d1, double d2, double xSpeed, double ySpeed, double zSpeed,
public LaserParticle(ClientWorld world, double d, double d1, double d2, double xSpeed, double ySpeed, double zSpeed,
float size, float red, float green, float blue, boolean depthTest, float maxAgeMul, BlockState blockState) {
this(world, d, d1, d2, xSpeed, ySpeed, zSpeed, size, red, green, blue, depthTest, maxAgeMul);
this.blockState = blockState;
this.setSprite(Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getTexture(blockState));
}

public LaserParticle(World world, double d, double d1, double d2, double xSpeed, double ySpeed, double zSpeed,
public LaserParticle(ClientWorld world, double d, double d1, double d2, double xSpeed, double ySpeed, double zSpeed,
float size, float red, float green, float blue, boolean depthTest, float maxAgeMul) {
super(world, d, d1, d2, ItemStack.EMPTY);
// super applies wiggle to motion so set it here instead
Expand Down Expand Up @@ -117,27 +117,27 @@ public void tick() {
this.setExpired();
return;
}
Vec3d playerPos = player.getPositionVec().add(0, player.getEyeHeight(), 0);
Vec3d blockPos = new Vec3d(sourceX, sourceY, sourceZ);
Vec3d look = player.getLookVec(); // or getLook(partialTicks)
Vector3d playerPos = player.getPositionVec().add(0, player.getEyeHeight(), 0);
Vector3d blockPos = new Vector3d(sourceX, sourceY, sourceZ);
Vector3d look = player.getLookVec(); // or getLook(partialTicks)
//The next 3 variables are directions on the screen relative to the players look direction. So right = to the right of the player, regardless of facing direction.
Vec3d right = new Vec3d(-look.z, 0, look.x).normalize();
Vec3d forward = look;
Vec3d down = right.crossProduct(forward);
Vector3d right = new Vector3d(-look.z, 0, look.x).normalize();
Vector3d forward = look;
Vector3d down = right.crossProduct(forward);

//These are used to calculate where the particles are going. We want them going into the laser, so we move the destination right, down, and forward a bit.
right = right.scale(0.65f);
forward = forward.scale(0.85f);
down = down.scale(-0.35);

//Take the player's eye position, and shift it to where the end of the laser is (Roughly)
Vec3d laserPos = playerPos.add(right);
Vector3d laserPos = playerPos.add(right);
laserPos = laserPos.add(forward);
laserPos = laserPos.add(down);

//Get the current position of the particle, and figure out the vector of where it's going
Vec3d partPos = new Vec3d(this.posX, this.posY, this.posZ);
Vec3d targetDirection = new Vec3d(laserPos.getX() - this.posX, laserPos.getY() - this.posY, laserPos.getZ() - this.posZ);
Vector3d partPos = new Vector3d(this.posX, this.posY, this.posZ);
Vector3d targetDirection = new Vector3d(laserPos.getX() - this.posX, laserPos.getY() - this.posY, laserPos.getZ() - this.posZ);

//The total distance between the laser's endpoint and the block(s) we're mining
double totalDistance = blockPos.distanceTo(laserPos);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.direwolf20.mininggadgets.client.particles.laserparticle;

import com.mojang.serialization.Codec;
import net.minecraft.particles.ParticleType;

public class LaserParticleType extends ParticleType<LaserParticleData> {
public LaserParticleType() {
super(false, LaserParticleData.DESERIALIZER);
}


@Override
public Codec<LaserParticleData> func_230522_e_() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.SpriteTexturedParticle;
import net.minecraft.world.World;
import net.minecraft.client.world.ClientWorld;

// Steal
public class LightParticle extends SpriteTexturedParticle {
public LightParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn) {
public LightParticle(ClientWorld worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn) {
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, speedIn);
float f = this.rand.nextFloat() * 0.1F + 0.2F;
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.setSize(0.02F, 0.02F);
this.particleScale *= this.rand.nextFloat() * 0.6F + 0.5F;
this.motionX *= (double)0.02F;
this.motionY *= (double)0.02F;
this.motionZ *= (double)0.02F;
this.motionX *= (double) 0.02F;
this.motionY *= (double) 0.02F;
this.motionZ *= (double) 0.02F;
this.maxAge = (int)(20.0D / (Math.random() * 0.8D + 0.2D));
this.particleAlpha = .8f;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particles.BasicParticleType;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -21,7 +21,7 @@ public LightParticleFactory(IAnimatedSprite p_i50522_1_) {
this.spriteSet = p_i50522_1_;
}

public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
public Particle makeParticle(BasicParticleType typeIn, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
LightParticle particle = new LightParticle(worldIn, x, y, z, xSpeed, ySpeed, zSpeed);
particle.selectSpriteRandomly(this.spriteSet);
particle.setColor(.1F, .5f, .5F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.SpriteTexturedParticle;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;

import java.util.Random;

Expand All @@ -32,7 +32,7 @@ public class PlayerParticle extends SpriteTexturedParticle {
public static final ResourceLocation lightParticle = new ResourceLocation(MiningGadgets.MOD_ID + ":textures/particle/lightparticle.png");


public PlayerParticle(World world, double sourceX, double sourceY, double sourceZ, double targetX, double targetY, double targetZ, double xSpeed, double ySpeed, double zSpeed,
public PlayerParticle(ClientWorld world, double sourceX, double sourceY, double sourceZ, double targetX, double targetY, double targetZ, double xSpeed, double ySpeed, double zSpeed,
float size, float red, float green, float blue, boolean collide, float maxAge, String particleType, IAnimatedSprite sprite) {
super(world, sourceX, sourceY, sourceZ);
motionX = xSpeed;
Expand Down Expand Up @@ -92,12 +92,12 @@ public void tick() {
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;

Vec3d sourcePos = new Vec3d(sourceX, sourceY, sourceZ);
Vec3d targetPos = new Vec3d(targetX, targetY, targetZ);
Vector3d sourcePos = new Vector3d(sourceX, sourceY, sourceZ);
Vector3d targetPos = new Vector3d(targetX, targetY, targetZ);

//Get the current position of the particle, and figure out the vector of where it's going
Vec3d partPos = new Vec3d(this.posX, this.posY, this.posZ);
Vec3d targetDirection = new Vec3d(targetPos.getX() - this.posX, targetPos.getY() - this.posY, targetPos.getZ() - this.posZ);
Vector3d partPos = new Vector3d(this.posX, this.posY, this.posZ);
Vector3d targetDirection = new Vector3d(targetPos.getX() - this.posX, targetPos.getY() - this.posY, targetPos.getZ() - this.posZ);

//The total distance between the particle and target
double totalDistance = targetPos.distanceTo(partPos);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package com.direwolf20.mininggadgets.client.particles.playerparticle;

import com.mojang.serialization.Codec;
import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particles.ParticleType;
import net.minecraft.world.World;

public class PlayerParticleType extends ParticleType<PlayerParticleData> {
public PlayerParticleType() {
super(false, PlayerParticleData.DESERIALIZER);
}

@Override
public Codec<PlayerParticleData> func_230522_e_() {
return null;
}

public static class FACTORY implements IParticleFactory<PlayerParticleData> {
private final IAnimatedSprite sprites;

Expand All @@ -19,7 +25,7 @@ public FACTORY(IAnimatedSprite sprites) {
}

@Override
public Particle makeParticle(PlayerParticleData data, World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
public Particle makeParticle(PlayerParticleData data, ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
return new PlayerParticle(world, x, y, z, data.targetX, data.targetY, data.targetZ, xSpeed, ySpeed, zSpeed, data.size, data.r, data.g, data.b, data.depthTest, data.maxAgeMul, data.partType, this.sprites);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraftforge.client.event.RenderWorldLastEvent;

import java.awt.*;
Expand All @@ -36,7 +36,7 @@ public static void render(RenderWorldLastEvent event, ItemStack item) {
}

List<BlockPos> coords = MiningCollect.collect(mc.player, lookingAt, mc.world, MiningProperties.getRange(item));
Vec3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView();
Vector3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView();

MatrixStack matrix = event.getMatrixStack();
matrix.push();
Expand All @@ -63,7 +63,7 @@ public static void render(RenderWorldLastEvent event, ItemStack item) {
buffer.finish(MyRenderType.BlockOverlay);
}

public static void render(Matrix4f matrix, IVertexBuilder builder, BlockPos pos, Color color) {
public static void render(Matrix4f matrix, IVertexBuilder builder, BlockPos pos, Color color) {
float red = color.getRed() / 255f, green = color.getGreen() / 255f, blue = color.getBlue() / 255f, alpha = .125f;

float startX = 0, startY = 0, startZ = -1, endX = 1, endY = 1, endZ = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MyRenderType(String name, VertexFormat format, int p_i225992_3_, int p_i2
public static final RenderType LASER_MAIN_BEAM = makeType("MiningLaserMainBeam",
DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256,
RenderType.State.getBuilder().texture(new TextureState(laserBeam2, false, false))
.layer(PROJECTION_LAYERING)
.layer(field_239235_M_)
.transparency(TRANSLUCENT_TRANSPARENCY)
.depthTest(DEPTH_ALWAYS)
.cull(CULL_DISABLED)
Expand All @@ -34,7 +34,7 @@ public MyRenderType(String name, VertexFormat format, int p_i225992_3_, int p_i2
public static final RenderType LASER_MAIN_ADDITIVE = makeType("MiningLaserAdditiveBeam",
DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256,
RenderType.State.getBuilder().texture(new TextureState(laserBeamGlow, false, false))
.layer(PROJECTION_LAYERING)
.layer(field_239235_M_)
.transparency(TRANSLUCENT_TRANSPARENCY)
.depthTest(DEPTH_ALWAYS)
.cull(CULL_DISABLED)
Expand All @@ -45,7 +45,7 @@ public MyRenderType(String name, VertexFormat format, int p_i225992_3_, int p_i2
public static final RenderType LASER_MAIN_CORE = makeType("MiningLaserCoreBeam",
DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256,
RenderType.State.getBuilder().texture(new TextureState(laserBeam, false, false))
.layer(PROJECTION_LAYERING)
.layer(field_239235_M_)
.transparency(TRANSLUCENT_TRANSPARENCY)
.depthTest(DEPTH_ALWAYS)
.cull(CULL_DISABLED)
Expand All @@ -56,7 +56,7 @@ public MyRenderType(String name, VertexFormat format, int p_i225992_3_, int p_i2
public static final RenderType BlockOverlay = makeType("MiningLaserBlockOverlay",
DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256,
RenderType.State.getBuilder()
.layer(PROJECTION_LAYERING)
.layer(field_239235_M_)
.transparency(TRANSLUCENT_TRANSPARENCY)
.texture(NO_TEXTURE)
.depthTest(DEPTH_LEQUAL)
Expand All @@ -71,7 +71,7 @@ public MyRenderType(String name, VertexFormat format, int p_i225992_3_, int p_i2
.shadeModel(SHADE_ENABLED)
.lightmap(LIGHTMAP_ENABLED)
.texture(BLOCK_SHEET_MIPPED)
.layer(PROJECTION_LAYERING)
.layer(field_239235_M_)
.transparency(TRANSLUCENT_TRANSPARENCY)
.depthTest(DEPTH_LEQUAL)
.cull(CULL_ENABLED)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.direwolf20.mininggadgets.client.renderer;

import com.direwolf20.mininggadgets.common.MiningGadgets;
import com.direwolf20.mininggadgets.common.items.MiningGadget;
import com.direwolf20.mininggadgets.common.items.gadget.MiningProperties;
import com.direwolf20.mininggadgets.common.items.upgrade.Upgrade;
import com.direwolf20.mininggadgets.common.items.upgrade.UpgradeTools;
import com.direwolf20.mininggadgets.common.items.MiningGadget;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
Expand All @@ -19,7 +19,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.client.event.RenderWorldLastEvent;

import static org.lwjgl.opengl.GL11.*;
Expand All @@ -38,7 +38,7 @@ public static void renderLaser(RenderWorldLastEvent event, PlayerEntity player,

int range = MiningProperties.getBeamRange(stack);

Vec3d playerPos = player.getEyePosition(ticks);
Vector3d playerPos = player.getEyePosition(ticks);
RayTraceResult trace = player.pick(range, 0.0F, false);

// parse data from item
Expand All @@ -57,7 +57,7 @@ private static float getSpeedModifier(ItemStack stack) {
}
}

private static void drawLasers(RenderWorldLastEvent event, Vec3d from, RayTraceResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, PlayerEntity player, float ticks, float speedModifier) {
private static void drawLasers(RenderWorldLastEvent event, Vector3d from, RayTraceResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, PlayerEntity player, float ticks, float speedModifier) {
Hand activeHand;
if (player.getHeldItemMainhand().getItem() instanceof MiningGadget) {
activeHand = Hand.MAIN_HAND;
Expand All @@ -75,7 +75,7 @@ private static void drawLasers(RenderWorldLastEvent event, Vec3d from, RayTraceR
float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime);
BufferBuilder wr = Tessellator.getInstance().getBuffer();

Vec3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
Vector3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();

MatrixStack matrix = event.getMatrixStack();
matrix.translate(view.getX(), view.getY(), view.getZ());
Expand Down
Loading

0 comments on commit 0ab91d0

Please sign in to comment.