Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ body:


**Version format:** v[mod_version]+[mod_loader]-[minecraft_version]
**Version example:** v5.0+fabric-1.26
**Title example:** [v5.3.1+neoforge-1.26.2] Red "Do not click" button
**Version example:** v5.0+fabric-26
**Title example:** [v5.3.1+neoforge-26.1.2] Red "Do not click" button
crashes the game when clicked
- type: textarea
id: description
Expand Down Expand Up @@ -69,9 +69,8 @@ body:
mod-pack. This helps project maintainers reproduce the issue, as other
mods often can and do cause issues.
placeholder: >-
Name a list of mods or link a mod-pack here. Please do not expect
project maintainers to manually download and install like 300 separate
mods.
Name a list of mods or link a mod-pack here. To rule out mod conflicts, it is
advised to reproduce the issue without other mods present (except for dependencies).
validations:
required: true
- type: checkboxes
Expand Down
122 changes: 66 additions & 56 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,66 @@
# -------------------- Eclipse IDE -------------------
# ==================================================
# Gradle
# ==================================================
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# ==================================================
# Java
# ==================================================
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
!**/src/main/resources/**/*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.gradle/
/build/

# ==================================================
# FabricMC
# ==================================================
run/

# ==================================================
# Eclipse IDE
# ==================================================
.metadata
bin/
tmp/
Expand Down Expand Up @@ -60,59 +122,7 @@ local.properties
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project

# ----------------------- Java -----------------------
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
!**/src/main/resources/**/*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.gradle/
/build/

# -------------------- Idea IDE -------------------
# ==================================================
# IntelliJ Idea IDE
# ==================================================
**/.idea/

# ----------------------- Gradle -----------------------
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# ----------------------- Fabric -----------------------
run/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ TCDCommons is a Minecraft modding API library that features its own GUI system a
## Dependencies

This mod depends on some other mods that first need to be installed before this mod can be installed. Those dependencies are as follows:
- 🏗 [Architectury API](https://github.com/architectury/architectury-api) - Allows this mod to run on `Fabric` and `NeoForge`
- 🧵 [Fabric API](https://github.com/FabricMC/fabric-api) (Fabric only) - Loads this mod's assets and resources.

## Building

Follow these steps to build the project from source.

### Prerequisites
* **Java 21**: Ensure you have the Java Development Kit (JDK) 21 installed.
* **Java 25**: Ensure you have the Java Development Kit (JDK) installed.
* **Git**: Required to clone this repository.

### Instructions
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'net.fabricmc.fabric-loom' version "1.15-SNAPSHOT"
id 'net.fabricmc.fabric-loom' version "1.17-SNAPSHOT"
}

dependencies {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ maven.group = com.thecsdev

# Mod properties
mod.id = tcdcommons
mod.version = 5.3.2
mod.version = 5.5.5
mod.name = TCDCommons API
mod.description = TheCSDev's personal Minecraft modding library.
mod.author = TheCSDev
Expand All @@ -22,14 +22,14 @@ mod.link.sources = https://thecsdev.com/fwd/tcdcommons-sources/
mod.link.issues = https://thecsdev.com/fwd/tcdcommons-issues/

# 'pack.mcmeta' properties
pack.format = 84.0
pack.format = 84

# Minecraft properties
minecraft.version = 26.1

# Fabric properties
fabric.loader_version = 0.18.6
fabric.api_version = 0.145.1+26.1
fabric.loader_version = 0.18.5
fabric.api_version = 0.144.0+26.1

# fabric.mod.json properties
fabric.json.entrypoints.main = com.thecsdev.commonmc.fabric.TCDCommonsFabric
Expand All @@ -38,8 +38,8 @@ fabric.api_version = 0.145.1+26.1

fabric.json.depends.java = >=25
fabric.json.depends.minecraft = ~26.1
fabric.json.depends.fabricloader = >=0.18.4
fabric.json.depends.fabric-api = >=0.145.1
fabric.json.depends.fabricloader = >=0.18.5
fabric.json.depends.fabric-api = >=0.144.0

# Neo-Forge properties
neoforge.version = 26.1.0.7-beta
Expand Down
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.Holder;
import net.minecraft.network.protocol.game.ClientboundLoginPacket;
import net.minecraft.resources.ResourceKey;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -40,7 +37,6 @@ public interface ClientEvent
/**
* <b>Trigger:</b> Whenever a {@link ClientLevel} is initialized.<br>
* <b>Thread:</b> Main (client)
* @see ClientLevel#ClientLevel(ClientPacketListener, ClientLevel.ClientLevelData, ResourceKey, Holder, int, int, LevelRenderer, boolean, long, int)
*/
Event<LevelInit> LEVEL_INIT = Events.createLoop();
// --------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public TEntityElement() {
focusableProperty().set(false, TEntityElement.class);
hoverableProperty().set(false, TEntityElement.class);
//automatic display data refreshing when relevant properties update
boundsProperty().addChangeListener((p, o, n) -> { if(!o.hasSameSize(n)) refresh(); });
this.entityType.addChangeListener((p, o, n) -> refresh());
boundsProperty().addChangeListener((_, o, n) -> { if(!o.hasSameSize(n)) refresh(); });
this.entityType.addChangeListener((_, _, _) -> refresh());
//the initial display data refresh
refresh();
}
Expand Down Expand Up @@ -157,14 +157,16 @@ public TEntityElement() {
public static final @ApiStatus.Internal class EntityProvider
{
// ==================================================
private static int NEXT_ID = 1048576;
// --------------------------------------------------
private static final Map<EntityType<?>, Object> CACHE = new HashMap<>();
// ==================================================
private EntityProvider() {}
static {
//clear cache when world-related events happen
ClientEvent.PLAYER_JOIN.addListener(__ -> CACHE.clear());
ClientEvent.PLAYER_QUIT.addListener(__ -> CACHE.clear());
ClientEvent.LEVEL_INIT.addListener(__ -> CACHE.clear());
ClientEvent.PLAYER_JOIN.addListener(_ -> CACHE.clear());
ClientEvent.PLAYER_QUIT.addListener(_ -> CACHE.clear());
ClientEvent.LEVEL_INIT.addListener(_ -> CACHE.clear());
}
// ==================================================
/**
Expand Down Expand Up @@ -206,15 +208,28 @@ else if(cached instanceof RuntimeException error)
Level level = client.level;
if(level == null) level = SandboxLevel.INSTANCE;

final var entity = entityType.create(level, MOB_SUMMONED);
CACHE.put(entityType, Objects.requireNonNull(entity, "'EntityType#create(...)' returned 'null' for " + entityType));
final var entity = Objects.requireNonNull(
entityType.create(level, MOB_SUMMONED),
"'EntityType#create(...)' returned 'null' for " + entityType);
entity.setId(nextEntityId());
CACHE.put(entityType, entity);
return entity;
} catch (Exception e) {
final var error = new RuntimeException("Failed to create 'Entity' instance of type " + entityType, e);
CACHE.put(entityType, error);
throw error;
}
}
// --------------------------------------------------
/**
* Generate next ID integer for a created {@link Entity} instance.
* @see Entity#setId(int)
*/
private static final int nextEntityId() {
NEXT_ID++; //increment next id
if(NEXT_ID < 1048576) NEXT_ID = 1048576; //counteract overflows (values '< 1' are prohibited)
return NEXT_ID; //return next id
}
// ==================================================
}
// ================================================== ==================================================
Expand Down

This file was deleted.

Loading
Loading