Skip to content

Commit

Permalink
Seems threadsafe enough
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchej123 committed Mar 1, 2024
1 parent 19f7c0a commit aac9662
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ dependencies {

runtimeOnly("com.github.GTNewHorizons:Baubles:1.0.4:dev") // for Thaumcraft
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")

compileOnlyApi("com.github.GTNewHorizons:Angelica:1.0.0-alpha31:api")

}
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 =
# [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,6 +7,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
Expand All @@ -15,15 +16,18 @@
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

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

/**
*
* @author CovertJaguar <http://www.railcraft.info>
*/
@ThreadSafeISBRH(perThread = false)
public class BlockRenderer implements ISimpleBlockRenderingHandler, IInvRenderer {

private final Map<Integer, IBlockRenderer> blockRenderers = new HashMap<Integer, IBlockRenderer>();
private final Map<Integer, IBlockRenderer> blockRenderers = new ConcurrentHashMap<>();
private final Map<Integer, IInvRenderer> itemRenderers = new HashMap<Integer, IInvRenderer>();
private ICombinedRenderer defaultRenderer = new DefaultRenderer();
private final ItemRenderer itemRenderer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.util.ForgeDirection;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import mods.railcraft.api.electricity.GridTools;
import mods.railcraft.api.electricity.IElectricGrid;
import mods.railcraft.api.electricity.IElectricGrid.ChargeHandler.ConnectType;
Expand All @@ -32,6 +34,7 @@
*
* @author CovertJaguar <http://www.railcraft.info>
*/
@ThreadSafeISBRH(perThread = false)
public class RenderBlockMachineDelta extends BlockRenderer {

public RenderBlockMachineDelta() {
Expand All @@ -41,6 +44,7 @@ public RenderBlockMachineDelta() {
addBlockRenderer(EnumMachineDelta.CAGE.ordinal(), new CageRenderer());
}

@ThreadSafeISBRH(perThread = false)
private class WireRenderer extends DefaultRenderer {

private final RenderBlockFrame renderFrame;
Expand Down Expand Up @@ -240,6 +244,7 @@ public void renderItem(RenderBlocks renderblocks, ItemStack item, IItemRenderer.
}
}

@ThreadSafeISBRH(perThread = false)
private class CageRenderer extends DefaultRenderer {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import mods.railcraft.common.blocks.RailcraftBlocks;

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

@Override
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mods/railcraft/client/render/RenderTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;

import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import mods.railcraft.api.tracks.ITrackInstance;
import mods.railcraft.api.tracks.ITrackSwitch;
import mods.railcraft.common.blocks.RailcraftBlocks;
import mods.railcraft.common.blocks.tracks.TileTrack;
import mods.railcraft.common.blocks.tracks.TrackGated;

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

@Override
Expand Down

0 comments on commit aac9662

Please sign in to comment.