
演示效果 演示效果 演示效果
build.gradle文件:build.gradle
plugins {
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.+'
//引入这个mixin依赖
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
}
version = "1.2.8-1.19"
group = "com.joy187.re8joymod"
archivesBaseName = "joy187"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
sourceSets.main.resources { srcDir 'src/generated/resources' }
//设置你的mixin源文件名称
mixin {
add sourceSets.main, "re8.refmap.json"
}
minecraft {
mappings channel: 'official', version: '1.19'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
runs {
client {
workingDirectory project.file('run')
property 'mixin.env.disableRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
//客户端中指定你资源包中的mixin文件
arg '-mixin.config=re8.mixins.json'
mods {
re8joymod {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'mixin.env.disableRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
//服务端中指定你资源包中的mixin文件
arg '-mixin.config=re8.mixins.json'
mods {
re8joymod {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'mixin.env.disableRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 're8joymod', '--all', '--output', file('src/generated/resources/')
//数据包中指定你资源包中的mixin文件
arg '-mixin.config=re8.mixins.json'
mods {
re8joymod {
source sourceSets.main
}
}
}
}
}
repositories {
mavenLocal()
maven {
url "https://www.cursemaven.com"
}
maven {
name "Progwml6 maven"
url "https://dvs1.progwml6.com/files/maven/"
}
maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
// maven {
// name "ModMaven"
// url "https://modmaven.k-4u.nl"
// }
maven {
name = "Curios API"
url = "https://maven.theillusivec4.top/"
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.19.2-43.1.1'
implementation fg.deobf('curse.maven:framework-549225:3873800')
implementation fg.deobf('curse.maven:mrcrayfishs-gun-mod-289479:3874034')
implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.19:3.1.36')
compileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.0.0.211")
compileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.0.0.211")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.19.2-5.1.1.0")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.19.2-5.1.1.0:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.211")
//这里引入mixin依赖
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
jar {
manifest {
attributes([
"Specification-Title": "Resident Evil 8 mod",
"Specification-Vendor": "Joy187",
"Specification-Version": "1",
"Implementation-Title": "Resident Evil 8 mod",
"Implementation-Version": project.version,
"Implementation-Vendor" : "Joy187",
//"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
//你资源包中的mixin配置文件
"MixinConfigs": "re8.mixins.json"
])
}
}
jar.finalizedBy('reobfJar')
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///X:/localmaven/mcmods"
}
}
}

"MixinConfigs"字段填写的名称一样:
re8.mixins.json
{
"required": true,
"package": "com.joy187.re8joymod.mixin",
"compatibilityLevel": "JAVA_8",
"minVersion": "0.8",
"refmap": "re8.refmap.json",
"plugin": "com.joy187.re8joymod.mixin.MixinPlugin", //注意这个地址
"mixins": [
],
"client": [
],
"injectors": {
"defaultRequire": 1
}
}
plugin地址,按照这个路径创建一个MixinPlugin文件,作为模组的mixin启动器:
MixinPlugin.java
package com.joy187.re8joymod.mixin;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import java.util.List;
import java.util.Set;
public class MixinPlugin implements IMixinConfigPlugin{
private boolean isFrameworkInstalled;
@Override
public void onLoad(String mixinPackage) {
try {
//这个字符串对应你的项目主类
Class.forName("com.joy187.re8joymod.Main", false, this.getClass().getClassLoader());
isFrameworkInstalled = true;
} catch (Exception e) {
isFrameworkInstalled = false;
}
}
@Override
public String getRefMapperConfig() {
return null;
}
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return isFrameworkInstalled; // this makes sure that forge's helpful mods not found screen shows up
}
@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
}
@Override
public List<String> getMixins() {
return null;
}
@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
}
LivingEntityMixin.json
package com.joy187.re8joymod.mixin;
import com.joy187.re8joymod.init.ItemInit;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stats;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin {
//这里我们将代码注入到checkTotemDeathProtection中,注入位置是其HEAD头部
@Inject(method = {"checkTotemDeathProtection"}, at = {@At("HEAD")}, cancellable = true)
private void checkTotemDeathProtection(DamageSource source, CallbackInfoReturnable<Boolean> info) {
LivingEntity livingEntity = ((LivingEntity)(Object)this);
if (livingEntity instanceof ServerPlayer player) {
ItemStack itemStack = null;
Inventory inventory = player.getInventory();
//在背包中找到我们的物品
for (int i = 0; i < inventory.getContainerSize(); i++) {
ItemStack stack = inventory.getItem(i);
if (stack.getItem().equals(ItemInit.BODYGUARD.get())) {
itemStack = stack;
break;
}
}
//如果找到了,当我们陷入濒死之时就会使用该物品并给予玩家一个15s的生命回复效果
if (itemStack != null) {
player.awardStat(Stats.ITEM_USED.get(ItemInit.BODYGUARD.get()));
CriteriaTriggers.USED_TOTEM.trigger(player, itemStack);
itemStack.shrink(1);
player.setHealth(10.0F);
player.removeAllEffects();
player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 300, 1));
player.level.broadcastEntityEvent(player, (byte) 35);
info.setReturnValue(true);
}
}
}
}
re8.mixins.json
{
"required": true,
"package": "com.joy187.re8joymod.mixin",
"compatibilityLevel": "JAVA_8",
"minVersion": "0.8",
"refmap": "re8.refmap.json",
"plugin": "com.joy187.re8joymod.mixin.MixinPlugin",
"mixins": [
"LivingEntityMixin" //放在这里
],
"client": [
],
"injectors": {
"defaultRequire": 1
}
}
ItemInit.java
public static final RegistryObject<Item> BODYGUARD = register("bodyguard",
() -> new Item(new Item.Properties().tab(Main.TUTORIAL_TAB)));
en_us.json
"item.re8joymod.bodyguard":"Crystal",
bodyguard.json
{
"parent": "item/generated",
"textures": {
"layer0": "re8joymod:item/bodyguard"
}
}

我正在编写一个包含C扩展的gem。通常当我写一个gem时,我会遵循TDD的过程,我会写一个失败的规范,然后处理代码直到它通过,等等......在“ext/mygem/mygem.c”中我的C扩展和在gemspec的“扩展”中配置的有效extconf.rb,如何运行我的规范并仍然加载我的C扩展?当我更改C代码时,我需要采取哪些步骤来重新编译代码?这可能是个愚蠢的问题,但是从我的gem的开发源代码树中输入“bundleinstall”不会构建任何native扩展。当我手动运行rubyext/mygem/extconf.rb时,我确实得到了一个Makefile(在整个项目的根目录中),然后当
我已经在Sinatra上创建了应用程序,它代表了一个简单的API。我想在生产和开发上进行部署。我想在部署时选择,是开发还是生产,一些方法的逻辑应该改变,这取决于部署类型。是否有任何想法,如何完成以及解决此问题的一些示例。例子:我有代码get'/api/test'doreturn"Itisdev"end但是在部署到生产环境之后我想在运行/api/test之后看到ItisPROD如何实现? 最佳答案 根据SinatraDocumentation:EnvironmentscanbesetthroughtheRACK_ENVenvironm
我们的git存储库中目前有一个Gemfile。但是,有一个gem我只在我的环境中本地使用(我的团队不使用它)。为了使用它,我必须将它添加到我们的Gemfile中,但每次我checkout到我们的master/dev主分支时,由于与跟踪的gemfile冲突,我必须删除它。我想要的是类似Gemfile.local的东西,它将继承从Gemfile导入的gems,但也允许在那里导入新的gems以供使用只有我的机器。此文件将在.gitignore中被忽略。这可能吗? 最佳答案 设置BUNDLE_GEMFILE环境变量:BUNDLE_GEMFI
这似乎非常适得其反,因为太多的gem会在window上破裂。我一直在处理很多mysql和ruby-mysqlgem问题(gem本身发生段错误,一个名为UnixSocket的类显然在Windows机器上不能正常工作,等等)。我只是在浪费时间吗?我应该转向不同的脚本语言吗? 最佳答案 我在Windows上使用Ruby的经验很少,但是当我开始使用Ruby时,我是在Windows上,我的总体印象是它不是Windows原生系统。因此,在主要使用Windows多年之后,开始使用Ruby促使我切换回原来的系统Unix,这次是Linux。Rub
我正在玩HTML5视频并且在ERB中有以下片段:mp4视频从在我的开发环境中运行的服务器很好地流式传输到chrome。然而firefox显示带有海报图像的视频播放器,但带有一个大X。问题似乎是mongrel不确定ogv扩展的mime类型,并且只返回text/plain,如curl所示:$curl-Ihttp://0.0.0.0:3000/pr6.ogvHTTP/1.1200OKConnection:closeDate:Mon,19Apr201012:33:50GMTLast-Modified:Sun,18Apr201012:46:07GMTContent-Type:text/plain
无论您是想搭建桌面端、WEB端或者移动端APP应用,HOOPSPlatform组件都可以为您提供弹性的3D集成架构,同时,由工业领域3D技术专家组成的HOOPS技术团队也能为您提供技术支持服务。如果您的客户期望有一种在多个平台(桌面/WEB/APP,而且某些客户端是“瘦”客户端)快速、方便地将数据接入到3D应用系统的解决方案,并且当访问数据时,在各个平台上的性能和用户体验保持一致,HOOPSPlatform将帮助您完成。利用HOOPSPlatform,您可以开发在任何环境下的3D基础应用架构。HOOPSPlatform可以帮您打造3D创新型产品,HOOPSSDK包含的技术有:快速且准确的CAD
在应用开发中,有时候我们需要获取系统的设备信息,用于数据上报和行为分析。那在鸿蒙系统中,我们应该怎么去获取设备的系统信息呢,比如说获取手机的系统版本号、手机的制造商、手机型号等数据。1、获取方式这里分为两种情况,一种是设备信息的获取,一种是系统信息的获取。1.1、获取设备信息获取设备信息,鸿蒙的SDK包为我们提供了DeviceInfo类,通过该类的一些静态方法,可以获取设备信息,DeviceInfo类的包路径为:ohos.system.DeviceInfo.具体的方法如下:ModifierandTypeMethodDescriptionstatic StringgetAbiList()Obt
运行bundleinstall后出现此错误:Gem::Package::FormatError:nometadatafoundin/Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gemAnerroroccurredwhileinstallinglibv8(3.11.8.13),andBundlercannotcontinue.Makesurethat`geminstalllibv8-v'3.11.8.13'`succeedsbeforebundling.我试试gemin
@作者:SYFStrive @博客首页:HomePage📜:微信小程序📌:个人社区(欢迎大佬们加入)👉:社区链接🔗📌:觉得文章不错可以点点关注👉:专栏连接🔗💃:感谢支持,学累了可以先看小段由小胖给大家带来的街舞👉微信小程序(🔥)目录自定义组件-behaviors 1、什么是behaviors 2、behaviors的工作方式 3、创建behavior 4、导入并使用behavior 5、behavior中所有可用的节点 6、同名字段的覆盖和组合规则总结最后自定义组件-behaviors 1、什么是behaviorsbehaviors是小程序中,用于实现
了解Rails缓存如何工作的人可以真正帮助我。这是嵌套在Rails::Initializer.runblock中的代码:config.after_initializedoSomeClass.const_set'SOME_CONST','SOME_VAL'end现在,如果我运行script/server并发出请求,一切都很好。然而,在我的Rails应用程序的第二个请求中,一切都因单元化常量错误而变得糟糕。在生产模式下,我可以成功发出第二个请求,这意味着常量仍然存在。我已通过将以上内容更改为以下内容来解决问题:config.after_initializedorequire'some_cl