mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-10-04 17:54:25 +02:00
everything but loot compiles
This commit is contained in:
parent
99dcd0f1ad
commit
6ab4634bfa
121 changed files with 771 additions and 678 deletions
276
build.gradle
276
build.gradle
|
@ -1,95 +1,133 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
|
||||
maven { url = 'https://maven.minecraftforge.net' }
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||
}
|
||||
plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '38.2'
|
||||
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'NaturesAura'
|
||||
|
||||
version = mod_version
|
||||
if (System.getenv('BUILD_NUMBER') != null) {
|
||||
version += "." + System.getenv('BUILD_NUMBER')
|
||||
}
|
||||
|
||||
group = mod_group_id
|
||||
|
||||
base {
|
||||
archivesName = mod_name
|
||||
}
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
minecraft {
|
||||
mappings channel: 'official', version: '1.19.2'
|
||||
// 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 {
|
||||
client {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
// 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', 'info'
|
||||
property 'mixin.env.disableRefMap', 'true'
|
||||
|
||||
mods {
|
||||
naturesaura {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client {
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
args '--nogui'
|
||||
}
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property 'forge.logging.console.level', 'info'
|
||||
property 'mixin.env.disableRefMap', 'true'
|
||||
|
||||
mods {
|
||||
naturesaura {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
// 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 {
|
||||
workingDirectory project.file('run')
|
||||
// example of overriding the workingDirectory set in configureEach above
|
||||
workingDirectory project.file('run-data')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property 'forge.logging.console.level', 'info'
|
||||
property 'mixin.env.disableRefMap', 'true'
|
||||
|
||||
args '--mod', 'naturesaura', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), '--existing', file('src/generated/resources')
|
||||
|
||||
mods {
|
||||
naturesaura {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
// 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/')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources {
|
||||
srcDir 'src/generated/resources'
|
||||
}
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
// 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'
|
||||
// }
|
||||
|
||||
// it says this gets included automatically but apparently it doesn't
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = "https://maven.blamejared.com"
|
||||
}
|
||||
|
@ -102,77 +140,83 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.19.2-43.2.0'
|
||||
// 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-${minecraft_version}-common-api:${jei_version}")
|
||||
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.19.2-common-api:11.5.0.297")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.19.2-forge:11.5.0.297")
|
||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")
|
||||
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")
|
||||
|
||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api")
|
||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")
|
||||
|
||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.19.2-77:api")
|
||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.19.2-77")
|
||||
// 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}")
|
||||
|
||||
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")
|
||||
|
||||
// TODO Enchantability
|
||||
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/
|
||||
// For more info:
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading by the runtime..
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : "naturesaura",
|
||||
"Specification-Vendor" : "Ellpeck",
|
||||
"Specification-Version" : "1", // We are version 1 of ourselves
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : "${version}",
|
||||
"Implementation-Vendor" : "Ellpeck",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
// 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: version,
|
||||
mod_authors : mod_authors, mod_description: mod_description,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from(sourceSets.main.output)
|
||||
archiveName = "${baseName}-${version}-deobf.${extension}"
|
||||
// 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'
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from(sourceSets.main.allSource)
|
||||
archiveName = "${baseName}-${version}-sources.${extension}"
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from(sourceSets.main.output)
|
||||
from(sourceSets.main.java)
|
||||
include("de/ellpeck/naturesaura/api/**")
|
||||
archiveName = "${baseName}-${version}-api.${extension}"
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives deobfJar
|
||||
archives sourcesJar
|
||||
archives apiJar
|
||||
}
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
|
||||
// tasks.named('publish').configure {
|
||||
// dependsOn 'reobfJar'
|
||||
// }
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId project.group
|
||||
artifactId project.archivesBaseName
|
||||
version project.version
|
||||
from components.java
|
||||
|
||||
artifact deobfJar {
|
||||
classifier 'deobf'
|
||||
}
|
||||
artifact sourcesJar {
|
||||
classifier 'sources'
|
||||
}
|
||||
artifact apiJar {
|
||||
classifier 'api'
|
||||
}
|
||||
|
||||
register('mavenJava', MavenPublication) {
|
||||
groupId mod_group_id
|
||||
artifactId mod_name
|
||||
artifact jar
|
||||
pom.withXml {
|
||||
def node = asNode()
|
||||
if (node.dependencies.size() > 0)
|
||||
|
@ -186,3 +230,7 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
|
|
@ -1,4 +1,57 @@
|
|||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.daemon=false
|
||||
## Environment Properties
|
||||
# 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.1.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
|
||||
jei_version=15.2.0.22
|
||||
curios_version=5.2.0-beta.3+1.20.1
|
||||
patchouli_version=1.20.1-80-FORGE-SNAPSHOT
|
||||
|
||||
## Mod Properties
|
||||
# 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=naturesaura
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=NaturesAura
|
||||
# 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=38.2
|
||||
# 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=de.ellpeck.naturesaura
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=Ellpeck
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Nature's Aura is a Minecraft mod about collecting, using and replenishing the Aura naturally present in the world to create useful devices and unique mechanics.
|
||||
|
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
13
settings.gradle
Normal file
13
settings.gradle
Normal file
|
@ -0,0 +1,13 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||
}
|
|
@ -13,6 +13,7 @@ import de.ellpeck.naturesaura.misc.LevelData;
|
|||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -117,22 +118,19 @@ public final class Helper {
|
|||
}
|
||||
|
||||
public static boolean areItemsEqual(ItemStack first, ItemStack second, boolean nbt) {
|
||||
if (!ItemStack.isSame(first, second))
|
||||
return false;
|
||||
return !nbt || ItemStack.tagMatches(first, second);
|
||||
// TODO see if this is the correct new comparison method?
|
||||
return nbt ? ItemStack.isSameItemSameTags(first, second) : ItemStack.isSameItem(first, second);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderItemInGui(ItemStack stack, int x, int y, float scale) {
|
||||
var poseStack = RenderSystem.getModelViewStack();
|
||||
public static void renderItemInGui(GuiGraphics graphics, ItemStack stack, int x, int y, float scale) {
|
||||
var poseStack = graphics.pose();
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(x, y, 0);
|
||||
poseStack.scale(scale, scale, scale);
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(stack, 0, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null);
|
||||
graphics.renderItem(stack, 0, 0);
|
||||
graphics.renderItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null);
|
||||
poseStack.popPose();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
@ -164,18 +162,18 @@ public final class Helper {
|
|||
}
|
||||
|
||||
public static InteractionResult putStackOnTile(Player player, InteractionHand hand, BlockPos pos, int slot, boolean sound) {
|
||||
var tile = player.level.getBlockEntity(pos);
|
||||
var tile = player.level().getBlockEntity(pos);
|
||||
if (tile instanceof BlockEntityImpl) {
|
||||
var handler = ((BlockEntityImpl) tile).getItemHandler();
|
||||
if (handler != null) {
|
||||
var handStack = player.getItemInHand(hand);
|
||||
if (!handStack.isEmpty()) {
|
||||
var remain = handler.insertItem(slot, handStack, player.level.isClientSide);
|
||||
var remain = handler.insertItem(slot, handStack, player.level().isClientSide);
|
||||
if (!ItemStack.matches(remain, handStack)) {
|
||||
if (sound)
|
||||
player.level.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
player.level().playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||
if (!player.level.isClientSide)
|
||||
if (!player.level().isClientSide)
|
||||
player.setItemInHand(hand, remain);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
@ -183,13 +181,13 @@ public final class Helper {
|
|||
|
||||
if (!handler.getStackInSlot(slot).isEmpty()) {
|
||||
if (sound)
|
||||
player.level.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
player.level().playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ITEM_FRAME_REMOVE_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||
if (!player.level.isClientSide) {
|
||||
if (!player.level().isClientSide) {
|
||||
var stack = handler.getStackInSlot(slot);
|
||||
if (!player.addItem(stack)) {
|
||||
var item = new ItemEntity(player.level, player.getX(), player.getY(), player.getZ(), stack);
|
||||
player.level.addFreshEntity(item);
|
||||
var item = new ItemEntity(player.level(), player.getX(), player.getY(), player.getZ(), stack);
|
||||
player.level().addFreshEntity(item);
|
||||
}
|
||||
handler.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
}
|
||||
|
@ -260,7 +258,7 @@ public final class Helper {
|
|||
public static void addAdvancement(Player player, ResourceLocation advancement, String criterion) {
|
||||
if (!(player instanceof ServerPlayer playerMp))
|
||||
return;
|
||||
var adv = playerMp.getLevel().getServer().getAdvancements().getAdvancement(advancement);
|
||||
var adv = playerMp.level().getServer().getAdvancements().getAdvancement(advancement);
|
||||
if (adv != null)
|
||||
playerMp.getAdvancements().award(adv, criterion);
|
||||
}
|
||||
|
@ -372,7 +370,7 @@ public final class Helper {
|
|||
return false;
|
||||
var disabled = !Helper.isToolEnabled(stack);
|
||||
stack.getOrCreateTag().putBoolean(NaturesAura.MOD_ID + ":disabled", !disabled);
|
||||
player.level.playSound(null, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.65F, 1F);
|
||||
player.level().playSound(null, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.65F, 1F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,13 @@ public final class NaturesAura {
|
|||
public static final String MOD_NAME = "Nature's Aura";
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(NaturesAura.MOD_NAME);
|
||||
public static final CreativeModeTab CREATIVE_TAB = new CreativeModeTab(NaturesAura.MOD_ID) {
|
||||
// TODO creative tab
|
||||
/* public static final CreativeModeTab CREATIVE_TAB = new CreativeModeTab(NaturesAura.MOD_ID) {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(ModItems.GOLD_LEAF);
|
||||
}
|
||||
};
|
||||
};*/
|
||||
public static NaturesAura instance;
|
||||
// this causes a classloading issue if it's not wrapped like this
|
||||
@SuppressWarnings("Convert2MethodRef")
|
||||
|
|
|
@ -16,8 +16,7 @@ import net.minecraft.world.level.block.LeavesBlock;
|
|||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -25,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
public class BlockAncientLeaves extends LeavesBlock implements IModItem, IColorProvidingBlock, IColorProvidingItem, ICustomBlockState, EntityBlock {
|
||||
|
||||
public BlockAncientLeaves() {
|
||||
super(Block.Properties.of(Material.LEAVES, MaterialColor.COLOR_PINK).strength(0.2F).randomTicks().noOcclusion().sound(SoundType.GRASS));
|
||||
super(Block.Properties.of().mapColor(MapColor.COLOR_PINK).strength(0.2F).randomTicks().noOcclusion().sound(SoundType.GRASS));
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityAncientLeaves::new, this));
|
||||
}
|
||||
|
|
|
@ -6,15 +6,14 @@ import de.ellpeck.naturesaura.reg.IModItem;
|
|||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.world.level.block.RotatedPillarBlock;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
|
||||
public class BlockAncientLog extends RotatedPillarBlock implements IModItem, ICustomBlockState {
|
||||
|
||||
private final String baseName;
|
||||
|
||||
public BlockAncientLog(String baseName) {
|
||||
super(Properties.of(Material.WOOD, MaterialColor.COLOR_PURPLE).strength(2.0F).sound(SoundType.WOOD));
|
||||
super(Properties.of().mapColor(MapColor.COLOR_PURPLE).strength(2.0F).sound(SoundType.WOOD));
|
||||
this.baseName = baseName;
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
@ -26,7 +26,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
|||
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
|
||||
|
||||
public BlockAncientSapling() {
|
||||
super(Properties.of(Material.GRASS).strength(0.0F).sound(SoundType.GRASS));
|
||||
super(Properties.of().strength(0.0F).sound(SoundType.GRASS));
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidBonemealTarget(BlockGetter level, BlockPos pos, BlockState state, boolean b) {
|
||||
public boolean isValidBonemealTarget(LevelReader p_256559_, BlockPos p_50898_, BlockState p_50899_, boolean p_50900_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -85,4 +85,4 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
|||
public void generateCustomItemModel(ItemModelGenerator generator) {
|
||||
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.world.entity.animal.Animal;
|
|||
import net.minecraft.world.entity.npc.Npc;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -28,7 +27,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|||
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
public BlockAnimalGenerator() {
|
||||
super("animal_generator", BlockEntityAnimalGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
||||
super("animal_generator", BlockEntityAnimalGenerator.class, Properties.of().strength(3F).sound(SoundType.STONE));
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
@ -36,7 +35,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingEvent.LivingTickEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (entity.level.isClientSide || entity.level.getGameTime() % 40 != 0 || !(entity instanceof Animal) || entity instanceof Npc)
|
||||
if (entity.level().isClientSide || entity.level().getGameTime() % 40 != 0 || !(entity instanceof Animal) || entity instanceof Npc)
|
||||
return;
|
||||
var data = entity.getPersistentData();
|
||||
var timeAlive = data.getInt(NaturesAura.MOD_ID + ":time_alive");
|
||||
|
@ -46,10 +45,10 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
@SubscribeEvent
|
||||
public void onEntityDeath(LivingDeathEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (entity.level.isClientSide || !(entity instanceof Animal) || entity instanceof Npc)
|
||||
if (entity.level().isClientSide || !(entity instanceof Animal) || entity instanceof Npc)
|
||||
return;
|
||||
var pos = entity.blockPosition();
|
||||
Helper.getBlockEntitiesInArea(entity.level, pos, 5, tile -> {
|
||||
Helper.getBlockEntitiesInArea(entity.level(), pos, 5, tile -> {
|
||||
if (!(tile instanceof BlockEntityAnimalGenerator gen))
|
||||
return false;
|
||||
|
||||
|
@ -71,7 +70,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
gen.setGenerationValues(time, amount);
|
||||
|
||||
var genPos = gen.getBlockPos();
|
||||
PacketHandler.sendToAllAround(entity.level, pos, 32, new PacketParticles(
|
||||
PacketHandler.sendToAllAround(entity.level(), pos, 32, new PacketParticles(
|
||||
(float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), PacketParticles.Type.ANIMAL_GEN_CONSUME,
|
||||
child ? 1 : 0,
|
||||
(int) (entity.getEyeHeight() * 10F),
|
||||
|
@ -114,4 +113,4 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,10 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAnimalSpawner;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockAnimalSpawner extends BlockContainerImpl {
|
||||
|
||||
public BlockAnimalSpawner() {
|
||||
super("animal_spawner", BlockEntityAnimalSpawner.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||
super("animal_spawner", BlockEntityAnimalSpawner.class, Properties.of().strength(2F).sound(SoundType.STONE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
|||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -23,7 +22,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -37,7 +35,7 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
|
|||
private final Block[] allowedGround;
|
||||
|
||||
public BlockAuraBloom(String baseName, Block... allowedGround) {
|
||||
super(Properties.of(Material.PLANT).noCollission().strength(0).sound(SoundType.GRASS));
|
||||
super(Properties.of().noCollission().strength(0).sound(SoundType.GRASS));
|
||||
this.baseName = baseName;
|
||||
this.allowedGround = allowedGround;
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
|
@ -58,7 +56,7 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
|
|||
@SuppressWarnings("deprecation")
|
||||
public void entityInside(BlockState state, Level levelIn, BlockPos pos, Entity entityIn) {
|
||||
if (this == ModBlocks.AURA_CACTUS)
|
||||
entityIn.hurt(DamageSource.CACTUS, 1);
|
||||
entityIn.hurt(entityIn.damageSources().cactus(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,12 +5,11 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockAuraDetector extends BlockContainerImpl {
|
||||
|
||||
public BlockAuraDetector() {
|
||||
super("aura_detector", BlockEntityAuraDetector.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||
super("aura_detector", BlockEntityAuraDetector.class, Properties.of().strength(2F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,14 +10,13 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlockState {
|
||||
|
||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
public BlockAutoCrafter() {
|
||||
super("auto_crafter", BlockEntityAutoCrafter.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
|
||||
super("auto_crafter", BlockEntityAutoCrafter.class, Properties.of().strength(1.5F).sound(SoundType.WOOD));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
@ -27,7 +26,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
|||
private static final VoxelShape SHAPE = Block.box(4, 4, 4, 12, 12, 12);
|
||||
|
||||
public BlockChunkLoader() {
|
||||
super("chunk_loader", BlockEntityChunkLoader.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
||||
super("chunk_loader", BlockEntityChunkLoader.class, Properties.of().strength(3F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.world.level.block.state.StateDefinition;
|
|||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -113,7 +113,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
|
||||
var drops = super.getDrops(state, builder);
|
||||
|
||||
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
||||
|
@ -176,8 +176,9 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
|||
private BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
try {
|
||||
return this.tileClass.getConstructor(BlockPos.class, BlockState.class).newInstance(pos, state);
|
||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException |
|
||||
NoSuchMethodException e) {
|
||||
throw new IllegalStateException("Cannot construct block entity from class " + this.tileClass, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,11 @@ import net.minecraft.util.RandomSource;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState {
|
||||
|
||||
public BlockDecayedLeaves() {
|
||||
super("decayed_leaves", Properties.of(Material.LEAVES).strength(0.2F).sound(SoundType.GRASS).noOcclusion().randomTicks());
|
||||
super("decayed_leaves", Properties.of().strength(0.2F).sound(SoundType.GRASS).noOcclusion().randomTicks());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -99,7 +99,7 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
|
|||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerLevel currentLevel, ServerLevel destLevel, float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||
// repositionEntity always causes a NPE because why wouldn't it, so this is a fixed copy
|
||||
entity.level.getProfiler().popPush("reloading");
|
||||
entity.level().getProfiler().popPush("reloading");
|
||||
var result = entity.getType().create(destLevel);
|
||||
if (result != null) {
|
||||
result.restoreFrom(entity);
|
||||
|
|
|
@ -21,8 +21,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
@ -38,7 +37,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
|||
protected static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
|
||||
|
||||
public BlockEndFlower() {
|
||||
super(Properties.of(Material.GRASS).noCollission().strength(0.5F).sound(SoundType.GRASS));
|
||||
super(Properties.of().noCollission().strength(0.5F).sound(SoundType.GRASS));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityEndFlower::new, this));
|
||||
|
@ -54,20 +53,20 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
|||
@SubscribeEvent
|
||||
public void onDragonTick(LivingEvent.LivingTickEvent event) {
|
||||
var living = event.getEntity();
|
||||
if (living.level.isClientSide || !(living instanceof EnderDragon dragon))
|
||||
if (living.level().isClientSide || !(living instanceof EnderDragon dragon))
|
||||
return;
|
||||
if (dragon.dragonDeathTime < 150 || dragon.dragonDeathTime % 10 != 0)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < 6; i++) {
|
||||
var x = dragon.level.random.nextInt(256) - 128;
|
||||
var z = dragon.level.random.nextInt(256) - 128;
|
||||
var pos = new BlockPos(x, dragon.level.getHeight(Heightmap.Types.WORLD_SURFACE, x, z), z);
|
||||
if (!dragon.level.isLoaded(pos))
|
||||
var x = dragon.level().random.nextInt(256) - 128;
|
||||
var z = dragon.level().random.nextInt(256) - 128;
|
||||
var pos = new BlockPos(x, dragon.level().getHeight(Heightmap.Types.WORLD_SURFACE, x, z), z);
|
||||
if (!dragon.level().isLoaded(pos))
|
||||
continue;
|
||||
if (dragon.level.getBlockState(pos.below()).getBlock() != Blocks.END_STONE)
|
||||
if (dragon.level().getBlockState(pos.below()).getBlock() != Blocks.END_STONE)
|
||||
continue;
|
||||
dragon.level.setBlockAndUpdate(pos, this.defaultBlockState());
|
||||
dragon.level().setBlockAndUpdate(pos, this.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,9 +103,10 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
|||
levelIn.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
|
||||
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
||||
if (tile instanceof BlockEntityEndFlower f && f.isDrainMode)
|
||||
return NonNullList.create();
|
||||
|
|
|
@ -27,7 +27,6 @@ import net.minecraft.world.level.BlockGetter;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -42,7 +41,7 @@ import java.util.List;
|
|||
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<BlockEntityEnderCrate>, ICustomBlockState {
|
||||
|
||||
public BlockEnderCrate() {
|
||||
super("ender_crate", BlockEntityEnderCrate.class, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
|
||||
super("ender_crate", BlockEntityEnderCrate.class, Properties.of().strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
@ -77,7 +76,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
var name = event.getName();
|
||||
if (name == null || name.isEmpty())
|
||||
return;
|
||||
if (ILevelData.getOverworldData(player.level).isEnderStorageLocked(name))
|
||||
if (ILevelData.getOverworldData(player.level()).isEnderStorageLocked(name))
|
||||
return;
|
||||
var output = stack.copy();
|
||||
output.getOrCreateTag().putString(NaturesAura.MOD_ID + ":ender_name", name);
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.world.entity.player.Player;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -22,7 +21,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState {
|
||||
|
||||
public BlockFieldCreator() {
|
||||
super("field_creator", BlockEntityFieldCreator.class, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
|
||||
super("field_creator", BlockEntityFieldCreator.class, Properties.of().strength(2F).noCollission().sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -15,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
public BlockFireworkGenerator() {
|
||||
super("firework_generator", BlockEntityFireworkGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
||||
super("firework_generator", BlockEntityFireworkGenerator.class, Properties.of().strength(3F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -15,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
public BlockFlowerGenerator() {
|
||||
super("flower_generator", BlockEntityFlowerGenerator.class, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
|
||||
super("flower_generator", BlockEntityFlowerGenerator.class, Properties.of().sound(SoundType.WOOD).strength(2F));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -37,7 +36,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
|
|||
};
|
||||
|
||||
public BlockFurnaceHeater() {
|
||||
super("furnace_heater", BlockEntityFurnaceHeater.class, Properties.of(Material.STONE).strength(3F));
|
||||
super("furnace_heater", BlockEntityFurnaceHeater.class, Properties.of().strength(3F));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,12 +8,11 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
|||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider<BlockEntityGeneratorLimitRemover>, ICustomBlockState {
|
||||
|
||||
public BlockGeneratorLimitRemover() {
|
||||
super("generator_limit_remover", BlockEntityGeneratorLimitRemover.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||
super("generator_limit_remover", BlockEntityGeneratorLimitRemover.class, Properties.of().strength(2F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,8 +18,7 @@ import net.minecraft.world.level.block.SoundType;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -29,7 +28,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr
|
|||
public static final IntegerProperty STAGE = IntegerProperty.create("stage", 0, BlockGoldenLeaves.HIGHEST_STAGE);
|
||||
|
||||
public BlockGoldenLeaves() {
|
||||
super(Properties.of(Material.LEAVES, MaterialColor.GOLD).strength(0.2F).randomTicks().noOcclusion().sound(SoundType.GRASS));
|
||||
super(Properties.of().mapColor(MapColor.GOLD).strength(0.2F).randomTicks().noOcclusion().sound(SoundType.GRASS));
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
}
|
||||
|
||||
|
@ -115,4 +114,4 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr
|
|||
public void generateCustomBlockState(BlockStateGenerator generator) {
|
||||
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.world.level.block.entity.Hopper;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
@ -51,7 +50,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
|
|||
private static final VoxelShape WEST_RAYTRACE_SHAPE = Shapes.or(Hopper.INSIDE, Block.box(0.0D, 8.0D, 6.0D, 4.0D, 10.0D, 10.0D));
|
||||
|
||||
public BlockGratedChute() {
|
||||
super("grated_chute", BlockEntityGratedChute.class, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
|
||||
super("grated_chute", BlockEntityGratedChute.class, Properties.of().strength(3.0F, 8.0F).sound(SoundType.METAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityHopperUpgrade;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -13,7 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
|
||||
|
||||
public BlockHopperUpgrade() {
|
||||
super("hopper_upgrade", BlockEntityHopperUpgrade.class, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
|
||||
super("hopper_upgrade", BlockEntityHopperUpgrade.class, Properties.of().strength(2.5F).sound(SoundType.METAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|