Skip to content

Commit

Permalink
Thread Safe (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchej123 authored Mar 10, 2024
1 parent 2a6cd9f commit 84430a2
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 13 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Add your dependencies here

dependencies {
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha31:api')
api("com.github.GTNewHorizons:Mantle:0.4.1:dev")
api("com.github.GTNewHorizons:ForgeMultipart:1.4.7:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
Expand Down Expand Up @@ -61,6 +61,9 @@ gradleTokenModId = GRADLETOKEN_MODID
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =

# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -123,7 +126,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +190,3 @@ curseForgeRelations =
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName =
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15'
}


Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

import org.lwjgl.opengl.GL11;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class DryingRackRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down Expand Up @@ -64,7 +67,7 @@ public int getRenderId() {
}

public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
Tessellator tessellator = Tessellator.instance;
final Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int

@Override
public boolean canRenderInPass(int pass) {
TankRender.renderPass = pass;
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import org.lwjgl.opengl.GL11;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.client.BlockSkinRenderHelper;
Expand All @@ -21,6 +23,7 @@
/**
* @author BluSunrize
*/
@ThreadSafeISBRH(perThread = false)
public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {

public static int renderID = RenderingRegistry.getNextAvailableRenderId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.TConstruct;
Expand All @@ -17,6 +19,7 @@
import tconstruct.smeltery.logic.FaucetLogic;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class CastingBlockRender implements ISimpleBlockRenderingHandler {

public static int searedModel = RenderingRegistry.getNextAvailableRenderId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.smeltery.blocks.GlassPaneConnected;

@ThreadSafeISBRH(perThread = false)
public class PaneConnectedRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/smeltery/model/PaneRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class PaneRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/tconstruct/smeltery/model/SmelteryRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import mantle.world.CoordTuple;
Expand All @@ -16,6 +18,7 @@
import tconstruct.smeltery.logic.SmelteryLogic;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class SmelteryRender implements ISimpleBlockRenderingHandler {

public static int smelteryModel = RenderingRegistry.getNextAvailableRenderId();
Expand All @@ -40,8 +43,8 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
public boolean renderSmeltery(IBlockAccess world, int x, int y, int z, Block block, int modelID,
RenderBlocks renderer) {
boolean ret = renderer.renderStandardBlock(block, x, y, z);
SmelteryLogic logic = (SmelteryLogic) world.getTileEntity(x, y, z);
if (logic.validStructure) {
final SmelteryLogic logic = (SmelteryLogic) world.getTileEntity(x, y, z);
if (logic != null && logic.validStructure) {
CoordTuple from = logic.minPos;
CoordTuple to = logic.maxPos;

Expand Down
11 changes: 7 additions & 4 deletions src/main/java/tconstruct/smeltery/model/TankRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;

import org.lwjgl.opengl.GL11;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.client.BlockSkinRenderHelper;
import tconstruct.smeltery.logic.LavaTankLogic;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class TankRender implements ISimpleBlockRenderingHandler {

public static int tankModelID = RenderingRegistry.getNextAvailableRenderId();
public static int renderPass = 0;

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
Expand All @@ -38,9 +41,9 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
RenderBlocks renderer) {
if (modelID == tankModelID) {
// Liquid
if (renderPass == 0) {
if (ForgeHooksClient.getWorldRenderPass() == 0) {
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(x, y, z);
if (logic.containsFluid()) {
if (logic != null && logic.containsFluid()) {
FluidStack liquid = logic.tank.getFluid();
renderer.setRenderBounds(0.001, 0.001, 0.001, 0.999, logic.getFluidAmountScaled(), 0.999);
Fluid fluid = liquid.getFluid();
Expand Down Expand Up @@ -84,7 +87,7 @@ public int getRenderId() {
}

private void renderDoRe(RenderBlocks renderblocks, Block block, int meta) {
Tessellator tessellator = Tessellator.instance;
final Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, 0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/tools/model/BattlesignRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;

@ThreadSafeISBRH(perThread = false)
public class BattlesignRender implements ISimpleBlockRenderingHandler {

public static int battlesignModelID = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/tools/model/FrypanRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;

@ThreadSafeISBRH(perThread = false)
public class FrypanRender implements ISimpleBlockRenderingHandler {

public static int frypanModelID = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/tools/model/TableRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

import org.lwjgl.opengl.GL11;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.tools.TinkerTools;

@ThreadSafeISBRH(perThread = false)
public class TableRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/world/model/BarricadeRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class BarricadeRender implements ISimpleBlockRenderingHandler {

public static int model;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/world/model/OreberryRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class OreberryRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/world/model/PunjiRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

import org.lwjgl.opengl.GL11;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;

@ThreadSafeISBRH(perThread = false)
public class PunjiRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/world/model/RenderLandmine.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import org.lwjgl.opengl.GL11;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.mechworks.landmine.Helper;
Expand All @@ -16,6 +18,7 @@
* @author fuj1n
*
*/
@ThreadSafeISBRH(perThread = false)
public class RenderLandmine implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/world/model/SlimeChannelRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.util.ItemHelper;

@ThreadSafeISBRH(perThread = false)
public class SlimeChannelRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/world/model/SlimePadRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tconstruct.client.BlockSkinRenderHelper;
import tconstruct.util.ItemHelper;
import tconstruct.world.TinkerWorld;
import tconstruct.world.blocks.SlimePad;

@ThreadSafeISBRH(perThread = false)
public class SlimePadRender implements ISimpleBlockRenderingHandler {

public static int model = RenderingRegistry.getNextAvailableRenderId();
Expand Down

0 comments on commit 84430a2

Please sign in to comment.