[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 20:06:14 -08:00
1 parent 274f51356c
commit a59e54c09a
5 files changed
+338 -488

No files matched your search

@@ -1,29 +1,36 @@
package com.projecturanus.betterp2p.client.gui.widget;
import appeng.client.gui.widgets.MEGuiTextField;
import com.projecturanus.betterp2p.client.gui.InfoWrapper;
public class IGuiTextField extends MEGuiTextField {
InfoWrapper info = null;
public void setVisible(boolean visible){
public void setVisible(boolean visible) {
this.field.setVisible(visible);
}
public void setFocus(boolean focus,int position){
public void setFocus(boolean focus, int position) {
this.field.setFocused(focus);
this.field.setCursorPosition(position);
}
public IGuiTextField(final int width, final int height, final String tooltip){
super(width,height,tooltip);
public IGuiTextField(final int width, final int height, final String tooltip) {
super(width, height, tooltip);
}
public IGuiTextField(final int width, final int height)
{
super(width,height,"");
public IGuiTextField(final int width, final int height) {
super(width, height, "");
this.setVisible(false);
}
public void setInfo(InfoWrapper _info){
public void setInfo(InfoWrapper _info) {
info = _info;
}
public InfoWrapper getInfo(){
public InfoWrapper getInfo() {
return info;
}
@@ -1,15 +1,18 @@
package com.projecturanus.betterp2p.client.render;
import com.projecturanus.betterp2p.util.GlStateManager;
import java.util.Collection;
import java.util.List;
import kotlin.Pair;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.Collection;
import java.util.List;
import com.projecturanus.betterp2p.util.GlStateManager;
/**
* Everything in this inner class is From a mod that has MIT license owned by romelo333 and maintained by McJty
@@ -23,7 +26,8 @@ import java.util.List;
*/
public class OutlineRenderer {
public static void renderOutlines(RenderWorldLastEvent evt, EntityPlayer p, Collection<List<Integer>> coordinates, int r, int g, int b) {
public static void renderOutlines(RenderWorldLastEvent evt, EntityPlayer p, Collection<List<Integer>> coordinates,
int r, int g, int b) {
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX);
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY);
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ);
@@ -45,10 +49,10 @@ public class OutlineRenderer {
private static void renderOutlines(Collection<List<Integer>> coordinates, int r, int g, int b, int thickness) {
Tessellator tessellator = Tessellator.instance;
// net.minecraft.client.renderer.VertexBuffer
//BufferBuilder buffer = tessellator.getBuffer();
// net.minecraft.client.renderer.VertexBuffer
// BufferBuilder buffer = tessellator.getBuffer();
tessellator.startDrawing(GL11.GL_LINES);
// GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f);
// GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f);
GL11.glLineWidth(thickness);
for (List<Integer> coordinate : coordinates) {
float x = coordinate.get(0);
@@ -59,7 +63,8 @@ public class OutlineRenderer {
tessellator.draw();
}
public static void renderHighLightedBlocksOutline(Tessellator tessellator, float mx, float my, float mz, int r, int g, int b, int a) {
public static void renderHighLightedBlocksOutline(Tessellator tessellator, float mx, float my, float mz, int r,
int g, int b, int a) {
tessellator.setColorRGBA(r, g, b, a);
tessellator.addVertex(mx, my, mz);
tessellator.addVertex(mx + 1, my, mz);
@@ -87,8 +92,8 @@ public class OutlineRenderer {
tessellator.addVertex(mx, my + 1, mz + 1);
}
public static void renderOutlinesWithFacing(RenderWorldLastEvent evt, EntityPlayer p, Collection<Pair<List<Integer>, ForgeDirection>> coordinates, int r, int g, int b) {
public static void renderOutlinesWithFacing(RenderWorldLastEvent evt, EntityPlayer p,
Collection<Pair<List<Integer>, ForgeDirection>> coordinates, int r, int g, int b) {
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX);
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY);
@@ -107,15 +112,15 @@ public class OutlineRenderer {
GlStateManager.depthMask(true);
}
private static void renderOutlinesWithFacing(Collection<Pair<List<Integer>, ForgeDirection>> coordinates, double x, double y, double z, int r, int g, int b, int thickness) {
private static void renderOutlinesWithFacing(Collection<Pair<List<Integer>, ForgeDirection>> coordinates, double x,
double y, double z, int r, int g, int b, int thickness) {
Tessellator tessellator = Tessellator.instance;
//BufferBuilder buffer = tessellator.getBuffer();
// BufferBuilder buffer = tessellator.getBuffer();
for (Pair<List<Integer>, ForgeDirection> coordinate : coordinates) {
List<Integer> pos = coordinate.component1();
ForgeDirection facing = coordinate.component2();
if (pos == null || facing == null || pos.size() != 3)
continue;
if (pos == null || facing == null || pos.size() != 3) continue;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
tessellator.startDrawing(GL11.GL_LINES);
@@ -148,10 +153,10 @@ public class OutlineRenderer {
case WEST:
break;
}
int[] west_matrix = {1, 0, 0, 0, 1, 0, 0, 0, 1};
int[] east_matrix = {-1, 0, 0, 0, 1, 0, 0, 0, 1};
int[] north_matrix = {0, 0, -1, 0, 1, 0, 1, 0, 0};
int[] south_matrix = {0, 0, 1, 0, 1, 0, -1, 0, 0};
int[] west_matrix = { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
int[] east_matrix = { -1, 0, 0, 0, 1, 0, 0, 0, 1 };
int[] north_matrix = { 0, 0, -1, 0, 1, 0, 1, 0, 0 };
int[] south_matrix = { 0, 0, 1, 0, 1, 0, -1, 0, 0 };
GlStateManager.translate(-0.5, -0.5, -0.5);
GlStateManager.translate(-pos.get(0), -pos.get(1), -pos.get(2));
@@ -161,9 +166,7 @@ public class OutlineRenderer {
}
public static void renderHighLightedBlocksOutlineForFacing(Tessellator tessellator,
int r, int g, int b, int a) {
public static void renderHighLightedBlocksOutlineForFacing(Tessellator tessellator, int r, int g, int b, int a) {
double minX = 0;
double minY = 0.125;
double minZ = 0.125;
@@ -1,19 +1,21 @@
package com.projecturanus.betterp2p.client.render;
import com.projecturanus.betterp2p.client.ClientCache;
import com.projecturanus.betterp2p.item.ItemAdvancedMemoryCard;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.util.ArrayList;
import java.util.List;
import kotlin.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
import java.util.List;
import com.projecturanus.betterp2p.client.ClientCache;
import com.projecturanus.betterp2p.item.ItemAdvancedMemoryCard;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class RenderHandler {
@@ -24,17 +26,14 @@ public class RenderHandler {
if (!ClientCache.INSTANCE.getPositions().isEmpty() || ClientCache.INSTANCE.getSelectedPosition() != null) {
if (ClientCache.INSTANCE.getSelectedPosition() != null) {
List<Pair<List<Integer>, ForgeDirection>> tmp = new ArrayList<>();
tmp.add(new Pair<>(ClientCache.INSTANCE.getSelectedPosition(), ClientCache.INSTANCE.getSelectedFacing()));
OutlineRenderer.renderOutlinesWithFacing(
event,
player,
tmp,
0x45,
0xDA,
0x75
);
tmp.add(
new Pair<>(
ClientCache.INSTANCE.getSelectedPosition(),
ClientCache.INSTANCE.getSelectedFacing()));
OutlineRenderer.renderOutlinesWithFacing(event, player, tmp, 0x45, 0xDA, 0x75);
}
OutlineRenderer.renderOutlinesWithFacing(event, player, ClientCache.INSTANCE.getPositions(), 0x66, 0xCC, 0xFF);
OutlineRenderer
.renderOutlinesWithFacing(event, player, ClientCache.INSTANCE.getPositions(), 0x66, 0xCC, 0xFF);
}
}
}
@@ -1,16 +1,18 @@
package com.projecturanus.betterp2p.client.render;
import com.projecturanus.betterp2p.util.GlStateManager;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
import com.projecturanus.betterp2p.util.GlStateManager;
/**
* Functions from this inner class are not authored by me (Sam Bassett aka Lothrazar) they are from BuildersGuides by
@@ -19,43 +21,48 @@ import java.util.List;
*
* All credit goes to author for this
*
* Source code: https://github.com/Ipsis/BuildersGuides Source License https://github.com/Ipsis/BuildersGuides/blob/master/COPYING.LESSER
* Source code: https://github.com/Ipsis/BuildersGuides Source License
* https://github.com/Ipsis/BuildersGuides/blob/master/COPYING.LESSER
*
* I used and modified two functions from this library https://github.com/Ipsis/BuildersGuides/blob/master/src/main/java/ipsis/buildersguides/util/RenderUtils.java
* I used and modified two functions from this library
* https://github.com/Ipsis/BuildersGuides/blob/master/src/main/java/ipsis/buildersguides/util/RenderUtils.java
*
*
*/
@SuppressWarnings("serial")
public class ShadowRenderer {
public static void renderBlockPos(List<Integer> p, List<Integer> center, double relX, double relY, double relZ, float red, float green, float blue) {
public static void renderBlockPos(List<Integer> p, List<Integer> center, double relX, double relY, double relZ,
float red, float green, float blue) {
if (p == null) {
return;
}
renderBlockList(new ArrayList<List<Integer>>() {
{
add(p);
}
}, center, relX, relY, relZ, red, green, blue);
}
public static void renderBlockPhantom(World world, final List<Integer> pos, ItemStack stack, final double relX, final double relY, final double relZ,
List<Integer> target, boolean isSolid) {
public static void renderBlockPhantom(World world, final List<Integer> pos, ItemStack stack, final double relX,
final double relY, final double relZ, List<Integer> target, boolean isSolid) {
if (stack.getItem() instanceof ItemBlock) {
int stateFromStack = stack.getItemDamage();
renderBlockPhantom(world, pos, stateFromStack, relX, relY, relZ, target, isSolid);
}
}
public static void renderBlockPhantom(World world, final List<Integer> pos, int state, final double relX, final double relY, final double relZ, List<Integer> target, boolean isSolid) {
public static void renderBlockPhantom(World world, final List<Integer> pos, int state, final double relX,
final double relY, final double relZ, List<Integer> target, boolean isSolid) {
int xOffset = target.get(0) - pos.get(0);
int yOffset = target.get(1) - pos.get(1);
int zOffset = target.get(2) - pos.get(2);
//final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
// final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
Tessellator tessellator = Tessellator.instance;
//BufferBuilder bufferBuilder = tessellator.getBuffer();
// BufferBuilder bufferBuilder = tessellator.getBuffer();
GlStateManager.pushMatrix();
//this first translate is to make relative to TE and everything
// this first translate is to make relative to TE and everything
GlStateManager.translate(relX + 0.5F, relY + 0.5F, relZ + 0.5F);
RenderHelper.disableStandardItemLighting();
if (!isSolid) {
@@ -64,18 +71,19 @@ public class ShadowRenderer {
GlStateManager.disableCull();
}
tessellator.startDrawing(GL11.GL_QUADS);
//move into frame and then back to zero - so world relative
// move into frame and then back to zero - so world relative
tessellator.setTranslation(-0.5 - pos.get(0) + xOffset, -.5 - pos.get(1) + yOffset, -.5 - pos.get(2) + zOffset);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
//TODO: pos below is the targetPos, other rel and pos are TE
//blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, bufferBuilder, false);
// TODO: pos below is the targetPos, other rel and pos are TE
// blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, bufferBuilder, false);
tessellator.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}
public static void renderBlockList(List<List<Integer>> blockPosList, List<Integer> center, double relX, double relY, double relZ, float red, float green, float blue) {
public static void renderBlockList(List<List<Integer>> blockPosList, List<Integer> center, double relX, double relY,
double relZ, float red, float green, float blue) {
GlStateManager.pushAttrib();
GlStateManager.pushMatrix();
// translate to center or te
@@ -86,16 +94,14 @@ public class ShadowRenderer {
GlStateManager.enableBlend();
float alpha = 0.5F;
GlStateManager.color(red, green, blue, alpha);
if (Minecraft.isAmbientOcclusionEnabled())
GlStateManager.shadeModel(GL11.GL_SMOOTH);
else
GlStateManager.shadeModel(GL11.GL_FLAT);
if (Minecraft.isAmbientOcclusionEnabled()) GlStateManager.shadeModel(GL11.GL_SMOOTH);
else GlStateManager.shadeModel(GL11.GL_FLAT);
for (List<Integer> p : blockPosList) {
GlStateManager.pushMatrix();
GlStateManager.translate(
(center.get(0) - p.get(0)) * -1.0F,
(center.get(1) - p.get(1)) * -1.0F,
(center.get(2) - p.get(2)) * -1.0F);
(center.get(0) - p.get(0)) * -1.0F,
(center.get(1) - p.get(1)) * -1.0F,
(center.get(2) - p.get(2)) * -1.0F);
shadedCube(0.4F);
GlStateManager.popMatrix();
}
@@ -109,7 +115,7 @@ public class ShadowRenderer {
private static void shadedCube(float scale) {
float size = 1.0F * scale;
Tessellator tessellator = Tessellator.instance;
//BufferBuilder worldRenderer = tessellator.getBuffer();
// BufferBuilder worldRenderer = tessellator.getBuffer();
// Front - anticlockwise vertices
// Back - clockwise vertices
tessellator.startDrawing(GL11.GL_QUADS);
File diff suppressed because it is too large. Load diff