Skip to content

Commit

Permalink
Angelica Support
Browse files Browse the repository at this point in the history
* Add Angelica as a compile time dependency
* Add the GTNH Maven
* Mark Renderers as thread safe with `@ThreadSafeISBRH`
* Move Tessellator.instance access into the methods so the ASM redirect properly supplies the CapturingTessellator
  • Loading branch information
mitchej123 committed Jan 31, 2024
1 parent 08c5f07 commit 3cdc252
Show file tree
Hide file tree
Showing 29 changed files with 110 additions and 14 deletions.
16 changes: 11 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ buildscript {
}

repositories {
maven {
url 'https://jitpack.io'
}
maven {
name = "gt"
url = "https://gregtech.mechaenetia.com/"
}
maven {
name = "GTNH Maven"
url = "https://nexus.gtnewhorizons.com/repository/public/"
}
maven {
url 'https://jitpack.io'
}
}

apply plugin: 'forge'
Expand Down Expand Up @@ -109,9 +113,11 @@ dependencies {
compileOnly "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev"
compileOnly "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
compileOnly "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
compileOnly("com.github.GTNewHorizons:Angelica:1.0.0-alpha19:dev") {
transitive = false
}

// 1.1.12 (for some reason the build failed when I used the version tag)
compileOnly("com.github.GTNewHorizons:lwjgl3ify:92b1e089c5:api") {
compileOnly("com.github.GTNewHorizons:lwjgl3ify:1.5.14:api") {
transitive = false
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
Expand All @@ -8,6 +9,7 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockAmethystClusterRenderer extends BlockModelBase {

public BlockAmethystClusterRenderer(int modelID) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;

@SideOnly(Side.CLIENT)
@ThreadSafeISBRH
public class BlockAzaleaRenderer extends BlockModelBase {

public BlockAzaleaRenderer(int modelID) {
super(modelID);
}

protected void renderInventoryModel(Block block, int meta, int modelId, RenderBlocks renderer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
final Tessellator tessellator = Tessellator.instance;
//We have to render each side manually because the bottom side gets rendered even though we set shouldSideBeRendered to false on side 0 (bottom)
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
tessellator.setNormal(0.0F, 1.0F, 0.0F);
Expand All @@ -40,4 +44,4 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
return renderStandardWorldCube(world, x, y, z, block, modelId, renderer, 0, 0, 0, 1, 1, 1);
}

}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import ganymedes01.etfuturum.blocks.BlockBamboo;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockBambooRenderer extends BlockModelBase {
public BlockBambooRenderer(int modelID) {
super(modelID);
Expand Down Expand Up @@ -60,4 +62,5 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
// }
return true;
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockBarrelRenderer extends BlockModelBase {

public BlockBarrelRenderer(int modelID) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCauldron;
import net.minecraft.client.renderer.EntityRenderer;
Expand All @@ -8,6 +9,7 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockCauldronBaseRenderer extends BlockModelBase {
public BlockCauldronBaseRenderer(int modelID) {
super(modelID);
Expand Down Expand Up @@ -45,4 +47,6 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
renderer.renderFaceYNeg(block, x, (double) y + 1.0F - 0.75F, z, iicon2);
return true;
}


}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockChainRenderer extends BlockModelBase {
public BlockChainRenderer(int modelID) {
super(modelID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand All @@ -9,6 +10,7 @@
import net.minecraft.world.IBlockAccess;

@SideOnly(Side.CLIENT)
@ThreadSafeISBRH
public class BlockChestRenderer implements ISimpleBlockRenderingHandler {

@Override
Expand All @@ -29,4 +31,4 @@ public boolean shouldRender3DInInventory(int modelId) {
public int getRenderId() {
return Blocks.chest.getRenderType();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

@SideOnly(Side.CLIENT)
@ThreadSafeISBRH
public class BlockChorusFlowerRenderer extends BlockModelBase {

public BlockChorusFlowerRenderer(int modelId) {
Expand Down Expand Up @@ -35,4 +37,4 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
renderer.renderAllFaces = false;
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.ModBlocks;
Expand All @@ -13,6 +14,7 @@
import java.util.Random;

@SideOnly(Side.CLIENT)
@ThreadSafeISBRH
public class BlockChorusPlantRenderer extends BlockChorusFlowerRenderer {

private final Random rand = new RandomXoshiro256StarStar();
Expand Down Expand Up @@ -114,4 +116,4 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b

return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import ganymedes01.etfuturum.ModBlocks;
import ganymedes01.etfuturum.blocks.BlockPotionCauldron;
import ganymedes01.etfuturum.tileentities.TileEntityCauldronColoredWater;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCauldron;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockColoredWaterCauldronRenderer extends BlockCauldronBaseRenderer {

public BlockColoredWaterCauldronRenderer(int modelID) {
Expand All @@ -18,6 +21,7 @@ public BlockColoredWaterCauldronRenderer(int modelID) {
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
final Tessellator tessellator = Tessellator.instance;

TileEntityCauldronColoredWater tile = (TileEntityCauldronColoredWater) world.getTileEntity(x, y, z);
int color = tile.getWaterColor();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import ganymedes01.etfuturum.ModBlocks;
import ganymedes01.etfuturum.blocks.BlockComposter;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockComposterRenderer extends BlockModelBase {

public BlockComposterRenderer(int modelID) {
super(modelID);
}

protected void renderStandardInventoryCube(Block block, int meta, int modelID, RenderBlocks renderer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
final Tessellator tessellator = Tessellator.instance;
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);

tessellator.setNormal(0.0F, -1.0F, 0.0F);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

@SideOnly(Side.CLIENT)
@ThreadSafeISBRH
public class BlockDoorRenderer extends BlockModelBase {

public BlockDoorRenderer(int modelID) {
Expand All @@ -33,4 +35,4 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
renderer.uvRotateTop = 0;
return flag;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

@SideOnly(Side.CLIENT)
@ThreadSafeISBRH
public class BlockDoubleLayerRenderer extends BlockModelBase {

private final float innerSizeMax;
Expand All @@ -32,4 +34,4 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
renderer.renderAllFaces = false;
return flag;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package ganymedes01.etfuturum.client.renderer.block;

import com.gtnewhorizons.angelica.rendering.ThreadSafeISBRH;
import ganymedes01.etfuturum.blocks.IEmissiveLayerBlock;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;

@ThreadSafeISBRH
public class BlockEmissiveLayerRenderer extends BlockModelBase {

/**
Expand Down Expand Up @@ -38,6 +41,7 @@ protected void renderInventoryModel(Block block, int meta, int modelId, RenderBl

protected void renderStandardInventoryCubeEmissive(Block block, int meta, int modelId, RenderBlocks renderer, boolean emissive,
double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
final Tessellator tessellator = Tessellator.instance;
if (emissive) {
int m = ((IEmissiveLayerBlock) block).getEmissiveLayerColor(meta);
float f = (float) (m >> 16 & 255) / 255.0F;
Expand Down Expand Up @@ -102,6 +106,7 @@ protected boolean renderStandardWorldCubeWithEmissiveness(IBlockAccess world, in
* Renders the YNeg face with proper shading like renderStandardBlock.
*/
private void renderFaceYNeg(RenderBlocks renderer, Block block, double dx, double dy, double dz, int minBrightness, IIcon icon, int meta) {
final Tessellator tessellator = Tessellator.instance;
renderer.enableAO = false;

int x = MathHelper.floor_double(dx);
Expand Down Expand Up @@ -139,6 +144,7 @@ private void renderFaceYNeg(RenderBlocks renderer, Block block, double dx, doubl
* Renders the YPos face with proper shading like renderStandardBlock.
*/
private void renderFaceYPos(RenderBlocks renderer, Block block, double dx, double dy, double dz, int minBrightness, IIcon icon, int meta) {
final Tessellator tessellator = Tessellator.instance;
renderer.enableAO = false;

int x = MathHelper.floor_double(dx);
Expand Down Expand Up @@ -176,6 +182,7 @@ private void renderFaceYPos(RenderBlocks renderer, Block block, double dx, doubl
* Renders the ZNeg face with proper shading like renderStandardBlock.
*/
private void renderFaceZNeg(RenderBlocks renderer, Block block, double dx, double dy, double dz, int minBrightness, IIcon icon, int meta) {
final Tessellator tessellator = Tessellator.instance;
renderer.enableAO = false;

int x = MathHelper.floor_double(dx);
Expand Down Expand Up @@ -214,6 +221,7 @@ private void renderFaceZNeg(RenderBlocks renderer, Block block, double dx, doubl
* Renders the ZPos face with proper shading like renderStandardBlock.
*/
private void renderFaceZPos(RenderBlocks renderer, Block block, double dx, double dy, double dz, int minBrightness, IIcon icon, int meta) {
final Tessellator tessellator = Tessellator.instance;
renderer.enableAO = false;

int x = MathHelper.floor_double(dx);
Expand Down Expand Up @@ -252,6 +260,7 @@ private void renderFaceZPos(RenderBlocks renderer, Block block, double dx, doubl
* Renders the XNeg face with proper shading like renderStandardBlock.
*/
private void renderFaceXNeg(RenderBlocks renderer, Block block, double dx, double dy, double dz, int minBrightness, IIcon icon, int meta) {
final Tessellator tessellator = Tessellator.instance;
renderer.enableAO = false;

int x = MathHelper.floor_double(dx);
Expand Down Expand Up @@ -290,6 +299,7 @@ private void renderFaceXNeg(RenderBlocks renderer, Block block, double dx, doubl
* Renders the XPos face with proper shading like renderStandardBlock.
*/
private void renderFaceXPos(RenderBlocks renderer, Block block, double dx, double dy, double dz, int minBrightness, IIcon icon, int meta) {
final Tessellator tessellator = Tessellator.instance;
renderer.enableAO = false;

int x = MathHelper.floor_double(dx);
Expand Down
Loading

0 comments on commit 3cdc252

Please sign in to comment.