初次提交,完成伐木的工作
This commit is contained in:
118
.gitignore
vendored
Normal file
118
.gitignore
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
# User-specific stuff
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
Thumbs.db:encryptable
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
**/build/
|
||||||
|
|
||||||
|
# Common working directory
|
||||||
|
run/
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2025
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
211
build.gradle
Normal file
211
build.gradle
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
|
||||||
|
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'eclipse'
|
||||||
|
id 'idea'
|
||||||
|
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'org.spongepowered.mixin'
|
||||||
|
|
||||||
|
group = mod_group_id
|
||||||
|
version = mod_version
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
}
|
||||||
|
|
||||||
|
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://parchmentmc.org/docs/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'
|
||||||
|
|
||||||
|
|
||||||
|
jvmArg "-XX:+AllowEnhancedClassRedefinition"
|
||||||
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||||
|
property 'forge.enabledGameTestNamespaces', mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
property 'forge.enabledGameTestNamespaces', mod_id
|
||||||
|
args '--nogui'
|
||||||
|
}
|
||||||
|
|
||||||
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||||
|
// By default, the server will crash when no gametests are provided.
|
||||||
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||||
|
gameTestServer {
|
||||||
|
property 'forge.enabledGameTestNamespaces', mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
data {
|
||||||
|
// example of overriding the workingDirectory set in configureEach above
|
||||||
|
workingDirectory project.file('run-data')
|
||||||
|
|
||||||
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||||
|
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mixin {
|
||||||
|
add sourceSets.main, "${mod_id}.refmap.json"
|
||||||
|
|
||||||
|
config "${mod_id}.mixins.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include resources generated by data generators.
|
||||||
|
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.
|
||||||
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
||||||
|
// flatDir {
|
||||||
|
// dir 'libs'
|
||||||
|
// }
|
||||||
|
maven {
|
||||||
|
url "https://cursemaven.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Specify the version of Minecraft to use.
|
||||||
|
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
|
||||||
|
// The "userdev" classifier will be requested and setup by ForgeGradle.
|
||||||
|
// 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}"
|
||||||
|
|
||||||
|
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
|
||||||
|
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||||
|
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
|
||||||
|
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
|
||||||
|
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
|
||||||
|
|
||||||
|
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||||
|
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||||
|
// The group id is ignored when searching -- in this case, it is "blank"
|
||||||
|
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
|
||||||
|
|
||||||
|
// For more info:
|
||||||
|
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||||
|
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||||
|
|
||||||
|
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||||
|
compileOnly fg.deobf("curse.maven:touhou-little-maid-355044:6440955")
|
||||||
|
runtimeOnly fg.deobf("curse.maven:touhou-little-maid-355044:6440955")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
|
tasks.named('processResources', ProcessResources).configure {
|
||||||
|
var replaceProperties = [
|
||||||
|
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||||
|
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||||
|
loader_version_range: loader_version_range,
|
||||||
|
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||||
|
mod_authors: mod_authors, mod_description: mod_description,
|
||||||
|
]
|
||||||
|
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
|
||||||
|
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||||
|
expand replaceProperties + [project: project]
|
||||||
|
}}
|
||||||
|
|
||||||
|
// Example for how to get properties into the manifest for reading at runtime.
|
||||||
|
tasks.named('jar', Jar).configure {
|
||||||
|
manifest {
|
||||||
|
attributes([
|
||||||
|
"Specification-Title" : mod_id,
|
||||||
|
"Specification-Vendor" : mod_authors,
|
||||||
|
"Specification-Version" : "1", // We are version 1 of ourselves
|
||||||
|
"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")
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the preferred method to reobfuscate your jar file
|
||||||
|
finalizedBy 'reobfJar'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||||
|
}
|
||||||
53
gradle.properties
Normal file
53
gradle.properties
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx3G
|
||||||
|
org.gradle.daemon=false
|
||||||
|
|
||||||
|
|
||||||
|
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||||
|
minecraft_version=1.20.1
|
||||||
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
|
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||||
|
# as they do not follow standard versioning conventions.
|
||||||
|
minecraft_version_range=[1.20.1,1.21)
|
||||||
|
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||||
|
forge_version=47.3.0
|
||||||
|
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||||
|
forge_version_range=[47,)
|
||||||
|
# The loader version range can only use the major version of Forge/FML as bounds
|
||||||
|
loader_version_range=[47,)
|
||||||
|
# The mapping channel to use for mappings.
|
||||||
|
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||||
|
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||||
|
#
|
||||||
|
# | 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 Minecraft Forge.
|
||||||
|
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
|
||||||
|
mapping_channel=official
|
||||||
|
# The mapping version to query from the mapping channel.
|
||||||
|
# This must match the format required by the mapping channel.
|
||||||
|
mapping_version=1.20.1
|
||||||
|
|
||||||
|
|
||||||
|
# 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=maid_useful_task
|
||||||
|
# The human-readable display name for the mod.
|
||||||
|
mod_name=maid useful task
|
||||||
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
|
mod_license=MIT
|
||||||
|
# The mod version. See https://semver.org/
|
||||||
|
mod_version=1.0.0
|
||||||
|
# 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=studio.fantasyit
|
||||||
|
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||||
|
mod_authors=
|
||||||
|
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||||
|
mod_description=
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
15
settings.gradle
Normal file
15
settings.gradle
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven {
|
||||||
|
name = 'MinecraftForge'
|
||||||
|
url = 'https://maven.minecraftforge.net/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = 'maid_useful_task'
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.world.food.FoodProperties;
|
||||||
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
|
import net.minecraft.world.item.CreativeModeTabs;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
import net.minecraft.world.level.material.MapColor;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
||||||
|
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||||
|
|
||||||
|
// The value here should match an entry in the META-INF/mods.toml file
|
||||||
|
@Mod(MaidUsefulTask.MODID)
|
||||||
|
public class MaidUsefulTask {
|
||||||
|
|
||||||
|
// Define mod id in a common place for everything to reference
|
||||||
|
public static final String MODID = "maid_useful_task";
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
public MaidUsefulTask() {
|
||||||
|
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
|
MemoryModuleRegistry.register(modEventBus);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.api.ILittleMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.api.LittleMaidExtension;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.api.entity.ai.IExtraMaidBrain;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.ExtraMaidBrainManager;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.task.TaskManager;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||||
|
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||||
|
import studio.fantasyit.maid_useful_task.task.MaidTreeTask;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@LittleMaidExtension
|
||||||
|
public class UsefulTaskExtension implements ILittleMaid {
|
||||||
|
@Override
|
||||||
|
public void addMaidTask(TaskManager manager) {
|
||||||
|
ILittleMaid.super.addMaidTask(manager);
|
||||||
|
manager.add(new MaidTreeTask());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addExtraMaidBrain(ExtraMaidBrainManager manager) {
|
||||||
|
manager.addExtraMaidBrain(new IExtraMaidBrain() {
|
||||||
|
@Override
|
||||||
|
public List<MemoryModuleType<?>> getExtraMemoryTypes() {
|
||||||
|
return List.of(
|
||||||
|
MemoryModuleRegistry.DESTROY_TARGET.get(),
|
||||||
|
MemoryModuleRegistry.PLACE_TARGET.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.behavior;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.init.InitEntities;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import studio.fantasyit.maid_useful_task.memory.BlockTargetMemory;
|
||||||
|
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||||
|
import studio.fantasyit.maid_useful_task.task.IMaidBlockDestroyTask;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.Conditions;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.WrappedMaidFakePlayer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DestoryBlockBehavior extends Behavior<EntityMaid> {
|
||||||
|
private IMaidBlockDestroyTask task;
|
||||||
|
|
||||||
|
public DestoryBlockBehavior() {
|
||||||
|
super(Map.of(
|
||||||
|
InitEntities.TARGET_POS.get(), MemoryStatus.VALUE_PRESENT,
|
||||||
|
MemoryModuleRegistry.DESTROY_TARGET.get(), MemoryStatus.VALUE_PRESENT
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkExtraStartConditions(@NotNull ServerLevel worldIn, @NotNull EntityMaid maid) {
|
||||||
|
return Conditions.hasReachedValidTargetOrReset(maid,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<BlockPos> blockPosSet = null;
|
||||||
|
int index = 0;
|
||||||
|
float destroyProgress = 0f;
|
||||||
|
BlockPos targetPos;
|
||||||
|
BlockState targetBlockState;
|
||||||
|
WrappedMaidFakePlayer fakePlayer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void start(ServerLevel p_22540_, @NotNull EntityMaid maid, long p_22542_) {
|
||||||
|
super.start(p_22540_, maid, p_22542_);
|
||||||
|
BlockTargetMemory blockTargetMemory = MemoryUtil.getDestroyTargetMemory(maid);
|
||||||
|
if (blockTargetMemory != null) {
|
||||||
|
blockPosSet = blockTargetMemory.getBlockPosSet();
|
||||||
|
blockPosSet.sort((o1, o2) -> (int) (o1.distSqr(maid.blockPosition()) - o2.distSqr(maid.blockPosition())));
|
||||||
|
}
|
||||||
|
index = 0;
|
||||||
|
task = (IMaidBlockDestroyTask) maid.getTask();
|
||||||
|
fakePlayer = WrappedMaidFakePlayer.get(maid);
|
||||||
|
targetPos = null;
|
||||||
|
targetBlockState = null;
|
||||||
|
maid.getNavigation().stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid p_22546_, long p_22547_) {
|
||||||
|
return (blockPosSet != null && index < blockPosSet.size()) || targetPos != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tick(@NotNull ServerLevel level, @NotNull EntityMaid maid, long p_22553_) {
|
||||||
|
if (!Conditions.stopAndCheckStopped(maid)) return;
|
||||||
|
if (targetPos != null) {
|
||||||
|
tickDestroyProgress(maid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (index < blockPosSet.size()) {
|
||||||
|
targetPos = blockPosSet.get(index++);
|
||||||
|
targetBlockState = level.getBlockState(targetPos);
|
||||||
|
if (!targetBlockState.isAir()) {
|
||||||
|
task.tryTakeOutToolForTarget(maid, targetPos);
|
||||||
|
if (task.canDestroyBlock(maid, targetPos)) {
|
||||||
|
destroyProgress = 0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
targetPos = null;
|
||||||
|
targetBlockState = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tickDestroyProgress(EntityMaid maid) {
|
||||||
|
float speed = fakePlayer.getMainHandItem().getDestroySpeed(targetBlockState) / fakePlayer.getDigSpeed(targetBlockState, targetPos) / 30;
|
||||||
|
MemoryUtil.setLookAt(maid, targetPos);
|
||||||
|
if (task.availableToGetDrop(maid, fakePlayer, targetPos, targetBlockState)) {
|
||||||
|
maid.swing(InteractionHand.MAIN_HAND);
|
||||||
|
destroyProgress += speed;
|
||||||
|
if (destroyProgress >= 1f) {
|
||||||
|
maid.getMainHandItem().hurt(1, maid.getRandom(), fakePlayer);
|
||||||
|
task.tryDestroyBlock(maid,targetPos);
|
||||||
|
destroyProgress = 0f;
|
||||||
|
targetPos = null;
|
||||||
|
targetBlockState = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
targetPos = null;
|
||||||
|
targetBlockState = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void stop(ServerLevel p_22548_, EntityMaid p_22549_, long p_22550_) {
|
||||||
|
super.stop(p_22548_, p_22549_, p_22550_);
|
||||||
|
MemoryUtil.clearDestroyTargetMemory(p_22549_);
|
||||||
|
MemoryUtil.clearTarget(p_22549_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean timedOut(long p_22537_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.behavior;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.task.MaidMoveToBlockTask;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.MaidPathFindingBFS;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.task.IMaidBlockDestroyTask;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DestoryBlockMoveBehavior extends MaidMoveToBlockTask {
|
||||||
|
private IMaidBlockDestroyTask task;
|
||||||
|
private MaidPathFindingBFS pathfindingBFS;
|
||||||
|
private BlockPos targetPos;
|
||||||
|
List<BlockPos> blockPosSet;
|
||||||
|
|
||||||
|
public DestoryBlockMoveBehavior() {
|
||||||
|
super(0.5f, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void start(@NotNull ServerLevel p_22540_, @NotNull EntityMaid maid, long p_22542_) {
|
||||||
|
super.start(p_22540_, maid, p_22542_);
|
||||||
|
task = (IMaidBlockDestroyTask) maid.getTask();
|
||||||
|
task.tryTakeOutTool(maid);
|
||||||
|
searchForDestination(p_22540_, maid);
|
||||||
|
@Nullable BlockPos target = MemoryUtil.getTargetPos(maid);
|
||||||
|
if (target != null && blockPosSet != null) {
|
||||||
|
blockPosSet.addAll(task.getTryDestroyBlockListBesidesStart(targetPos, target, maid));
|
||||||
|
MemoryUtil.setDestroyTargetMemory(maid, blockPosSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldMoveTo(@NotNull ServerLevel serverLevel, @NotNull EntityMaid entityMaid, @NotNull BlockPos blockPos) {
|
||||||
|
if (!task.shouldDestroyBlock(entityMaid, blockPos)) return false;
|
||||||
|
targetPos = blockPos.immutable();
|
||||||
|
if (blockPos instanceof BlockPos.MutableBlockPos mb) {
|
||||||
|
for (int dx = 0; dx < task.reachDistance(); dx = dx <= 0 ? 1 - dx : -dx) {
|
||||||
|
for (int dy = 0; dy < task.reachDistance(); dy = dy <= 0 ? 1 - dy : -dy) {
|
||||||
|
for (int dz = 0; dz < task.reachDistance(); dz = dz <= 0 ? 1 - dz : -dz) {
|
||||||
|
BlockPos pos = mb.offset(dx, dy, dz);
|
||||||
|
if (entityMaid.isWithinRestriction(pos) && pathfindingBFS.canPathReach(pos)) {
|
||||||
|
blockPosSet = task.toDestroyFromStanding(entityMaid, targetPos, pos);
|
||||||
|
if (blockPosSet != null) {
|
||||||
|
mb.set(pos);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
targetPos = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull MaidPathFindingBFS getOrCreateArrivalMap(@NotNull ServerLevel worldIn, @NotNull EntityMaid maid) {
|
||||||
|
this.pathfindingBFS = super.getOrCreateArrivalMap(worldIn, maid);
|
||||||
|
return this.pathfindingBFS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.behavior;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.init.InitEntities;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||||
|
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||||
|
import studio.fantasyit.maid_useful_task.task.IMaidBlockPlaceTask;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.Conditions;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class PlaceBlockBehavior extends Behavior<EntityMaid> {
|
||||||
|
private BlockPos target;
|
||||||
|
|
||||||
|
public PlaceBlockBehavior() {
|
||||||
|
super(Map.of(MemoryModuleRegistry.PLACE_TARGET.get(), MemoryStatus.VALUE_PRESENT,
|
||||||
|
InitEntities.TARGET_POS.get(), MemoryStatus.VALUE_PRESENT
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkExtraStartConditions(ServerLevel p_22538_, EntityMaid p_22539_) {
|
||||||
|
return Conditions.hasReachedValidTargetOrReset(p_22539_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid p_22546_, long p_22547_) {
|
||||||
|
return target != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void start(ServerLevel p_22540_, EntityMaid maid, long p_22542_) {
|
||||||
|
super.start(p_22540_, maid, p_22542_);
|
||||||
|
target = MemoryUtil.getPlaceTarget(maid);
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
MemoryUtil.setLookAt(maid, target);
|
||||||
|
maid.getNavigation().stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tick(ServerLevel p_22551_, EntityMaid maid, long p_22553_) {
|
||||||
|
if (!Conditions.stopAndCheckStopped(maid)) return;
|
||||||
|
IMaidBlockPlaceTask task = (IMaidBlockPlaceTask) maid.getTask();
|
||||||
|
if (task.shouldPlacePos(maid, maid.getMainHandItem(), target)) {
|
||||||
|
maid.swing(InteractionHand.MAIN_HAND);
|
||||||
|
task.tryPlaceBlock(maid, maid.getMainHandItem(), target);
|
||||||
|
}
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void stop(ServerLevel p_22548_, EntityMaid p_22549_, long p_22550_) {
|
||||||
|
super.stop(p_22548_, p_22549_, p_22550_);
|
||||||
|
MemoryUtil.clearPlaceTarget(p_22549_);
|
||||||
|
MemoryUtil.clearTarget(p_22549_);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.behavior;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.task.MaidMoveToBlockTask;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.MaidPathFindingBFS;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.task.IMaidBlockPlaceTask;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PlaceBlockMoveBehavior extends MaidMoveToBlockTask {
|
||||||
|
private IMaidBlockPlaceTask task;
|
||||||
|
private MaidPathFindingBFS pathfindingBFS;
|
||||||
|
private BlockPos targetPos;
|
||||||
|
private ItemStack targetItem;
|
||||||
|
|
||||||
|
public PlaceBlockMoveBehavior() {
|
||||||
|
super(0.5f, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void start(ServerLevel p_22540_, EntityMaid maid, long p_22542_) {
|
||||||
|
super.start(p_22540_, maid, p_22542_);
|
||||||
|
task = (IMaidBlockPlaceTask) maid.getTask();
|
||||||
|
CombinedInvWrapper inv = maid.getAvailableInv(true);
|
||||||
|
List<ItemStack> markedVis = new ArrayList<>();
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
if (!task.shouldPlaceItemStack(maid, inv.getStackInSlot(i))) continue;
|
||||||
|
int finalI = i;
|
||||||
|
if (markedVis.stream().anyMatch(t -> ItemStack.isSameItem(t, inv.getStackInSlot(finalI)))) continue;
|
||||||
|
targetItem = inv.getStackInSlot(i);
|
||||||
|
searchForDestination(p_22540_, maid);
|
||||||
|
@Nullable BlockPos target = MemoryUtil.getTargetPos(maid);
|
||||||
|
if (target != null) {
|
||||||
|
MemoryUtil.setPlaceTarget(maid, targetPos);
|
||||||
|
inv.setStackInSlot(finalI, maid.getMainHandItem());
|
||||||
|
maid.setItemInHand(InteractionHand.MAIN_HAND, targetItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
markedVis.add(targetItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldMoveTo(ServerLevel serverLevel, EntityMaid entityMaid, BlockPos blockPos) {
|
||||||
|
if (!task.shouldPlacePos(entityMaid, targetItem, blockPos)) return false;
|
||||||
|
targetPos = blockPos.immutable();
|
||||||
|
if (blockPos instanceof BlockPos.MutableBlockPos mb) {
|
||||||
|
final int[] dv = {0, 1, -1};
|
||||||
|
for (int dx : dv) {
|
||||||
|
for (int dy : dv) {
|
||||||
|
for (int dz : dv) {
|
||||||
|
BlockPos pos = mb.offset(dx, dy, dz);
|
||||||
|
if (entityMaid.isWithinRestriction(pos) && pathfindingBFS.canPathReach(pos)) {
|
||||||
|
mb.set(pos);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
targetPos = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull MaidPathFindingBFS getOrCreateArrivalMap(@NotNull ServerLevel worldIn, @NotNull EntityMaid maid) {
|
||||||
|
this.pathfindingBFS = super.getOrCreateArrivalMap(worldIn, maid);
|
||||||
|
return this.pathfindingBFS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.memory;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class BlockTargetMemory {
|
||||||
|
public static final Codec<BlockTargetMemory> CODEC = RecordCodecBuilder.create(instance ->
|
||||||
|
instance.group(
|
||||||
|
BlockPos
|
||||||
|
.CODEC
|
||||||
|
.listOf()
|
||||||
|
.fieldOf("blockPosSet")
|
||||||
|
.forGetter(BlockTargetMemory::getBlockPosSet)
|
||||||
|
).apply(instance, BlockTargetMemory::new)
|
||||||
|
);
|
||||||
|
|
||||||
|
List<BlockPos> blockPosSet;
|
||||||
|
|
||||||
|
public BlockTargetMemory(List<BlockPos> blockPosSet) {
|
||||||
|
this.blockPosSet = blockPosSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockPos> getBlockPosSet() {
|
||||||
|
return blockPosSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlockPosSet(List<BlockPos> blockPosSet) {
|
||||||
|
this.blockPosSet = blockPosSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.mixin;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.task.MaidRunOne;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
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;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
|
|
||||||
|
@Mixin(MaidRunOne.class)
|
||||||
|
abstract public class MaidRunOneMixin {
|
||||||
|
@Inject(method = "tryStart(Lnet/minecraft/server/level/ServerLevel;Lcom/github/tartaricacid/touhoulittlemaid/entity/passive/EntityMaid;J)Z", at = @At("HEAD"), cancellable = true,remap = false)
|
||||||
|
public void runOne(ServerLevel pLevel, EntityMaid maid, long pGameTime, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (MemoryUtil.getDestroyTargetMemory(maid) != null || MemoryUtil.getPlaceTarget(maid) != null)
|
||||||
|
cir.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.registry;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||||
|
import studio.fantasyit.maid_useful_task.memory.BlockTargetMemory;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class MemoryModuleRegistry {
|
||||||
|
public static final DeferredRegister<MemoryModuleType<?>> REGISTER
|
||||||
|
= DeferredRegister.create(Registries.MEMORY_MODULE_TYPE, MaidUsefulTask.MODID);
|
||||||
|
public static final RegistryObject<MemoryModuleType<BlockTargetMemory>> DESTROY_TARGET
|
||||||
|
= REGISTER.register("block_targets", () -> new MemoryModuleType<>(Optional.of(BlockTargetMemory.CODEC)));
|
||||||
|
public static final RegistryObject<MemoryModuleType<BlockPos>> PLACE_TARGET
|
||||||
|
= REGISTER.register("place_target", () -> new MemoryModuleType<>(Optional.empty()));
|
||||||
|
|
||||||
|
public static void register(IEventBus eventBus) {
|
||||||
|
REGISTER.register(eventBus);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.task;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.mojang.datafixers.util.Pair;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
import net.minecraft.world.level.block.BaseFireBlock;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
|
import net.minecraft.world.level.material.FluidState;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.DestoryBlockBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.DestoryBlockMoveBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.WrappedMaidFakePlayer;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public interface IMaidBlockDestroyTask {
|
||||||
|
default @Nullable List<BlockPos> toDestroyFromStanding(EntityMaid maid, BlockPos targetPos, BlockPos standPos) {
|
||||||
|
List<BlockPos> list = new ArrayList<>();
|
||||||
|
Vec3 eyePos = standPos.getCenter().add(0, maid.getEyeHeight() - 0.5, 0);
|
||||||
|
Boolean available = BlockGetter.traverseBlocks(eyePos, targetPos.getCenter(), maid.level(), (level, pos) -> {
|
||||||
|
BlockState state = level.getBlockState(pos);
|
||||||
|
if (state.isAir()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (mayDestroy(maid, pos)) {
|
||||||
|
list.add(pos.immutable());
|
||||||
|
return null;
|
||||||
|
} else return false;
|
||||||
|
}, (a) -> true);
|
||||||
|
if (available) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取尝试破坏的方块列表。不包含起点列表
|
||||||
|
*
|
||||||
|
* @param startPos 开始位置
|
||||||
|
* @param maid 执行操作的女仆
|
||||||
|
* @return 相连的所有方块
|
||||||
|
*/
|
||||||
|
default List<BlockPos> getTryDestroyBlockListBesidesStart(BlockPos startPos, BlockPos standPos, EntityMaid maid) {
|
||||||
|
Set<BlockPos> marked = new HashSet<>();
|
||||||
|
Queue<BlockPos> queue = new LinkedList<>();
|
||||||
|
List<BlockPos> result = new ArrayList<>();
|
||||||
|
final int[] dv = {0, 1, -1};
|
||||||
|
final int maxDXZ = 2;
|
||||||
|
queue.add(startPos);
|
||||||
|
marked.add(startPos);
|
||||||
|
// C(9), O(N)
|
||||||
|
while (!queue.isEmpty()) {
|
||||||
|
BlockPos pos = queue.poll();
|
||||||
|
for (int dx : dv) {
|
||||||
|
for (int dy : dv) {
|
||||||
|
for (int dz : dv) {
|
||||||
|
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||||
|
BlockPos target = pos.offset(dx, dy, dz);
|
||||||
|
if (Math.abs(target.getX() - standPos.getX()) > maxDXZ || Math.abs(target.getZ() - standPos.getZ()) > maxDXZ)
|
||||||
|
continue;
|
||||||
|
if (target.distSqr(standPos) > reachDistance() * reachDistance()) continue;
|
||||||
|
if (marked.contains(target)) continue;
|
||||||
|
if (!shouldDestroyBlock(maid, target)) continue;
|
||||||
|
List<BlockPos> targetList = toDestroyFromStanding(maid, target, standPos);
|
||||||
|
if (targetList == null) continue;
|
||||||
|
marked.add(target);
|
||||||
|
result.addAll(targetList);
|
||||||
|
queue.add(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 女仆是否想要破坏这个方块,需要判断工具符合等,将用于寻路判断
|
||||||
|
*
|
||||||
|
* @param maid 女仆
|
||||||
|
* @param pos 目标位置
|
||||||
|
* @return 是否想要破坏
|
||||||
|
*/
|
||||||
|
boolean shouldDestroyBlock(EntityMaid maid, BlockPos pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 女仆是否可以破坏这个方块,光线投射确定女仆的挖掘地点
|
||||||
|
*
|
||||||
|
* @param maid
|
||||||
|
* @param pos
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean mayDestroy(EntityMaid maid, BlockPos pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 女仆是否可以破坏这个方块,用于进行破坏前检查
|
||||||
|
*
|
||||||
|
* @param maid 女仆
|
||||||
|
* @param pos 位置
|
||||||
|
* @return 是否可以破坏
|
||||||
|
*/
|
||||||
|
default boolean canDestroyBlock(EntityMaid maid, BlockPos pos) {
|
||||||
|
if (maid.distanceToSqr(pos.getCenter()) > Math.pow(reachDistance(), 2)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尝试破坏方块
|
||||||
|
*
|
||||||
|
* @param maid 女仆
|
||||||
|
* @param blockPos 位置
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default boolean tryDestroyBlock(EntityMaid maid, BlockPos blockPos) {
|
||||||
|
ServerLevel level = (ServerLevel) maid.level();
|
||||||
|
BlockState blockState = level.getBlockState(blockPos);
|
||||||
|
if (blockState.isAir()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
FluidState fluidState = level.getFluidState(blockPos);
|
||||||
|
if (!(blockState.getBlock() instanceof BaseFireBlock)) {
|
||||||
|
level.levelEvent(2001, blockPos, Block.getId(blockState));
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockEntity blockEntity = blockState.hasBlockEntity() ? level.getBlockEntity(blockPos) : null;
|
||||||
|
//改用MainHandItem来roll loot
|
||||||
|
maid.dropResourcesToMaidInv(blockState, level, blockPos, blockEntity, maid, maid.getMainHandItem());
|
||||||
|
|
||||||
|
boolean setResult = level.setBlock(blockPos, fluidState.createLegacyBlock(), 3);
|
||||||
|
if (setResult) {
|
||||||
|
level.gameEvent(GameEvent.BLOCK_DESTROY, blockPos, GameEvent.Context.of(maid, blockState));
|
||||||
|
}
|
||||||
|
|
||||||
|
return setResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尝试拿取工具。如果没有工具什么都不需要操作,后续交给canDestroy和shouldDestroy判断
|
||||||
|
*
|
||||||
|
* @param maid
|
||||||
|
*/
|
||||||
|
default void tryTakeOutTool(EntityMaid maid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void tryTakeOutToolForTarget(EntityMaid maid, BlockPos pos) {
|
||||||
|
tryTakeOutTool(maid);
|
||||||
|
}
|
||||||
|
|
||||||
|
default boolean availableToGetDrop(EntityMaid maid, WrappedMaidFakePlayer fakePlayer, BlockPos pos, BlockState targetBlockState) {
|
||||||
|
return fakePlayer.hasCorrectToolForDrops(targetBlockState);
|
||||||
|
}
|
||||||
|
|
||||||
|
default int reachDistance() {
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(@NotNull EntityMaid entityMaid) {
|
||||||
|
return List.of(
|
||||||
|
Pair.of(5, new DestoryBlockBehavior()),
|
||||||
|
Pair.of(4, new DestoryBlockMoveBehavior())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.task;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.mojang.datafixers.util.Pair;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.InteractionResult;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
|
import net.minecraft.world.level.ClipContext;
|
||||||
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.DestoryBlockBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.DestoryBlockMoveBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.WrappedMaidFakePlayer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IMaidBlockPlaceTask {
|
||||||
|
boolean shouldPlaceItemStack(EntityMaid maid, ItemStack itemStack);
|
||||||
|
|
||||||
|
boolean shouldPlacePos(EntityMaid maid, ItemStack itemStack, BlockPos pos);
|
||||||
|
|
||||||
|
default boolean tryPlaceBlock(EntityMaid maid, ItemStack itemStack, BlockPos pos){
|
||||||
|
Player fakePlayer = WrappedMaidFakePlayer.get(maid);
|
||||||
|
BlockHitResult result = null;
|
||||||
|
ClipContext rayTraceContext = new ClipContext(maid.getPosition(0).add(0, maid.getEyeHeight(), 0),
|
||||||
|
pos.getCenter(),
|
||||||
|
ClipContext.Block.OUTLINE,
|
||||||
|
ClipContext.Fluid.NONE,
|
||||||
|
fakePlayer);
|
||||||
|
result = maid.level().clip(rayTraceContext);
|
||||||
|
UseOnContext useContext = new UseOnContext(fakePlayer, InteractionHand.MAIN_HAND, result);
|
||||||
|
InteractionResult actionresult = fakePlayer.getItemInHand(InteractionHand.MAIN_HAND).onItemUseFirst(useContext);
|
||||||
|
if (actionresult == InteractionResult.PASS) {
|
||||||
|
InteractionResult interactionResult = fakePlayer.getItemInHand(InteractionHand.MAIN_HAND).useOn(useContext);
|
||||||
|
if (interactionResult.consumesAction()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default @NotNull List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(@NotNull EntityMaid entityMaid) {
|
||||||
|
return List.of(
|
||||||
|
Pair.of(5, new DestoryBlockBehavior()),
|
||||||
|
Pair.of(4, new DestoryBlockMoveBehavior())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.task;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.mojang.datafixers.util.Pair;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.level.block.LeavesBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.DestoryBlockBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.DestoryBlockMoveBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.PlaceBlockBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.PlaceBlockMoveBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.WrappedMaidFakePlayer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockDestroyTask {
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getUid() {
|
||||||
|
return new ResourceLocation(MaidUsefulTask.MODID, "maid_tree");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getIcon() {
|
||||||
|
return Items.OAK_SAPLING.getDefaultInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean enableLookAndRandomWalk(EntityMaid maid) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public SoundEvent getAmbientSound(EntityMaid entityMaid) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldDestroyBlock(EntityMaid maid, BlockPos pos) {
|
||||||
|
BlockState blockState = maid.level().getBlockState(pos);
|
||||||
|
return blockState.is(BlockTags.LOGS) && isValidNatureTree(maid, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mayDestroy(EntityMaid maid, BlockPos pos) {
|
||||||
|
BlockState blockState = maid.level().getBlockState(pos);
|
||||||
|
if (blockState.is(BlockTags.LEAVES)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return blockState.is(BlockTags.LOGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPlaceItemStack(EntityMaid maid, ItemStack itemStack) {
|
||||||
|
return itemStack.is(ItemTags.SAPLINGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPlacePos(EntityMaid maid, ItemStack itemStack, BlockPos pos) {
|
||||||
|
ServerLevel level = (ServerLevel) maid.level();
|
||||||
|
if(!level.getBlockState(pos.below()).is(BlockTags.DIRT)) return false;
|
||||||
|
if (!level.getBlockState(pos).canBeReplaced()) return false;
|
||||||
|
final int[] dv = {0, 1, -1, 2, -2};
|
||||||
|
for (int dx : dv) {
|
||||||
|
for (int dy = 0; dy < 4; dy++) {
|
||||||
|
for (int dz : dv) {
|
||||||
|
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||||
|
if (!level.getBlockState(pos.offset(dx, dy, dz)).canBeReplaced())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tryTakeOutTool(EntityMaid maid) {
|
||||||
|
CombinedInvWrapper inv = maid.getAvailableInv(true);
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
if (inv.getStackInSlot(i).is(ItemTags.AXES)) {
|
||||||
|
@NotNull ItemStack tmp = inv.getStackInSlot(i);
|
||||||
|
inv.setStackInSlot(i, maid.getMainHandItem());
|
||||||
|
maid.setItemInHand(InteractionHand.MAIN_HAND, tmp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swapShearsOrNone(EntityMaid maid) {
|
||||||
|
CombinedInvWrapper inv = maid.getAvailableInv(true);
|
||||||
|
int target = -1;
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
if (inv.getStackInSlot(i).is(Items.SHEARS)) {
|
||||||
|
target = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!inv.getStackInSlot(i).isDamageableItem()) {
|
||||||
|
target = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (target != -1) {
|
||||||
|
@NotNull ItemStack tmp = inv.getStackInSlot(target);
|
||||||
|
inv.setStackInSlot(target, maid.getMainHandItem());
|
||||||
|
maid.setItemInHand(InteractionHand.MAIN_HAND, tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tryTakeOutToolForTarget(EntityMaid maid, BlockPos pos) {
|
||||||
|
if (maid.level().getBlockState(pos).is(BlockTags.LEAVES)) {
|
||||||
|
swapShearsOrNone(maid);
|
||||||
|
} else {
|
||||||
|
tryTakeOutTool(maid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean availableToGetDrop(EntityMaid maid, WrappedMaidFakePlayer fakePlayer, BlockPos pos, BlockState targetBlockState) {
|
||||||
|
if (targetBlockState.is(BlockTags.LEAVES))
|
||||||
|
return true;
|
||||||
|
return IMaidBlockDestroyTask.super.availableToGetDrop(maid, fakePlayer, pos, targetBlockState);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos) {
|
||||||
|
final int[] dv = {0, 1, -1};
|
||||||
|
for (int dx : dv) {
|
||||||
|
for (int dz : dv) {
|
||||||
|
for (int dy = 0; dy < 6; dy++) {
|
||||||
|
BlockState blockState = maid.level().getBlockState(startPos.offset(dx, dy, dz));
|
||||||
|
if (blockState.is(BlockTags.LEAVES) && !blockState.getValue(LeavesBlock.PERSISTENT)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(EntityMaid entityMaid) {
|
||||||
|
ArrayList<Pair<Integer, BehaviorControl<? super EntityMaid>>> list = new ArrayList<>();
|
||||||
|
|
||||||
|
list.add(Pair.of(5, new DestoryBlockBehavior()));
|
||||||
|
list.add(Pair.of(4, new DestoryBlockMoveBehavior()));
|
||||||
|
list.add(Pair.of(3, new PlaceBlockBehavior()));
|
||||||
|
list.add(Pair.of(2, new PlaceBlockMoveBehavior()));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.util;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.init.InitEntities;
|
||||||
|
import net.minecraft.world.entity.ai.Brain;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||||
|
import net.minecraft.world.entity.ai.memory.WalkTarget;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class Conditions {
|
||||||
|
public static boolean hasReachedValidTargetOrReset(EntityMaid maid){
|
||||||
|
return hasReachedValidTargetOrReset(maid, 2);
|
||||||
|
}
|
||||||
|
public static boolean hasReachedValidTargetOrReset(EntityMaid maid, float closeEnough) {
|
||||||
|
Brain<EntityMaid> brain = maid.getBrain();
|
||||||
|
return brain.getMemory(InitEntities.TARGET_POS.get()).map(targetPos -> {
|
||||||
|
Vec3 targetV3d = targetPos.currentPosition();
|
||||||
|
if (maid.distanceToSqr(targetV3d) > Math.pow(closeEnough, 2)) {
|
||||||
|
Optional<WalkTarget> walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET);
|
||||||
|
if (walkTarget.isEmpty() || !walkTarget.get().getTarget().currentPosition().equals(targetV3d)) {
|
||||||
|
brain.eraseMemory(InitEntities.TARGET_POS.get());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).orElse(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean stopAndCheckStopped(EntityMaid maid) {
|
||||||
|
if (!maid.getNavigation().isDone()) {
|
||||||
|
maid.getNavigation().stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return maid.getDeltaMovement().length() < 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.util;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
|
import net.minecraftforge.items.wrapper.RangedWrapper;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
public class MaidUtils {
|
||||||
|
public static void swapToHand(EntityMaid maid, Predicate<ItemStack> isSuitable) {
|
||||||
|
RangedWrapper availableBackpackInv = maid.getAvailableBackpackInv();
|
||||||
|
for (int i = 0; i < availableBackpackInv.getSlots(); i++) {
|
||||||
|
ItemStack itemStack = availableBackpackInv.getStackInSlot(i);
|
||||||
|
if (isSuitable.test(itemStack)) {
|
||||||
|
ItemStack tmp = availableBackpackInv.getStackInSlot(i);
|
||||||
|
availableBackpackInv.setStackInSlot(i, maid.getMainHandItem());
|
||||||
|
maid.setItemInHand(InteractionHand.MAIN_HAND, tmp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.util;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.init.InitEntities;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BlockPosTracker;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.PositionTracker;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.memory.BlockTargetMemory;
|
||||||
|
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class MemoryUtil {
|
||||||
|
public static @Nullable BlockTargetMemory getDestroyTargetMemory(EntityMaid maid) {
|
||||||
|
Optional<BlockTargetMemory> memory = maid.getBrain().getMemory(MemoryModuleRegistry.DESTROY_TARGET.get());
|
||||||
|
return memory.orElse(null);
|
||||||
|
}
|
||||||
|
public static void setDestroyTargetMemory(EntityMaid maid, List<BlockPos> blockPosSet) {
|
||||||
|
maid.getBrain().setMemory(MemoryModuleRegistry.DESTROY_TARGET.get(), new BlockTargetMemory(blockPosSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearDestroyTargetMemory(EntityMaid maid) {
|
||||||
|
maid.getBrain().eraseMemory(MemoryModuleRegistry.DESTROY_TARGET.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearTarget(EntityMaid maid) {
|
||||||
|
maid.getBrain().eraseMemory(InitEntities.TARGET_POS.get());
|
||||||
|
maid.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @Nullable BlockPos getTargetPos(EntityMaid maid) {
|
||||||
|
Optional<PositionTracker> memory = maid.getBrain().getMemory(InitEntities.TARGET_POS.get());
|
||||||
|
return memory.map(PositionTracker::currentBlockPosition).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @Nullable BlockPos getPlaceTarget(EntityMaid maid) {
|
||||||
|
Optional<BlockPos> memory = maid.getBrain().getMemory(MemoryModuleRegistry.PLACE_TARGET.get());
|
||||||
|
return memory.orElse(null);
|
||||||
|
}
|
||||||
|
public static void setPlaceTarget(EntityMaid maid, BlockPos blockPos) {
|
||||||
|
maid.getBrain().setMemory(MemoryModuleRegistry.PLACE_TARGET.get(), blockPos);
|
||||||
|
}
|
||||||
|
public static void clearPlaceTarget(EntityMaid maid) {
|
||||||
|
maid.getBrain().eraseMemory(MemoryModuleRegistry.PLACE_TARGET.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLookAt(EntityMaid maid, BlockPos pos) {
|
||||||
|
maid.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, new BlockPosTracker(pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.util;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.effect.MobEffect;
|
||||||
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
|
import net.minecraft.world.entity.HumanoidArm;
|
||||||
|
import net.minecraft.world.entity.RelativeMovement;
|
||||||
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.material.Fluid;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
public class WrappedMaidFakePlayer extends FakePlayer {
|
||||||
|
private static ConcurrentHashMap<UUID, WrappedMaidFakePlayer> cache = new ConcurrentHashMap<>();
|
||||||
|
private final EntityMaid maid;
|
||||||
|
|
||||||
|
public static WrappedMaidFakePlayer get(EntityMaid maid) {
|
||||||
|
if (cache.containsKey(maid.getUUID())) {
|
||||||
|
return cache.get(maid.getUUID());
|
||||||
|
} else {
|
||||||
|
WrappedMaidFakePlayer fakePlayer = new WrappedMaidFakePlayer(maid);
|
||||||
|
cache.put(maid.getUUID(), fakePlayer);
|
||||||
|
return fakePlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private WrappedMaidFakePlayer(EntityMaid maid) {
|
||||||
|
super((ServerLevel) maid.level(), new GameProfile(UUID.randomUUID(), maid.getName().getString()));
|
||||||
|
this.maid = maid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeEffect(MobEffect p_21196_) {
|
||||||
|
return maid.removeEffect(p_21196_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public MobEffectInstance removeEffectNoUpdate(@Nullable MobEffect p_21164_) {
|
||||||
|
return maid.removeEffectNoUpdate(p_21164_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeAllEffects() {
|
||||||
|
return maid.removeAllEffects();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addEffect(MobEffectInstance p_147208_, @Nullable Entity p_147209_) {
|
||||||
|
return maid.addEffect(p_147208_, p_147209_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeAffected(MobEffectInstance p_21197_) {
|
||||||
|
return maid.canBeAffected(p_21197_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceAddEffect(MobEffectInstance p_147216_, @Nullable Entity p_147217_) {
|
||||||
|
maid.forceAddEffect(p_147216_, p_147217_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public MobEffectInstance getEffect(MobEffect p_21125_) {
|
||||||
|
return maid.getEffect(p_21125_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<MobEffectInstance> getActiveEffects() {
|
||||||
|
return maid.getActiveEffects();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<MobEffect, MobEffectInstance> getActiveEffectsMap() {
|
||||||
|
return maid.getActiveEffectsMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasEffect(MobEffect p_21024_) {
|
||||||
|
return maid.hasEffect(p_21024_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getMainHandItem() {
|
||||||
|
if (maid == null) return ItemStack.EMPTY;
|
||||||
|
return maid.getMainHandItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemInHand(InteractionHand p_21009_, ItemStack p_21010_) {
|
||||||
|
maid.setItemInHand(p_21009_, p_21010_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemSlot(EquipmentSlot p_36161_, ItemStack p_36162_) {
|
||||||
|
maid.setItemSlot(p_36161_, p_36162_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemBySlot(EquipmentSlot p_36257_) {
|
||||||
|
if (maid == null) return ItemStack.EMPTY;
|
||||||
|
return maid.getItemBySlot(p_36257_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEyeInFluid(TagKey<Fluid> p_204030_) {
|
||||||
|
return maid.isEyeInFluid(p_204030_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onGround() {
|
||||||
|
return maid.onGround();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Level level() {
|
||||||
|
if (maid == null) return super.level();
|
||||||
|
return maid.level();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerLevel serverLevel() {
|
||||||
|
if (maid == null) return super.serverLevel();
|
||||||
|
return (ServerLevel) maid.level();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockPos blockPosition() {
|
||||||
|
if (maid == null) return BlockPos.ZERO;
|
||||||
|
return maid.blockPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 position() {
|
||||||
|
if (maid == null) return Vec3.ZERO;
|
||||||
|
return maid.position();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void teleportTo(double p_8969_, double p_8970_, double p_8971_) {
|
||||||
|
if (maid == null) return;
|
||||||
|
maid.teleportTo(p_8969_, p_8970_, p_8971_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean teleportTo(ServerLevel p_265564_, double p_265424_, double p_265680_, double p_265312_, Set<RelativeMovement> p_265192_, float p_265059_, float p_265266_) {
|
||||||
|
if (maid == null) return false;
|
||||||
|
return maid.teleportTo(p_265564_, p_265424_, p_265680_, p_265312_, p_265192_, p_265059_, p_265266_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void teleportRelative(double p_251611_, double p_248861_, double p_252266_) {
|
||||||
|
maid.teleportRelative(p_251611_, p_248861_, p_252266_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void moveTo(double p_9171_, double p_9172_, double p_9173_) {
|
||||||
|
if (maid == null) return;
|
||||||
|
maid.moveTo(p_9171_, p_9172_, p_9173_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkPos chunkPosition() {
|
||||||
|
return maid.chunkPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/main/resources/META-INF/accesstransformer.cfg
Normal file
1
src/main/resources/META-INF/accesstransformer.cfg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
public net.minecraft.world.level.BlockGetter m_151361_(Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/Vec3;Ljava/lang/Object;Ljava/util/function/BiFunction;Ljava/util/function/Function;)Ljava/lang/Object;
|
||||||
66
src/main/resources/META-INF/mods.toml
Normal file
66
src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# This is an example mods.toml file. It contains the data relating to the loading mods.
|
||||||
|
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
|
||||||
|
# The overall format is standard TOML format, v0.5.0.
|
||||||
|
# Note that there are a couple of TOML lists in this file.
|
||||||
|
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||||
|
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||||
|
modLoader="javafml" #mandatory
|
||||||
|
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||||
|
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||||
|
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||||
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
|
license="${mod_license}"
|
||||||
|
# A URL to refer people to when problems occur with this mod
|
||||||
|
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||||
|
# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN),
|
||||||
|
# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers.
|
||||||
|
#clientSideOnly=true #optional - defaults to false if absent
|
||||||
|
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||||
|
[[mods]] #mandatory
|
||||||
|
# The modid of the mod
|
||||||
|
modId="${mod_id}" #mandatory
|
||||||
|
# The version number of the mod
|
||||||
|
version="${mod_version}" #mandatory
|
||||||
|
# A display name for the mod
|
||||||
|
displayName="${mod_name}" #mandatory
|
||||||
|
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
||||||
|
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||||
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
|
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||||
|
# A file name (in the root of the mod JAR) containing a logo for display
|
||||||
|
#logoFile="maid_useful_task.png" #optional
|
||||||
|
# A text field displayed in the mod UI
|
||||||
|
#credits="Thanks for this example mod goes to Java" #optional
|
||||||
|
# A text field displayed in the mod UI
|
||||||
|
authors="${mod_authors}" #optional
|
||||||
|
# Display Test controls the display for your mod in the server connection screen
|
||||||
|
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||||
|
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||||
|
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||||
|
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||||
|
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||||
|
#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional)
|
||||||
|
|
||||||
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
|
description='''${mod_description}'''
|
||||||
|
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||||
|
[[dependencies."${mod_id}"]] #optional
|
||||||
|
# the modid of the dependency
|
||||||
|
modId="forge" #mandatory
|
||||||
|
# Does this dependency have to exist - if not, ordering below must be specified
|
||||||
|
mandatory=true #mandatory
|
||||||
|
# The version range of the dependency
|
||||||
|
versionRange="${forge_version_range}" #mandatory
|
||||||
|
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
||||||
|
# BEFORE - This mod is loaded BEFORE the dependency
|
||||||
|
# AFTER - This mod is loaded AFTER the dependency
|
||||||
|
ordering="NONE"
|
||||||
|
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||||
|
side="BOTH"# Here's another dependency
|
||||||
|
[[dependencies."${mod_id}"]]
|
||||||
|
modId="minecraft"
|
||||||
|
mandatory=true
|
||||||
|
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||||
|
versionRange="${minecraft_version_range}"
|
||||||
|
ordering="NONE"
|
||||||
|
side="BOTH"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"task.maid_useful_task.maid_tree": "Logging"
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"task.maid_useful_task.maid_tree": "伐木"
|
||||||
|
}
|
||||||
15
src/main/resources/maid_useful_task.mixins.json
Normal file
15
src/main/resources/maid_useful_task.mixins.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "studio.fantasyit.maid_useful_task.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"refmap": "maid_useful_task.refmap.json",
|
||||||
|
"mixins": [
|
||||||
|
"MaidRunOneMixin"
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/main/resources/pack.mcmeta
Normal file
7
src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"description": "maid_useful_task resources",
|
||||||
|
"pack_format": 26,
|
||||||
|
"forge:server_data_pack_format": 12
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user