mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-13 00:09:09 +01: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
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.world.level.BlockGetter;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
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 net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -22,7 +21,7 @@ public class BlockLight extends BlockImpl implements ICustomBlockState, INoItemB
|
|||
private static final VoxelShape SHAPE = Block.box(4, 4, 4, 12, 12, 12);
|
||||
|
||||
public BlockLight() {
|
||||
super("light", Properties.of(Material.WOOL).noCollission().lightLevel(s -> 15));
|
||||
super("light", Properties.of().noCollission().lightLevel(s -> 15));
|
||||
}
|
||||
|
||||
@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 BlockLowerLimiter extends BlockContainerImpl implements ICustomBlockState, ITESRProvider<BlockEntityLowerLimiter> {
|
||||
|
||||
public BlockLowerLimiter() {
|
||||
super("lower_limiter", BlockEntityLowerLimiter.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||
super("lower_limiter", BlockEntityLowerLimiter.class, Properties.of().strength(2F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityMossGenerator;
|
|||
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 BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
|
||||
|
||||
public BlockMossGenerator() {
|
||||
super("moss_generator", BlockEntityMossGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||
super("moss_generator", BlockEntityMossGenerator.class, Properties.of().strength(2.5F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.world.level.BlockGetter;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
|
@ -27,7 +26,7 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
|
|||
private static final VoxelShape SHAPE = Shapes.create(0, 0, 0, 1, 12 / 16F, 1);
|
||||
|
||||
public BlockNatureAltar() {
|
||||
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of(Material.STONE).strength(4F));
|
||||
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of().strength(4F));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
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.Blocks;
|
||||
import net.minecraft.world.level.block.BonemealableBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -36,7 +36,7 @@ public class BlockNetherGrass extends BlockImpl implements ICustomBlockState, Bo
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidBonemealTarget(BlockGetter levelIn, BlockPos pos, BlockState state, boolean isClient) {
|
||||
public boolean isValidBonemealTarget(LevelReader levelIn, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return levelIn.getBlockState(pos.above()).isAir();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.SaplingBlock;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
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;
|
||||
|
@ -25,7 +24,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|||
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
public BlockOakGenerator() {
|
||||
super("oak_generator", BlockEntityOakGenerator.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
|
||||
super("oak_generator", BlockEntityOakGenerator.class, Properties.of().strength(2F).sound(SoundType.WOOD));
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
@ -39,11 +38,11 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
Helper.getBlockEntitiesInArea(level, pos, 10, tile -> {
|
||||
if (!(tile instanceof BlockEntityOakGenerator oak))
|
||||
return false;
|
||||
var replacement = BlockOakGenerator.getReplacement(event.getFeature());
|
||||
/* var replacement = BlockOakGenerator.getReplacement(event.getFeature());
|
||||
if (replacement != null) {
|
||||
oak.scheduledBigTrees.add(pos);
|
||||
event.setFeature(replacement);
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -69,7 +68,8 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
}
|
||||
|
||||
private static Holder<? extends ConfiguredFeature<?, ?>> getReplacement(Holder<? extends ConfiguredFeature<?, ?>> feature) {
|
||||
// TODO oak gen replacements
|
||||
/*private static Holder<? extends ConfiguredFeature<?, ?>> getReplacement(Holder<? extends ConfiguredFeature<?, ?>> feature) {
|
||||
if (feature == TreeFeatures.FANCY_OAK || feature == TreeFeatures.FANCY_OAK_BEES) {
|
||||
return TreeFeatures.OAK;
|
||||
} else if (feature == TreeFeatures.FANCY_OAK_BEES_002) {
|
||||
|
@ -81,5 +81,5 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -16,7 +16,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.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
|
@ -27,7 +26,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
|
|||
private static final VoxelShape SHAPE = Shapes.create(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
|
||||
|
||||
public BlockOfferingTable() {
|
||||
super("offering_table", BlockEntityOfferingTable.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
|
||||
super("offering_table", BlockEntityOfferingTable.class, Properties.of().strength(2F).sound(SoundType.WOOD));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,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;
|
||||
|
@ -21,7 +20,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|||
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
public BlockPickupStopper() {
|
||||
super("pickup_stopper", BlockEntityPickupStopper.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||
super("pickup_stopper", BlockEntityPickupStopper.class, Properties.of().strength(2F).sound(SoundType.STONE));
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
@ -32,7 +31,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
if (player != null && !player.isShiftKeyDown()) {
|
||||
var item = event.getItem();
|
||||
var pos = item.blockPosition();
|
||||
Helper.getBlockEntitiesInArea(item.level, pos, 8, tile -> {
|
||||
Helper.getBlockEntitiesInArea(item.level(), pos, 8, tile -> {
|
||||
if (!(tile instanceof BlockEntityPickupStopper stopper))
|
||||
return false;
|
||||
var radius = stopper.getRadius();
|
||||
|
@ -44,8 +43,8 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
|
||||
event.setCanceled(true);
|
||||
|
||||
if (item.level.getGameTime() % 3 == 0)
|
||||
PacketHandler.sendToAllAround(item.level, pos, 32,
|
||||
if (item.level().getGameTime() % 3 == 0)
|
||||
PacketHandler.sendToAllAround(item.level(), pos, 32,
|
||||
new PacketParticles((float) item.getX(), (float) item.getY(), (float) item.getZ(), PacketParticles.Type.PICKUP_STOPPER));
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -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 BlockPlacer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
public BlockPlacer() {
|
||||
super("placer", BlockEntityPlacer.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||
super("placer", BlockEntityPlacer.class, Properties.of().strength(2.5F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,12 +3,11 @@ package de.ellpeck.naturesaura.blocks;
|
|||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityPotionGenerator;
|
||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockPotionGenerator extends BlockContainerImpl implements ICustomBlockState {
|
||||
|
||||
public BlockPotionGenerator() {
|
||||
super("potion_generator", BlockEntityPotionGenerator.class, Properties.of(Material.STONE).strength(5F));
|
||||
super("potion_generator", BlockEntityPotionGenerator.class, Properties.of().strength(5F));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.world.level.BlockGetter;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
@ -17,7 +16,7 @@ public class BlockPowderPlacer extends BlockContainerImpl implements ICustomBloc
|
|||
private static final VoxelShape SHAPE = Shapes.create(0F, 0F, 0F, 1F, 4 / 16F, 1F);
|
||||
|
||||
public BlockPowderPlacer() {
|
||||
super("powder_placer", BlockEntityPowderPlacer.class, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
|
||||
super("powder_placer", BlockEntityPowderPlacer.class, Properties.of().strength(2, 5F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.world.item.Items;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
|
@ -34,7 +33,7 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
|||
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<BlockEntityProjectileGenerator>, ICustomBlockState {
|
||||
|
||||
public BlockProjectileGenerator() {
|
||||
super("projectile_generator", BlockEntityProjectileGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||
super("projectile_generator", BlockEntityProjectileGenerator.class, Properties.of().strength(2.5F).sound(SoundType.STONE));
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new AbstractProjectileDispenseBehavior() {
|
||||
|
@ -61,7 +60,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
@SubscribeEvent
|
||||
public void onProjectileImpact(ProjectileImpactEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (entity.level.isClientSide)
|
||||
if (entity.level().isClientSide)
|
||||
return;
|
||||
var ray = event.getRayTraceResult();
|
||||
if (!(ray instanceof BlockHitResult blockRay))
|
||||
|
@ -69,7 +68,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
var pos = blockRay.getBlockPos();
|
||||
if (pos == null)
|
||||
return;
|
||||
var tile = entity.level.getBlockEntity(pos);
|
||||
var tile = entity.level().getBlockEntity(pos);
|
||||
if (!(tile instanceof BlockEntityProjectileGenerator generator))
|
||||
return;
|
||||
if (generator.nextSide != blockRay.getDirection())
|
||||
|
@ -81,9 +80,9 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
return;
|
||||
generator.generateAura(amount);
|
||||
|
||||
PacketHandler.sendToAllAround(entity.level, pos, 32,
|
||||
PacketHandler.sendToAllAround(entity.level(), pos, 32,
|
||||
new PacketParticles((float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ()));
|
||||
entity.level.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.BLOCKS, 0.8F, 1F);
|
||||
entity.level().playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.BLOCKS, 0.8F, 1F);
|
||||
|
||||
generator.nextSide = generator.nextSide.getClockWise();
|
||||
generator.sendToClients();
|
||||
|
|
|
@ -4,12 +4,11 @@ import de.ellpeck.naturesaura.ModConfig;
|
|||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityRFConverter;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockRFConverter extends BlockContainerImpl {
|
||||
|
||||
public BlockRFConverter() {
|
||||
super("rf_converter", BlockEntityRFConverter.class, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
|
||||
super("rf_converter", BlockEntityRFConverter.class, Properties.of().sound(SoundType.STONE).strength(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,12 +48,12 @@ public class BlockSlimeSplitGenerator extends BlockContainerImpl implements IVis
|
|||
@SubscribeEvent
|
||||
public void onLivingDeath(LivingDeathEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (!(entity instanceof Slime slime) || entity.level.isClientSide)
|
||||
if (!(entity instanceof Slime slime) || entity.level().isClientSide)
|
||||
return;
|
||||
var size = slime.getSize();
|
||||
if (size <= 1)
|
||||
return;
|
||||
Helper.getBlockEntitiesInArea(entity.level, entity.blockPosition(), 8, tile -> {
|
||||
Helper.getBlockEntitiesInArea(entity.level(), entity.blockPosition(), 8, tile -> {
|
||||
if (!(tile instanceof BlockEntitySlimeSplitGenerator gen))
|
||||
return false;
|
||||
if (gen.isBusy())
|
||||
|
|
|
@ -15,7 +15,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.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
@ -24,7 +23,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.living.MobSpawnEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
|
@ -33,7 +32,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
|
|||
private static final VoxelShape SHAPE = Shapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
|
||||
|
||||
public BlockSpawnLamp() {
|
||||
super("spawn_lamp", BlockEntitySpawnLamp.class, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
|
||||
super("spawn_lamp", BlockEntitySpawnLamp.class, Properties.of().strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
@ -43,12 +42,12 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
|
||||
public void onSpawn(MobSpawnEvent.PositionCheck event) {
|
||||
var amountToUse = 200;
|
||||
if (event.getSpawner() != null)
|
||||
return;
|
||||
var accessor = event.getLevel();
|
||||
var pos = new BlockPos(event.getX(), event.getY(), event.getZ());
|
||||
var pos = BlockPos.containing(event.getX(), event.getY(), event.getZ());
|
||||
if (!(accessor instanceof Level level))
|
||||
return;
|
||||
var data = (LevelData) ILevelData.getLevelData(level);
|
||||
|
@ -65,7 +64,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
|
|||
continue;
|
||||
|
||||
var entity = (Mob) event.getEntity();
|
||||
if (entity.checkSpawnRules(level, event.getSpawnReason()) && entity.checkSpawnObstruction(level)) {
|
||||
if (entity.checkSpawnRules(level, event.getSpawnType()) && entity.checkSpawnObstruction(level)) {
|
||||
var spot = IAuraChunk.getHighestSpot(level, lampPos, 32, lampPos);
|
||||
IAuraChunk.getAuraChunk(level, spot).drainAura(spot, amountToUse);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
|
|||
Player player = Minecraft.getInstance().player;
|
||||
if (player == null)
|
||||
return 0;
|
||||
return BiomeColors.getAverageWaterColor(player.level, player.blockPosition());
|
||||
return BiomeColors.getAverageWaterColor(player.level(), player.blockPosition());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,12 +4,11 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityTimeChanger;
|
|||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public class BlockTimeChanger extends BlockContainerImpl implements ICustomBlockState {
|
||||
|
||||
public BlockTimeChanger() {
|
||||
super("time_changer", BlockEntityTimeChanger.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||
super("time_changer", BlockEntityTimeChanger.class, Properties.of().strength(2.5F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,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.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
|
@ -39,7 +38,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
|||
private static final VoxelShape SHAPE = Shapes.create(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
|
||||
|
||||
public BlockWoodStand() {
|
||||
super("wood_stand", BlockEntityWoodStand.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
|
||||
super("wood_stand", BlockEntityWoodStand.class, Properties.of().strength(1.5F).sound(SoundType.WOOD));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.tags.BlockTags;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.SaplingBlock;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
public final class Multiblocks {
|
||||
|
||||
|
@ -38,7 +37,7 @@ public final class Multiblocks {
|
|||
'G', ModBlocks.GOLD_POWDER,
|
||||
'0', new Matcher(Blocks.OAK_SAPLING.defaultBlockState(),
|
||||
(level, start, offset, pos, state, c) -> {
|
||||
if (state.getBlock() instanceof SaplingBlock || state.getMaterial() == Material.WOOD)
|
||||
if (state.getBlock() instanceof SaplingBlock || state.is(BlockTags.LOGS))
|
||||
return true;
|
||||
// try-catch to prevent blocks that need to have been placed crashing here
|
||||
try {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab
|
|||
|
||||
this.time += 10;
|
||||
if (this.time >= this.currentRecipe.time) {
|
||||
var entity = this.currentRecipe.makeEntity(this.level, new BlockPos(this.spawnX, this.worldPosition.getY() + 1, this.spawnZ));
|
||||
var entity = this.currentRecipe.makeEntity(this.level, BlockPos.containing(this.spawnX, this.worldPosition.getY() + 1, this.spawnZ));
|
||||
this.level.addFreshEntity(entity);
|
||||
|
||||
this.currentRecipe = null;
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.entity.item.ItemEntity;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.inventory.TransientCraftingContainer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -17,7 +18,7 @@ import net.minecraft.world.phys.AABB;
|
|||
|
||||
public class BlockEntityAutoCrafter extends BlockEntityImpl implements ITickableBlockEntity {
|
||||
|
||||
public final CraftingContainer crafting = new CraftingContainer(new AbstractContainerMenu(null, 0) {
|
||||
public final CraftingContainer crafting = new TransientCraftingContainer(new AbstractContainerMenu(null, 0) {
|
||||
@Override
|
||||
public ItemStack quickMoveStack(Player p_38941_, int p_38942_) {
|
||||
return ItemStack.EMPTY;
|
||||
|
@ -81,7 +82,7 @@ public class BlockEntityAutoCrafter extends BlockEntityImpl implements ITickable
|
|||
if (recipe == null)
|
||||
return;
|
||||
|
||||
var result = recipe.assemble(this.crafting);
|
||||
var result = recipe.assemble(this.crafting, this.level.registryAccess());
|
||||
if (result.isEmpty())
|
||||
return;
|
||||
var resultItem = new ItemEntity(this.level,
|
||||
|
|
|
@ -57,7 +57,7 @@ public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements I
|
|||
return;
|
||||
|
||||
if (output.isEmpty()) {
|
||||
var result = recipe.getResultItem();
|
||||
var result = recipe.getResultItem(this.level.registryAccess());
|
||||
tile.setItem(2, result.copy());
|
||||
} else {
|
||||
output.grow(1);
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.Vec3;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -109,7 +109,7 @@ public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickabl
|
|||
if (!state.isAir() && state.getDestroySpeed(this.level, pos) >= 0F) {
|
||||
var fake = FakePlayerFactory.getMinecraft((ServerLevel) this.level);
|
||||
if (!MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(this.level, pos, state, fake))) {
|
||||
var drops = state.getDrops(new LootContext.Builder((ServerLevel) this.level)
|
||||
var drops = state.getDrops(new LootParams.Builder((ServerLevel) this.level)
|
||||
.withParameter(LootContextParams.THIS_ENTITY, fake)
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos))
|
||||
.withParameter(LootContextParams.BLOCK_STATE, state)
|
||||
|
|
|
@ -105,7 +105,7 @@ public class BlockEntityFurnaceHeater extends BlockEntityImpl implements ITickab
|
|||
var recipe = this.level.getRecipeManager().getRecipeFor(BlockEntityFurnaceHeater.getRecipeType(furnace), furnace, this.level).orElse(null);
|
||||
if (recipe == null)
|
||||
return false;
|
||||
var output = recipe.getResultItem();
|
||||
var output = recipe.getResultItem(this.level.registryAccess());
|
||||
var currOutput = furnace.getItem(2);
|
||||
return currOutput.isEmpty() || Helper.areItemsEqual(currOutput, output, true) && currOutput.getCount() + output.getCount() <= output.getMaxStackSize();
|
||||
} else
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
|
|||
|
||||
var up = pos.above();
|
||||
var state = this.level.getBlockState(up);
|
||||
if (state.getMaterial().isReplaceable())
|
||||
if (state.canBeReplaced())
|
||||
validPositions.add(up);
|
||||
}
|
||||
if (validPositions.isEmpty())
|
||||
|
|
|
@ -49,15 +49,15 @@ public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickable
|
|||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var angle = this.level.random.nextFloat() * Math.PI * 2;
|
||||
var pos = this.worldPosition.offset(Math.cos(angle) * range * this.level.random.nextFloat(), 0, Math.sin(angle) * range * this.level.random.nextFloat());
|
||||
var pos = this.worldPosition.offset(Mth.floor(Math.cos(angle) * range * this.level.random.nextFloat()), 0, Mth.floor(Math.sin(angle) * range * this.level.random.nextFloat()));
|
||||
pos = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
|
||||
var down = pos.below();
|
||||
|
||||
var fluid = this.level.getFluidState(down).getType();
|
||||
if (fluid == Fluids.WATER) {
|
||||
if (this.level.getBlockState(down).getMaterial().isReplaceable())
|
||||
if (this.level.getBlockState(down).canBeReplaced())
|
||||
this.level.setBlockAndUpdate(down, Blocks.ICE.defaultBlockState());
|
||||
} else if (Blocks.SNOW.defaultBlockState().canSurvive(this.level, pos) && this.level.getBlockState(pos).getBlock() != Blocks.SNOW && this.level.getBlockState(pos).getMaterial().isReplaceable()) {
|
||||
} else if (Blocks.SNOW.defaultBlockState().canSurvive(this.level, pos) && this.level.getBlockState(pos).getBlock() != Blocks.SNOW && this.level.getBlockState(pos).canBeReplaced()) {
|
||||
this.level.setBlockAndUpdate(pos, Blocks.SNOW.defaultBlockState());
|
||||
|
||||
if (this.snowmanCount < range / 2 && this.level.random.nextFloat() >= 0.995F) {
|
||||
|
@ -83,9 +83,9 @@ public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickable
|
|||
for (var i = range * 4; i >= 0; i--) {
|
||||
var angle = this.level.random.nextFloat() * Math.PI * 2;
|
||||
var pos = this.worldPosition.offset(
|
||||
Math.cos(angle) * range * this.level.random.nextFloat(),
|
||||
Mth.floor(Math.cos(angle) * range * this.level.random.nextFloat()),
|
||||
Mth.nextInt(this.level.random, range / 2, range),
|
||||
Math.sin(angle) * range * this.level.random.nextFloat());
|
||||
Mth.floor(Math.sin(angle) * range * this.level.random.nextFloat()));
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
pos.getX() + this.level.random.nextFloat(), pos.getY() + 1, pos.getZ() + this.level.random.nextFloat(),
|
||||
this.level.random.nextGaussian() * 0.05, 0, this.level.random.nextGaussian() * 0.05,
|
||||
|
|
|
@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
@ -10,6 +9,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
|||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderEnderCrate implements BlockEntityRenderer<BlockEntityEnderCrate> {
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
|
||||
|
@ -44,7 +44,7 @@ public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEnt
|
|||
var brightness = 15 << 20 | 15 << 4;
|
||||
var alpha = ((float) Math.sin(System.currentTimeMillis() / 800D) + 1F) / 2F;
|
||||
stack.translate(-0.002F + xOff, 1 + 0.002F + yOff, 1 + 0.002F + zOff);
|
||||
stack.mulPose(Vector3f.XP.rotationDegrees(180F));
|
||||
stack.mulPose(Axis.XP.rotationDegrees(180F));
|
||||
stack.scale(1.004F, 1.004F, 1.004F);
|
||||
model.renderToBuffer(stack, buffer.getBuffer(model.renderType(texture)), brightness, combinedOverlayIn, 1, 1, 1, alpha * maxAlpha);
|
||||
stack.popPose();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
|
||||
public class RenderNatureAltar implements BlockEntityRenderer<BlockEntityNatureAltar> {
|
||||
|
||||
|
@ -23,8 +23,8 @@ public class RenderNatureAltar implements BlockEntityRenderer<BlockEntityNatureA
|
|||
var time = tileEntityIn.bobTimer + partialTicks;
|
||||
var bob = (float) Math.sin(time / 10F) * 0.1F;
|
||||
matrixStackIn.translate(0.5F, 1.2F + bob, 0.5F);
|
||||
matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(time * 3 % 360));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, 0);
|
||||
matrixStackIn.mulPose(Axis.YP.rotationDegrees(time * 3 % 360));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, tileEntityIn.getLevel(), 0);
|
||||
matrixStackIn.popPose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityOfferingTable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -47,11 +47,11 @@ public class RenderOfferingTable implements BlockEntityRenderer<BlockEntityOffer
|
|||
0.35F + this.rand.nextFloat() * 0.3F,
|
||||
0.9F + yOff + i * 0.001F,
|
||||
0.35F + this.rand.nextFloat() * 0.3F);
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(this.rand.nextFloat() * 360));
|
||||
matrixStack.mulPose(Vector3f.XP.rotationDegrees(90F));
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(this.rand.nextFloat() * 360));
|
||||
matrixStack.mulPose(Axis.XP.rotationDegrees(90F));
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStack, iRenderTypeBuffer, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, combinedLightIn, combinedOverlayIn, matrixStack, iRenderTypeBuffer, tileEntityOfferingTable.getLevel(), 0);
|
||||
matrixStack.popPose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
@ -34,13 +34,13 @@ public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntit
|
|||
public void render(BlockEntityProjectileGenerator te, float partialTicks, PoseStack stack, MultiBufferSource buffer, int combinedLightIn, int combinedOverlayIn) {
|
||||
stack.pushPose();
|
||||
if (te.nextSide == Direction.NORTH) {
|
||||
stack.mulPose(Vector3f.YP.rotationDegrees(270));
|
||||
stack.mulPose(Axis.YP.rotationDegrees(270));
|
||||
stack.translate(-0.002F, 0, -1);
|
||||
} else if (te.nextSide == Direction.EAST) {
|
||||
stack.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
stack.mulPose(Axis.YP.rotationDegrees(180));
|
||||
stack.translate(-1.002F, 0, -1);
|
||||
} else if (te.nextSide == Direction.SOUTH) {
|
||||
stack.mulPose(Vector3f.YP.rotationDegrees(90));
|
||||
stack.mulPose(Axis.YP.rotationDegrees(90));
|
||||
stack.translate(-1.002F, 0, 0);
|
||||
} else {
|
||||
stack.translate(-0.002F, 0, 0);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityWoodStand;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
|
||||
public class RenderWoodStand implements BlockEntityRenderer<BlockEntityWoodStand> {
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class RenderWoodStand implements BlockEntityRenderer<BlockEntityWoodStand
|
|||
if (!stack.isEmpty()) {
|
||||
matrixStack.pushPose();
|
||||
var item = stack.getItem();
|
||||
if (item instanceof BlockItem blockItem && blockItem.getBlock().defaultBlockState().getMaterial().isSolid()) {
|
||||
if (item instanceof BlockItem blockItem && blockItem.getBlock().defaultBlockState().isSolid()) {
|
||||
matrixStack.translate(0.5F, 0.755F, 0.5F);
|
||||
var scale = 0.95F;
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
|
@ -30,9 +30,9 @@ public class RenderWoodStand implements BlockEntityRenderer<BlockEntityWoodStand
|
|||
matrixStack.translate(0.5F, 0.825F, 0.4F);
|
||||
var scale = 0.75F;
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
matrixStack.mulPose(Vector3f.XP.rotationDegrees(90));
|
||||
matrixStack.mulPose(Axis.XP.rotationDegrees(90));
|
||||
}
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.GROUND, i, i1, matrixStack, iRenderTypeBuffer, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, i, i1, matrixStack, iRenderTypeBuffer, tileEntityWoodStand.getLevel(), 0);
|
||||
matrixStack.popPose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class AngerEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (!this.bb.contains(player.getEyePosition()))
|
||||
return ActiveType.INACTIVE;
|
||||
|
|
|
@ -49,11 +49,11 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (!this.bb.contains(player.getEyePosition()))
|
||||
return ActiveType.INACTIVE;
|
||||
if (!NaturesAuraAPI.instance().isEffectPowderActive(player.level, player.blockPosition(), AnimalEffect.NAME))
|
||||
if (!NaturesAuraAPI.instance().isEffectPowderActive(player.level(), player.blockPosition(), AnimalEffect.NAME))
|
||||
return ActiveType.INHIBITED;
|
||||
return ActiveType.ACTIVE;
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
private void setInLove(Animal animal) {
|
||||
animal.setInLove(null);
|
||||
for (var j = 0; j < 7; j++)
|
||||
animal.level.addParticle(ParticleTypes.HEART,
|
||||
animal.getX() + (double) (animal.level.random.nextFloat() * animal.getBbWidth() * 2.0F) - animal.getBbWidth(),
|
||||
animal.getY() + 0.5D + (double) (animal.level.random.nextFloat() * animal.getBbHeight()),
|
||||
animal.getZ() + (double) (animal.level.random.nextFloat() * animal.getBbWidth() * 2.0F) - animal.getBbWidth(),
|
||||
animal.level.random.nextGaussian() * 0.02D,
|
||||
animal.level.random.nextGaussian() * 0.02D,
|
||||
animal.level.random.nextGaussian() * 0.02D);
|
||||
animal.level().addParticle(ParticleTypes.HEART,
|
||||
animal.getX() + (double) (animal.level().random.nextFloat() * animal.getBbWidth() * 2.0F) - animal.getBbWidth(),
|
||||
animal.getY() + 0.5D + (double) (animal.level().random.nextFloat() * animal.getBbHeight()),
|
||||
animal.getZ() + (double) (animal.level().random.nextFloat() * animal.getBbWidth() * 2.0F) - animal.getBbWidth(),
|
||||
animal.level().random.nextGaussian() * 0.02D,
|
||||
animal.level().random.nextGaussian() * 0.02D,
|
||||
animal.level().random.nextGaussian() * 0.02D);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BreathlessEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (!this.bb.contains(player.getEyePosition()))
|
||||
return ActiveType.INACTIVE;
|
||||
|
|
|
@ -39,11 +39,11 @@ public class CacheRechargeEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (!this.bb.contains(player.getEyePosition()))
|
||||
return ActiveType.INACTIVE;
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(player.level, player.blockPosition(), CacheRechargeEffect.NAME))
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(player.level(), player.blockPosition(), CacheRechargeEffect.NAME))
|
||||
return ActiveType.INHIBITED;
|
||||
return ActiveType.ACTIVE;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ExplosionEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
|
||||
return ActiveType.INACTIVE;
|
||||
|
@ -65,9 +65,11 @@ public class ExplosionEffect implements IDrainSpotEffect {
|
|||
var z = Mth.floor(pos.getZ() + level.random.nextGaussian() * this.dist);
|
||||
var chosenPos = new BlockPos(x, level.getHeight(Heightmap.Types.WORLD_SURFACE, x, z), z);
|
||||
if (chosenPos.distSqr(pos) <= this.dist * this.dist && level.isLoaded(chosenPos)) {
|
||||
level.explode(null,
|
||||
chosenPos.getX() + 0.5, chosenPos.getY() + 0.5, chosenPos.getZ() + 0.5,
|
||||
this.strength, false, Explosion.BlockInteraction.DESTROY);
|
||||
var explosion = new Explosion(level, null, chosenPos.getX() + 0.5, chosenPos.getY() + 0.5, chosenPos.getZ() + 0.5, this.strength, false, Explosion.BlockInteraction.DESTROY);
|
||||
if (!net.minecraftforge.event.ForgeEventFactory.onExplosionStart(level, explosion)) {
|
||||
explosion.explode();
|
||||
explosion.finalizeExplosion(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class GrassDieEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
|
||||
return ActiveType.INACTIVE;
|
||||
|
@ -62,7 +62,7 @@ public class GrassDieEffect implements IDrainSpotEffect {
|
|||
if (!this.calcValues(level, pos, spot))
|
||||
return;
|
||||
for (var i = this.amount / 2 + level.random.nextInt(this.amount / 2); i >= 0; i--) {
|
||||
var grassPos = new BlockPos(
|
||||
var grassPos = BlockPos.containing(
|
||||
pos.getX() + level.random.nextGaussian() * this.dist,
|
||||
pos.getY() + level.random.nextGaussian() * this.dist,
|
||||
pos.getZ() + level.random.nextGaussian() * this.dist
|
||||
|
|
|
@ -44,7 +44,7 @@ public class NetherDecayEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
|
||||
return ActiveType.INACTIVE;
|
||||
|
@ -61,7 +61,7 @@ public class NetherDecayEffect implements IDrainSpotEffect {
|
|||
if (!this.calcValues(level, pos, spot))
|
||||
return;
|
||||
for (var i = this.amount / 2 + level.random.nextInt(this.amount / 2); i >= 0; i--) {
|
||||
var offset = new BlockPos(
|
||||
var offset = BlockPos.containing(
|
||||
pos.getX() + level.random.nextGaussian() * this.dist,
|
||||
pos.getY() + level.random.nextGaussian() * this.dist,
|
||||
pos.getZ() + level.random.nextGaussian() * this.dist);
|
||||
|
|
|
@ -43,11 +43,11 @@ public class NetherGrassEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
|
||||
return ActiveType.INACTIVE;
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(player.level, player.blockPosition(), NetherGrassEffect.NAME))
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(player.level(), player.blockPosition(), NetherGrassEffect.NAME))
|
||||
return ActiveType.INHIBITED;
|
||||
return ActiveType.ACTIVE;
|
||||
}
|
||||
|
|
|
@ -59,11 +59,11 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
|
||||
return ActiveType.INACTIVE;
|
||||
if (!NaturesAuraAPI.instance().isEffectPowderActive(player.level, player.blockPosition(), OreSpawnEffect.NAME))
|
||||
if (!NaturesAuraAPI.instance().isEffectPowderActive(player.level(), player.blockPosition(), OreSpawnEffect.NAME))
|
||||
return ActiveType.INHIBITED;
|
||||
return ActiveType.ACTIVE;
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@ public class PlantBoostEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public ActiveType isActiveHere(Player player, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.level, pos, spot))
|
||||
if (!this.calcValues(player.level(), pos, spot))
|
||||
return ActiveType.INACTIVE;
|
||||
if (player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
|
||||
return ActiveType.INACTIVE;
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(player.level, player.blockPosition(), PlantBoostEffect.NAME))
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(player.level(), player.blockPosition(), PlantBoostEffect.NAME))
|
||||
return ActiveType.INHIBITED;
|
||||
return ActiveType.ACTIVE;
|
||||
}
|
||||
|
|
|
@ -15,29 +15,29 @@ public final class CommandAura {
|
|||
.then(Commands.literal("add").then(Commands.argument("amount", IntegerArgumentType.integer(1)).executes(context -> {
|
||||
var amount = IntegerArgumentType.getInteger(context, "amount");
|
||||
var source = context.getSource();
|
||||
var pos = new BlockPos(source.getPosition());
|
||||
var pos = BlockPos.containing(source.getPosition());
|
||||
while (amount > 0) {
|
||||
var spot = IAuraChunk.getLowestSpot(source.getLevel(), pos, 35, pos);
|
||||
amount -= IAuraChunk.getAuraChunk(source.getLevel(), spot).storeAura(spot, amount);
|
||||
}
|
||||
source.sendSuccess(Component.literal("Added aura to area"), true);
|
||||
source.sendSuccess(() -> Component.literal("Added aura to area"), true);
|
||||
return 0;
|
||||
})))
|
||||
.then(Commands.literal("remove").then(Commands.argument("amount", IntegerArgumentType.integer(1)).executes(context -> {
|
||||
var amount = IntegerArgumentType.getInteger(context, "amount");
|
||||
var source = context.getSource();
|
||||
var pos = new BlockPos(source.getPosition());
|
||||
var pos = BlockPos.containing(source.getPosition());
|
||||
while (amount > 0) {
|
||||
var spot = IAuraChunk.getHighestSpot(source.getLevel(), pos, 35, pos);
|
||||
amount -= IAuraChunk.getAuraChunk(source.getLevel(), spot).drainAura(spot, amount);
|
||||
}
|
||||
source.sendSuccess(Component.literal("Removed aura from area"), true);
|
||||
source.sendSuccess(() -> Component.literal("Removed aura from area"), true);
|
||||
return 0;
|
||||
})))
|
||||
.then(Commands.literal("reset").then(Commands.argument("range", IntegerArgumentType.integer(10, 1000)).executes(context -> {
|
||||
var range = IntegerArgumentType.getInteger(context, "range");
|
||||
var source = context.getSource();
|
||||
var pos = new BlockPos(source.getPosition());
|
||||
var pos = BlockPos.containing(source.getPosition());
|
||||
IAuraChunk.getSpotsInArea(source.getLevel(), pos, range, (spot, amount) -> {
|
||||
var chunk = IAuraChunk.getAuraChunk(source.getLevel(), spot);
|
||||
if (amount > 0)
|
||||
|
@ -45,7 +45,7 @@ public final class CommandAura {
|
|||
else
|
||||
chunk.storeAura(spot, -amount);
|
||||
});
|
||||
source.sendSuccess(Component.literal("Reset aura in area"), true);
|
||||
source.sendSuccess(() -> Component.literal("Reset aura in area"), true);
|
||||
return 0;
|
||||
}))));
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class CuriosCompat implements ICompat {
|
|||
private final LazyOptional<ICurio> curio = LazyOptional.of(() -> new ICurio() {
|
||||
@Override
|
||||
public void curioTick(SlotContext slotContext) {
|
||||
stack.getItem().inventoryTick(stack, slotContext.entity().level, slotContext.entity(), -1, false);
|
||||
stack.getItem().inventoryTick(stack, slotContext.entity().level(), slotContext.entity(), -1, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.compat.jei;
|
|||
import com.mojang.blaze3d.platform.Lighting;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
|
||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||
|
@ -15,6 +15,7 @@ import mezz.jei.api.recipe.RecipeIngredientRole;
|
|||
import mezz.jei.api.recipe.RecipeType;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -47,8 +48,8 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
RenderSystem.applyModelViewMatrix();
|
||||
matrixstack.translate(0.0D, 0.0D, 1000.0D);
|
||||
matrixstack.scale(scale, scale, scale);
|
||||
var quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
||||
var quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
||||
var quaternion = Axis.ZP.rotationDegrees(180.0F);
|
||||
var quaternion1 = Axis.XP.rotationDegrees(f1 * 20.0F);
|
||||
quaternion.mul(quaternion1);
|
||||
matrixstack.mulPose(quaternion);
|
||||
var f2 = entity.yBodyRot;
|
||||
|
@ -63,7 +64,7 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
entity.yHeadRotO = entity.getYRot();
|
||||
Lighting.setupForEntityInInventory();
|
||||
var entityrenderermanager = Minecraft.getInstance().getEntityRenderDispatcher();
|
||||
quaternion1.conj();
|
||||
quaternion1.conjugate();
|
||||
entityrenderermanager.overrideCameraOrientation(quaternion1);
|
||||
entityrenderermanager.setRenderShadow(false);
|
||||
var buff = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
|
@ -108,7 +109,7 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(AnimalSpawnerRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack matrixStack, double mouseX, double mouseY) {
|
||||
public void draw(AnimalSpawnerRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
var entity = this.entityCache.get(recipe.entity);
|
||||
if (entity == null) {
|
||||
|
@ -116,13 +117,13 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
this.entityCache.put(recipe.entity, entity);
|
||||
}
|
||||
|
||||
matrixStack.pushPose();
|
||||
graphics.pose().pushPose();
|
||||
var size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
|
||||
AnimalSpawnerCategory.renderEntity(matrixStack, 36, 56, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
|
||||
matrixStack.popPose();
|
||||
AnimalSpawnerCategory.renderEntity(graphics.pose(), 36, 56, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
|
||||
graphics.pose().popPose();
|
||||
|
||||
var name = recipe.entity.getDescription().getString();
|
||||
minecraft.font.drawShadow(matrixStack, name, 36 - minecraft.font.width(name) / 2F, 55, 0xFFFFFF);
|
||||
graphics.drawString(minecraft.font, name, 36 - minecraft.font.width(name) / 2F, 55, 0xFFFFFF, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ import de.ellpeck.naturesaura.events.ClientEvents;
|
|||
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -29,10 +27,7 @@ import vazkii.patchouli.api.PatchouliAPI;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PatchouliCompat implements ICompat {
|
||||
|
@ -100,26 +95,24 @@ public class PatchouliCompat implements ICompat {
|
|||
var x = gui.width / 2 + 272 / 2 - 16;
|
||||
var y = gui.height / 2 - 180 / 2 - 26;
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.BOOK_GUI);
|
||||
Screen.blit(event.getPoseStack(), x, y, 469, 0, 43, 42, 512, 256);
|
||||
event.getGraphics().blit(ClientEvents.BOOK_GUI, x, y, 469, 0, 43, 42, 512, 256);
|
||||
|
||||
if (event.getMouseX() >= x && event.getMouseY() >= y && event.getMouseX() < x + 43 && event.getMouseY() < y + 42)
|
||||
gui.renderComponentTooltip(event.getPoseStack(),
|
||||
event.getGraphics().renderTooltip(Minecraft.getInstance().font,
|
||||
Collections.singletonList(Component.literal("It's the author Ellpeck's birthday!").setStyle(Style.EMPTY.applyFormat(ChatFormatting.GOLD))),
|
||||
event.getMouseX(), event.getMouseY(), gui.getMinecraft().font);
|
||||
Optional.empty(),
|
||||
event.getMouseX(), event.getMouseY());
|
||||
} else if (now.getMonth() == Month.JUNE) {
|
||||
var x = gui.width / 2 + 272 / 2;
|
||||
var y = gui.height / 2 + 32;
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.BOOK_GUI);
|
||||
Screen.blit(event.getPoseStack(), x, y, 424, 0, 45, 26, 512, 256);
|
||||
event.getGraphics().blit(ClientEvents.BOOK_GUI, x, y, 424, 0, 45, 26, 512, 256);
|
||||
|
||||
if (event.getMouseX() >= x && event.getMouseY() >= y && event.getMouseX() < x + 45 && event.getMouseY() < y + 26)
|
||||
gui.renderComponentTooltip(event.getPoseStack(),
|
||||
Collections.singletonList(Component.literal("\u00A76Happy \u00A74P\u00A76r\u00A7ei\u00A72d\u00A79e\u00A75!")),
|
||||
event.getMouseX(), event.getMouseY(), gui.getMinecraft().font);
|
||||
//noinspection UnnecessaryUnicodeEscape
|
||||
event.getGraphics().renderTooltip(gui.getMinecraft().font,
|
||||
Collections.singletonList(Component.literal("\u00A76Happy \u00A74P\u00A76r\u00A7ei\u00A72d\u00A79e\u00A75!")), Optional.empty(),
|
||||
event.getMouseX(), event.getMouseY());
|
||||
}
|
||||
|
||||
var name = gui.getMinecraft().player.getName().getString();
|
||||
|
@ -128,24 +121,21 @@ public class PatchouliCompat implements ICompat {
|
|||
var x = gui.width / 2 - 272 / 2 + 20;
|
||||
var y = gui.height / 2 + 180 / 2;
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.BOOK_GUI);
|
||||
|
||||
Screen.blit(event.getPoseStack(), x, y, 496, 44, 16, 18, 512, 256);
|
||||
event.getGraphics().blit(ClientEvents.BOOK_GUI, x, y, 496, 44, 16, 18, 512, 256);
|
||||
if (info.tier() == 1) {
|
||||
Screen.blit(event.getPoseStack(), x, y, 496 - 16, 44, 16, 18, 512, 256);
|
||||
event.getGraphics().blit(ClientEvents.BOOK_GUI, x, y, 496 - 16, 44, 16, 18, 512, 256);
|
||||
} else {
|
||||
var r = (info.color() >> 16 & 255) / 255F;
|
||||
var g = (info.color() >> 8 & 255) / 255F;
|
||||
var b = (info.color() & 255) / 255F;
|
||||
RenderSystem.setShaderColor(r, g, b, 1);
|
||||
Screen.blit(event.getPoseStack(), x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
event.getGraphics().blit(ClientEvents.BOOK_GUI, x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
}
|
||||
|
||||
if (event.getMouseX() >= x && event.getMouseY() >= y && event.getMouseX() < x + 16 && event.getMouseY() < y + 18)
|
||||
gui.renderComponentTooltip(event.getPoseStack(),
|
||||
Collections.singletonList(Component.literal("Thanks for your support, " + name + "!").setStyle(Style.EMPTY.applyFormat(ChatFormatting.YELLOW))),
|
||||
event.getMouseX(), event.getMouseY(), gui.getMinecraft().font);
|
||||
event.getGraphics().renderTooltip(gui.getMinecraft().font,
|
||||
Collections.singletonList(Component.literal("Thanks for your support, " + name + "!").setStyle(Style.EMPTY.applyFormat(ChatFormatting.YELLOW))), Optional.empty(),
|
||||
event.getMouseX(), event.getMouseY());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.compat.patchouli;
|
|||
|
||||
import de.ellpeck.naturesaura.recipes.AltarRecipe;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.Level;
|
||||
import vazkii.patchouli.api.IComponentProcessor;
|
||||
import vazkii.patchouli.api.IVariable;
|
||||
import vazkii.patchouli.api.IVariableProvider;
|
||||
|
@ -11,18 +12,19 @@ public class ProcessorAltar implements IComponentProcessor {
|
|||
private AltarRecipe recipe;
|
||||
|
||||
@Override
|
||||
public void setup(IVariableProvider provider) {
|
||||
public void setup(Level level, IVariableProvider provider) {
|
||||
this.recipe = PatchouliCompat.getRecipe("altar", provider.get("recipe").asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariable process(String key) {
|
||||
public IVariable process(Level level, String key) {
|
||||
if (this.recipe == null)
|
||||
return null;
|
||||
return switch (key) {
|
||||
case "input" -> PatchouliCompat.ingredientVariable(this.recipe.input);
|
||||
case "output" -> IVariable.from(this.recipe.output);
|
||||
case "catalyst" -> this.recipe.catalyst != Ingredient.EMPTY ? PatchouliCompat.ingredientVariable(this.recipe.catalyst) : null;
|
||||
case "catalyst" ->
|
||||
this.recipe.catalyst != Ingredient.EMPTY ? PatchouliCompat.ingredientVariable(this.recipe.catalyst) : null;
|
||||
case "name" -> IVariable.wrap(this.recipe.output.getHoverName().getString());
|
||||
default -> null;
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.compat.patchouli;
|
|||
|
||||
import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.ForgeSpawnEggItem;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.patchouli.api.IComponentProcessor;
|
||||
|
@ -13,12 +14,12 @@ public class ProcessorAnimalSpawner implements IComponentProcessor {
|
|||
private AnimalSpawnerRecipe recipe;
|
||||
|
||||
@Override
|
||||
public void setup(IVariableProvider provider) {
|
||||
public void setup(Level level, IVariableProvider provider) {
|
||||
this.recipe = PatchouliCompat.getRecipe("animal_spawner", provider.get("recipe").asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariable process(String key) {
|
||||
public IVariable process(Level level, String key) {
|
||||
if (this.recipe == null)
|
||||
return null;
|
||||
if (key.startsWith("input")) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.naturesaura.compat.patchouli;
|
||||
|
||||
import de.ellpeck.naturesaura.recipes.OfferingRecipe;
|
||||
import net.minecraft.world.level.Level;
|
||||
import vazkii.patchouli.api.IComponentProcessor;
|
||||
import vazkii.patchouli.api.IVariable;
|
||||
import vazkii.patchouli.api.IVariableProvider;
|
||||
|
@ -10,12 +11,12 @@ public class ProcessorOffering implements IComponentProcessor {
|
|||
private OfferingRecipe recipe;
|
||||
|
||||
@Override
|
||||
public void setup(IVariableProvider provider) {
|
||||
public void setup(Level level, IVariableProvider provider) {
|
||||
this.recipe = PatchouliCompat.getRecipe("offering", provider.get("recipe").asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariable process(String key) {
|
||||
public IVariable process(Level level, String key) {
|
||||
if (this.recipe == null)
|
||||
return null;
|
||||
return switch (key) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.naturesaura.compat.patchouli;
|
||||
|
||||
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
|
||||
import net.minecraft.world.level.Level;
|
||||
import vazkii.patchouli.api.IComponentProcessor;
|
||||
import vazkii.patchouli.api.IVariable;
|
||||
import vazkii.patchouli.api.IVariableProvider;
|
||||
|
@ -10,12 +11,12 @@ public class ProcessorTreeRitual implements IComponentProcessor {
|
|||
private TreeRitualRecipe recipe;
|
||||
|
||||
@Override
|
||||
public void setup(IVariableProvider provider) {
|
||||
public void setup(Level level, IVariableProvider provider) {
|
||||
this.recipe = PatchouliCompat.getRecipe("tree_ritual", provider.get("recipe").asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariable process(String key) {
|
||||
public IVariable process(Level level, String key) {
|
||||
if (this.recipe == null)
|
||||
return null;
|
||||
if (key.startsWith("input")) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import de.ellpeck.naturesaura.reg.IModItem;
|
|||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.tags.BlockTagsProvider;
|
||||
import net.minecraft.data.tags.IntrinsicHolderTagsProvider;
|
||||
import net.minecraft.data.tags.ItemTagsProvider;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
|
@ -39,15 +40,15 @@ public class ItemTagProvider extends ItemTagsProvider {
|
|||
ModRegistry.ALL_ITEMS.stream().sorted(Comparator.comparing(IModItem::getBaseName)).filter(i -> i instanceof Item).map(i -> (Item) i).forEach(i -> {
|
||||
if (i instanceof ItemPickaxe) {
|
||||
this.tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(i);
|
||||
this.tag(Tags.Items.TOOLS_PICKAXES).add(i);
|
||||
this.tag(ItemTags.PICKAXES).add(i);
|
||||
} else if (i instanceof ItemAxe) {
|
||||
this.tag(Tags.Items.TOOLS_AXES).add(i);
|
||||
this.tag(ItemTags.AXES).add(i);
|
||||
} else if (i instanceof ItemHoe) {
|
||||
this.tag(Tags.Items.TOOLS_HOES).add(i);
|
||||
this.tag(ItemTags.HOES).add(i);
|
||||
} else if (i instanceof ItemSword) {
|
||||
this.tag(Tags.Items.TOOLS_SWORDS).add(i);
|
||||
this.tag(ItemTags.SWORDS).add(i);
|
||||
} else if (i instanceof ItemShovel) {
|
||||
this.tag(Tags.Items.TOOLS_SHOVELS).add(i);
|
||||
this.tag(ItemTags.SHOVELS).add(i);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class ItemTagProvider extends ItemTagsProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TagAppender<Item> tag(TagKey<Item> tag) {
|
||||
public IntrinsicHolderTagsProvider.IntrinsicTagAppender<Item> tag(TagKey<Item> tag) {
|
||||
// super is protected, but CuriosCompat needs this
|
||||
return super.tag(tag);
|
||||
}
|
||||
|
|
|
@ -10,13 +10,13 @@ import de.ellpeck.naturesaura.misc.LevelData;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.damagesource.EntityDamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -94,16 +94,16 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
if (this.powderListDirty)
|
||||
this.updatePowderListStatus(this.getInhibitedEffect());
|
||||
|
||||
if (this.level.isClientSide) {
|
||||
if (this.level.getGameTime() % 5 == 0) {
|
||||
if (this.level().isClientSide) {
|
||||
if (this.level().getGameTime() % 5 == 0) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
this.getX() + this.level.random.nextGaussian() * 0.1F,
|
||||
this.getX() + this.level().random.nextGaussian() * 0.1F,
|
||||
this.getY(),
|
||||
this.getZ() + this.level.random.nextGaussian() * 0.1F,
|
||||
this.level.random.nextGaussian() * 0.005F,
|
||||
this.level.random.nextFloat() * 0.03F,
|
||||
this.level.random.nextGaussian() * 0.005F,
|
||||
this.getColor(), this.level.random.nextFloat() * 3F + 1F, 120, 0F, true, true);
|
||||
this.getZ() + this.level().random.nextGaussian() * 0.1F,
|
||||
this.level().random.nextGaussian() * 0.005F,
|
||||
this.level().random.nextFloat() * 0.03F,
|
||||
this.level().random.nextGaussian() * 0.005F,
|
||||
this.getColor(), this.level().random.nextFloat() * 3F + 1F, 120, 0F, true, true);
|
||||
}
|
||||
this.renderTicks++;
|
||||
}
|
||||
|
@ -124,18 +124,18 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Packet<?> getAddEntityPacket() {
|
||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean skipAttackInteraction(Entity entity) {
|
||||
return entity instanceof Player player && (!this.level.mayInteract(player, this.blockPosition()) || this.hurt(DamageSource.playerAttack(player), 0.0F));
|
||||
return entity instanceof Player player && (!this.level().mayInteract(player, this.blockPosition()) || this.hurt(this.damageSources().playerAttack(player), 0.0F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
if (source instanceof EntityDamageSource && !this.level.isClientSide) {
|
||||
if (source.getEntity() != null && !this.level().isClientSide) {
|
||||
this.spawnAtLocation(this.getDrop(), 0F);
|
||||
this.kill();
|
||||
return true;
|
||||
|
@ -200,7 +200,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
}
|
||||
|
||||
private void updatePowderListStatus(ResourceLocation inhibitedEffect) {
|
||||
var powders = ((LevelData) ILevelData.getLevelData(this.level)).effectPowders;
|
||||
var powders = ((LevelData) ILevelData.getLevelData(this.level())).effectPowders;
|
||||
if (this.lastEffect != null) {
|
||||
var oldList = powders.get(this.lastEffect);
|
||||
oldList.removeIf(t -> this.getEyePosition().equals(t.getA()));
|
||||
|
|
|
@ -29,7 +29,7 @@ public class EntityLightProjectile extends ThrowableProjectile {
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.level.isClientSide && this.tickCount > 1) {
|
||||
if (this.level().isClientSide && this.tickCount > 1) {
|
||||
for (float i = 0; i <= 1; i += 0.2F) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
Mth.lerp(i, this.xOld, this.getX()),
|
||||
|
@ -43,12 +43,12 @@ public class EntityLightProjectile extends ThrowableProjectile {
|
|||
|
||||
@Override
|
||||
protected void onHit(HitResult result) {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (result instanceof BlockHitResult res) {
|
||||
var pos = res.getBlockPos().relative(res.getDirection());
|
||||
var state = this.level.getBlockState(pos);
|
||||
if (state.getMaterial().isReplaceable())
|
||||
this.level.setBlockAndUpdate(pos, ModBlocks.LIGHT.defaultBlockState());
|
||||
var state = this.level().getBlockState(pos);
|
||||
if (state.canBeReplaced())
|
||||
this.level().setBlockAndUpdate(pos, ModBlocks.LIGHT.defaultBlockState());
|
||||
} else if (result instanceof EntityHitResult entity) {
|
||||
entity.getEntity().setSecondsOnFire(5);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import net.minecraft.nbt.ListTag;
|
|||
import net.minecraft.nbt.LongTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
@ -57,15 +59,15 @@ public class EntityMoverMinecart extends Minecart {
|
|||
return;
|
||||
var pos = this.blockPosition();
|
||||
|
||||
if (!this.spotOffsets.isEmpty() && this.level.getGameTime() % 10 == 0)
|
||||
PacketHandler.sendToAllAround(this.level, pos, 32, new PacketParticles(
|
||||
if (!this.spotOffsets.isEmpty() && this.level().getGameTime() % 10 == 0)
|
||||
PacketHandler.sendToAllAround(this.level(), pos, 32, new PacketParticles(
|
||||
(float) this.getX(), (float) this.getY(), (float) this.getZ(), PacketParticles.Type.MOVER_CART,
|
||||
Mth.floor(this.getDeltaMovement().x * 100F), Mth.floor(this.getDeltaMovement().y * 100F), Mth.floor(this.getDeltaMovement().z * 100F)));
|
||||
|
||||
if (pos.distSqr(this.lastPosition) < 8 * 8)
|
||||
return;
|
||||
|
||||
this.moveAura(this.level, this.lastPosition, this.level, pos);
|
||||
this.moveAura(this.level(), this.lastPosition, this.level(), pos);
|
||||
this.lastPosition = pos;
|
||||
}
|
||||
|
||||
|
@ -93,13 +95,13 @@ public class EntityMoverMinecart extends Minecart {
|
|||
|
||||
var pos = this.blockPosition();
|
||||
if (!this.isActive) {
|
||||
this.moveAura(this.level, this.lastPosition, this.level, pos);
|
||||
this.moveAura(this.level(), this.lastPosition, this.level(), pos);
|
||||
this.spotOffsets.clear();
|
||||
this.lastPosition = BlockPos.ZERO;
|
||||
return;
|
||||
}
|
||||
|
||||
IAuraChunk.getSpotsInArea(this.level, pos, 25, (spot, amount) -> {
|
||||
IAuraChunk.getSpotsInArea(this.level(), pos, 25, (spot, amount) -> {
|
||||
if (amount > 0)
|
||||
this.spotOffsets.add(spot.subtract(pos));
|
||||
});
|
||||
|
@ -110,7 +112,7 @@ public class EntityMoverMinecart extends Minecart {
|
|||
@Override
|
||||
public void destroy(DamageSource source) {
|
||||
this.kill();
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS))
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS))
|
||||
this.spawnAtLocation(new ItemStack(ModItems.MOVER_CART), 0);
|
||||
}
|
||||
|
||||
|
@ -145,7 +147,7 @@ public class EntityMoverMinecart extends Minecart {
|
|||
var entity = super.changeDimension(destination, teleporter);
|
||||
if (entity instanceof EntityMoverMinecart) {
|
||||
var pos = entity.blockPosition();
|
||||
this.moveAura(this.level, this.lastPosition, entity.level, pos);
|
||||
this.moveAura(this.level(), this.lastPosition, entity.level(), pos);
|
||||
((EntityMoverMinecart) entity).lastPosition = pos;
|
||||
}
|
||||
return entity;
|
||||
|
@ -183,7 +185,7 @@ public class EntityMoverMinecart extends Minecart {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Packet<?> getAddEntityPacket() {
|
||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public class EntityStructureFinder extends EyeOfEnder {
|
|||
this.yRotO += 360.0F;
|
||||
this.setXRot(Mth.lerp(0.2F, this.xRotO, this.getXRot()));
|
||||
this.setYRot(Mth.lerp(0.2F, this.yRotO, this.getYRot()));
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
var d3 = this.targetX - d0;
|
||||
var d4 = this.targetZ - d2;
|
||||
var f1 = (float) Math.sqrt(d3 * d3 + d4 * d4);
|
||||
|
@ -111,21 +111,21 @@ public class EntityStructureFinder extends EyeOfEnder {
|
|||
|
||||
if (this.isInWater()) {
|
||||
for (var i = 0; i < 4; ++i)
|
||||
this.level.addParticle(ParticleTypes.BUBBLE, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
|
||||
} else if (this.level.isClientSide) {
|
||||
this.level().addParticle(ParticleTypes.BUBBLE, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
|
||||
} else if (this.level().isClientSide) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(d0 - vec3d.x * 0.25D + this.random.nextDouble() * 0.6D - 0.3D, d1 - vec3d.y * 0.25D - 0.5D, d2 - vec3d.z * 0.25D + this.random.nextDouble() * 0.6D - 0.3D, vec3d.x * 0.25F, vec3d.y * 0.25F, vec3d.z * 0.25F, this.entityData.get(EntityStructureFinder.COLOR), 1, 50, 0, false, true);
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
this.setPos(d0, d1, d2);
|
||||
++this.despawnTimer;
|
||||
if (this.despawnTimer > 80 && !this.level.isClientSide) {
|
||||
if (this.despawnTimer > 80 && !this.level().isClientSide) {
|
||||
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
|
||||
this.remove(RemovalReason.DISCARDED);
|
||||
if (this.shatterOrDrop) {
|
||||
this.level.addFreshEntity(new ItemEntity(this.level, this.getX(), this.getY(), this.getZ(), this.getItem()));
|
||||
this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
|
||||
} else {
|
||||
PacketHandler.sendToAllAround(this.level, this.blockPosition(), 32, new PacketParticles((float) this.getX(), (float) this.getY(), (float) this.getZ(), PacketParticles.Type.STRUCTURE_FINDER, this.getId()));
|
||||
PacketHandler.sendToAllAround(this.level(), this.blockPosition(), 32, new PacketParticles((float) this.getX(), (float) this.getY(), (float) this.getZ(), PacketParticles.Type.STRUCTURE_FINDER, this.getId()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.ellpeck.naturesaura.entities.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
|
||||
import de.ellpeck.naturesaura.items.ItemEffectPowder;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
|
@ -13,6 +13,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
|||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -40,11 +41,11 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
|
|||
var time = entity.renderTicks + entity.getId() + partialTicks;
|
||||
var bob = (float) Math.sin(time / 10F) * 0.05F;
|
||||
matrixStackIn.translate(0, 0.15F + bob, 0);
|
||||
matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(time * 3 % 360));
|
||||
matrixStackIn.mulPose(Axis.YP.rotationDegrees(time * 3 % 360));
|
||||
var effect = entity.getInhibitedEffect();
|
||||
var stack = this.items.computeIfAbsent(effect,
|
||||
res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.GROUND, packedLightIn, OverlayTexture.NO_OVERLAY, matrixStackIn, bufferIn, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLightIn, OverlayTexture.NO_OVERLAY, matrixStackIn, bufferIn, entity.level(), 0);
|
||||
matrixStackIn.popPose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.entities.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
@ -35,7 +35,7 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
|||
matrixStackIn.pushPose();
|
||||
matrixStackIn.translate(0, 22 / 16F, 0);
|
||||
matrixStackIn.translate(0, 0, 1);
|
||||
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(180));
|
||||
matrixStackIn.mulPose(Axis.XP.rotationDegrees(180));
|
||||
this.model.renderToBuffer(matrixStackIn, bufferIn.getBuffer(this.model.renderType(RenderMoverMinecart.RES)), packedLightIn, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
|
||||
matrixStackIn.popPose();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@ package de.ellpeck.naturesaura.events;
|
|||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
|
@ -18,8 +21,8 @@ import de.ellpeck.naturesaura.items.ModItems;
|
|||
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.ChatScreen;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.BiomeColors;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
|
@ -197,7 +200,7 @@ public class ClientEvents {
|
|||
// dirty raytrace to see if we're looking at roughly this spot
|
||||
if (playerEye.distanceToSqr(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5) <= range * range) {
|
||||
for (var d = 0F; d <= range; d += 0.5F) {
|
||||
if (pos.equals(new BlockPos(playerEye.add(playerView.scale(d))))) {
|
||||
if (pos.equals(BlockPos.containing(playerEye.add(playerView.scale(d))))) {
|
||||
ClientEvents.hoveringAuraSpot = pos;
|
||||
break;
|
||||
}
|
||||
|
@ -250,7 +253,8 @@ public class ClientEvents {
|
|||
@SubscribeEvent
|
||||
public void onOverlayRender(RenderGuiOverlayEvent.Post event) {
|
||||
var mc = Minecraft.getInstance();
|
||||
var stack = event.getPoseStack();
|
||||
var graphics = event.getGuiGraphics();
|
||||
var stack = graphics.pose();
|
||||
if (event.getOverlay() == VanillaGuiOverlay.HOTBAR.type()) {
|
||||
var res = event.getWindow();
|
||||
if (mc.player != null) {
|
||||
|
@ -266,17 +270,16 @@ public class ClientEvents {
|
|||
|
||||
var color = container.getAuraColor();
|
||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
|
||||
if (width < 80)
|
||||
Screen.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||
if (width > 0)
|
||||
Screen.blit(stack, x, y, 0, 6, width, 6, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, x, y, 0, 6, width, 6, 256, 256);
|
||||
|
||||
var scale = 0.75F;
|
||||
stack.pushPose();
|
||||
stack.scale(scale, scale, scale);
|
||||
var s = ClientEvents.heldCache.getHoverName().getString();
|
||||
mc.font.drawShadow(stack, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color);
|
||||
graphics.drawString(mc.font, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color, true);
|
||||
stack.popPose();
|
||||
|
||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
|
||||
|
@ -285,7 +288,6 @@ public class ClientEvents {
|
|||
|
||||
if (!ClientEvents.heldEye.isEmpty() || !ClientEvents.heldOcular.isEmpty()) {
|
||||
stack.pushPose();
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
|
||||
|
||||
int conf = ModConfig.instance.auraBarLocation.get();
|
||||
if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) {
|
||||
|
@ -306,33 +308,33 @@ public class ClientEvents {
|
|||
var tHeight = Mth.ceil(Mth.clamp(totalPercentage, 0F, 1F) * 50);
|
||||
var y = !ClientEvents.heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY;
|
||||
if (tHeight < 50)
|
||||
Screen.blit(stack, startX, y, 6, 12, 6, 50 - tHeight, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, startX, y, 6, 12, 6, 50 - tHeight, 256, 256);
|
||||
if (tHeight > 0)
|
||||
Screen.blit(stack, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
|
||||
|
||||
if (!ClientEvents.heldOcular.isEmpty()) {
|
||||
var topHeight = Mth.ceil(Mth.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25);
|
||||
if (topHeight > 0) {
|
||||
if (topHeight < 25)
|
||||
Screen.blit(stack, startX, startY, 18, 12, 6, 25 - topHeight, 256, 256);
|
||||
Screen.blit(stack, startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, startX, startY, 18, 12, 6, 25 - topHeight, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256);
|
||||
}
|
||||
var bottomHeight = Mth.floor(Mth.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25);
|
||||
if (bottomHeight < 25) {
|
||||
Screen.blit(stack, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256);
|
||||
if (bottomHeight > 0)
|
||||
Screen.blit(stack, startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256);
|
||||
}
|
||||
}
|
||||
|
||||
if (totalPercentage > (ClientEvents.heldOcular.isEmpty() ? 1F : 1.5F))
|
||||
mc.font.drawShadow(stack, "+", startX + plusOffX, startY - 0.5F, color);
|
||||
graphics.drawString(mc.font, "+", startX + plusOffX, startY - 0.5F, color, true);
|
||||
if (totalPercentage < (ClientEvents.heldOcular.isEmpty() ? 0F : -0.5F))
|
||||
mc.font.drawShadow(stack, "-", startX + plusOffX, startY - 0.5F + (ClientEvents.heldOcular.isEmpty() ? 44 : 70), color);
|
||||
graphics.drawString(mc.font, "-", startX + plusOffX, startY - 0.5F + (ClientEvents.heldOcular.isEmpty() ? 44 : 70), color, true);
|
||||
|
||||
stack.pushPose();
|
||||
stack.scale(textScale, textScale, textScale);
|
||||
mc.font.drawShadow(stack, text, textX / textScale, textY / textScale, color);
|
||||
graphics.drawString(mc.font, text, textX / textScale, textY / textScale, color, true);
|
||||
stack.popPose();
|
||||
|
||||
if (!ClientEvents.heldOcular.isEmpty()) {
|
||||
|
@ -342,11 +344,10 @@ public class ClientEvents {
|
|||
var stackY = conf < 2 ? 10 : res.getGuiScaledHeight() - 60;
|
||||
for (var effect : ClientEvents.SHOWING_EFFECTS.values()) {
|
||||
var itemStack = effect.getA();
|
||||
Helper.renderItemInGui(itemStack, stackX, stackY, 1F);
|
||||
Helper.renderItemInGui(graphics, itemStack, stackX, stackY, 1F);
|
||||
if (effect.getB()) {
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
|
||||
Screen.blit(stack, stackX, stackY, 240, 0, 16, 16, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, stackX, stackY, 240, 0, 16, 16, 256, 256);
|
||||
RenderSystem.enableDepthTest();
|
||||
}
|
||||
stackY += 12;
|
||||
|
@ -365,7 +366,7 @@ public class ClientEvents {
|
|||
if (tile != null && (container = tile.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER, null).orElse(null)) != null) {
|
||||
var state = mc.level.getBlockState(pos);
|
||||
var blockStack = state.getBlock().getCloneItemStack(state, blockHitResult, mc.level, pos, mc.player);
|
||||
this.drawContainerInfo(stack, container.getStoredAura(), container.getMaxAura(), container.getAuraColor(),
|
||||
this.drawContainerInfo(graphics, container.getStoredAura(), container.getMaxAura(), container.getAuraColor(),
|
||||
mc, res, 35, blockStack.getHoverName().getString(), null);
|
||||
|
||||
if (tile instanceof BlockEntityNatureAltar) {
|
||||
|
@ -373,46 +374,44 @@ public class ClientEvents {
|
|||
if (!tileStack.isEmpty()) {
|
||||
var stackCont = tileStack.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER, null).orElse(null);
|
||||
if (stackCont != null) {
|
||||
this.drawContainerInfo(stack, stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(),
|
||||
this.drawContainerInfo(graphics, stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(),
|
||||
mc, res, 55, tileStack.getHoverName().getString(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (tile instanceof BlockEntityRFConverter) {
|
||||
EnergyStorage storage = ((BlockEntityRFConverter) tile).storage;
|
||||
this.drawContainerInfo(stack, storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916,
|
||||
this.drawContainerInfo(graphics, storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916,
|
||||
mc, res, 35, I18n.get("block.naturesaura.rf_converter"),
|
||||
storage.getEnergyStored() + " / " + storage.getMaxEnergyStored() + " RF");
|
||||
} else if (tile instanceof BlockEntityGratedChute chute) {
|
||||
var itemStack = chute.getItemHandler().getStackInSlot(0);
|
||||
|
||||
if (itemStack.isEmpty()) {
|
||||
mc.font.drawShadow(stack,
|
||||
graphics.drawString(mc.font,
|
||||
ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info.naturesaura.empty"),
|
||||
x + 5, y - 11, 0xFFFFFF);
|
||||
} else {
|
||||
Helper.renderItemInGui(itemStack, x + 2, y - 18, 1F);
|
||||
Helper.renderItemInGui(graphics, itemStack, x + 2, y - 18, 1F);
|
||||
}
|
||||
|
||||
Helper.renderItemInGui(ClientEvents.ITEM_FRAME, x - 24, y - 24, 1F);
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
|
||||
Helper.renderItemInGui(graphics, ClientEvents.ITEM_FRAME, x - 24, y - 24, 1F);
|
||||
var u = chute.isBlacklist ? 240 : 224;
|
||||
RenderSystem.disableDepthTest();
|
||||
Screen.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
||||
RenderSystem.enableDepthTest();
|
||||
} else if (tile instanceof BlockEntityItemDistributor distributor) {
|
||||
Helper.renderItemInGui(ClientEvents.DISPENSER, x - 24, y - 24, 1F);
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
|
||||
Helper.renderItemInGui(graphics, ClientEvents.DISPENSER, x - 24, y - 24, 1F);
|
||||
var u = !distributor.isRandomMode ? 240 : 224;
|
||||
RenderSystem.disableDepthTest();
|
||||
Screen.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
||||
RenderSystem.enableDepthTest();
|
||||
} else if (tile instanceof BlockEntityAuraTimer timer) {
|
||||
var itemStack = timer.getItemHandler().getStackInSlot(0);
|
||||
if (!itemStack.isEmpty()) {
|
||||
Helper.renderItemInGui(itemStack, x - 20, y - 20, 1);
|
||||
mc.font.drawShadow(stack, ChatFormatting.GRAY + this.createTimeString(timer.getTotalTime()), x + 5, y - 11, 0xFFFFFF);
|
||||
mc.font.drawShadow(stack, ChatFormatting.GRAY + I18n.get("info.naturesaura.remaining", this.createTimeString(timer.getTimeLeft())), x + 5, y + 3, 0xFFFFFF);
|
||||
Helper.renderItemInGui(graphics, itemStack, x - 20, y - 20, 1);
|
||||
graphics.drawString(mc.font, ChatFormatting.GRAY + this.createTimeString(timer.getTotalTime()), x + 5, y - 11, 0xFFFFFF);
|
||||
graphics.drawString(mc.font, ChatFormatting.GRAY + I18n.get("info.naturesaura.remaining", this.createTimeString(timer.getTimeLeft())), x + 5, y + 3, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -426,10 +425,10 @@ public class ClientEvents {
|
|||
var format = NumberFormat.getInstance();
|
||||
var spot = IAuraChunk.getAuraChunk(mc.level, ClientEvents.hoveringAuraSpot).getActualDrainSpot(ClientEvents.hoveringAuraSpot, false);
|
||||
var color = spot.intValue() > 0 ? ChatFormatting.GREEN : ChatFormatting.RED;
|
||||
mc.font.drawShadow(stack, "Pos: " + spot.pos.toShortString(), res.getGuiScaledWidth() / 2F + 5, res.getGuiScaledHeight() / 2F - 20, 0xFFFFFF);
|
||||
mc.font.drawShadow(stack, "Amount: " + color + format.format(spot.intValue()), res.getGuiScaledWidth() / 2F + 5, res.getGuiScaledHeight() / 2F - 10, 0xFFFFFF);
|
||||
graphics.drawString(mc.font, "Pos: " + spot.pos.toShortString(), res.getGuiScaledWidth() / 2F + 5, res.getGuiScaledHeight() / 2F - 20, 0xFFFFFF, true);
|
||||
graphics.drawString(mc.font, "Amount: " + color + format.format(spot.intValue()), res.getGuiScaledWidth() / 2F + 5, res.getGuiScaledHeight() / 2F - 10, 0xFFFFFF, true);
|
||||
if (spot.originalSpreadPos != null)
|
||||
mc.font.drawShadow(stack, "Dist from Original: " + (int) Math.sqrt(spot.pos.distSqr(spot.originalSpreadPos)) + " (" + spot.originalSpreadPos.toShortString() + ")", res.getGuiScaledWidth() / 2F + 5, res.getGuiScaledHeight() / 2F, 0xFFFFFF);
|
||||
graphics.drawString(mc.font, "Dist from Original: " + (int) Math.sqrt(spot.pos.distSqr(spot.originalSpreadPos)) + " (" + spot.originalSpreadPos.toShortString() + ")", res.getGuiScaledWidth() / 2F + 5, res.getGuiScaledHeight() / 2F, 0xFFFFFF, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -443,22 +442,21 @@ public class ClientEvents {
|
|||
return String.format("%02d:%02d:%02d.%02d", hours, minutes, seconds, ticks);
|
||||
}
|
||||
|
||||
private void drawContainerInfo(PoseStack stack, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) {
|
||||
private void drawContainerInfo(GuiGraphics graphics, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) {
|
||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
||||
|
||||
var x = res.getGuiScaledWidth() / 2 - 40;
|
||||
var y = res.getGuiScaledHeight() / 2 + yOffset;
|
||||
var width = Mth.ceil(stored / (float) max * 80);
|
||||
|
||||
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
|
||||
if (width < 80)
|
||||
Screen.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||
if (width > 0)
|
||||
Screen.blit(stack, x, y, 0, 6, width, 6, 256, 256);
|
||||
graphics.blit(ClientEvents.OVERLAYS, x, y, 0, 6, width, 6, 256, 256);
|
||||
|
||||
mc.font.drawShadow(stack, name, x + 40 - mc.font.width(name) / 2F, y - 9, color);
|
||||
graphics.drawString(mc.font, name, x + 40 - mc.font.width(name) / 2F, y - 9, color, true);
|
||||
|
||||
if (textBelow != null)
|
||||
mc.font.drawShadow(stack, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color);
|
||||
graphics.drawString(mc.font, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,13 +65,13 @@ public class CommonEvents {
|
|||
@SubscribeEvent
|
||||
public void onItemUse(PlayerInteractEvent.RightClickBlock event) {
|
||||
var player = event.getEntity();
|
||||
if (player.level.isClientSide)
|
||||
if (player.level().isClientSide)
|
||||
return;
|
||||
var held = event.getItemStack();
|
||||
if (!held.isEmpty() && ForgeRegistries.ITEMS.getKey(held.getItem()).getPath().contains("chisel")) {
|
||||
var state = player.level.getBlockState(event.getPos());
|
||||
var state = player.level().getBlockState(event.getPos());
|
||||
if (NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.containsKey(state)) {
|
||||
var data = (LevelData) ILevelData.getLevelData(player.level);
|
||||
var data = (LevelData) ILevelData.getLevelData(player.level());
|
||||
data.addMossStone(event.getPos());
|
||||
}
|
||||
}
|
||||
|
@ -104,16 +104,16 @@ public class CommonEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
if (!event.player.level.isClientSide && event.phase == TickEvent.Phase.END) {
|
||||
if (event.player.level.getGameTime() % 10 == 0) {
|
||||
if (!event.player.level().isClientSide && event.phase == TickEvent.Phase.END) {
|
||||
if (event.player.level().getGameTime() % 10 == 0) {
|
||||
var pending = CommonEvents.PENDING_AURA_CHUNKS.get(event.player.getUUID());
|
||||
pending.removeIf(p -> this.handleChunkWatchDeferred(event.player, p));
|
||||
}
|
||||
|
||||
if (event.player.level.getGameTime() % 200 != 0)
|
||||
if (event.player.level().getGameTime() % 200 != 0)
|
||||
return;
|
||||
|
||||
var aura = IAuraChunk.triangulateAuraInArea(event.player.level, event.player.blockPosition(), 25);
|
||||
var aura = IAuraChunk.triangulateAuraInArea(event.player.level(), event.player.blockPosition(), 25);
|
||||
if (aura <= 0)
|
||||
Helper.addAdvancement(event.player, new ResourceLocation(NaturesAura.MOD_ID, "negative_imbalance"), "triggered_in_code");
|
||||
else if (aura >= 1500000)
|
||||
|
@ -127,7 +127,7 @@ public class CommonEvents {
|
|||
}
|
||||
|
||||
private boolean handleChunkWatchDeferred(Player player, ChunkPos pos) {
|
||||
var chunk = Helper.getLoadedChunk(player.level, pos.x, pos.z);
|
||||
var chunk = Helper.getLoadedChunk(player.level(), pos.x, pos.z);
|
||||
if (!(chunk instanceof LevelChunk levelChunk))
|
||||
return false;
|
||||
var auraChunk = (AuraChunk) levelChunk.getCapability(NaturesAuraAPI.CAP_AURA_CHUNK, null).orElse(null);
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.gen;
|
|||
import com.mojang.serialization.Codec;
|
||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -14,9 +15,9 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
|||
import net.minecraft.world.level.levelgen.feature.TreeFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
import static net.minecraft.core.Direction.Axis;
|
||||
import static net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase;
|
||||
|
||||
public class LevelGenAncientTree extends Feature<NoneFeatureConfiguration> {
|
||||
|
||||
|
@ -41,8 +42,8 @@ public class LevelGenAncientTree extends Feature<NoneFeatureConfiguration> {
|
|||
var x = (float) Math.sin(angle) * length;
|
||||
var z = (float) Math.cos(angle) * length;
|
||||
|
||||
var goal = pos.offset(x, 0, z);
|
||||
while (level.isStateAtPosition(goal, state -> state.getMaterial().isReplaceable())) {
|
||||
var goal = pos.offset(Mth.floor(x), 0, Mth.floor(z));
|
||||
while (level.isStateAtPosition(goal, BlockStateBase::canBeReplaced)) {
|
||||
goal = goal.below();
|
||||
if (goal.distSqr(pos) >= 10 * 10)
|
||||
break;
|
||||
|
@ -71,7 +72,7 @@ public class LevelGenAncientTree extends Feature<NoneFeatureConfiguration> {
|
|||
var x = (float) Math.sin(angle) * length;
|
||||
var z = (float) Math.cos(angle) * length;
|
||||
|
||||
var goal = trunkTop.offset(x, rand.nextInt(3) + 1, z);
|
||||
var goal = trunkTop.offset(Mth.floor(x), rand.nextInt(3) + 1, Mth.floor(z));
|
||||
this.makeBranch(level, trunkTop, goal, ModBlocks.ANCIENT_LOG.defaultBlockState(), true);
|
||||
this.makeLeaves(level, goal, ModBlocks.ANCIENT_LEAVES.defaultBlockState(), rand.nextInt(2) + 2, rand);
|
||||
}
|
||||
|
@ -87,7 +88,7 @@ public class LevelGenAncientTree extends Feature<NoneFeatureConfiguration> {
|
|||
var stepZ = (float) pos.getZ() / (float) length;
|
||||
|
||||
for (var i = 0; i <= length; i++) {
|
||||
var goal = first.offset(0.5F + i * stepX, 0.5F + i * stepY, 0.5F + i * stepZ);
|
||||
var goal = first.offset(Mth.floor(0.5F + i * stepX), Mth.floor(0.5F + i * stepY), Mth.floor(0.5F + i * stepZ));
|
||||
if (!level.isStateAtPosition(goal, s -> !TreeFeature.validTreePos(level, goal))) {
|
||||
if (hasAxis) {
|
||||
var axis = this.getLogAxis(first, goal);
|
||||
|
@ -105,8 +106,8 @@ public class LevelGenAncientTree extends Feature<NoneFeatureConfiguration> {
|
|||
for (var z = -radius; z <= radius; z++) {
|
||||
var goal = pos.offset(x, y, z);
|
||||
if (pos.distSqr(goal) <= radius * radius + rand.nextInt(3) - 1) {
|
||||
if (!level.isStateAtPosition(goal, s -> s.getMaterial() == Material.LEAVES)) {
|
||||
if (level.isStateAtPosition(goal, st -> st.getMaterial() != Material.WOOD && st.getBlock() != Blocks.DIRT && st.getBlock() != Blocks.GRASS))
|
||||
if (!level.isStateAtPosition(goal, s -> s.is(BlockTags.LEAVES))) {
|
||||
if (level.isStateAtPosition(goal, st -> !st.is(BlockTags.LOGS) && st.getBlock() != Blocks.DIRT && st.getBlock() != Blocks.GRASS))
|
||||
this.setBlock(level, goal, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package de.ellpeck.naturesaura.gui;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -21,25 +19,23 @@ public class GuiEnderCrate extends AbstractContainerScreen<ContainerEnderCrate>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
this.renderBackground(matrixStack);
|
||||
super.render(matrixStack, mouseX, mouseY, partialTicks);
|
||||
this.renderTooltip(matrixStack, mouseX, mouseY);
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
|
||||
this.renderBackground(graphics);
|
||||
super.render(graphics, mouseX, mouseY, partialTicks);
|
||||
this.renderTooltip(graphics, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderLabels(PoseStack matrixStack, int mouseX, int mouseY) {
|
||||
this.font.draw(matrixStack, this.title.getString(), 8, 6, 4210752);
|
||||
this.font.draw(matrixStack, this.playerInventoryTitle, 8, this.imageHeight - 96 + 2, 4210752);
|
||||
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752);
|
||||
graphics.drawString(this.font, this.playerInventoryTitle, 8, this.imageHeight - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(PoseStack matrixStack, float partialTicks, int mouseX, int mouseY) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, GuiEnderCrate.CHEST_GUI_TEXTURE);
|
||||
protected void renderBg(GuiGraphics graphics, float partialTicks, int mouseX, int mouseY) {
|
||||
var i = (this.width - this.imageWidth) / 2;
|
||||
var j = (this.height - this.imageHeight) / 2;
|
||||
this.blit(matrixStack, i, j, 0, 0, this.imageWidth, 3 * 18 + 17);
|
||||
this.blit(matrixStack, i, j + 3 * 18 + 17, 0, 126, this.imageWidth, 96);
|
||||
graphics.blit(GuiEnderCrate.CHEST_GUI_TEXTURE, i, j, 0, 0, this.imageWidth, 3 * 18 + 17);
|
||||
graphics.blit(GuiEnderCrate.CHEST_GUI_TEXTURE, i, j + 3 * 18 + 17, 0, 126, this.imageWidth, 96);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICu
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO aura bottle creative
|
||||
/* @Override
|
||||
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
|
||||
if (this.allowedIn(tab)) {
|
||||
for (var type : NaturesAuraAPI.AURA_TYPES.values()) {
|
||||
|
@ -61,7 +62,7 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICu
|
|||
items.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Component getName(ItemStack stack) {
|
||||
|
@ -116,19 +117,19 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICu
|
|||
if (held.isEmpty() || held.getItem() != ModItems.BOTTLE_TWO_THE_REBOTTLING)
|
||||
return;
|
||||
var player = event.getEntity();
|
||||
HitResult ray = Item.getPlayerPOVHitResult(player.level, player, ClipContext.Fluid.NONE);
|
||||
HitResult ray = Item.getPlayerPOVHitResult(player.level(), player, ClipContext.Fluid.NONE);
|
||||
if (ray.getType() == HitResult.Type.BLOCK)
|
||||
return;
|
||||
var bottle = ItemAuraBottle.create(player.level, player.blockPosition());
|
||||
var bottle = ItemAuraBottle.create(player.level(), player.blockPosition());
|
||||
if (bottle.isEmpty())
|
||||
return;
|
||||
|
||||
if (!player.level.isClientSide) {
|
||||
if (!player.level().isClientSide) {
|
||||
held.shrink(1);
|
||||
if (!player.addItem(bottle))
|
||||
player.level.addFreshEntity(new ItemEntity(player.level, player.getX(), player.getY(), player.getZ(), bottle));
|
||||
player.level().addFreshEntity(new ItemEntity(player.level(), player.getX(), player.getY(), player.getZ(), bottle));
|
||||
|
||||
player.level.playSound(null, player.getX(), player.getY(), player.getZ(),
|
||||
player.level().playSound(null, player.getX(), player.getY(), player.getZ(),
|
||||
SoundEvents.BOTTLE_FILL_DRAGONBREATH, SoundSource.PLAYERS, 1F, 1F);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.ellpeck.naturesaura.items;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer;
|
||||
|
@ -9,15 +9,13 @@ import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
|||
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -63,7 +61,8 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO creative tabs for items with variations
|
||||
/* @Override
|
||||
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
|
||||
if (this.allowedIn(tab)) {
|
||||
items.add(new ItemStack(this));
|
||||
|
@ -74,7 +73,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
|||
items.add(stack);
|
||||
});
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public boolean isBarVisible(ItemStack stack) {
|
||||
|
@ -122,8 +121,8 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
|||
var legs = !player.getInventory().armor.get(EquipmentSlot.LEGS.getIndex()).isEmpty();
|
||||
matrices.translate(-0.15F, 0.65F, chest ? -0.195F : legs ? -0.165F : -0.1475F);
|
||||
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||
matrices.mulPose(Vector3f.XP.rotationDegrees(180F));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer, 0);
|
||||
matrices.mulPose(Axis.XP.rotationDegrees(180F));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer, player.level(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,18 +20,18 @@ public class ItemBirthSpirit extends ItemGlowing {
|
|||
@SubscribeEvent
|
||||
public void onBabyBorn(BabyEntitySpawnEvent event) {
|
||||
LivingEntity parent = event.getParentA();
|
||||
if (!parent.level.isClientSide && event.getCausedByPlayer() != null) {
|
||||
if (!parent.level().isClientSide && event.getCausedByPlayer() != null) {
|
||||
var pos = parent.blockPosition();
|
||||
var aura = IAuraChunk.getAuraInArea(parent.level, pos, 30);
|
||||
var aura = IAuraChunk.getAuraInArea(parent.level(), pos, 30);
|
||||
if (aura < 1200000)
|
||||
return;
|
||||
|
||||
var amount = parent.level.random.nextInt(3) + 1;
|
||||
var item = new ItemEntity(parent.level, parent.getX(), parent.getY(), parent.getZ(), new ItemStack(ModItems.BIRTH_SPIRIT, amount));
|
||||
parent.level.addFreshEntity(item);
|
||||
var amount = parent.level().random.nextInt(3) + 1;
|
||||
var item = new ItemEntity(parent.level(), parent.getX(), parent.getY(), parent.getZ(), new ItemStack(ModItems.BIRTH_SPIRIT, amount));
|
||||
parent.level().addFreshEntity(item);
|
||||
|
||||
var spot = IAuraChunk.getHighestSpot(parent.level, pos, 30, pos);
|
||||
IAuraChunk.getAuraChunk(parent.level, spot).drainAura(spot, 800 * amount);
|
||||
var spot = IAuraChunk.getHighestSpot(parent.level(), pos, 30, pos);
|
||||
IAuraChunk.getAuraChunk(parent.level(), spot).drainAura(spot, 800 * amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ItemCaveFinder extends ItemImpl {
|
|||
|
||||
var offUp = offset.above();
|
||||
var stateUp = levelIn.getBlockState(offUp);
|
||||
if (stateUp.isCollisionShapeFullBlock(levelIn, offUp) || stateUp.getMaterial().isLiquid())
|
||||
if (stateUp.isCollisionShapeFullBlock(levelIn, offUp) || stateUp.liquid())
|
||||
continue;
|
||||
|
||||
var sky = levelIn.getBrightness(LightLayer.SKY, offUp);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ItemDeathRing extends ItemImpl {
|
|||
@SubscribeEvent
|
||||
public void onDeath(LivingDeathEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (!entity.level.isClientSide && entity instanceof Player) {
|
||||
if (!entity.level().isClientSide && entity instanceof Player) {
|
||||
var equipped = Helper.getEquippedItem(s -> s.getItem() == ModItems.DEATH_RING, (Player) entity);
|
||||
if (!equipped.isEmpty()) {
|
||||
entity.setHealth(entity.getMaxHealth() / 2);
|
||||
|
@ -32,7 +32,7 @@ public class ItemDeathRing extends ItemImpl {
|
|||
|
||||
var data = new CompoundTag();
|
||||
data.putInt("id", entity.getId());
|
||||
PacketHandler.sendToAllAround(entity.level, entity.blockPosition(), 32, new PacketClient(1, data));
|
||||
PacketHandler.sendToAllAround(entity.level(), entity.blockPosition(), 32, new PacketClient(1, data));
|
||||
|
||||
equipped.shrink(1);
|
||||
event.setCanceled(true);
|
||||
|
|
|
@ -46,7 +46,8 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
|
|||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO effect powder creative tab
|
||||
/* @Override
|
||||
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
|
||||
if (this.allowedIn(tab)) {
|
||||
for (var effect : NaturesAuraAPI.EFFECT_POWDERS.keySet()) {
|
||||
|
@ -55,7 +56,7 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
|
|||
items.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Component getName(ItemStack stack) {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ItemEnderAccess extends ItemImpl {
|
|||
@Nullable
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int windowId, Inventory inv, Player player) {
|
||||
IItemHandler handler = ILevelData.getOverworldData(inv.player.level).getEnderStorage(name);
|
||||
IItemHandler handler = ILevelData.getOverworldData(inv.player.level()).getEnderStorage(name);
|
||||
return new ContainerEnderCrate(ModContainers.ENDER_ACCESS, windowId, player, handler);
|
||||
}
|
||||
}, buffer -> buffer.writeUtf(name));
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package de.ellpeck.naturesaura.items;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -26,8 +26,8 @@ public class ItemEye extends ItemImpl implements ITrinketItem {
|
|||
var armor = !player.getInventory().armor.get(EquipmentSlot.CHEST.getIndex()).isEmpty();
|
||||
matrices.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
|
||||
matrices.scale(0.3F, 0.3F, 0.3F);
|
||||
matrices.mulPose(Vector3f.XP.rotationDegrees(180));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer, 0);
|
||||
matrices.mulPose(Axis.XP.rotationDegrees(180));
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer, player.level(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class ItemImpl extends Item implements IModItem {
|
|||
}
|
||||
|
||||
public ItemImpl(String baseName, Item.Properties properties) {
|
||||
super(properties.tab(NaturesAura.CREATIVE_TAB));
|
||||
super(properties);
|
||||
this.baseName = baseName;
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
}
|
||||
|
|
|
@ -33,19 +33,19 @@ public class ItemPetReviver extends ItemImpl {
|
|||
@SubscribeEvent
|
||||
public void onEntityTick(LivingEvent.LivingTickEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (entity.level.isClientSide || entity.level.getGameTime() % 20 != 0 || !(entity instanceof TamableAnimal tameable))
|
||||
if (entity.level().isClientSide || entity.level().getGameTime() % 20 != 0 || !(entity instanceof TamableAnimal tameable))
|
||||
return;
|
||||
if (!tameable.isTame() || !tameable.getPersistentData().getBoolean(NaturesAura.MOD_ID + ":pet_reviver"))
|
||||
return;
|
||||
var owner = tameable.getOwner();
|
||||
if (owner == null || owner.distanceToSqr(tameable) > 5 * 5)
|
||||
return;
|
||||
if (entity.level.random.nextFloat() >= 0.65F) {
|
||||
((ServerLevel) entity.level).sendParticles(ParticleTypes.HEART,
|
||||
entity.getX() + entity.level.random.nextGaussian() * 0.25F,
|
||||
entity.getEyeY() + entity.level.random.nextGaussian() * 0.25F,
|
||||
entity.getZ() + entity.level.random.nextGaussian() * 0.25F,
|
||||
entity.level.random.nextInt(2) + 1, 0, 0, 0, 0);
|
||||
if (entity.level().random.nextFloat() >= 0.65F) {
|
||||
((ServerLevel) entity.level()).sendParticles(ParticleTypes.HEART,
|
||||
entity.getX() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.getEyeY() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.getZ() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.level().random.nextInt(2) + 1, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ItemPetReviver extends ItemImpl {
|
|||
if (stack.getItem() != ModItems.PET_REVIVER)
|
||||
return;
|
||||
target.getPersistentData().putBoolean(NaturesAura.MOD_ID + ":pet_reviver", true);
|
||||
if (!target.level.isClientSide)
|
||||
if (!target.level().isClientSide)
|
||||
stack.shrink(1);
|
||||
event.setCancellationResult(InteractionResult.SUCCESS);
|
||||
event.setCanceled(true);
|
||||
|
@ -71,13 +71,13 @@ public class ItemPetReviver extends ItemImpl {
|
|||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onLivingDeath(LivingDeathEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (entity.level.isClientSide || !(entity instanceof TamableAnimal tameable))
|
||||
if (entity.level().isClientSide || !(entity instanceof TamableAnimal tameable))
|
||||
return;
|
||||
if (!tameable.isTame() || !tameable.getPersistentData().getBoolean(NaturesAura.MOD_ID + ":pet_reviver"))
|
||||
return;
|
||||
|
||||
// get the overworld, and the overworld's spawn point, by default
|
||||
var spawnLevel = tameable.level.getServer().overworld();
|
||||
var spawnLevel = tameable.level().getServer().overworld();
|
||||
var spawn = Vec3.atBottomCenterOf(spawnLevel.getSharedSpawnPos());
|
||||
|
||||
// check if the owner is online, and respawn at the bed if they are
|
||||
|
@ -87,18 +87,18 @@ public class ItemPetReviver extends ItemImpl {
|
|||
if (pos != null) {
|
||||
var f = player.getRespawnAngle();
|
||||
var b = player.isRespawnForced();
|
||||
var bed = Player.findRespawnPositionAndUseSpawnBlock((ServerLevel) player.level, pos, f, b, false);
|
||||
var bed = Player.findRespawnPositionAndUseSpawnBlock((ServerLevel) player.level(), pos, f, b, false);
|
||||
if (bed.isPresent()) {
|
||||
spawnLevel = (ServerLevel) player.level;
|
||||
spawnLevel = (ServerLevel) player.level();
|
||||
spawn = bed.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PacketHandler.sendToAllAround(tameable.level, tameable.blockPosition(), 32, new PacketParticles((float) tameable.getX(), (float) tameable.getEyeY(), (float) tameable.getZ(), PacketParticles.Type.PET_REVIVER, 0xc2461d));
|
||||
PacketHandler.sendToAllAround(tameable.level(), tameable.blockPosition(), 32, new PacketParticles((float) tameable.getX(), (float) tameable.getEyeY(), (float) tameable.getZ(), PacketParticles.Type.PET_REVIVER, 0xc2461d));
|
||||
|
||||
var spawnedPet = tameable;
|
||||
if (tameable.level != spawnLevel) {
|
||||
if (tameable.level() != spawnLevel) {
|
||||
tameable.remove(Entity.RemovalReason.DISCARDED);
|
||||
spawnedPet = (TamableAnimal) tameable.getType().create(spawnLevel);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class ItemPetReviver extends ItemImpl {
|
|||
spawnedPet.setInSittingPose(true);
|
||||
spawnedPet.setJumping(false);
|
||||
spawnedPet.setTarget(null);
|
||||
if (tameable.level != spawnLevel) {
|
||||
if (tameable.level() != spawnLevel) {
|
||||
spawnLevel.addFreshEntity(spawnedPet);
|
||||
tameable.remove(Entity.RemovalReason.DISCARDED);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class ItemPetReviver extends ItemImpl {
|
|||
var auraPos = IAuraChunk.getHighestSpot(spawnLevel, spawnedPet.blockPosition(), 35, spawnedPet.blockPosition());
|
||||
IAuraChunk.getAuraChunk(spawnLevel, auraPos).drainAura(auraPos, 200000);
|
||||
|
||||
PacketHandler.sendToAllAround(spawnedPet.level, spawnedPet.blockPosition(), 32, new PacketParticles((float) spawnedPet.getX(), (float) spawnedPet.getEyeY(), (float) spawnedPet.getZ(), PacketParticles.Type.PET_REVIVER, 0x4dba2f));
|
||||
PacketHandler.sendToAllAround(spawnedPet.level(), spawnedPet.blockPosition(), 32, new PacketParticles((float) spawnedPet.getX(), (float) spawnedPet.getEyeY(), (float) spawnedPet.getZ(), PacketParticles.Type.PET_REVIVER, 0x4dba2f));
|
||||
|
||||
if (owner instanceof Player)
|
||||
owner.sendSystemMessage(Component.translatable("info." + NaturesAura.MOD_ID + ".pet_reviver", spawnedPet.getDisplayName()).withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY));
|
||||
|
|
|
@ -83,8 +83,8 @@ public class ItemRangeVisualizer extends ItemImpl {
|
|||
return;
|
||||
var entity = event.getTarget();
|
||||
if (entity instanceof IVisualizable) {
|
||||
if (entity.level.isClientSide) {
|
||||
var dim = entity.level.dimension().location();
|
||||
if (entity.level().isClientSide) {
|
||||
var dim = entity.level().dimension().location();
|
||||
ItemRangeVisualizer.visualize(event.getEntity(), ItemRangeVisualizer.VISUALIZED_ENTITIES, dim, entity);
|
||||
}
|
||||
event.getEntity().swing(event.getHand());
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue