Skip to content

Commit

Permalink
Add (non-working) forge build
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny-Hui committed Mar 21, 2024
1 parent 723a2a0 commit ce2cb4b
Show file tree
Hide file tree
Showing 31 changed files with 380 additions and 134 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
run: chmod +x ./gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Setup Forge files
run: ./gradlew forge:setupFiles -Pminecraft_version="${{ matrix.minecraft }}"
- name: Build with Gradle
run: ./gradlew build -Pminecraft_version="${{ matrix.minecraft }}"
- name: Upload Artifacts to GitHub
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ bin/

fabric/run/

# Temporary: Can't get MTR with JCM to launch *in dev environment*, so have to copy all assets from MTR to JCM for testing, no plan to bundle it with the mod
fabric/src/main/resources/assets/mtr/
# forge
forge/src/main/java/**/mod
forge/src/main/java/net/londonunderground/mod
forge/src/main/resources/assets
forge/src/main/resources/data
#forge/src/main/resources/META-INF

# java

Expand Down
25 changes: 9 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
plugins {
// id "com.github.johnrengelman.shadow" version "+" apply false
}

subprojects {
apply plugin: "java"
// apply plugin: "com.github.johnrengelman.shadow"

group project.maven_group
version "${rootProject.properties.mod_version}+${rootProject.properties.minecraft_version}"

configurations {
// shadowImplementation
// implementation.extendsFrom shadowImplementation
base {
archivesName = "${rootProject.archives_base_name}-${project.properties.loader_name}"
}

dependencies {
annotationProcessor 'systems.manifold:manifold-preprocessor:+'
implementation 'com.google.code.findbugs:jsr305:+'
implementation "org.mtr:Minecraft-Mappings-common:0.0.1"
}

repositories {
mavenCentral()
flatDir { dirs "../libs" }
maven { url "https://jitpack.io" }
}
//
// shadowJar {
// minimize()
// configurations = [project.configurations.shadowImplementation]
// enableRelocation = false
// relocationPrefix = "com.lx862.jcm.lib"
// }

/* Manifold support */
tasks.withType(JavaCompile).forEach {
Expand All @@ -45,4 +33,9 @@ subprojects {
"-ALOADER=$project.properties.loader_name"
]
}

tasks.register('moveBuildFile', Copy) {
from "${project.projectDir}/build/libs/${base.archivesName.get()}-${version}.jar"
into "${rootProject.projectDir}/build"
}
}
9 changes: 0 additions & 9 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ loom {
}
}

base {
archivesName = "${rootProject.archives_base_name}-fabric"
}

repositories {
maven { url = "https://maven.terraformersmc.com/" }
}
Expand Down Expand Up @@ -70,11 +66,6 @@ jar {
}
}

tasks.register('moveBuildFile', Copy) {
from "${project.projectDir}/build/libs/${base.archivesName.get()}-${version}.jar"
into "${rootProject.projectDir}/build"
}

build {
finalizedBy moveBuildFile
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private static void offerOrDrop(PlayerEntity player, Hand hand, ItemStack stack)
}

private static void playSplashSoundToPlayer(PlayerEntity player) {
player.playSound(new SoundEvent(net.minecraft.sound.SoundEvents.ITEM_BUCKET_FILL), SoundCategory.BLOCKS, 1F, 1F);
// TODO: Need Mapping
// player.playSound(new SoundEvent(net.minecraft.sound.SoundEvents.ITEM_BUCKET_FILL), SoundCategory.BLOCKS, 1F, 1F);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public BlockState getPlacementState2(ItemPlacementContext ctx) {
}

public void onPlaced2(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
HorizontalDoubleBlockBehavior.placeBlock(world, pos, state, IS_LEFT, Direction.convert(state.get(new Property<>(FACING.data)).rotateYClockwise()), width);
HorizontalDoubleBlockBehavior.placeBlock(world, pos, state, IS_LEFT, Direction.convert(state.get(new Property<>(FACING.data))).rotateYClockwise(), width);
}

@Override
Expand All @@ -48,4 +48,4 @@ public void addBlockProperties(List<HolderBase<?>> properties) {
super.addBlockProperties(properties);
properties.add(IS_LEFT);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package com.lx862.jcm.mod.block.base;
/*package com.lx862.jcm.mod.block.base;
import com.lx862.jcm.mod.block.behavior.WaterloggableBehavior;
import org.mtr.mapping.holder.*;
import org.mtr.mapping.tool.HolderBase;
import java.util.List;

*/
/**
* A waterlogged block
* Cannot find ways to migrate non-waterlogged block yet, so this is not in use.
* (WATERLOGGED is a BooleanProperty, by default Minecraft will use the first value as it's default value, and somehow "true" comes first)
*/

/*
public abstract class WaterloggableBlock extends JCMBlock implements WaterloggableBehavior {
public WaterloggableBlock(BlockSettings settings) {
super(settings);
Expand Down Expand Up @@ -39,3 +41,4 @@ public BlockState getStateForNeighborUpdate2(BlockState state, Direction directi
return super.getStateForNeighborUpdate2(state, direction, neighborState, world, pos, neighborPos);
}
}
*/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.lx862.jcm.mod.block.behavior;
/*package com.lx862.jcm.mod.block.behavior;
import com.lx862.jcm.mod.util.BlockUtil;
import net.minecraft.block.Waterloggable;
Expand Down Expand Up @@ -31,3 +31,4 @@ default BlockState getWaterloggedState(BlockState state, World world, BlockPos p
return state.with(new Property<>(WATERLOGGED.data), world.getFluidState(pos).getFluid() == Fluids.WATER);
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,31 @@ public void writeCompoundTag(CompoundTag compoundTag) {

@Override
public void blockEntityTick() {
World world = getWorld2();

if(repeatTick > 0 && !soundID.isEmpty() && world != null && !world.isClient() && JCMServerStats.getGameTick() % repeatTick == 0) {
if(needRedstone && !world.isReceivingRedstonePower(pos)) return;
boolean bl1 = world.isEmittingRedstonePower(getPos2(), Direction.NORTH);
boolean bl2 = world.isEmittingRedstonePower(getPos2(), Direction.EAST);
boolean bl3 = world.isEmittingRedstonePower(getPos2(), Direction.SOUTH);
boolean bl4 = world.isEmittingRedstonePower(getPos2(), Direction.WEST);
boolean bl5 = world.isEmittingRedstonePower(getPos2(), Direction.UP);
boolean bl6 = world.isEmittingRedstonePower(getPos2(), Direction.DOWN);
boolean emittingRedstonePower = bl1 || bl2 || bl3 || bl4 || bl5 || bl6;
if(needRedstone && !emittingRedstonePower) return;

if(!limitRange) {
world.getPlayers().forEach(player -> {
Identifier identifier = null;
try {
identifier = new Identifier(soundID);
} catch (Exception ignored) {
}

if(identifier == null) return;
final SoundCategory category = SOURCE_LIST[soundCategory];
final long seed = world.getRandom().nextLong();
// TODO: Implement the rest, need SoundEvent.of
});
// world.getPlayers().forEach(player -> {
// Identifier identifier = null;
// try {
// identifier = new Identifier(soundID);
// } catch (Exception ignored) {
// }
//
// if(identifier == null) return;
// final SoundCategory category = SOURCE_LIST[soundCategory];
// final long seed = world.getRandom().nextLong();
// // TODO: Implement the rest, need SoundEvent.of
// });
} else {

}
Expand Down Expand Up @@ -114,4 +123,4 @@ public void setData(String soundId, int soundCategory, int interval, float volum
this.limitRange = limitRange;
this.markDirty2();
}
}
}
Loading

0 comments on commit ce2cb4b

Please sign in to comment.