Skip to content

Commit b54104d

Browse files
committed
Initial commit
0 parents  commit b54104d

File tree

21 files changed

+577
-0
lines changed

21 files changed

+577
-0
lines changed

.gitignore

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
# mpeltonen/sbt-idea plugin
11+
.idea_modules/
12+
13+
# JIRA plugin
14+
atlassian-ide-plugin.xml
15+
16+
# Compiled class file
17+
*.class
18+
19+
# Log file
20+
*.log
21+
22+
# BlueJ files
23+
*.ctxt
24+
25+
# Package Files #
26+
*.jar
27+
*.war
28+
*.nar
29+
*.ear
30+
*.zip
31+
*.tar.gz
32+
*.rar
33+
34+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
35+
hs_err_pid*
36+
37+
*~
38+
39+
# temporary files which can be created if a process still has a handle open of a deleted file
40+
.fuse_hidden*
41+
42+
# KDE directory preferences
43+
.directory
44+
45+
# Linux trash folder which might appear on any partition or disk
46+
.Trash-*
47+
48+
# .nfs files are created when an open file is removed but is still being accessed
49+
.nfs*
50+
51+
# General
52+
.DS_Store
53+
.AppleDouble
54+
.LSOverride
55+
56+
# Icon must end with two \r
57+
Icon
58+
59+
# Thumbnails
60+
._*
61+
62+
# Files that might appear in the root of a volume
63+
.DocumentRevisions-V100
64+
.fseventsd
65+
.Spotlight-V100
66+
.TemporaryItems
67+
.Trashes
68+
.VolumeIcon.icns
69+
.com.apple.timemachine.donotpresent
70+
71+
# Directories potentially created on remote AFP share
72+
.AppleDB
73+
.AppleDesktop
74+
Network Trash Folder
75+
Temporary Items
76+
.apdisk
77+
78+
# Windows thumbnail cache files
79+
Thumbs.db
80+
Thumbs.db:encryptable
81+
ehthumbs.db
82+
ehthumbs_vista.db
83+
84+
# Dump file
85+
*.stackdump
86+
87+
# Folder config file
88+
[Dd]esktop.ini
89+
90+
# Recycle Bin used on file shares
91+
$RECYCLE.BIN/
92+
93+
# Windows Installer files
94+
*.cab
95+
*.msi
96+
*.msix
97+
*.msm
98+
*.msp
99+
100+
# Windows shortcuts
101+
*.lnk
102+
103+
.gradle
104+
build/
105+
106+
# Ignore Gradle GUI config
107+
gradle-app.setting
108+
109+
# Cache of project
110+
.gradletasknamecache
111+
112+
**/build/
113+
114+
# Common working directory
115+
run/
116+
117+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
118+
!gradle-wrapper.jar

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Zbx1425
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

build.gradle

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
plugins {
2+
id 'dev.architectury.loom' version '1.7-SNAPSHOT' apply false
3+
id 'architectury-plugin' version '3.4-SNAPSHOT'
4+
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
5+
}
6+
7+
architectury {
8+
minecraft = project.minecraft_version
9+
}
10+
11+
allprojects {
12+
group = rootProject.maven_group
13+
version = rootProject.mod_version
14+
}
15+
16+
subprojects {
17+
apply plugin: 'dev.architectury.loom'
18+
apply plugin: 'architectury-plugin'
19+
apply plugin: 'maven-publish'
20+
21+
base {
22+
// Set up a suffixed format for the mod jar names, e.g. `example-fabric`.
23+
archivesName = "$rootProject.archives_name-$project.name"
24+
}
25+
26+
repositories {
27+
// Add repositories to retrieve artifacts from in here.
28+
// You should only use this when depending on other mods because
29+
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
30+
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
31+
// for more information about repositories.
32+
}
33+
34+
dependencies {
35+
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
36+
mappings loom.officialMojangMappings()
37+
}
38+
39+
java {
40+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
41+
// if it is present.
42+
// If you remove this line, sources will not be generated.
43+
withSourcesJar()
44+
45+
sourceCompatibility = JavaVersion.VERSION_21
46+
targetCompatibility = JavaVersion.VERSION_21
47+
}
48+
49+
tasks.withType(JavaCompile).configureEach {
50+
it.options.release = 21
51+
}
52+
53+
// Configure Maven publishing.
54+
publishing {
55+
publications {
56+
mavenJava(MavenPublication) {
57+
artifactId = base.archivesName.get()
58+
from components.java
59+
}
60+
}
61+
62+
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
63+
repositories {
64+
// Add repositories to publish to here.
65+
// Notice: This block does NOT have the same function as the block in the top level.
66+
// The repositories here will be used for publishing your artifact, not for
67+
// retrieving dependencies.
68+
}
69+
}
70+
}

common/build.gradle

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
architectury {
2+
common rootProject.enabled_platforms.split(',')
3+
}
4+
5+
dependencies {
6+
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
7+
// which get remapped to the correct annotations on each platform.
8+
// Do NOT use other classes from Fabric Loader.
9+
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package cn.zbx1425.minopp;
2+
3+
public final class Mino {
4+
public static final String MOD_ID = "minopp";
5+
6+
public static void init() {
7+
// Write common init code here.
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package cn.zbx1425.minopp.game;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public record Card(Family family, Suit suit, int number) {
7+
8+
public static List<Card> createDeck() {
9+
// Create a deck of UNO cards.
10+
List<Card> deck = new ArrayList<>();
11+
// Numbers
12+
for (Suit suit : Suit.values()) {
13+
for (int i = 0; i <= 9; i++) deck.add(new Card(Family.NUMBER, suit, i));
14+
for (int i = 1; i <= 9; i++) deck.add(new Card(Family.NUMBER, suit, i));
15+
}
16+
// Skip, Reverse, Draw 2
17+
for (Suit suit : Suit.values()) {
18+
for (int i = 0; i < 2; i++) {
19+
deck.add(new Card(Family.SKIP, suit, -101));
20+
deck.add(new Card(Family.REVERSE, suit, -102));
21+
deck.add(new Card(Family.DRAW, suit, -2));
22+
}
23+
}
24+
// Wild, Wild Draw 4
25+
for (int i = 0; i < 4; i++) {
26+
deck.add(new Card(Family.NUMBER, Suit.WILD, -1));
27+
deck.add(new Card(Family.DRAW, Suit.WILD, -4));
28+
}
29+
return deck;
30+
}
31+
32+
public boolean canPlayOn(Card card) {
33+
if (suit == Suit.WILD) return true;
34+
return suit == card.suit || number == card.number;
35+
}
36+
37+
public enum Suit {
38+
39+
RED,
40+
YELLOW,
41+
GREEN,
42+
BLUE,
43+
44+
WILD
45+
}
46+
47+
public enum Family {
48+
49+
NUMBER,
50+
SKIP,
51+
REVERSE,
52+
DRAW
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cn.zbx1425.minopp.game;
2+
3+
public enum CardActionResult {
4+
5+
SUCCESS,
6+
7+
NO_PLAYER,
8+
NO_CARD,
9+
NOT_YOUR_TURN,
10+
11+
INVALID_MATCH,
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cn.zbx1425.minopp.game;
2+
3+
import java.util.*;
4+
5+
public class CardGame {
6+
7+
public Map<UUID, CardPlayer> players = new HashMap<>();
8+
9+
public List<Card> deck = new ArrayList<>();
10+
11+
public Card topCard;
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package cn.zbx1425.minopp.game;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
import java.util.UUID;
6+
7+
public class CardPlayer {
8+
9+
public List<Card> hand = new ArrayList<>();
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"required": true,
3+
"package": "cn.zbx1425.minopp.mixin",
4+
"compatibilityLevel": "JAVA_21",
5+
"minVersion": "0.8",
6+
"client": [
7+
],
8+
"mixins": [
9+
],
10+
"injectors": {
11+
"defaultRequire": 1
12+
}
13+
}

fabric/build.gradle

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
plugins {
2+
id 'com.github.johnrengelman.shadow'
3+
}
4+
5+
architectury {
6+
platformSetupLoomIde()
7+
fabric()
8+
}
9+
10+
configurations {
11+
common {
12+
canBeResolved = true
13+
canBeConsumed = false
14+
}
15+
compileClasspath.extendsFrom common
16+
runtimeClasspath.extendsFrom common
17+
developmentFabric.extendsFrom common
18+
19+
// Files in this configuration will be bundled into your mod using the Shadow plugin.
20+
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
21+
shadowBundle {
22+
canBeResolved = true
23+
canBeConsumed = false
24+
}
25+
}
26+
27+
dependencies {
28+
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
29+
30+
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
31+
32+
33+
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
34+
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
35+
}
36+
37+
processResources {
38+
inputs.property 'version', project.version
39+
40+
filesMatching('fabric.mod.json') {
41+
expand version: project.version
42+
}
43+
}
44+
45+
shadowJar {
46+
configurations = [project.configurations.shadowBundle]
47+
archiveClassifier = 'dev-shadow'
48+
}
49+
50+
remapJar {
51+
input.set shadowJar.archiveFile
52+
}

0 commit comments

Comments
 (0)