Skip to content

Commit

Permalink
Revert "spotless apply & update buildscript:"
Browse files Browse the repository at this point in the history
This reverts commit 850c66b.
  • Loading branch information
dyedquartz committed Dec 5, 2023
1 parent 9165d34 commit cf77f0e
Show file tree
Hide file tree
Showing 48 changed files with 2,650 additions and 2,791 deletions.
12 changes: 1 addition & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1701739812
//version: 1701481996
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -222,16 +222,6 @@ if (enableSpotless.toBoolean()) {
//noinspection GroovyAssignabilityCheck
eclipse('4.19.0').configFile(formatFile)
}
kotlin {
target 'src/*/kotlin/**/*.kt'

toggleOffOn()
ktfmt('0.39')

trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
scala {
target 'src/*/scala/**/*.scala'
scalafmt('3.7.1')
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
modName = Betterer P2P

# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = betterp2p
modId = bettererp2p

modGroup = com.projecturanus.betterp2p

Expand Down Expand Up @@ -113,14 +113,14 @@ modrinthRelations =
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
curseForgeProjectId = 943734
curseForgeProjectId =

# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
curseForgeRelations = [requiredDependency:shadowfacts-forgelin;requiredDependency:ae2-extended-life]
curseForgeRelations =

# This project's release type on CurseForge and/or Modrinth
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.projecturanus.betterp2p.client.render;

import java.util.Collection;

import kotlin.Pair;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.shader.ShaderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.client.event.RenderWorldLastEvent;

import org.lwjgl.opengl.GL11;

import kotlin.Pair;
import java.util.Collection;

/**
* Everything in this inner class is From a mod that has MIT license owned by romelo333 and maintained by McJty
Expand All @@ -27,8 +28,7 @@
*/
public class OutlineRenderer {

public static void renderOutlines(RenderWorldLastEvent evt, EntityPlayer p, Collection<BlockPos> coordinates, int r,
int g, int b) {
public static void renderOutlines(RenderWorldLastEvent evt, EntityPlayer p, Collection<BlockPos> coordinates, int r, int g, int b) {
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();
Expand All @@ -50,10 +50,10 @@ public static void renderOutlines(RenderWorldLastEvent evt, EntityPlayer p, Coll

private static void renderOutlines(Collection<BlockPos> coordinates, int r, int g, int b, int thickness) {
Tessellator tessellator = Tessellator.getInstance();
// net.minecraft.client.renderer.VertexBuffer
// net.minecraft.client.renderer.VertexBuffer
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
// 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 (BlockPos coordinate : coordinates) {
float x = coordinate.getX();
Expand All @@ -64,8 +64,7 @@ private static void renderOutlines(Collection<BlockPos> coordinates, int r, int
tessellator.draw();
}

public static void renderHighLightedBlocksOutline(BufferBuilder buffer, float mx, float my, float mz, float r,
float g, float b, float a) {
public static void renderHighLightedBlocksOutline(BufferBuilder buffer, float mx, float my, float mz, float r, float g, float b, float a) {
buffer.pos(mx, my, mz).color(r, g, b, a).endVertex();
buffer.pos(mx + 1, my, mz).color(r, g, b, a).endVertex();
buffer.pos(mx, my, mz).color(r, g, b, a).endVertex();
Expand All @@ -92,9 +91,9 @@ public static void renderHighLightedBlocksOutline(BufferBuilder buffer, float mx
buffer.pos(mx, my + 1, mz + 1).color(r, g, b, a).endVertex();
}

public static void renderOutlinesWithFacing(RenderWorldLastEvent evt, EntityPlayer p,
Collection<Pair<BlockPos, EnumFacing>> coordinates, int r, int g,
int b) {

public static void renderOutlinesWithFacing(RenderWorldLastEvent evt, EntityPlayer p, Collection<Pair<BlockPos, EnumFacing>> coordinates, int r, int g, int b) {

double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();
Expand All @@ -112,8 +111,7 @@ public static void renderOutlinesWithFacing(RenderWorldLastEvent evt, EntityPlay
GlStateManager.depthMask(true);
}

private static void renderOutlinesWithFacing(Collection<Pair<BlockPos, EnumFacing>> coordinates, double x, double y,
double z, int r, int g, int b, int thickness) {
private static void renderOutlinesWithFacing(Collection<Pair<BlockPos, EnumFacing>> coordinates, double x, double y, double z, int r, int g, int b, int thickness) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();

Expand Down Expand Up @@ -152,18 +150,20 @@ private static void renderOutlinesWithFacing(Collection<Pair<BlockPos, EnumFacin
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.getX(), -pos.getY(), -pos.getZ());
tessellator.draw();
GlStateManager.popMatrix();
}

}


public static void renderHighLightedBlocksOutlineForFacing(BufferBuilder buffer,
float r, float g, float b, float a) {
double minX = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.projecturanus.betterp2p.client.render;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
Expand All @@ -15,29 +12,28 @@
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

import java.util.ArrayList;
import java.util.List;

/**
* Functions from this inner class are not authored by me (Sam Bassett aka Lothrazar) they are from BuildersGuides by
*
* @author Ipsis
*
* 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(BlockPos p, BlockPos center, double relX, double relY, double relZ, float red,
float green, float blue) {
public static void renderBlockPos(BlockPos p, BlockPos center, double relX, double relY, double relZ, float red, float green, float blue) {
if (p == null) {
return;
}
Expand All @@ -49,20 +45,17 @@ public static void renderBlockPos(BlockPos p, BlockPos center, double relX, doub
}, center, relX, relY, relZ, red, green, blue);
}

public static void renderBlockPhantom(World world, final BlockPos pos, ItemStack stack, final double relX,
final double relY, final double relZ,
public static void renderBlockPhantom(World world, final BlockPos pos, ItemStack stack, final double relX, final double relY, final double relZ,
BlockPos target, boolean isSolid) {
if (stack.getItem() instanceof ItemBlock) {
ItemBlock ib = (ItemBlock) stack.getItem();
IBlockState stateFromStack = ib.getBlock().getStateForPlacement(world, pos, EnumFacing.DOWN, pos.getX(),
pos.getY(), pos.getZ(),
stack.getItemDamage(), null, EnumHand.MAIN_HAND);
IBlockState stateFromStack = ib.getBlock().getStateForPlacement(world, pos, EnumFacing.DOWN, pos.getX(), pos.getY(), pos.getZ(),
stack.getItemDamage(), null, EnumHand.MAIN_HAND);
renderBlockPhantom(world, pos, stateFromStack, relX, relY, relZ, target, isSolid);
}
}

public static void renderBlockPhantom(World world, final BlockPos pos, IBlockState state, final double relX,
final double relY, final double relZ, BlockPos target, boolean isSolid) {
public static void renderBlockPhantom(World world, final BlockPos pos, IBlockState state, final double relX, final double relY, final double relZ, BlockPos target, boolean isSolid) {
int xOffset = target.getX() - pos.getX();
int yOffset = target.getY() - pos.getY();
int zOffset = target.getZ() - pos.getZ();
Expand All @@ -71,7 +64,7 @@ public static void renderBlockPhantom(World world, final BlockPos pos, IBlockSta
Tessellator tessellator = Tessellator.getInstance();
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 == false) {
Expand All @@ -80,20 +73,18 @@ public static void renderBlockPhantom(World world, final BlockPos pos, IBlockSta
GlStateManager.disableCull();
}
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
// move into frame and then back to zero - so world relative
bufferBuilder.setTranslation(-0.5 - pos.getX() + xOffset, -.5 - pos.getY() + yOffset,
-.5 - pos.getZ() + zOffset);
//move into frame and then back to zero - so world relative
bufferBuilder.setTranslation(-0.5 - pos.getX() + xOffset, -.5 - pos.getY() + yOffset, -.5 - pos.getZ() + zOffset);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
// TODO: pos below is the targetPos, other rel and pos are TE
//TODO: pos below is the targetPos, other rel and pos are TE
blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, bufferBuilder, false);
bufferBuilder.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}

public static void renderBlockList(List<BlockPos> blockPosList, BlockPos center, double relX, double relY,
double relZ, float red, float green, float blue) {
public static void renderBlockList(List<BlockPos> blockPosList, BlockPos center, double relX, double relY, double relZ, float red, float green, float blue) {
GlStateManager.pushAttrib();
GlStateManager.pushMatrix();
// translate to center or te
Expand All @@ -111,9 +102,9 @@ public static void renderBlockList(List<BlockPos> blockPosList, BlockPos center,
for (BlockPos p : blockPosList) {
GlStateManager.pushMatrix();
GlStateManager.translate(
(center.getX() - p.getX()) * -1.0F,
(center.getY() - p.getY()) * -1.0F,
(center.getZ() - p.getZ()) * -1.0F);
(center.getX() - p.getX()) * -1.0F,
(center.getY() - p.getY()) * -1.0F,
(center.getZ() - p.getZ()) * -1.0F);
shadedCube(0.4F);
GlStateManager.popMatrix();
}
Expand Down
34 changes: 15 additions & 19 deletions src/main/kotlin/com/projecturanus/betterp2p/BetterP2P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,23 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
import org.apache.logging.log4j.Logger

@Mod(
modid = Tags.MODID,
modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter",
dependencies = "required-after: appliedenergistics2; required-after: forgelin;")

@Mod(modid = Tags.MODID, modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter", dependencies = "required-after: appliedenergistics2; required-after: forgelin;")
object BetterP2P {
lateinit var logger: Logger
@SidedProxy(
serverSide = "com.projecturanus.betterp2p.CommonProxy",
clientSide = "com.projecturanus.betterp2p.ClientProxy")
lateinit var proxy: CommonProxy
lateinit var logger: Logger
@SidedProxy(serverSide = "com.projecturanus.betterp2p.CommonProxy", clientSide = "com.projecturanus.betterp2p.ClientProxy")
lateinit var proxy: CommonProxy

@Mod.EventHandler
fun preInit(event: FMLPreInitializationEvent) {
logger = event.modLog
ModNetwork.registerNetwork()
@Mod.EventHandler
fun preInit(event: FMLPreInitializationEvent) {
logger = event.modLog
ModNetwork.registerNetwork()

BetterP2PConfig.loadConfig(Configuration(event.suggestedConfigurationFile))
}
BetterP2PConfig.loadConfig(Configuration(event.suggestedConfigurationFile))
}

@Mod.EventHandler
fun postInit(event: FMLPostInitializationEvent) {
proxy.postInit()
}
@Mod.EventHandler
fun postInit(event: FMLPostInitializationEvent) {
proxy.postInit()
}
}
Loading

0 comments on commit cf77f0e

Please sign in to comment.