Skip to content

Commit

Permalink
v1.5.0 backport to mc1.18.2 [Forge & Fabric]
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyForReal committed Jul 8, 2023
1 parent e62970b commit 3092801
Show file tree
Hide file tree
Showing 256 changed files with 5,537 additions and 4,242 deletions.
120 changes: 45 additions & 75 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,50 +1,48 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id "io.github.p03w.machete" version "1.+"
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
archivesBaseName = "${archives_base_name}-mc${mc_version}-${modloader}"
version = "v${mod_version}"
group = project.maven_group

repositories {
mavenLocal()
mavenCentral()
maven {
name "SquidDev"
url "https://squiddev.cc/maven"
}
maven { url 'https://jitpack.io' }
maven { url "https://maven.shedaniel.me/" }
maven {
// Location of the maven for vazkii's mods
name 'blamejared'
url 'https://maven.blamejared.com'
}

maven { url = 'https://maven.parchmentmc.org' }

maven { url = "https://squiddev.cc/maven/" }
maven { url = "https://maven.shedaniel.me/" }
maven { url = "https://maven.blamejared.com" } // Location of the maven for vazkii's mods

maven { url = "https://jitpack.io/" } // CC:R, Mixin Extras, fabric ASM

maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Suggestion Tweaker
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu, EMI
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url = "https://mvn.devos.one/snapshots/" } // Create, Porting Lib, Forge Tags, Milk Lib
maven { url = "https://cursemaven.com" } // Forge Config API Port
maven { url = "https://maven.tterrag.com/" } // Registrate and Flywheel
maven { url = "https://maven.cafeteria.dev" } // Fake Player API
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
maven { url = "https://jitpack.io/" } // Mixin Extras, fabric ASM

maven { url = "https://maven.terraformersmc.com/releases/" } // Modmenu
}

dependencies {
// dev environment
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
minecraft "com.mojang:minecraft:${project.mc_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.mc_version}:${project.parchment_version}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modLocalRuntime("maven.modrinth:lazydfu:0.1.2") // lazydfu - improves start times
modLocalRuntime("maven.modrinth:suggestion-tweaker:${project.suggestion_tweaker_version}") // suggestion tweaker - dev QOL, improves command suggestions
modLocalRuntime("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } // required for suggestion tweaker and REI
modLocalRuntime("com.terraformersmc:modmenu:${project.modmenu_version}") { exclude group: "net.fabricmc"; exclude group: "net.fabricmc.fabric-api" } // always good to have

// dependencies we dont use nowerdays HAHAHAHAHAHA
//modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")

// recipe viewers
modRuntimeOnly("dev.architectury:architectury-fabric:${project.architectury_version}") // for REI
Expand All @@ -62,93 +60,65 @@ dependencies {
println("unknown recipe viewer: $recipeViewer")
}

modLocalRuntime("maven.modrinth:lazydfu:0.1.2") // lazydfu - improves start times
modLocalRuntime("maven.modrinth:suggestion-tweaker:${project.suggestion_tweaker_version}") // suggestion tweaker - dev QOL, improves command suggestions
modLocalRuntime("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } // required for suggestion tweaker and REI
modLocalRuntime("com.terraformersmc:modmenu:${project.modmenu_version}") { exclude group: "net.fabricmc"; exclude group: "net.fabricmc.fabric-api" } // always good to have

// used to prevent forge config api port from complaining
modImplementation("com.github.AlphaMode:fakeconfig:master-SNAPSHOT") { exclude(group: "net.fabricmc.fabric-api") }
modImplementation("com.github.AlphaMode:fakeconfigtoml:master-SNAPSHOT") { exclude(group: "net.fabricmc.fabric-api") }

// create setup
modImplementation("com.simibubi:Create:${project.create_version}") { transitive = false }
modImplementation("io.github.fabricators_of_create:Porting-Lib:${project.port_lib_version}+${project.minecraft_version}-dev.${project.port_lib_hash}")
// Create
modImplementation("com.simibubi.create:create-fabric-${project.mc_version}:${project.create_version}+mc${project.mc_version}")
modImplementation("io.github.fabricators_of_create:Porting-Lib:$project.port_lib_version+$project.mc_version")
modImplementation("me.alphamode:ForgeTags:${project.forge_tags_version}")
modImplementation(include("com.electronwill.night-config:core:${project.night_config_core_version}"))
modImplementation(include("com.electronwill.night-config:toml:${project.night_config_toml_version}"))
modImplementation("curse.maven:forge-config-api-port-fabric-547434:${project.config_api_id}") { transitive = false }
modImplementation("com.tterrag.registrate:Registrate:${project.registrate_version}")
modImplementation("com.jozufozu.flywheel:flywheel-fabric-1.18.2:${project.flywheel_version}")
modImplementation("com.jozufozu.flywheel:flywheel-fabric-${project.mc_version}:${project.flywheel_version}")
modImplementation("com.jamieswhiteshirt:reach-entity-attributes:${project.reach_entity_attributes_version}")
modImplementation("dev.cafeteria:fake-player-api:${project.fake_player_api_version}")
modImplementation("io.github.tropheusj:milk-lib:${project.milk_lib_version}")
implementation("com.google.code.findbugs:jsr305:${project.jsr305_version}")

// CC:R setup
modImplementation("com.github.cc-tweaked:cc-restitched:${project.cc_version}")

// dependencies
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")










// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"



modApi "com.github.cc-tweaked:cc-restitched:${project.cc_version}"

// create setup
modImplementation("com.simibubi:Create:${project.create_version}") { transitive = false }

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation("com.github.cc-tweaked:cc-restitched:v${project.mc_version}-${project.cc_version}-ccr")
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
expand(project.properties)
}
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
options.compilerArgs <<"-Xlint:deprecation"
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
manifest {
attributes([
"Specification-Title" : "${project.archives_base_name}",
"Specification-Vendor" : "${project.maven_group}",
"Specification-Version" : "1",
"Implementation-Title" : project.name,
"Implementation-Version" : project.mod_version,
"Implementation-Vendor" : "${project.maven_group}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
repositories {}
}
43 changes: 22 additions & 21 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G

# Description
copyright_year=2023
license=Apache-2.0
modloader=fabric

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.3
mc_version=1.18.2
parchment_version = 2022.11.06
loader_version=0.14.8

# Mod Properties
mod_version = 1.3.1
mod_version = 1.5.0
maven_group = cc.tweaked_programs
archives_base_name = cccbridge

# Dependencies
fabric_version=0.57.0+1.18.2
cc_version=v1.18.2-1.100.5-ccr
fabric_version=0.67.0+1.18.2
cc_version=1.100.5

# Create setup
# https://modrinth.com/mod/create-fabric
create_version = 0.5.0c-691
create_version=0.5.1-b-build.1078
create_version_production=0.5.1-b

flywheel_version=0.6.8.a-36
reach_entity_attributes_version=2.1.1
registrate_version=MC1.18.2-1.1.3
forge_tags_version=2.1
milk_lib_version=0.3.2
port_lib_version=1.2.1031-beta

# https://github.com/Fabricators-of-Create/Create/blob/mc1.18/fabric/dev/gradle.properties
config_api_id = 3671141
forge_config_api_port_version = 3.2.0
fake_player_api_version = 0.3.0
flywheel_version = 0.6.4-30
reach_entity_attributes_version = 2.1.1
registrate_version = MC1.18.2-1.1.3
forge_tags_version = 2.1
milk_lib_version = 0.3.2
port_lib_version = 1.2.421-beta
port_lib_hash = b8d195a
night_config_core_version = 3.6.3
night_config_toml_version = 3.6.3
jsr305_version = 3.0.2
night_config_core_version = 3.6.6
night_config_toml_version = 3.6.6

# dev env mods
# https://modrinth.com/mod/modmenu
modmenu_version = 3.2.2
modmenu_version = 3.2.4
# https://modrinth.com/mod/suggestion-tweaker
suggestion_tweaker_version = 1.18.x-1.2.0
# https://modrinth.com/mod/cloth-config
Expand Down

This file was deleted.

54 changes: 28 additions & 26 deletions fabric/src/main/java/cc/tweaked_programs/cccbridge/CCCBridge.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
package cc.tweaked_programs.cccbridge;

import cc.tweaked_programs.cccbridge.block.RedRouterBlock;
import cc.tweaked_programs.cccbridge.block.ScrollerBlock;
import cc.tweaked_programs.cccbridge.blockEntity.RedRouterBlockEntity;
import cc.tweaked_programs.cccbridge.block.SourceBlock;
import cc.tweaked_programs.cccbridge.blockEntity.ScrollerBlockEntity;
import cc.tweaked_programs.cccbridge.block.*;
import cc.tweaked_programs.cccbridge.blockEntity.*;
import cc.tweaked_programs.cccbridge.display.SourceBlockDisplaySource;
import cc.tweaked_programs.cccbridge.blockEntity.SourceBlockEntity;
import cc.tweaked_programs.cccbridge.block.TargetBlock;
import cc.tweaked_programs.cccbridge.display.TargetBlockDisplayTarget;
import cc.tweaked_programs.cccbridge.blockEntity.TargetBlockEntity;
import com.simibubi.create.content.logistics.block.display.AllDisplayBehaviours;
import cc.tweaked_programs.cccbridge.entity.animatronic.AnimatronicEntity;
import cc.tweaked_programs.cccbridge.entity.animatronic.AnimatronicModel;
import cc.tweaked_programs.cccbridge.entity.animatronic.AnimatronicRenderer;
import com.simibubi.create.content.redstone.displayLink.AllDisplayBehaviours;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.peripheral.IPeripheralProvider;
import net.fabricmc.api.ModInitializer;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.decoration.Motive;

public class CCCBridge implements ModInitializer {
public static final String MOD_ID = "cccbridge";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

public static final IPeripheralProvider peripheralProvider = new PeripheralProvider();
//public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

@Override
public void onInitialize() {
BlockRegister.registerBlockEntity("source_block", SourceBlockEntity::new, new SourceBlock());
AllDisplayBehaviours.assignTile(AllDisplayBehaviours.register(new Identifier(MOD_ID, "source_block_display_source"), new SourceBlockDisplaySource()), BlockRegister.getBlockEntityType("source_block"));
// Block (-entities)
CCCRegister.registerBlockEntity("source_block", SourceBlockEntity::new, new SourceBlock());
CCCRegister.registerBlockEntity("target_block", TargetBlockEntity::new, new TargetBlock());

BlockRegister.registerBlockEntity("target_block", TargetBlockEntity::new, new TargetBlock());
AllDisplayBehaviours.assignTile(AllDisplayBehaviours.register(new Identifier(MOD_ID, "target_block_display_source"), new TargetBlockDisplayTarget()), BlockRegister.getBlockEntityType("target_block"));
CCCRegister.registerBlockEntity("redrouter_block", RedRouterBlockEntity::new, new RedRouterBlock());
CCCRegister.registerBlockEntity("scroller_block", ScrollerBlockEntity::new, new ScrollerBlock());
CCCRegister.registerBlockEntity("animatronic_block", AnimatronicBlockEntity::new, new AnimatronicBlock());

BlockRegister.registerBlockEntity("redrouter_block", RedRouterBlockEntity::new, new RedRouterBlock());
BlockRegister.registerBlockEntity("scroller_block", ScrollerBlockEntity::new, new ScrollerBlock());
// Entities
CCCRegister.registerEntity("animatronic", FabricEntityTypeBuilder.create(MobCategory.MISC, AnimatronicEntity::new).dimensions(EntityDimensions.fixed(0.6F, 1.8F)).build(), AnimatronicRenderer::new, AnimatronicModel.LAYER_LOCATION, AnimatronicModel::createBodyLayer);

CCCSoundEvents.init();
// Create Display Stuff
AllDisplayBehaviours.assignBlockEntity(AllDisplayBehaviours.register(new ResourceLocation(MOD_ID, "source_block_display_source"), new SourceBlockDisplaySource()), CCCRegister.getBlockEntityType("source_block"));
AllDisplayBehaviours.assignBlockEntity(AllDisplayBehaviours.register(new ResourceLocation(MOD_ID, "target_block_display_target"), new TargetBlockDisplayTarget()), CCCRegister.getBlockEntityType("target_block"));

ComputerCraftAPI.registerPeripheralProvider(peripheralProvider);
// Misc
Registry.register(Registry.MOTIVE, new ResourceLocation(MOD_ID, "funny_redrouters"), new Motive(32,16));
CCCSoundEvents.init();
ComputerCraftAPI.registerPeripheralProvider(new PeripheralProvider());
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package cc.tweaked_programs.cccbridge;

import cc.tweaked_programs.cccbridge.blockEntity.AnimatronicBlockEntity;
import cc.tweaked_programs.cccbridge.blockEntity.RedRouterBlockEntity;
import cc.tweaked_programs.cccbridge.blockEntityRenderer.AnimatronicBlockEntityRenderer;
import cc.tweaked_programs.cccbridge.blockEntityRenderer.RedRouterBlockEntityRenderer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.minecraft.world.level.block.entity.BlockEntityType;

public class CCCBridgeClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(BlockRegister.getBlock("redrouter_block"), RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(BlockRegister.getBlock("scroller_block"), RenderLayer.getCutout());
BlockEntityRendererRegistry.register((BlockEntityType<AnimatronicBlockEntity>)CCCRegister.getBlockEntityType("animatronic_block"), AnimatronicBlockEntityRenderer::new);
BlockEntityRendererRegistry.register((BlockEntityType<RedRouterBlockEntity>)CCCRegister.getBlockEntityType("redrouter_block"), RedRouterBlockEntityRenderer::new);
}
}
Loading

0 comments on commit 3092801

Please sign in to comment.