mixins added and camera mixin has been started
This commit is contained in:
61
build.gradle
61
build.gradle
@@ -3,7 +3,8 @@ plugins {
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
}
|
||||
id 'org.spongepowered.mixin' version '0.7.+'
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
group = mod_group_id
|
||||
@@ -17,60 +18,16 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
minecraft {
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// Channel: Version:
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
||||
//
|
||||
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
// In most cases, it is not necessary to enable.
|
||||
// enableEclipsePrepareRuns = true
|
||||
// enableIdeaPrepareRuns = true
|
||||
|
||||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||
// It is REQUIRED to be set to true for this template to function.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
copyIdeResources = true
|
||||
|
||||
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
|
||||
// The folder name can be set on a run configuration using the "folderName" property.
|
||||
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
|
||||
// generateRunFolders = true
|
||||
|
||||
// This property enables access transformers for use in development.
|
||||
// They will be applied to the Minecraft artifact.
|
||||
// The access transformer file can be anywhere in the project.
|
||||
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
||||
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
||||
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
@@ -83,6 +40,7 @@ minecraft {
|
||||
|
||||
client {
|
||||
// this block needs to be here for runClient to exist
|
||||
arg "-mixin.config=hals_steampowered.mixin.json"
|
||||
}
|
||||
|
||||
server {
|
||||
@@ -105,7 +63,6 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
repositories {
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
@@ -119,7 +76,7 @@ dependencies {
|
||||
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
|
||||
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
implementation 'org.spongepowered:mixingradle:0.7.+'
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
||||
@@ -134,7 +91,6 @@ dependencies {
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
@@ -164,10 +120,13 @@ tasks.named('jar', Jar).configure {
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
'TweakClass' : 'org.spongepowered.asm.launch.MixinTweaker',
|
||||
'TweakOrder' : 0,
|
||||
'MixinConfigs' : 'hals_steampowered.mixin.json'
|
||||
])
|
||||
}
|
||||
|
||||
}
|
||||
rename 'mixin.refmap.json', 'hals_steampowered.mixin-refmap.json'
|
||||
// This is the preferred method to reobfuscate your jar file
|
||||
finalizedBy 'reobfJar'
|
||||
}
|
||||
|
||||
@@ -42,18 +42,18 @@ mapping_version=1.16.5
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=examplemod
|
||||
mod_id=hals_steampowered
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=Example Mod
|
||||
mod_name=Hal's Steampowered
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.0.0
|
||||
mod_version=0.1.0EX
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
mod_group_id=com.example.examplemod
|
||||
mod_group_id=net.halbear.steampowered
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=YourNameHere, OtherNameHere
|
||||
mod_authors=halbear1
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
|
||||
mod_description=Steampowered is a complex steam vehicle mod mainly focusing around rail travel!
|
||||
|
||||
@@ -2,6 +2,8 @@ pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven { url = 'https://maven.minecraftforge.net/' }
|
||||
maven { url = 'https://repo.spongepowered.org/maven' }
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
|
||||
@@ -338,9 +338,11 @@ public class TrainTrack extends DirectionalBlock {
|
||||
}
|
||||
}
|
||||
if (trackType == MOUNTAININCLINE){
|
||||
if(world.getBlockState(placementPos.relative(facing.getOpposite()).relative(facing.getOpposite())).is(Objects.requireNonNull(BlockTags.getAllTags().getTag(new ResourceLocation("hals_steampowered", "flattrack"))))){
|
||||
if(world.getBlockState(placementPos.relative(facing.getOpposite()).relative(facing.getOpposite())).is(Objects.requireNonNull(BlockTags.getAllTags().getTag(new ResourceLocation("hals_steampowered", "flattrack"))))
|
||||
&& world.getBlockState(placementPos.relative(facing.getOpposite())).getMaterial().isReplaceable()){
|
||||
trackType = MOUNTAININCLINESTART;
|
||||
} else if (world.getBlockState(placementPos.relative(facing).relative(facing).above()).is(Objects.requireNonNull(BlockTags.getAllTags().getTag(new ResourceLocation("hals_steampowered", "flattrack"))))){
|
||||
} else if (world.getBlockState(placementPos.relative(facing).relative(facing).above()).is(Objects.requireNonNull(BlockTags.getAllTags().getTag(new ResourceLocation("hals_steampowered", "flattrack"))))
|
||||
& world.getBlockState(placementPos.relative(facing)).getMaterial().isReplaceable()){
|
||||
trackType = MOUNTAININCLINEEND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,14 @@ package net.halbear.steampowered.registry.utility;
|
||||
import net.halbear.steampowered.HalsSteampowered;
|
||||
import net.halbear.steampowered.registry.blocks.ModBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.settings.PointOfView;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.halbear.steampowered.registry.utility.mixin;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.settings.PointOfView;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ActiveRenderInfo.class)
|
||||
public abstract class CameraMixin {
|
||||
|
||||
@Inject(method = "setup", at = @At(value = "TAIL"),cancellable = true)
|
||||
private void setup(IBlockReader currentRenderedLevel, Entity entity, boolean isDetached, boolean isMirrored, float partialTicks, CallbackInfo ci){
|
||||
|
||||
//if(entity.isPassenger() && Minecraft.getInstance().options.getCameraType() != PointOfView.FIRST_PERSON){ //this was test code to make sure it works, it does work
|
||||
//this.move(-this.getMaxZoom(8.0D), 1.0D, 0.0D);
|
||||
//}
|
||||
}
|
||||
@Shadow protected abstract void move(double p_216782_1_, double p_216782_3_, double p_216782_5_);
|
||||
@Shadow protected abstract double getMaxZoom(double p_216779_1_);
|
||||
}
|
||||
@@ -15,8 +15,4 @@ public class Steam_Alice_040 extends AbstractTrainLocomotiveEntity {
|
||||
super(EntityType, World);
|
||||
}
|
||||
|
||||
/*public static AttributeModifierMap.MutableAttribute setCustomAttributes(){
|
||||
return MobEntity.createLivingAttributes()
|
||||
.add(Attributes.MAX_HEALTH,20.0D);
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.halbear.steampowered.trains;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Steam_USA_narrow_shunter_040 extends AbstractTrainLocomotiveEntity {
|
||||
|
||||
public Steam_USA_narrow_shunter_040(EntityType<?> EntityType, World World) {
|
||||
super(EntityType, World);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.halbear.steampowered.trains;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Steam_Welsh_Mountain_060 extends AbstractTrainLocomotiveEntity {
|
||||
|
||||
public Steam_Welsh_Mountain_060(EntityType<?> EntityType, World World) {
|
||||
super(EntityType, World);
|
||||
}
|
||||
|
||||
}
|
||||
12
src/main/resources/hals_steampowered.mixin.json
Normal file
12
src/main/resources/hals_steampowered.mixin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "net.halbear.steampowered.registry.utility.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"client": [
|
||||
"CameraMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"refmap": "hals_steampowered.mixin-refmap.json"
|
||||
}
|
||||
Reference in New Issue
Block a user