diff --git a/build.gradle b/build.gradle index 3f4cd7d89..c330f1a67 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '5.1.+' + id 'net.minecraftforge.gradle' version '[6.0,6.2)' } java.toolchain.languageVersion = JavaLanguageVersion.of(17) @@ -12,10 +12,15 @@ version = "${mc_version}-${mod_version}" group = 'com.lothrazar.cyclic' archivesBaseName = 'Cyclic' +base { + archivesName = mod_id +} + minecraft { mappings channel: 'official', version: "${mc_version}" accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + copyIdeResources = true // Default run configurations. // These can be tweaked, removed, or duplicated as needed. @@ -33,7 +38,7 @@ minecraft { property 'mixin.env.disableRefMap', 'true' mods { - cyclic { + "${mod_id}" { source sourceSets.main } } @@ -70,7 +75,8 @@ dependencies { // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-common:${jei_version}") runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") - implementation fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}") + // runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${version}") + // compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${version}:api") // optional compat: guidebook //RIP patchouli i will miss you please stop being dead soon @@ -106,6 +112,26 @@ repositories { maven { url = "https://modmaven.dev" } // maven { url 'https://www.cursemaven.com' } } + + + +def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] +def replaceProperties = [ + minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, + forge_version: forge_version, forge_version_range: forge_version_range, + loader_version_range: loader_version_range, + mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_authors: mod_authors, mod_description: mod_description +] +processResources { + inputs.properties replaceProperties + replaceProperties.put 'project', project + + filesMatching(resourceTargets) { + expand replaceProperties + } +} + // Example for how to get properties into the manifest for reading by the runtime.. jar { manifest { diff --git a/gradle.properties b/gradle.properties index 3a47378fb..48610ce84 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,15 +6,28 @@ org.gradle.daemon=false # as needed run/server.properties : online-mode=false dist_folder=c:/temp +mod_id=cyclic +mod_name=cyclic +id=cyclic +mod_license=All Rights Reserved +mod_authors=Lothrazar +mod_description=stuff +mod_group_id=com.lothrazar.cyclic curse_id=239286 mod_version=1.10.0 -mc_version=1.19.4 -forge_version=45.1.0 - +minecraft_version=1.20 +mc_version=1.20 +minecraft_version_range=[1.20,1.21) +# The Forge version must agree with the Minecraft version to get a valid artifact +forge_version=46.0.13 +# The Forge version range can use any version of Forge as bounds or match the loader version range +forge_version_range=[46,) +# The loader version range can only use the major version of Forge/FML as bounds +loader_version_range=[46,) # optional dependencies -jei_version=13.1.0.11 -curios_version=5.1.5.3 +jei_version=14.0.0.5 +curios_version=5.2.0-beta.1+1.20 patchouli_version=78 # for eclipse.ini if needed diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f..943f0cbfa 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee..37aef8d3f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6c..65dcd68d6 100644 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/gradlew.bat b/gradlew.bat index f127cfd49..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/src/main/java/com/lothrazar/cyclic/api/IHasTooltip.java b/src/main/java/com/lothrazar/cyclic/api/IHasTooltip.java index 2d70b878a..f2bf34cf8 100644 --- a/src/main/java/com/lothrazar/cyclic/api/IHasTooltip.java +++ b/src/main/java/com/lothrazar/cyclic/api/IHasTooltip.java @@ -10,7 +10,7 @@ public interface IHasTooltip { * * @return tooltips as a list */ - public List getTooltip(); + public List getTooltips(); /** * Override the tooltip and set it to a new list containing this string diff --git a/src/main/java/com/lothrazar/cyclic/block/anvil/ScreenAnvil.java b/src/main/java/com/lothrazar/cyclic/block/anvil/ScreenAnvil.java index e14153dbe..d7844ed99 100644 --- a/src/main/java/com/lothrazar/cyclic/block/anvil/ScreenAnvil.java +++ b/src/main/java/com/lothrazar/cyclic/block/anvil/ScreenAnvil.java @@ -5,6 +5,8 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -15,7 +17,7 @@ public class ScreenAnvil extends ScreenBase { public ScreenAnvil(ContainerAnvil screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileAnvilAuto.MAX); + this.energy = new EnergyBar(this.font, TileAnvilAuto.MAX); } @Override @@ -31,7 +33,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -40,13 +42,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 54, 34); this.drawSlotLarge(ms, 104, 30); diff --git a/src/main/java/com/lothrazar/cyclic/block/anvilmagma/ScreenAnvilMagma.java b/src/main/java/com/lothrazar/cyclic/block/anvilmagma/ScreenAnvilMagma.java index 2c6f41a68..bd78a4161 100644 --- a/src/main/java/com/lothrazar/cyclic/block/anvilmagma/ScreenAnvilMagma.java +++ b/src/main/java/com/lothrazar/cyclic/block/anvilmagma/ScreenAnvilMagma.java @@ -5,6 +5,8 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -15,7 +17,7 @@ public class ScreenAnvilMagma extends ScreenBase { public ScreenAnvilMagma(ContainerAnvilMagma screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, 152, 8, TileAnvilMagma.CAPACITY); + fluid = new FluidBar(this.font, 152, 8, TileAnvilMagma.CAPACITY); } @Override @@ -30,7 +32,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -38,14 +40,14 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 54, 34); this.drawSlotLarge(ms, 104, 30); diff --git a/src/main/java/com/lothrazar/cyclic/block/anvilvoid/ScreenAnvilVoid.java b/src/main/java/com/lothrazar/cyclic/block/anvilvoid/ScreenAnvilVoid.java index 3116a4646..edf81a031 100644 --- a/src/main/java/com/lothrazar/cyclic/block/anvilvoid/ScreenAnvilVoid.java +++ b/src/main/java/com/lothrazar/cyclic/block/anvilvoid/ScreenAnvilVoid.java @@ -6,6 +6,8 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -16,7 +18,7 @@ public class ScreenAnvilVoid extends ScreenBase { public ScreenAnvilVoid(ContainerAnvilVoid screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, 152, 8, TileAnvilVoid.CAPACITY); + fluid = new FluidBar(this.font, 152, 8, TileAnvilVoid.CAPACITY); fluid.emtpyTooltip = "0 " + ChatUtil.lang("fluid.cyclic.xpjuice"); } @@ -32,7 +34,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -41,13 +43,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 54, 34); this.drawSlotLarge(ms, 104, 30); diff --git a/src/main/java/com/lothrazar/cyclic/block/battery/BlockBattery.java b/src/main/java/com/lothrazar/cyclic/block/battery/BlockBattery.java index 9bfd84fbd..742047cc3 100644 --- a/src/main/java/com/lothrazar/cyclic/block/battery/BlockBattery.java +++ b/src/main/java/com/lothrazar/cyclic/block/battery/BlockBattery.java @@ -21,6 +21,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.energy.IEnergyStorage; @@ -45,7 +46,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { //because harvestBlock manually forces a drop return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/battery/ScreenBattery.java b/src/main/java/com/lothrazar/cyclic/block/battery/ScreenBattery.java index 1aa3df107..b865fee2e 100644 --- a/src/main/java/com/lothrazar/cyclic/block/battery/ScreenBattery.java +++ b/src/main/java/com/lothrazar/cyclic/block/battery/ScreenBattery.java @@ -10,6 +10,8 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -26,7 +28,7 @@ public class ScreenBattery extends ScreenBase { public ScreenBattery(ContainerBattery screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileBattery.MAX); + this.energy = new EnergyBar(this.font, TileBattery.MAX); } @Override @@ -94,7 +96,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -102,7 +104,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnToggle.setTooltip(ChatUtil.lang("gui.cyclic.flowing" + menu.tile.getFlowing())); btnToggle.setTextureId(menu.tile.getFlowing() == 1 ? TextureEnum.POWER_MOVING : TextureEnum.POWER_STOP); btnU.setTextureId(getTextureId(Fields.U)); @@ -120,7 +122,7 @@ private TextureEnum getTextureId(Enum field) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 133, 53, TextureRegistry.SLOT_CHARGE); energy.draw(ms, menu.getEnergy()); diff --git a/src/main/java/com/lothrazar/cyclic/block/batteryclay/ClayBattery.java b/src/main/java/com/lothrazar/cyclic/block/batteryclay/ClayBattery.java index ad13bceaa..4afadec80 100644 --- a/src/main/java/com/lothrazar/cyclic/block/batteryclay/ClayBattery.java +++ b/src/main/java/com/lothrazar/cyclic/block/batteryclay/ClayBattery.java @@ -17,6 +17,7 @@ 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.storage.loot.LootParams; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.energy.IEnergyStorage; @@ -33,7 +34,7 @@ public void registerClient() { } @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state,LootParams.Builder builder) { //because harvestBlock manually forces a drop return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/batteryclay/ScreenClayBattery.java b/src/main/java/com/lothrazar/cyclic/block/batteryclay/ScreenClayBattery.java index 19bf4f1eb..701b873f1 100644 --- a/src/main/java/com/lothrazar/cyclic/block/batteryclay/ScreenClayBattery.java +++ b/src/main/java/com/lothrazar/cyclic/block/batteryclay/ScreenClayBattery.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -13,7 +14,7 @@ public class ScreenClayBattery extends ScreenBase { public ScreenClayBattery(ContainerClayBattery screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileClayBattery.MAX); + this.energy = new EnergyBar(this.font, TileClayBattery.MAX); } @Override @@ -24,7 +25,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -32,13 +33,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.getEnergy()); } diff --git a/src/main/java/com/lothrazar/cyclic/block/beaconpotion/ScreenPotion.java b/src/main/java/com/lothrazar/cyclic/block/beaconpotion/ScreenPotion.java index 395e06c86..dac820dab 100644 --- a/src/main/java/com/lothrazar/cyclic/block/beaconpotion/ScreenPotion.java +++ b/src/main/java/com/lothrazar/cyclic/block/beaconpotion/ScreenPotion.java @@ -9,6 +9,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -20,7 +21,7 @@ public class ScreenPotion extends ScreenBase { public ScreenPotion(ContainerPotion screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - energy = new EnergyBar(this, TilePotionBeacon.MAX); + energy = new EnergyBar(this.font, TilePotionBeacon.MAX); } @Override @@ -42,7 +43,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -50,7 +51,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); @@ -59,7 +60,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 148, 8, TextureRegistry.SLOT_FILTER, 18); energy.draw(ms, menu.tile.getEnergy()); diff --git a/src/main/java/com/lothrazar/cyclic/block/breaker/ScreenBreaker.java b/src/main/java/com/lothrazar/cyclic/block/breaker/ScreenBreaker.java index a12e9571e..7568e5971 100644 --- a/src/main/java/com/lothrazar/cyclic/block/breaker/ScreenBreaker.java +++ b/src/main/java/com/lothrazar/cyclic/block/breaker/ScreenBreaker.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -25,21 +26,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/fluid/ScreenCableFluid.java b/src/main/java/com/lothrazar/cyclic/block/cable/fluid/ScreenCableFluid.java index eba17db6a..42a43c0f0 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/fluid/ScreenCableFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/fluid/ScreenCableFluid.java @@ -3,6 +3,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -46,20 +47,20 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, imageWidth / 2 - 9, 28, TextureRegistry.SLOT_FILTER, 18); } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java b/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java index d336ae47e..0da319aa5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java @@ -3,6 +3,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -46,20 +47,20 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, imageWidth / 2 - 9, 28, TextureRegistry.SLOT_FILTER, 18); } diff --git a/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java b/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java index a956e1bae..1aae94137 100644 --- a/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java +++ b/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java @@ -5,6 +5,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -45,21 +46,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); // this.txtDuration.render(ms, mouseX, mouseX, partialTicks); // this.txtDelay.render(ms, mouseX, mouseX, partialTicks); diff --git a/src/main/java/com/lothrazar/cyclic/block/collectfluid/ScreenFluidCollect.java b/src/main/java/com/lothrazar/cyclic/block/collectfluid/ScreenFluidCollect.java index 0544008d2..b6d24e4ef 100644 --- a/src/main/java/com/lothrazar/cyclic/block/collectfluid/ScreenFluidCollect.java +++ b/src/main/java/com/lothrazar/cyclic/block/collectfluid/ScreenFluidCollect.java @@ -9,6 +9,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -21,8 +22,8 @@ public class ScreenFluidCollect extends ScreenBase { public ScreenFluidCollect(ContainerFluidCollect screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, TileFluidCollect.CAPACITY); - energy = new EnergyBar(this, TileFluidCollect.MAX); + fluid = new FluidBar(this.font, TileFluidCollect.CAPACITY); + energy = new EnergyBar(this.font, TileFluidCollect.MAX); } @Override @@ -56,7 +57,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -65,7 +66,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); @@ -76,7 +77,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 9, 50); if (TileFluidCollect.POWERCONF.get() > 0) { diff --git a/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java b/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java index edac9f774..ec2be2f90 100644 --- a/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java +++ b/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -62,14 +63,14 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnRedstone.onValueUpdate(menu.tile); btnRender.onValueUpdate(menu.tile); btnDirection.onValueUpdate(menu.tile); @@ -79,7 +80,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); for (int i = 0; i < 9; i++) { int y = 81; diff --git a/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemEntity.java b/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemEntity.java index e061b66f3..12942e93a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemEntity.java +++ b/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemEntity.java @@ -42,18 +42,16 @@ public float getSpin(float partialTicks) { @Override public void tick() { - if (this.level == null) { - return; - } - if (!(this.level.getBlockState(this.blockPosition()).getBlock() instanceof BlockConveyor)) { + + if (!(level().getBlockState(this.blockPosition()).getBlock() instanceof BlockConveyor)) { this.spawnRegularStack(); } super.tick(); } private void spawnRegularStack() { - ItemEntity e = new ItemEntity(this.level, this.getX(), this.getY(), this.getZ(), this.getItem()); - this.level.addFreshEntity(e); + ItemEntity e = new ItemEntity(this.level() ,this.getX(), this.getY(), this.getZ(), this.getItem()); + this.level().addFreshEntity(e); this.setItem(ItemStack.EMPTY); this.remove(RemovalReason.DISCARDED); } diff --git a/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemRenderer.java b/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemRenderer.java index c38617c56..5ea5d48cf 100644 --- a/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemRenderer.java +++ b/src/main/java/com/lothrazar/cyclic/block/conveyor/ConveyorItemRenderer.java @@ -30,7 +30,7 @@ public ConveyorItemRenderer(EntityRendererProvider.Context renderManager) { public void render(ConveyorItemEntity entity, float entityYaw, float partialTicks, PoseStack ms, MultiBufferSource buffer, int packedLightIn) { ms.pushPose(); ItemStack stack = entity.getItem(); - BakedModel model = this.renderer.getModel(stack, entity.level, null, packedLightIn); + BakedModel model = this.renderer.getModel(stack, entity.level(), null, packedLightIn); this.renderer.render(stack, ItemDisplayContext.GROUND, false, ms, buffer, packedLightIn, OverlayTexture.NO_OVERLAY, model); ms.popPose(); super.render(entity, entityYaw, partialTicks, ms, buffer, packedLightIn); diff --git a/src/main/java/com/lothrazar/cyclic/block/crafter/ScreenCrafter.java b/src/main/java/com/lothrazar/cyclic/block/crafter/ScreenCrafter.java index 97d7b4d2c..a5ec1f49d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/crafter/ScreenCrafter.java +++ b/src/main/java/com/lothrazar/cyclic/block/crafter/ScreenCrafter.java @@ -30,6 +30,7 @@ import com.lothrazar.cyclic.gui.TexturedProgress; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -42,9 +43,9 @@ public class ScreenCrafter extends ScreenBase { public ScreenCrafter(ContainerCrafter screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); this.imageHeight = 256; - this.energy = new EnergyBar(this, TileCrafter.MAX); + this.energy = new EnergyBar(this.font, TileCrafter.MAX); this.energy.setHeight(120); - this.progress = new TexturedProgress(this, ContainerCrafter.PREVIEW_START_X - 3, ContainerCrafter.PREVIEW_START_Y + Const.SQ, 24, 17, TextureRegistry.ARROW); + this.progress = new TexturedProgress(this.font, ContainerCrafter.PREVIEW_START_X - 3, ContainerCrafter.PREVIEW_START_Y + Const.SQ, 24, 17, TextureRegistry.ARROW); this.progress.max = TileCrafter.TIMER_FULL; this.progress.setTopDown(false); } @@ -62,7 +63,7 @@ protected void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { super.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -70,14 +71,14 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnRedstone.onValueUpdate(menu.tile); this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); energy.draw(ms, menu.tile.getEnergy()); for (int rowPos = 0; rowPos < TileCrafter.IO_NUM_ROWS; rowPos++) { diff --git a/src/main/java/com/lothrazar/cyclic/block/crafter/TileCrafter.java b/src/main/java/com/lothrazar/cyclic/block/crafter/TileCrafter.java index 387a985cf..5c113194c 100644 --- a/src/main/java/com/lothrazar/cyclic/block/crafter/TileCrafter.java +++ b/src/main/java/com/lothrazar/cyclic/block/crafter/TileCrafter.java @@ -42,6 +42,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.Ingredient; @@ -290,7 +291,7 @@ public ItemStack quickMoveStack(Player p_38941_, int p_38942_) { } } - private final CraftingContainer craftMatrix = new CraftingContainer(new FakeContainer(MenuType.CRAFTING, 18291238), 3, 3); + private final TransientCraftingContainer craftMatrix = new TransientCraftingContainer(new FakeContainer(MenuType.CRAFTING, 18291238), 3, 3); @Override public Component getDisplayName() { diff --git a/src/main/java/com/lothrazar/cyclic/block/crate/BlockCrate.java b/src/main/java/com/lothrazar/cyclic/block/crate/BlockCrate.java index 311fc4f21..1249d93b3 100644 --- a/src/main/java/com/lothrazar/cyclic/block/crate/BlockCrate.java +++ b/src/main/java/com/lothrazar/cyclic/block/crate/BlockCrate.java @@ -15,6 +15,7 @@ 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.storage.loot.LootParams; public class BlockCrate extends BlockCyclic { @@ -44,7 +45,7 @@ public void registerClient() { } @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { // because harvestBlock manually forces a drop, we must do this to dodge that return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/crate/ScreenCrate.java b/src/main/java/com/lothrazar/cyclic/block/crate/ScreenCrate.java index e41cbd4a7..f1dd2ef8f 100644 --- a/src/main/java/com/lothrazar/cyclic/block/crate/ScreenCrate.java +++ b/src/main/java/com/lothrazar/cyclic/block/crate/ScreenCrate.java @@ -3,6 +3,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -19,17 +20,17 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) {} + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) {} @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/cratemini/ScreenCrateMini.java b/src/main/java/com/lothrazar/cyclic/block/cratemini/ScreenCrateMini.java index 8aa12d01c..8142fd20d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cratemini/ScreenCrateMini.java +++ b/src/main/java/com/lothrazar/cyclic/block/cratemini/ScreenCrateMini.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -19,19 +20,19 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { super.renderLabels(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); for (int colPos = 0; colPos < 5; colPos++) { for (int rowPos = 0; rowPos < 3; rowPos++) { diff --git a/src/main/java/com/lothrazar/cyclic/block/crusher/ScreenCrusher.java b/src/main/java/com/lothrazar/cyclic/block/crusher/ScreenCrusher.java index f0cda09eb..4da63e6f2 100644 --- a/src/main/java/com/lothrazar/cyclic/block/crusher/ScreenCrusher.java +++ b/src/main/java/com/lothrazar/cyclic/block/crusher/ScreenCrusher.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.TexturedProgress; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -17,8 +18,8 @@ public class ScreenCrusher extends ScreenBase { public ScreenCrusher(ContainerCrusher screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileCrusher.MAX); - this.progress = new TexturedProgress(this, 78, 40, TextureRegistry.SAW); + this.energy = new EnergyBar(this.font, TileCrusher.MAX); + this.progress = new TexturedProgress(this.font, 78, 40, TextureRegistry.SAW); } @Override @@ -33,7 +34,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -42,13 +43,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 52, 34); this.drawSlotLarge(ms, 104, 20); diff --git a/src/main/java/com/lothrazar/cyclic/block/detectorentity/ScreenDetector.java b/src/main/java/com/lothrazar/cyclic/block/detectorentity/ScreenDetector.java index 71772e391..a65ccb952 100644 --- a/src/main/java/com/lothrazar/cyclic/block/detectorentity/ScreenDetector.java +++ b/src/main/java/com/lothrazar/cyclic/block/detectorentity/ScreenDetector.java @@ -10,6 +10,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -71,14 +72,14 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRender.onValueUpdate(menu.tile); @@ -90,7 +91,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_PLAIN); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/detectoritem/ScreenDetectorItem.java b/src/main/java/com/lothrazar/cyclic/block/detectoritem/ScreenDetectorItem.java index af1f2b20d..2dd6bd8fe 100644 --- a/src/main/java/com/lothrazar/cyclic/block/detectoritem/ScreenDetectorItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/detectoritem/ScreenDetectorItem.java @@ -10,6 +10,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -66,14 +67,14 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRender.onValueUpdate(menu.tile); @@ -83,7 +84,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_PLAIN); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/disenchant/ScreenDisenchant.java b/src/main/java/com/lothrazar/cyclic/block/disenchant/ScreenDisenchant.java index 06e4d38b0..0747783aa 100644 --- a/src/main/java/com/lothrazar/cyclic/block/disenchant/ScreenDisenchant.java +++ b/src/main/java/com/lothrazar/cyclic/block/disenchant/ScreenDisenchant.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -18,8 +19,8 @@ public class ScreenDisenchant extends ScreenBase { public ScreenDisenchant(ContainerDisenchant screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - energy = new EnergyBar(this, TileDisenchant.MAX); - fluid = new FluidBar(this, 134, 8, TileDisenchant.CAPACITY); + energy = new EnergyBar(this.font, TileDisenchant.MAX); + fluid = new FluidBar(this.font, 134, 8, TileDisenchant.CAPACITY); fluid.emtpyTooltip = "0 " + ChatUtil.lang("fluid.cyclic.xpjuice"); } @@ -36,7 +37,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -45,14 +46,14 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); int x = 23; int y = 39; diff --git a/src/main/java/com/lothrazar/cyclic/block/dropper/ScreenDropper.java b/src/main/java/com/lothrazar/cyclic/block/dropper/ScreenDropper.java index 6b9b7ceed..72ac33653 100644 --- a/src/main/java/com/lothrazar/cyclic/block/dropper/ScreenDropper.java +++ b/src/main/java/com/lothrazar/cyclic/block/dropper/ScreenDropper.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -18,7 +19,7 @@ public class ScreenDropper extends ScreenBase { public ScreenDropper(ContainerDropper screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileDropper.MAX); + this.energy = new EnergyBar(this.font, TileDropper.MAX); } @Override @@ -50,7 +51,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -58,7 +59,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRender.onValueUpdate(menu.tile); @@ -66,7 +67,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 88, 58); this.drawSlot(ms, 9, 58, TextureRegistry.SLOT_GPS); diff --git a/src/main/java/com/lothrazar/cyclic/block/enderitemshelf/BlockItemShelf.java b/src/main/java/com/lothrazar/cyclic/block/enderitemshelf/BlockItemShelf.java index ccace8540..a24fc7394 100644 --- a/src/main/java/com/lothrazar/cyclic/block/enderitemshelf/BlockItemShelf.java +++ b/src/main/java/com/lothrazar/cyclic/block/enderitemshelf/BlockItemShelf.java @@ -23,6 +23,7 @@ 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.storage.loot.LootParams; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -122,8 +123,8 @@ public TileItemShelf getTileEntity(Level world, BlockPos pos) { } @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { - // because harvestBlock manually forces a drop, we must do this to dodge that + public List getDrops(BlockState state, LootParams.Builder builder) { + // because harvestBlock manually forces a drop, we must do this to dodge that0 return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/endershelf/BlockEnderShelf.java b/src/main/java/com/lothrazar/cyclic/block/endershelf/BlockEnderShelf.java index 69171ff78..3b11f4f9c 100644 --- a/src/main/java/com/lothrazar/cyclic/block/endershelf/BlockEnderShelf.java +++ b/src/main/java/com/lothrazar/cyclic/block/endershelf/BlockEnderShelf.java @@ -27,6 +27,7 @@ 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.storage.loot.LootParams; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -119,7 +120,7 @@ public TileEnderShelf getTileEntity(Level world, BlockPos pos) { // @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { // because harvestBlock manually forces a drop, we must do this to dodge that return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/expcollect/BlockExpPylon.java b/src/main/java/com/lothrazar/cyclic/block/expcollect/BlockExpPylon.java index e6eca14c8..f4acde8f4 100644 --- a/src/main/java/com/lothrazar/cyclic/block/expcollect/BlockExpPylon.java +++ b/src/main/java/com/lothrazar/cyclic/block/expcollect/BlockExpPylon.java @@ -21,6 +21,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -56,7 +57,7 @@ public BlockEntityTicker getTicker(Level world, Block } @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { //because harvestBlock manually forces a drop return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/expcollect/ScreenExpPylon.java b/src/main/java/com/lothrazar/cyclic/block/expcollect/ScreenExpPylon.java index 8aa4ab62d..e6a607210 100644 --- a/src/main/java/com/lothrazar/cyclic/block/expcollect/ScreenExpPylon.java +++ b/src/main/java/com/lothrazar/cyclic/block/expcollect/ScreenExpPylon.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -16,7 +17,7 @@ public class ScreenExpPylon extends ScreenBase { public ScreenExpPylon(ContainerExpPylon screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, 150, 8, TileExpPylon.CAPACITY); + fluid = new FluidBar(this.font, 150, 8, TileExpPylon.CAPACITY); } @Override @@ -31,7 +32,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -39,18 +40,18 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); int xp = menu.tile.getStoredXp(); if (xp >= 0) { - this.font.draw(ms, xp + " " + ChatUtil.lang("cyclic.screen.xp"), (this.getXSize()) / 2 + 4, 40.0F, 4209792); + ms.drawString(font, xp + " " + ChatUtil.lang("cyclic.screen.xp"), (this.getXSize()) / 2 + 4, (int) 40.0F, 4209792); } btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); fluid.draw(ms, menu.tile.tank.getFluid()); } diff --git a/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java b/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java index 5eb733239..2b3aeb160 100644 --- a/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java +++ b/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java @@ -5,6 +5,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -42,21 +43,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 148, 8, TextureRegistry.SLOT_FILTER, 18); } diff --git a/src/main/java/com/lothrazar/cyclic/block/fishing/ScreenFisher.java b/src/main/java/com/lothrazar/cyclic/block/fishing/ScreenFisher.java index e2541a767..70f6c93c8 100644 --- a/src/main/java/com/lothrazar/cyclic/block/fishing/ScreenFisher.java +++ b/src/main/java/com/lothrazar/cyclic/block/fishing/ScreenFisher.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -25,21 +26,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, imageWidth / 2 - 9, 28); } diff --git a/src/main/java/com/lothrazar/cyclic/block/fishing/TileFisher.java b/src/main/java/com/lothrazar/cyclic/block/fishing/TileFisher.java index f4634a41d..b42726c34 100644 --- a/src/main/java/com/lothrazar/cyclic/block/fishing/TileFisher.java +++ b/src/main/java/com/lothrazar/cyclic/block/fishing/TileFisher.java @@ -26,8 +26,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.LootDataManager; +import net.minecraft.world.level.storage.loot.LootDataType; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.LootTables; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; @@ -134,18 +136,19 @@ private void doFishing(ItemStack fishingRod, BlockPos center) { Level world = this.getLevel(); RandomSource rand = world.random; if (rand.nextDouble() < CHANCE.get() && world instanceof ServerLevel) { - LootTables manager = world.getServer().getLootTables(); + LootDataManager manager = level.getServer().getLootData(); if (manager == null) { return; } - LootTable table = manager.get(BuiltInLootTables.FISHING); + LootTable table = manager.getElement(LootDataType.TABLE, BuiltInLootTables.FISHING); if (table == null) { return; } //got it int luck = EnchantmentHelper.getTagEnchantmentLevel(Enchantments.FISHING_LUCK, fishingRod) + 1; - LootContext lootContext = new LootContext.Builder((ServerLevel) world) - .withLuck(luck).withRandom(rand).withParameter(LootContextParams.ORIGIN, + LootParams lootContext = new LootParams.Builder((ServerLevel) world) + .withLuck(luck)//.withRandom(rand) + .withParameter(LootContextParams.ORIGIN, new Vec3(center.getX(), center.getY(), center.getZ())) .withParameter(LootContextParams.TOOL, fishingRod) .create(LootContextParamSets.FISHING); diff --git a/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java b/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java index cd9264a3c..6853d9f41 100644 --- a/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java +++ b/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java @@ -8,6 +8,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -20,7 +21,7 @@ public class ScreenForester extends ScreenBase { public ScreenForester(ContainerForester screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileForester.MAX); + this.energy = new EnergyBar(this.font, TileForester.MAX); } @Override @@ -45,7 +46,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -53,7 +54,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); @@ -62,7 +63,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); int relX = this.getXSize() / 2 - 9; this.drawSlot(ms, relX, 24, TextureRegistry.SLOT_SAPLING, Const.SQ); diff --git a/src/main/java/com/lothrazar/cyclic/block/generatorfluid/ScreenGeneratorFluid.java b/src/main/java/com/lothrazar/cyclic/block/generatorfluid/ScreenGeneratorFluid.java index 8d2d653d8..6747a664d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/generatorfluid/ScreenGeneratorFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/generatorfluid/ScreenGeneratorFluid.java @@ -14,6 +14,7 @@ import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -27,9 +28,9 @@ public class ScreenGeneratorFluid extends ScreenBase { public ScreenGeneratorFluid(ContainerGeneratorFluid screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileGeneratorFluid.MAX); - this.progress = new TexturedProgress(this, 76, 60, TextureRegistry.LAVA_PROG); - fluid = new FluidBar(this, 39, 57, TileGeneratorFluid.CAPACITY); + this.energy = new EnergyBar(this.font, TileGeneratorFluid.MAX); + this.progress = new TexturedProgress(this.font, 76, 60, TextureRegistry.LAVA_PROG); + fluid = new FluidBar(this.font, 39, 57, TileGeneratorFluid.CAPACITY); } @Override @@ -52,30 +53,31 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(ms); - super.render(ms, mouseX, mouseY, partialTicks); - this.renderTooltip(ms, mouseX, mouseY); - energy.renderHoveredToolTip(ms, mouseX, mouseY, menu.tile.getEnergy()); - progress.renderHoveredToolTip(ms, mouseX, mouseY, menu.tile.getField(TileGeneratorFluid.Fields.TIMER.ordinal())); - fluid.renderHoveredToolTip(ms, mouseX, mouseY, menu.tile.getFluid()); + public void render(GuiGraphics gg, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(gg); + super.render(gg, mouseX, mouseY, partialTicks); + this.renderTooltip(gg, mouseX, mouseY); + energy.renderHoveredToolTip(gg, mouseX, mouseY, menu.tile.getEnergy()); + progress.renderHoveredToolTip(gg, mouseX, mouseY, menu.tile.getField(TileGeneratorFluid.Fields.TIMER.ordinal())); + fluid.renderHoveredToolTip(gg, mouseX, mouseY, menu.tile.getFluid()); btnRedstone.onValueUpdate(menu.tile); - ms.pushPose(); - ms.translate(this.width / 2, this.height / 2, 0); - ms.mulPose(Axis.ZP.rotationDegrees(-90)); - ms.translate(-this.width / 2, -this.height / 2, 0); + var pose=gg.pose(); + pose.pushPose(); + pose.translate(this.width / 2, this.height / 2, 0); + pose.mulPose(Axis.ZP.rotationDegrees(-90)); + pose.translate(-this.width / 2, -this.height / 2, 0); Vector4f vec = new Vector4f(mouseX, mouseY, 0, 1); // - vec = ms.last().pose().transform(vec); + vec = pose.last().pose().transform(vec); // vec.transform(ms.last().pose()); - ms.popPose(); //Look, it's a bit hacky, but it gets the job done. Rotation Math! + pose.popPose(); //Look, it's a bit hacky, but it gets the job done. Rotation Math! if (fluid.isMouseover((int) vec.x(), (int) vec.y())) { - fluid.renderTooltip(ms, mouseX, mouseY, menu.tile.getFluid()); + fluid.renderTooltip(gg, mouseX, mouseY, menu.tile.getFluid()); } } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); int fld = TileGeneratorFluid.Fields.FLOWING.ordinal(); @@ -84,16 +86,17 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { - this.drawBackground(ms, TextureRegistry.INVENTORY); - energy.draw(ms, menu.tile.getEnergy()); + protected void renderBg(GuiGraphics gg, float partialTicks, int mouseX, int mouseY) { + this.drawBackground(gg, TextureRegistry.INVENTORY); + energy.draw(gg, menu.tile.getEnergy()); progress.max = menu.tile.getField(TileGeneratorFluid.Fields.BURNMAX.ordinal()); - progress.draw(ms, menu.tile.getField(TileGeneratorFluid.Fields.TIMER.ordinal())); - ms.pushPose(); - ms.translate(this.width / 2, this.height / 2, 0); - ms.mulPose(Axis.ZP.rotationDegrees(90)); - ms.translate(-this.width / 2, -this.height / 2, 0); - fluid.draw(ms, menu.tile.getFluid()); - ms.popPose(); + progress.draw(gg, menu.tile.getField(TileGeneratorFluid.Fields.TIMER.ordinal())); + var pose=gg.pose(); + pose.pushPose(); + pose.translate(this.width / 2, this.height / 2, 0); + pose.mulPose(Axis.ZP.rotationDegrees(90)); + pose.translate(-this.width / 2, -this.height / 2, 0); + fluid.draw(gg, menu.tile.getFluid()); + pose.popPose(); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/generatorfood/ScreenGeneratorFood.java b/src/main/java/com/lothrazar/cyclic/block/generatorfood/ScreenGeneratorFood.java index 18d8ed722..5e6f256be 100644 --- a/src/main/java/com/lothrazar/cyclic/block/generatorfood/ScreenGeneratorFood.java +++ b/src/main/java/com/lothrazar/cyclic/block/generatorfood/ScreenGeneratorFood.java @@ -11,6 +11,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -23,8 +24,8 @@ public class ScreenGeneratorFood extends ScreenBase { public ScreenGeneratorFood(ContainerGeneratorFood screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileGeneratorFood.MAX); - this.progress = new TexturedProgress(this, 76, 60, TextureRegistry.FOOD_PROG); + this.energy = new EnergyBar(this.font, TileGeneratorFood.MAX); + this.progress = new TexturedProgress(this.font, 76, 60, TextureRegistry.FOOD_PROG); } @Override @@ -47,7 +48,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -57,7 +58,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); int fld = TileGeneratorFood.Fields.FLOWING.ordinal(); @@ -66,7 +67,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlotLarge(ms, 70, 30); energy.draw(ms, menu.tile.getEnergy()); diff --git a/src/main/java/com/lothrazar/cyclic/block/generatorfuel/ScreenGeneratorFuel.java b/src/main/java/com/lothrazar/cyclic/block/generatorfuel/ScreenGeneratorFuel.java index 13a839d04..b54c0a4f7 100644 --- a/src/main/java/com/lothrazar/cyclic/block/generatorfuel/ScreenGeneratorFuel.java +++ b/src/main/java/com/lothrazar/cyclic/block/generatorfuel/ScreenGeneratorFuel.java @@ -11,6 +11,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -23,8 +24,8 @@ public class ScreenGeneratorFuel extends ScreenBase { public ScreenGeneratorFuel(ContainerGeneratorFuel screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileGeneratorFuel.MAX); - this.progress = new TexturedProgress(this, 76, 60, TextureRegistry.FUEL_PROG); + this.energy = new EnergyBar(this.font, TileGeneratorFuel.MAX); + this.progress = new TexturedProgress(this.font , 76, 60, TextureRegistry.FUEL_PROG); } @Override @@ -47,7 +48,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -57,7 +58,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); int fld = TileGeneratorFuel.Fields.FLOWING.ordinal(); @@ -66,7 +67,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlotLarge(ms, 70, 30); progress.max = menu.tile.getField(TileGeneratorFuel.Fields.BURNMAX.ordinal()); diff --git a/src/main/java/com/lothrazar/cyclic/block/generatoritem/ScreenGeneratorDrops.java b/src/main/java/com/lothrazar/cyclic/block/generatoritem/ScreenGeneratorDrops.java index 8c0adfad6..f6281291e 100644 --- a/src/main/java/com/lothrazar/cyclic/block/generatoritem/ScreenGeneratorDrops.java +++ b/src/main/java/com/lothrazar/cyclic/block/generatoritem/ScreenGeneratorDrops.java @@ -11,6 +11,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -23,8 +24,8 @@ public class ScreenGeneratorDrops extends ScreenBase { public ScreenGeneratorDrops(ContainerGeneratorDrops screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileGeneratorDrops.MAX); - this.progress = new TexturedProgress(this, 76, 60, TextureRegistry.MAT_PROG); + this.energy = new EnergyBar(this.font, TileGeneratorDrops.MAX); + this.progress = new TexturedProgress(this.font, 76, 60, TextureRegistry.MAT_PROG); } @Override @@ -47,7 +48,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -57,7 +58,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); int fld = TileGeneratorDrops.Fields.FLOWING.ordinal(); @@ -66,7 +67,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); // this.drawSlot(ms, 54, 34); this.drawSlotLarge(ms, 70, 30); diff --git a/src/main/java/com/lothrazar/cyclic/block/generatorsolar/ScreenGeneratorSolar.java b/src/main/java/com/lothrazar/cyclic/block/generatorsolar/ScreenGeneratorSolar.java index 44704eea2..c592211f2 100644 --- a/src/main/java/com/lothrazar/cyclic/block/generatorsolar/ScreenGeneratorSolar.java +++ b/src/main/java/com/lothrazar/cyclic/block/generatorsolar/ScreenGeneratorSolar.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -13,7 +14,7 @@ public class ScreenGeneratorSolar extends ScreenBase { public ScreenGeneratorSolar(ContainerGeneratorSolar screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileGeneratorSolar.MAX); + this.energy = new EnergyBar(this.font, TileGeneratorSolar.MAX); } @Override @@ -24,7 +25,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -32,13 +33,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.getEnergy()); } diff --git a/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java b/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java index 600440009..4ba782910 100644 --- a/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java +++ b/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -21,7 +22,7 @@ public class ScreenHarvester extends ScreenBase { public ScreenHarvester(ContainerHarvester screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileHarvester.MAX_ENERGY); + this.energy = new EnergyBar(this.font, TileHarvester.MAX_ENERGY); } @Override @@ -62,7 +63,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -70,7 +71,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnRedstone.onValueUpdate(menu.tile); btnRender.onValueUpdate(menu.tile); btnDirection.onValueUpdate(menu.tile); @@ -80,7 +81,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.tile.getEnergy()); } diff --git a/src/main/java/com/lothrazar/cyclic/block/laser/ScreenLaser.java b/src/main/java/com/lothrazar/cyclic/block/laser/ScreenLaser.java index 94dc044bc..0b69129c5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/laser/ScreenLaser.java +++ b/src/main/java/com/lothrazar/cyclic/block/laser/ScreenLaser.java @@ -9,6 +9,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -89,21 +90,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); this.drawSlot(ms, 151, 7, TextureRegistry.SLOT_GPS, 18); btnX.setMessage(ChatUtil.ilang("button.offsetblock.name" + diff --git a/src/main/java/com/lothrazar/cyclic/block/melter/ScreenMelter.java b/src/main/java/com/lothrazar/cyclic/block/melter/ScreenMelter.java index e0877acd8..b941cbc2b 100644 --- a/src/main/java/com/lothrazar/cyclic/block/melter/ScreenMelter.java +++ b/src/main/java/com/lothrazar/cyclic/block/melter/ScreenMelter.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.TexturedProgress; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -17,9 +18,9 @@ public class ScreenMelter extends ScreenBase { public ScreenMelter(ContainerMelter screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - energy = new EnergyBar(this, TileMelter.MAX); - fluid = new FluidBar(this, 132, 8, TileMelter.CAPACITY); - this.progress = new TexturedProgress(this, 68, 37, 24, 17, TextureRegistry.ARROW); + energy = new EnergyBar(this.font, TileMelter.MAX); + fluid = new FluidBar(this.font, 132, 8, TileMelter.CAPACITY); + this.progress = new TexturedProgress(this.font, 68, 37, 24, 17, TextureRegistry.ARROW); this.progress.setTopDown(false); } @@ -31,7 +32,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -40,13 +41,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.tile.getEnergy()); this.progress.max = menu.tile.getField(TileMelter.Fields.BURNMAX.ordinal()); diff --git a/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java b/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java index 7bb005860..bf0a05100 100644 --- a/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java +++ b/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -20,7 +21,7 @@ public class ScreenMiner extends ScreenBase { public ScreenMiner(ContainerMiner screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileMiner.MAX); + this.energy = new EnergyBar(this.font, TileMiner.MAX); } @Override @@ -58,7 +59,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -66,7 +67,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); btnRedstone.onValueUpdate(menu.tile); @@ -76,7 +77,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); if (menu.tile.inventory.getStackInSlot(TileMiner.SLOT_TOOL).isEmpty()) { this.drawSlot(ms, 32, 8, TextureRegistry.SLOT_TOOL, 18); diff --git a/src/main/java/com/lothrazar/cyclic/block/packager/ScreenPackager.java b/src/main/java/com/lothrazar/cyclic/block/packager/ScreenPackager.java index 51bca5661..6a88bec6c 100644 --- a/src/main/java/com/lothrazar/cyclic/block/packager/ScreenPackager.java +++ b/src/main/java/com/lothrazar/cyclic/block/packager/ScreenPackager.java @@ -5,6 +5,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -15,7 +16,7 @@ public class ScreenPackager extends ScreenBase { public ScreenPackager(ContainerPackager screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TilePackager.MAX); + this.energy = new EnergyBar(this.font, TilePackager.MAX); } @Override @@ -31,7 +32,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -41,13 +42,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 50, 40); this.drawSlotLarge(ms, 90, 36); diff --git a/src/main/java/com/lothrazar/cyclic/block/peatfarm/ScreenPeatFarm.java b/src/main/java/com/lothrazar/cyclic/block/peatfarm/ScreenPeatFarm.java index 94f7a3dcc..2ad407162 100644 --- a/src/main/java/com/lothrazar/cyclic/block/peatfarm/ScreenPeatFarm.java +++ b/src/main/java/com/lothrazar/cyclic/block/peatfarm/ScreenPeatFarm.java @@ -8,6 +8,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -20,8 +21,8 @@ public class ScreenPeatFarm extends ScreenBase { public ScreenPeatFarm(ContainerPeatFarm screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, 132, 8, TilePeatFarm.CAPACITY); - energy = new EnergyBar(this, TilePeatFarm.MAX); + fluid = new FluidBar(this.font, 132, 8, TilePeatFarm.CAPACITY); + energy = new EnergyBar(this.font, TilePeatFarm.MAX); } @Override @@ -39,7 +40,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -48,7 +49,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); btnRedstone.onValueUpdate(menu.tile); @@ -56,7 +57,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int x, int y) { + protected void renderBg(GuiGraphics ms, float partialTicks, int x, int y) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.getEnergy()); fluid.draw(ms, menu.tile.getFluid()); diff --git a/src/main/java/com/lothrazar/cyclic/block/placer/ScreenPlacer.java b/src/main/java/com/lothrazar/cyclic/block/placer/ScreenPlacer.java index c162d1b46..69e6a5311 100644 --- a/src/main/java/com/lothrazar/cyclic/block/placer/ScreenPlacer.java +++ b/src/main/java/com/lothrazar/cyclic/block/placer/ScreenPlacer.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -25,21 +26,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, imageWidth / 2 - 9, 28); } diff --git a/src/main/java/com/lothrazar/cyclic/block/placerfluid/ScreenPlacerFluid.java b/src/main/java/com/lothrazar/cyclic/block/placerfluid/ScreenPlacerFluid.java index cf18353d5..aef481544 100644 --- a/src/main/java/com/lothrazar/cyclic/block/placerfluid/ScreenPlacerFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/placerfluid/ScreenPlacerFluid.java @@ -5,6 +5,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -15,7 +16,7 @@ public class ScreenPlacerFluid extends ScreenBase { public ScreenPlacerFluid(ContainerPlacerFluid screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, 152, 14, TilePlacerFluid.CAPACITY); + fluid = new FluidBar(this.font, 152, 14, TilePlacerFluid.CAPACITY); } @Override @@ -30,7 +31,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -38,14 +39,14 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); fluid.draw(ms, menu.tile.getFluid()); } diff --git a/src/main/java/com/lothrazar/cyclic/block/screen/ScreenScreentext.java b/src/main/java/com/lothrazar/cyclic/block/screen/ScreenScreentext.java index 574edc597..12e5f8aeb 100644 --- a/src/main/java/com/lothrazar/cyclic/block/screen/ScreenScreentext.java +++ b/src/main/java/com/lothrazar/cyclic/block/screen/ScreenScreentext.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.TextBoxAutosave; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -70,20 +71,20 @@ public void init() { // } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); btnRedstone.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_PLAIN); this.txtString.render(ms, mouseX, mouseY, partialTicks); } diff --git a/src/main/java/com/lothrazar/cyclic/block/shapebuilder/ScreenStructure.java b/src/main/java/com/lothrazar/cyclic/block/shapebuilder/ScreenStructure.java index 09d2edcf8..a9cbd0ad5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/shapebuilder/ScreenStructure.java +++ b/src/main/java/com/lothrazar/cyclic/block/shapebuilder/ScreenStructure.java @@ -13,6 +13,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -25,7 +26,7 @@ public class ScreenStructure extends ScreenBase { public ScreenStructure(ContainerStructure screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileStructure.MAX); + this.energy = new EnergyBar(this.font, TileStructure.MAX); this.imageHeight = 256; } @@ -95,7 +96,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -103,7 +104,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnRedstone.onValueUpdate(menu.tile); btnRender.onValueUpdate(menu.tile); this.drawButtonTooltips(ms, mouseX, mouseY); @@ -119,7 +120,7 @@ private void updateDisabledButtons() { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); energy.draw(ms, menu.getEnergy()); this.drawSlot(ms, 60, 20); diff --git a/src/main/java/com/lothrazar/cyclic/block/shapedata/ScreenShapedata.java b/src/main/java/com/lothrazar/cyclic/block/shapedata/ScreenShapedata.java index 71963d0e9..9072cfcda 100644 --- a/src/main/java/com/lothrazar/cyclic/block/shapedata/ScreenShapedata.java +++ b/src/main/java/com/lothrazar/cyclic/block/shapedata/ScreenShapedata.java @@ -12,6 +12,7 @@ import com.lothrazar.cyclic.registry.PacketRegistry; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -55,14 +56,14 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); // this.drawName(ms, title.getString()); // this.drawName(ms, "" + container.tile.getField(TileShapedata.Fields.STASH.ordinal())); @@ -74,7 +75,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 8, 28 + 18, TextureRegistry.SLOT_GPS, 18); this.drawSlot(ms, 8 + 18, 28, TextureRegistry.SLOT_GPS, 18); diff --git a/src/main/java/com/lothrazar/cyclic/block/shears/BlockShearing.java b/src/main/java/com/lothrazar/cyclic/block/shears/BlockShearing.java index 8532878dd..44092430d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/shears/BlockShearing.java +++ b/src/main/java/com/lothrazar/cyclic/block/shears/BlockShearing.java @@ -39,10 +39,10 @@ public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity e if (entityIn instanceof IForgeShearable) { //do it IForgeShearable sheep = (IForgeShearable) entityIn; - if (sheep.isShearable(ItemStack.EMPTY, entityIn.level, pos)) { - List drops = sheep.onSheared(null, ItemStack.EMPTY, entityIn.level, pos, entityIn.level.random.nextInt(3)); + if (sheep.isShearable(ItemStack.EMPTY, worldIn, pos)) { + List drops = sheep.onSheared(null, ItemStack.EMPTY, worldIn, pos, worldIn.random.nextInt(3)); drops.forEach(d -> { - RandomSource rand = entityIn.level.random; + RandomSource rand = worldIn.random; ItemEntity ent = entityIn.spawnAtLocation(d, 1.0F); ent.setDeltaMovement(ent.getDeltaMovement().add((rand.nextFloat() - rand.nextFloat()) * 0.1F, rand.nextFloat() * 0.05F, (rand.nextFloat() - rand.nextFloat()) * 0.1F)); }); diff --git a/src/main/java/com/lothrazar/cyclic/block/solidifier/ScreenSolidifier.java b/src/main/java/com/lothrazar/cyclic/block/solidifier/ScreenSolidifier.java index 7d2024e0a..7919bc997 100644 --- a/src/main/java/com/lothrazar/cyclic/block/solidifier/ScreenSolidifier.java +++ b/src/main/java/com/lothrazar/cyclic/block/solidifier/ScreenSolidifier.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.TexturedProgress; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -17,9 +18,9 @@ public class ScreenSolidifier extends ScreenBase { public ScreenSolidifier(ContainerSolidifier screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileSolidifier.MAX); - fluid = new FluidBar(this, 8, 8, TileSolidifier.CAPACITY); - this.progress = new TexturedProgress(this, 68, 37, 24, 17, TextureRegistry.ARROW); + this.energy = new EnergyBar(this.font, TileSolidifier.MAX); + fluid = new FluidBar(this.font, 8, 8, TileSolidifier.CAPACITY); + this.progress = new TexturedProgress(this.font, 68, 37, 24, 17, TextureRegistry.ARROW); this.progress.setTopDown(false); } @@ -32,7 +33,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -41,13 +42,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.getEnergy()); this.progress.max = menu.tile.getField(TileSolidifier.Fields.BURNMAX.ordinal()); diff --git a/src/main/java/com/lothrazar/cyclic/block/soundplay/ScreenSoundPlayer.java b/src/main/java/com/lothrazar/cyclic/block/soundplay/ScreenSoundPlayer.java index 9af299edb..6baf6cb7e 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundplay/ScreenSoundPlayer.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundplay/ScreenSoundPlayer.java @@ -3,6 +3,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -13,20 +14,20 @@ public ScreenSoundPlayer(ContainerSoundPlayer screenContainer, Inventory inv, Co } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 80, 34, TextureRegistry.SLOT_SOUND); } diff --git a/src/main/java/com/lothrazar/cyclic/block/soundrecord/ScreenSoundRecorder.java b/src/main/java/com/lothrazar/cyclic/block/soundrecord/ScreenSoundRecorder.java index 37e55460f..bf3b8cd0a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundrecord/ScreenSoundRecorder.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundrecord/ScreenSoundRecorder.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.registry.PacketRegistry; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -61,14 +62,14 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); // this.drawName(ms, this.title.getString()); int x = 38, y = 12; @@ -80,7 +81,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY_SOUND); this.drawSlot(ms, 8, 208, TextureRegistry.SLOT_SOUND); } diff --git a/src/main/java/com/lothrazar/cyclic/block/tank/BlockFluidTank.java b/src/main/java/com/lothrazar/cyclic/block/tank/BlockFluidTank.java index 8f371ab5e..9128c968d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/tank/BlockFluidTank.java +++ b/src/main/java/com/lothrazar/cyclic/block/tank/BlockFluidTank.java @@ -26,6 +26,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; @@ -99,7 +100,7 @@ public boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter wo } @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { //because harvestBlock manually forces a drop return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/tankcask/BlockCask.java b/src/main/java/com/lothrazar/cyclic/block/tankcask/BlockCask.java index c43d62f40..6d8402c82 100644 --- a/src/main/java/com/lothrazar/cyclic/block/tankcask/BlockCask.java +++ b/src/main/java/com/lothrazar/cyclic/block/tankcask/BlockCask.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -32,7 +33,7 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { } @Override - public List getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { //because harvestBlock manually forces a drop return new ArrayList<>(); } diff --git a/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java b/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java index 6e6e1ee21..6b3c5ecf0 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java +++ b/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java @@ -63,7 +63,7 @@ private boolean canBlockSeeSky(Level world, BlockPos pos) { } BlockState blockstate = world.getBlockState(blockpos1); int opa = blockstate.getLightBlock(world, blockpos1); - if (opa > 0 && !blockstate.getMaterial().isLiquid()) { + if (opa > 0 && !blockstate.liquid()) { return false; } } diff --git a/src/main/java/com/lothrazar/cyclic/block/tp/ScreenTeleport.java b/src/main/java/com/lothrazar/cyclic/block/tp/ScreenTeleport.java index dadbafb77..33e52398c 100644 --- a/src/main/java/com/lothrazar/cyclic/block/tp/ScreenTeleport.java +++ b/src/main/java/com/lothrazar/cyclic/block/tp/ScreenTeleport.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -13,7 +14,7 @@ public class ScreenTeleport extends ScreenBase { public ScreenTeleport(ContainerTeleport screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileTeleport.MAX); + this.energy = new EnergyBar(this.font , TileTeleport.MAX); } @Override @@ -25,7 +26,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -33,13 +34,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 79, 35, TextureRegistry.SLOT_GPS); energy.draw(ms, menu.tile.getEnergy()); diff --git a/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java b/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java index 668cfadbc..bbeb8f6e2 100644 --- a/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java +++ b/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java @@ -9,6 +9,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.lothrazar.cyclic.util.ChatUtil; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -20,8 +21,8 @@ public class ScreenUncraft extends ScreenBase { public ScreenUncraft(ContainerUncraft screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileUncraft.MAX); - this.progress = new TexturedProgress(this, 58, 20, TextureRegistry.SAW); + this.energy = new EnergyBar(this.font, TileUncraft.MAX); + this.progress = new TexturedProgress(this.font, 58, 20, TextureRegistry.SAW); this.progress.max = TileUncraft.TIMER.get(); } @@ -38,7 +39,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -46,7 +47,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnRedstone.onValueUpdate(menu.tile); this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, this.title.getString()); @@ -77,7 +78,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); energy.draw(ms, menu.tile.getEnergy()); this.drawSlot(ms, 38, 18); diff --git a/src/main/java/com/lothrazar/cyclic/block/uncrafter/TileUncraft.java b/src/main/java/com/lothrazar/cyclic/block/uncrafter/TileUncraft.java index fb4d4fa22..26689bd26 100644 --- a/src/main/java/com/lothrazar/cyclic/block/uncrafter/TileUncraft.java +++ b/src/main/java/com/lothrazar/cyclic/block/uncrafter/TileUncraft.java @@ -257,7 +257,7 @@ private boolean recipeMatches(ItemStack stack, Recipe recipe) { return true; } else { - return ItemStack.tagMatches(stack, recipeResultItem); + return ItemStack.isSameItemSameTags(stack, recipeResultItem); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/user/ScreenUser.java b/src/main/java/com/lothrazar/cyclic/block/user/ScreenUser.java index f547501a8..a6e5ed7ca 100644 --- a/src/main/java/com/lothrazar/cyclic/block/user/ScreenUser.java +++ b/src/main/java/com/lothrazar/cyclic/block/user/ScreenUser.java @@ -7,6 +7,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -19,7 +20,7 @@ public class ScreenUser extends ScreenBase { public ScreenUser(ContainerUser screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileUser.MAX); + this.energy = new EnergyBar(this.font , TileUser.MAX); } @Override @@ -52,7 +53,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -60,7 +61,7 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { btnRedstone.onValueUpdate(menu.tile); btnType.onValueUpdate(menu.tile); btnType.setTooltip("block.cyclic.user.type." + menu.tile.doHitBreak); @@ -71,7 +72,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 150, 52); energy.draw(ms, menu.tile.getEnergy()); diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/energy/ScreenWirelessEnergy.java b/src/main/java/com/lothrazar/cyclic/block/wireless/energy/ScreenWirelessEnergy.java index 5ab91933f..cebf5e870 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/energy/ScreenWirelessEnergy.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/energy/ScreenWirelessEnergy.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -16,7 +17,7 @@ public class ScreenWirelessEnergy extends ScreenBase { public ScreenWirelessEnergy(ContainerWirelessEnergy screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.energy = new EnergyBar(this, TileWirelessEnergy.MAX); + this.energy = new EnergyBar(this.font , TileWirelessEnergy.MAX); } @Override @@ -31,7 +32,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -40,13 +41,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); // this.drawSlot(ms, 79, 35, TextureRegistry.SLOT_GPS); int y = 35; diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/ScreenWirelessFluid.java b/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/ScreenWirelessFluid.java index e3e6b1910..bacc52f2b 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/ScreenWirelessFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/ScreenWirelessFluid.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -16,7 +17,7 @@ public class ScreenWirelessFluid extends ScreenBase { public ScreenWirelessFluid(ContainerWirelessFluid screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - fluid = new FluidBar(this, 152, 8, TileMelter.CAPACITY); + fluid = new FluidBar(this.font , 152, 8, TileMelter.CAPACITY); } @Override @@ -31,7 +32,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -40,13 +41,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 79, 35, TextureRegistry.SLOT_GPS); fluid.draw(ms, menu.tile.getFluid()); diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/item/ScreenWirelessItem.java b/src/main/java/com/lothrazar/cyclic/block/wireless/item/ScreenWirelessItem.java index f5e4dfd78..6f79b61d8 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/item/ScreenWirelessItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/item/ScreenWirelessItem.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -25,7 +26,7 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -33,13 +34,13 @@ public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); this.drawSlot(ms, 79, 35, TextureRegistry.SLOT_GPS); this.drawSlot(ms, 142, 35); diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/ScreenTransmit.java b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/ScreenTransmit.java index 7fcfc18c5..fe1189ab3 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/ScreenTransmit.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/ScreenTransmit.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.gui.TextureEnum; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -29,21 +30,21 @@ public void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { this.drawButtonTooltips(ms, mouseX, mouseY); this.drawName(ms, title.getString()); btnRender.onValueUpdate(menu.tile); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); for (int s = 0; s < 9; s++) { this.drawSlot(ms, 8 + 18 * s, 48, TextureRegistry.SLOT_GPS, Const.SQ); diff --git a/src/main/java/com/lothrazar/cyclic/block/workbench/ContainerWorkbench.java b/src/main/java/com/lothrazar/cyclic/block/workbench/ContainerWorkbench.java index a25562576..3c22e8a2b 100644 --- a/src/main/java/com/lothrazar/cyclic/block/workbench/ContainerWorkbench.java +++ b/src/main/java/com/lothrazar/cyclic/block/workbench/ContainerWorkbench.java @@ -19,6 +19,7 @@ import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.inventory.ResultSlot; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.Recipe; @@ -34,7 +35,7 @@ public class ContainerWorkbench extends RecipeBookMenu implem public static final int OUTPUT_START_X = 124; public static final int OUTPUT_START_Y = 35; public static final int GRID_NUM_ROWS = 3; - private final CraftingContainer craftMatrix = new CraftingContainer(this, GRID_NUM_ROWS, GRID_NUM_ROWS); + private final CraftingContainer craftMatrix = new TransientCraftingContainer(this, GRID_NUM_ROWS, GRID_NUM_ROWS); private final ResultContainer craftResult = new ResultContainer(); private final Player player; private final ContainerLevelAccess worldPosCallable; @@ -87,7 +88,7 @@ public void clearCraftingContent() { @Override public boolean recipeMatches(Recipe recipeIn) { - return recipeIn.matches(this.craftMatrix, this.player.level); + return recipeIn.matches(this.craftMatrix, this.player.level()); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/block/workbench/ScreenWorkbench.java b/src/main/java/com/lothrazar/cyclic/block/workbench/ScreenWorkbench.java index ab883a598..6fa5237f8 100644 --- a/src/main/java/com/lothrazar/cyclic/block/workbench/ScreenWorkbench.java +++ b/src/main/java/com/lothrazar/cyclic/block/workbench/ScreenWorkbench.java @@ -8,6 +8,7 @@ import com.lothrazar.cyclic.registry.PacketRegistry; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -17,13 +18,6 @@ public ScreenWorkbench(ContainerWorkbench screenContainer, Inventory inv, Compon super(screenContainer, inv, titleIn); } - @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(ms); - super.render(ms, mouseX, mouseY, partialTicks); - this.renderTooltip(ms, mouseX, mouseY); - } - @Override public void init() { super.init(); @@ -46,14 +40,20 @@ public void init() { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(ms); + super.render(ms, mouseX, mouseY, partialTicks); + this.renderTooltip(ms, mouseX, mouseY); + } + @Override + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { // super.drawGuiContainerForegroundLayer(ms, mouseX, mouseY); this.drawName(ms, title.getString()); this.drawButtonTooltips(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int x, int y) { + protected void renderBg(GuiGraphics ms, float partialTicks, int x, int y) { //previous was fine, but this references exactly the 'minecraft:' vanilla crafting table this.drawBackground(ms, TextureRegistry.V_CRAFTING); } diff --git a/src/main/java/com/lothrazar/cyclic/command/CommandGetHome.java b/src/main/java/com/lothrazar/cyclic/command/CommandGetHome.java index 7b4a587a0..5e7bb6241 100644 --- a/src/main/java/com/lothrazar/cyclic/command/CommandGetHome.java +++ b/src/main/java/com/lothrazar/cyclic/command/CommandGetHome.java @@ -6,6 +6,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; @@ -24,7 +25,7 @@ public static int execute(CommandContext ctx) throws Command BlockPos respawnPos = player.getRespawnPosition(); Optional optional = Optional.empty(); if (respawnPos != null) { - optional = Player.findRespawnPositionAndUseSpawnBlock(player.getLevel(), respawnPos, 0.0F, true, true); + optional = Player.findRespawnPositionAndUseSpawnBlock((ServerLevel) player.level(), respawnPos, 0.0F, true, true); } if (optional.isPresent()) { Vec3 thanksMojang = optional.get(); diff --git a/src/main/java/com/lothrazar/cyclic/command/CommandHome.java b/src/main/java/com/lothrazar/cyclic/command/CommandHome.java index 433e7dd2e..71dfcd776 100644 --- a/src/main/java/com/lothrazar/cyclic/command/CommandHome.java +++ b/src/main/java/com/lothrazar/cyclic/command/CommandHome.java @@ -22,7 +22,7 @@ public static void teleport(ServerPlayer player) { if (optional.isPresent()) { Vec3 thanksMojang = optional.get(); BlockPos bedLocation = new BlockPos((int) thanksMojang.x, (int) thanksMojang.y, (int) thanksMojang.z); - EntityUtil.enderTeleportEvent(player, player.level, bedLocation); + EntityUtil.enderTeleportEvent(player, player.level(), bedLocation); ModCyclic.LOGGER.info("[home]" + bedLocation + " | " + player.getUUID()); } else { diff --git a/src/main/java/com/lothrazar/cyclic/command/CommandNetherping.java b/src/main/java/com/lothrazar/cyclic/command/CommandNetherping.java index 7990b35d4..53c861c9a 100644 --- a/src/main/java/com/lothrazar/cyclic/command/CommandNetherping.java +++ b/src/main/java/com/lothrazar/cyclic/command/CommandNetherping.java @@ -22,7 +22,7 @@ public static int execute(CommandContext ctx) throws Command public static int exeNether(CommandContext ctx) throws CommandSyntaxException { ServerPlayer player = ctx.getSource().getPlayerOrException(); double factor = 1 / NETHER_RATIO; //overworld: use 1/8th - boolean isnether = player.level.dimension() == Level.NETHER; + boolean isnether = player.level().dimension() == Level.NETHER; if (isnether) { //you are nether, multiply by it factor = NETHER_RATIO; diff --git a/src/main/java/com/lothrazar/cyclic/compat/jei/CrusherRecipeCategory.java b/src/main/java/com/lothrazar/cyclic/compat/jei/CrusherRecipeCategory.java index 93f4703ca..2aad55323 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/jei/CrusherRecipeCategory.java +++ b/src/main/java/com/lothrazar/cyclic/compat/jei/CrusherRecipeCategory.java @@ -15,6 +15,7 @@ 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.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -53,19 +54,20 @@ public RecipeType getRecipeType() { } @Override - public void draw(RecipeCrusher recipe, IRecipeSlotsView recipeSlotsView, PoseStack ms, double mouseX, double mouseY) { + public void draw(RecipeCrusher recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics ms, double mouseX, double mouseY) { int x = 78; + var font=Minecraft.getInstance().font; if (recipe.energy.getTicks() < 40) { - Minecraft.getInstance().font.draw(ms, recipe.energy.getTicks() + " t", x, 6, FONT); + ms.drawString(font, recipe.energy.getTicks() + " t", x, 6, FONT); } else { int sec = recipe.energy.getTicks() / 20; - Minecraft.getInstance().font.draw(ms, sec + " s", x, 6, FONT); + ms.drawString(font, sec + " s", x, 6, FONT); } - Minecraft.getInstance().font.draw(ms, recipe.energy.getRfPertick() + " RF/t", x, 16, FONT); - Minecraft.getInstance().font.draw(ms, recipe.energy.getEnergyTotal() + " RF", x, 26, FONT); + ms.drawString(font, recipe.energy.getRfPertick() + " RF/t", x, 16, FONT); + ms.drawString(font, recipe.energy.getEnergyTotal() + " RF", x, 26, FONT); if (!recipe.randOutput.bonus.isEmpty() && recipe.randOutput.percent > 0) { - Minecraft.getInstance().font.draw(ms, recipe.randOutput.percent + "%", 56, 36, FONT); + ms.drawString(font, recipe.randOutput.percent + "%", 56, 36, FONT); } } diff --git a/src/main/java/com/lothrazar/cyclic/compat/jei/GenfluidRecipeCategory.java b/src/main/java/com/lothrazar/cyclic/compat/jei/GenfluidRecipeCategory.java index 6af3d9186..4a2135edc 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/jei/GenfluidRecipeCategory.java +++ b/src/main/java/com/lothrazar/cyclic/compat/jei/GenfluidRecipeCategory.java @@ -17,6 +17,7 @@ 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.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -56,10 +57,11 @@ public RecipeType getRecipeType() { } @Override - public void draw(RecipeGeneratorFluid recipe, IRecipeSlotsView recipeSlotsView, PoseStack ms, double mouseX, double mouseY) { - Minecraft.getInstance().font.draw(ms, recipe.getTicks() + " t", 60, 0, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getRfpertick() + " RF/t", 60, 10, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getRfTotal() + " RF", 60, 20, FONT); + public void draw(RecipeGeneratorFluid recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics ms, double mouseX, double mouseY) { + var font= Minecraft.getInstance().font; + ms.drawString(font, recipe.getTicks() + " t", 60, 0, FONT); + ms.drawString(font, recipe.getRfpertick() + " RF/t", 60, 10, FONT); + ms.drawString(font, recipe.getRfTotal() + " RF", 60, 20, FONT); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/compat/jei/GenitemRecipeCategory.java b/src/main/java/com/lothrazar/cyclic/compat/jei/GenitemRecipeCategory.java index 2d14a76dd..885bfd2e5 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/jei/GenitemRecipeCategory.java +++ b/src/main/java/com/lothrazar/cyclic/compat/jei/GenitemRecipeCategory.java @@ -15,6 +15,7 @@ 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.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -53,10 +54,11 @@ public RecipeType getRecipeType() { } @Override - public void draw(RecipeGeneratorItem recipe, IRecipeSlotsView recipeSlotsView, PoseStack ms, double mouseX, double mouseY) { - Minecraft.getInstance().font.draw(ms, recipe.getTicks() + " t", 60, 0, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getRfPertick() + " RF/t", 60, 10, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getEnergyTotal() + " RF", 60, 20, FONT); + public void draw(RecipeGeneratorItem recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics ms, double mouseX, double mouseY) { + var font = Minecraft.getInstance().font; + ms.drawString(font, recipe.getTicks() + " t", 60, 0, FONT); + ms.drawString(font, recipe.getRfPertick() + " RF/t", 60, 10, FONT); + ms.drawString(font, recipe.getEnergyTotal() + " RF", 60, 20, FONT); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/compat/jei/MelterRecipeCategory.java b/src/main/java/com/lothrazar/cyclic/compat/jei/MelterRecipeCategory.java index b76dd1a99..d53124bcc 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/jei/MelterRecipeCategory.java +++ b/src/main/java/com/lothrazar/cyclic/compat/jei/MelterRecipeCategory.java @@ -17,6 +17,7 @@ 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.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -56,10 +57,11 @@ public RecipeType getRecipeType() { } @Override - public void draw(RecipeMelter recipe, IRecipeSlotsView recipeSlotsView, PoseStack ms, double mouseX, double mouseY) { - Minecraft.getInstance().font.draw(ms, recipe.getEnergy().getTicks() + " t", 60, 0, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getEnergy().getRfPertick() + " RF/t", 60, 10, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getEnergy().getEnergyTotal() + " RF", 60, 20, FONT); + public void draw(RecipeMelter recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics ms, double mouseX, double mouseY) { + var font = Minecraft.getInstance().font; + ms.drawString(font, recipe.getEnergy().getTicks() + " t", 60, 0, FONT); + ms.drawString(font, recipe.getEnergy().getRfPertick() + " RF/t", 60, 10, FONT); + ms.drawString(font, recipe.getEnergy().getEnergyTotal() + " RF", 60, 20, FONT); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/compat/jei/SolidifierRecipeCategory.java b/src/main/java/com/lothrazar/cyclic/compat/jei/SolidifierRecipeCategory.java index f1bc5cfde..db8f7a9d5 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/jei/SolidifierRecipeCategory.java +++ b/src/main/java/com/lothrazar/cyclic/compat/jei/SolidifierRecipeCategory.java @@ -17,6 +17,7 @@ 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.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -56,10 +57,11 @@ public RecipeType getRecipeType() { } @Override - public void draw(RecipeSolidifier recipe, IRecipeSlotsView recipeSlotsView, PoseStack ms, double mouseX, double mouseY) { - Minecraft.getInstance().font.draw(ms, recipe.getEnergy().getTicks() + " t", 60, 0, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getEnergy().getRfPertick() + " RF/t", 60, 10, FONT); - Minecraft.getInstance().font.draw(ms, recipe.getEnergy().getEnergyTotal() + " RF", 60, 20, FONT); + public void draw(RecipeSolidifier recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics ms, double mouseX, double mouseY) { + var font = Minecraft.getInstance().font; + ms.drawString(font, recipe.getEnergy().getTicks() + " t", 60, 0, FONT); + ms.drawString(font, recipe.getEnergy().getRfPertick() + " RF/t", 60, 10, FONT); + ms.drawString(font, recipe.getEnergy().getEnergyTotal() + " RF", 60, 20, FONT); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/enchant/BeheadingEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/BeheadingEnchant.java index 6b447ac54..7d51b2ca2 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/BeheadingEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/BeheadingEnchant.java @@ -110,7 +110,7 @@ public void onEntityKill(LivingDeathEvent event) { if (level <= 0) { return; } - Level world = attacker.level; + Level world = attacker.level(); if (Mth.nextInt(world.random, 0, 100) > percentForLevel(level)) { return; } diff --git a/src/main/java/com/lothrazar/cyclic/enchant/DisarmEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/DisarmEnchant.java index 8b7a20cbf..88a8f044d 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/DisarmEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/DisarmEnchant.java @@ -74,7 +74,7 @@ public void doPostAttack(LivingEntity user, Entity target, int level) { LivingEntity livingTarget = (LivingEntity) target; List toDisarm = new ArrayList<>(); target.getHandSlots().forEach(itemStack -> { - if (getChanceToDisarm(level) > user.level.random.nextDouble()) { + if (getChanceToDisarm(level) > user.level().random.nextDouble()) { toDisarm.add(itemStack); } }); @@ -89,7 +89,7 @@ else if (itemStack.equals(livingTarget.getOffhandItem())) { dropHeld = true; } if (dropHeld) { - user.level.addFreshEntity(new ItemEntity(user.level, livingTarget.getX(), + user.level().addFreshEntity(new ItemEntity(user.level(), livingTarget.getX(), livingTarget.getY(), livingTarget.getZ(), itemStack)); } }); diff --git a/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java index d775dd9dd..d30447ab8 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java @@ -68,7 +68,7 @@ public boolean canEnchant(ItemStack stack) { @Override public void doPostHurt(LivingEntity user, Entity attacker, int level) { - if (user.level.isClientSide || !(attacker instanceof LivingEntity) + if (user.level().isClientSide || !(attacker instanceof LivingEntity) || FakePlayerUtil.isFakePlayer(attacker)) { //do nothing on clientside, server only //only trigger if attacker is alive and not a fakeplayer @@ -82,7 +82,7 @@ public void doPostHurt(LivingEntity user, Entity attacker, int level) { + getCurrentArmorLevelSlot(user, EquipmentSlot.FEET); double adjustedActivationChance = BASE_ACTIVATION_CHANCE / totalLevels; //does it pass the chance - if (adjustedActivationChance > user.level.random.nextDouble()) { + if (adjustedActivationChance > user.level().random.nextDouble()) { List negativeEffects = EnchantUtil.getNegativeEffects(); Collections.shuffle(negativeEffects); int appliedEffects = 0; @@ -92,7 +92,7 @@ public void doPostHurt(LivingEntity user, Entity attacker, int level) { //should be impossible, but i had a random NPE crash log } if (appliedEffects < MIN_EFFECTS - || BASE_APPLY_CHANCE > user.level.random.nextDouble()) { + || BASE_APPLY_CHANCE > user.level().random.nextDouble()) { //the OR means, if we are under minimum, always go thru //if we are beyond minimum, check the random chance livingAttacker.addEffect(new MobEffectInstance(effect, EFFECT_DURATION)); diff --git a/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java index 6fc6fa08d..cf761fc7b 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java @@ -106,11 +106,11 @@ public void onEntityUpdate(LivingTickEvent event) { } //Ticking int level = getCurrentLevelTool(entity.getItemInHand(InteractionHand.MAIN_HAND)); - if (level > 0 && !entity.level.isClientSide) { - if (entity.level.random.nextDouble() > ODDS_ROTATE / level) { + if (level > 0 && !entity.level().isClientSide) { + if (entity.level().random.nextDouble() > ODDS_ROTATE / level) { return; //slow the dice down } - final int growthLimit = level * 2 + (entity.level.isRaining() ? 4 : 1); //faster when raining too + final int growthLimit = level * 2 + (entity.level().isRaining() ? 4 : 1); //faster when raining too int grown = 0; List shape = ShapeUtil.squareHorizontalFull(entity.blockPosition().below(), level + RADIUSFACTOR.get()); shape = ShapeUtil.repeatShapeByHeight(shape, 2); @@ -121,9 +121,9 @@ public void onEntityUpdate(LivingTickEvent event) { } //do one BlockPos pos = shape.get(i); - BlockState target = entity.level.getBlockState(pos); + BlockState target = entity.level().getBlockState(pos); if (target.getBlock() instanceof CropBlock igrowable) { // IGrowable gone, dont use BonemealableBlock - igrowable.growCrops(entity.level, pos, target); + igrowable.growCrops(entity.level(), pos, target); grown++; // allow mods to override growCrops() for custom behavior } else { //still use same old age logic as always unchanged @@ -134,7 +134,7 @@ public void onEntityUpdate(LivingTickEvent event) { int maxAge = Collections.max(propAge.getPossibleValues()); Integer currentAge = target.getValue(propAge); if (currentAge < maxAge) { - if (entity.level.setBlockAndUpdate(pos, target.setValue(propAge, currentAge + 1))) { + if (entity.level().setBlockAndUpdate(pos, target.setValue(propAge, currentAge + 1))) { grown++; } } diff --git a/src/main/java/com/lothrazar/cyclic/enchant/MultiJumpEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/MultiJumpEnchant.java index 6227ca8c1..58ac6e7a1 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/MultiJumpEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/MultiJumpEnchant.java @@ -100,7 +100,7 @@ public void onEntityUpdate(LivingTickEvent event) { return; } //if you are on the ground or not airborne, should be same thing - if ((p.hasImpulse == false || p.isOnGround()) && + if ((p.hasImpulse == false || p.onGround()) && armorStack.getOrCreateTag().getInt(NBT_USES) > 0) { //you have landed on the ground, dont count previous jumps TagDataUtil.setItemStackNBTVal(armorStack, NBT_USES, 0); diff --git a/src/main/java/com/lothrazar/cyclic/enchant/TravellerEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/TravellerEnchant.java index fbb9ada6f..21e0ead16 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/TravellerEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/TravellerEnchant.java @@ -112,7 +112,7 @@ public void onEntityUpdate(LivingDamageEvent event) { } int level = getCurrentArmorLevelSlot(event.getEntity(), EquipmentSlot.LEGS); DamageSource source = event.getSource(); // .type(); - DamageSources bullshit = event.getEntity().getLevel().damageSources(); + DamageSources bullshit = event.getEntity().level().damageSources(); if (level > 0 && (source == bullshit.cactus() || source == bullshit.flyIntoWall() || source == bullshit.sweetBerryBush() @@ -132,7 +132,7 @@ else if (event.getEntity().getItemBySlot(EquipmentSlot.CHEST).getItem() instance if (event.getAmount() > event.getEntity().getHealth() - 0.5F) { //either you crashed flying straight into the ground, or just fell while wearing elytra (you still die to void tho) event.setAmount(event.getEntity().getHealth() - 1F); - ParticleUtil.spawnParticle(event.getEntity().level, ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, event.getEntity().blockPosition(), 4); + ParticleUtil.spawnParticle(event.getEntity().level(), ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, event.getEntity().blockPosition(), 4); } } } diff --git a/src/main/java/com/lothrazar/cyclic/enchant/XpEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/XpEnchant.java index 5c87c4a2c..d5f0eb842 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/XpEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/XpEnchant.java @@ -65,7 +65,7 @@ public void handleBlockBreakEvent(BlockEvent.BreakEvent event) { if (level <= 0) { return; } - event.setExpToDrop(event.getExpToDrop() + getRandomExpAmount(level, event.getPlayer().level)); + event.setExpToDrop(event.getExpToDrop() + getRandomExpAmount(level, event.getPlayer().level())); } @SubscribeEvent @@ -80,7 +80,7 @@ public void handleEntityDropEvent(LivingExperienceDropEvent event) { if (level <= 0) { return; } - event.setDroppedExperience(event.getDroppedExperience() + getRandomExpAmount(level, event.getAttackingPlayer().level)); + event.setDroppedExperience(event.getDroppedExperience() + getRandomExpAmount(level, event.getAttackingPlayer().level())); } private int getRandomExpAmount(int level, Level world) { diff --git a/src/main/java/com/lothrazar/cyclic/event/BlockSpawnEvents.java b/src/main/java/com/lothrazar/cyclic/event/BlockSpawnEvents.java index 2abb98355..ea4dbb502 100644 --- a/src/main/java/com/lothrazar/cyclic/event/BlockSpawnEvents.java +++ b/src/main/java/com/lothrazar/cyclic/event/BlockSpawnEvents.java @@ -46,7 +46,7 @@ public void onLivingSpawnEvent(MobSpawnEvent.FinalizeSpawn event) { if (radius > 0 && height > 0 && CandlePeaceBlock.isBad(mob, res) - && ServerCacheHolder.PEACE_CANDLE.hasCollision(mob.level, mob.blockPosition(), radius.intValue(), height.intValue()) + && ServerCacheHolder.PEACE_CANDLE.hasCollision(mob.level(), mob.blockPosition(), radius.intValue(), height.intValue()) // && LevelWorldUtil.doesBlockExist(mob.level, mob.blockPosition(), BlockRegistry.PEACE_CANDLE.get().defaultBlockState().setValue(BlockCyclic.LIT, true), radius, height) ) { //default range 32 and filtered @@ -59,7 +59,7 @@ public void onLivingSpawnEvent(MobSpawnEvent.FinalizeSpawn event) { if (radius > 0 && height > 0 && BlockAltarNoTraders.isSpawnDenied(mob, res) - && ServerCacheHolder.NO_SOLICITING.hasCollision(mob.level, mob.blockPosition(), radius.intValue(), height.intValue()) + && ServerCacheHolder.NO_SOLICITING.hasCollision(mob.level(), mob.blockPosition(), radius.intValue(), height.intValue()) // && LevelWorldUtil.doesBlockExist(mob.level, mob.blockPosition(), BlockRegistry.NO_SOLICITING.get().defaultBlockState().setValue(BlockAltarNoTraders.LIT, true), radius, height) ) { ModCyclic.LOGGER.info(mob.blockPosition() + " Spawn cancelled by cache-altar " + mob.getType()); diff --git a/src/main/java/com/lothrazar/cyclic/event/EventRender.java b/src/main/java/com/lothrazar/cyclic/event/EventRender.java index 33ffe3469..16b9a3b92 100644 --- a/src/main/java/com/lothrazar/cyclic/event/EventRender.java +++ b/src/main/java/com/lothrazar/cyclic/event/EventRender.java @@ -27,11 +27,13 @@ import com.lothrazar.cyclic.util.SoundUtil; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; @@ -41,13 +43,13 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.event.CustomizeGuiOverlayEvent; -import net.minecraftforge.client.event.RenderLevelLastEvent; +import net.minecraftforge.client.event.CustomizeGuiOverlayEvent; +import net.minecraftforge.client.event.RenderLevelStageEvent; +import net.minecraftforge.client.event.RenderLevelStageEvent.Stage; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.eventbus.api.SubscribeEvent; - -@SuppressWarnings("removal") // fix in 1.19 + public class EventRender { @SubscribeEvent @@ -55,22 +57,24 @@ public class EventRender { public static void onCustomizeDebugText(CustomizeGuiOverlayEvent.DebugText event) { //Build scepter feature : render selected blockstate in cross hair Player player = Minecraft.getInstance().player; + var level = player.level(); Minecraft mc = Minecraft.getInstance(); // ModCyclic.LOGGER.info("TESTME : ElementType.CROSSHAIRS is gone deleted"); // if (event.getType() == ElementType.ALL) { ItemStack itemStackHeld = BuilderItem.getIfHeld(player); if (itemStackHeld.getItem() instanceof BuilderItem) { // - BlockState targetState = BuilderActionType.getBlockState(player.level, itemStackHeld); + BlockState targetState = BuilderActionType.getBlockState(level, itemStackHeld); if (targetState != null) { //ok still - drawStack(event.getPoseStack(), new ItemStack(targetState.getBlock())); + + drawStack(event.getGuiGraphics(), new ItemStack(targetState.getBlock())); int slot = PlayerUtil.getFirstSlotWithBlock(player, targetState); if (slot < 0) { //nothing found int width = mc.getWindow().getGuiScaledWidth(); int height = mc.getWindow().getGuiScaledHeight(); - drawString(event.getPoseStack(), "" + 0, width / 2 + 16, height / 2 + 12); + drawString(event.getGuiGraphics(), "" + 0, width / 2 + 16, height / 2 + 12); } } } @@ -82,30 +86,36 @@ public static void onCustomizeDebugText(CustomizeGuiOverlayEvent.DebugText event // } if (datFile.spectatorTicks > 0) { int sec = datFile.spectatorTicks / 20; - drawString(event.getPoseStack(), "noClip " + sec, 10, height - 10); + drawString(event.getGuiGraphics(), "noClip " + sec, 10, height - 10); } } - public static void drawString(PoseStack ms, String str, int x, int y) { + public static void drawString(GuiGraphics gg, String str, int x, int y) { Minecraft mc = Minecraft.getInstance(); - mc.font.draw(ms, str, x, y, 0xFFFFFF); + gg.drawString(mc.font, str, x, y, 0xFFFFFF); } - public static void drawStack(PoseStack poseStack, ItemStack stack) { + public static void drawStack(GuiGraphics poseStack, ItemStack stack) { Minecraft mc = Minecraft.getInstance(); int width = mc.getWindow().getGuiScaledWidth(); int height = mc.getWindow().getGuiScaledHeight(); - mc.getItemRenderer().renderAndDecorateItem(poseStack, stack, width / 2, height / 2); +// mc.getItemRenderer().render(stack, null, false, null, null, width, height, null); + var context = ItemDisplayContext.GUI; + var pose = poseStack.pose(); + poseStack.renderItem(stack, width / 2, height / 2,0,10); } @SubscribeEvent - public void onRenderWorldLast(RenderLevelLastEvent event) { + public void onRenderWorldLast(RenderLevelStageEvent event) { Minecraft mc = Minecraft.getInstance(); Player player = mc.player; if (player == null) { return; } - Level world = player.level; + if(event.getStage() != Stage.AFTER_SOLID_BLOCKS) { + return; //send it + } + Level world = player.level(); double range = 6F; float alpha = 0.125F * 2; Map renderCubes = new HashMap<>(); diff --git a/src/main/java/com/lothrazar/cyclic/event/ItemEvents.java b/src/main/java/com/lothrazar/cyclic/event/ItemEvents.java index 90219330e..d18d92966 100644 --- a/src/main/java/com/lothrazar/cyclic/event/ItemEvents.java +++ b/src/main/java/com/lothrazar/cyclic/event/ItemEvents.java @@ -137,7 +137,7 @@ public void onArrowLooseEvent(ArrowLooseEvent event) { } ItemStack stackBow = event.getBow(); Player player = event.getEntity(); - Level worldIn = player.level; + Level worldIn = player.level(); if (worldIn.isClientSide == false) { int level = EnchantRegistry.MULTIBOW.get().getCurrentLevelTool(stackBow); if (level <= 0) { @@ -176,7 +176,7 @@ public void onProjectileImpactEvent(ProjectileImpactEvent event) { if (arrow == null || event.getRayTraceResult() == null) { return; } - Level world = arrow.level; + Level world = arrow.level(); Type hit = event.getRayTraceResult().getType(); Entity shooter = arrow.getOwner(); // getShooter if (shooter instanceof Player) { @@ -274,8 +274,8 @@ else if (src.getEntity() instanceof Player) { //player DEALING damage Player ply = (Player) src.getEntity(); ItemStack find = CharmUtil.getIfEnabled(ply, ItemRegistry.CHARM_VENOM.get()); - if (!find.isEmpty() && ply.level.random.nextDouble() < 0.25F) { - int seconds = 2 + ply.level.random.nextInt(4); + if (!find.isEmpty() && ply.level().random.nextDouble() < 0.25F) { + int seconds = 2 + ply.level().random.nextInt(4); event.getEntity().addEffect(new MobEffectInstance(MobEffects.POISON, 20 * seconds, 0)); ItemStackUtil.damageItem(ply, find); } diff --git a/src/main/java/com/lothrazar/cyclic/fluid/FluidBiomassHolder.java b/src/main/java/com/lothrazar/cyclic/fluid/FluidBiomassHolder.java index 828e47584..447648575 100644 --- a/src/main/java/com/lothrazar/cyclic/fluid/FluidBiomassHolder.java +++ b/src/main/java/com/lothrazar/cyclic/fluid/FluidBiomassHolder.java @@ -13,7 +13,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Material; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -29,7 +28,8 @@ public class FluidBiomassHolder { public static final int COLOR = 0x725D3C; public static RegistryObject STILL = FluidRegistry.FLUIDS.register(id, () -> new ForgeFlowingFluid.Source(makeProperties())); public static RegistryObject FLOWING = FluidRegistry.FLUIDS.register(id + "_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties())); - public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new BiomassFluidBlock(STILL, Block.Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable())); + public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new BiomassFluidBlock(STILL, Block.Properties.of().liquid() + .noCollission().strength(100.0F).noLootTable())); public static RegistryObject BUCKET = ItemRegistry.ITEMS.register(id + "_bucket", () -> new BucketItem(STILL, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); public static RegistryObject test_fluid_type = FluidRegistry.FLUID_TYPES.register(id, () -> new FluidType(FluidType.Properties.create()) { diff --git a/src/main/java/com/lothrazar/cyclic/fluid/FluidHoneyHolder.java b/src/main/java/com/lothrazar/cyclic/fluid/FluidHoneyHolder.java index 00ef7fcba..273a6c852 100644 --- a/src/main/java/com/lothrazar/cyclic/fluid/FluidHoneyHolder.java +++ b/src/main/java/com/lothrazar/cyclic/fluid/FluidHoneyHolder.java @@ -11,8 +11,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.FlowingFluid; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -27,7 +26,8 @@ public class FluidHoneyHolder { public static final int COLOR = 0xFFCE5D; public static RegistryObject STILL = FluidRegistry.FLUIDS.register(id, () -> new ForgeFlowingFluid.Source(makeProperties())); public static RegistryObject FLOWING = FluidRegistry.FLUIDS.register(id + "_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties())); - public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new HoneyFluidBlock(STILL, Block.Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable())); + public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new HoneyFluidBlock(STILL, Block.Properties.of().liquid() + .noCollission().strength(100.0F).noLootTable())); public static RegistryObject BUCKET = ItemRegistry.ITEMS.register(id + "_bucket", () -> new BucketItem(STILL, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); public static RegistryObject test_fluid_type = FluidRegistry.FLUID_TYPES.register(id, () -> new FluidType(FluidType.Properties.create()) { diff --git a/src/main/java/com/lothrazar/cyclic/fluid/FluidMagmaHolder.java b/src/main/java/com/lothrazar/cyclic/fluid/FluidMagmaHolder.java index 2f2cf0241..a23f22935 100644 --- a/src/main/java/com/lothrazar/cyclic/fluid/FluidMagmaHolder.java +++ b/src/main/java/com/lothrazar/cyclic/fluid/FluidMagmaHolder.java @@ -11,8 +11,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.FlowingFluid; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -26,7 +25,7 @@ public class FluidMagmaHolder { public static final int COLOR = 0x4B261F; public static RegistryObject STILL = FluidRegistry.FLUIDS.register(id, () -> new MagmaFluidBlock.Source(makeProperties())); public static RegistryObject FLOWING = FluidRegistry.FLUIDS.register(id + "_flowing", () -> new MagmaFluidBlock.Flowing(makeProperties())); - public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new MagmaFluidBlock(STILL, Block.Properties.of(Material.WATER).strength(100.0F).lightLevel((p_235456_0_) -> { + public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new MagmaFluidBlock(STILL, Block.Properties.of().liquid().strength(100.0F).lightLevel((p_235456_0_) -> { return 8; }).noLootTable())); public static RegistryObject BUCKET = ItemRegistry.ITEMS.register(id + "_bucket", () -> new BucketItem(STILL, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); diff --git a/src/main/java/com/lothrazar/cyclic/fluid/FluidSlimeHolder.java b/src/main/java/com/lothrazar/cyclic/fluid/FluidSlimeHolder.java index b961f5ee7..3ebf1179b 100644 --- a/src/main/java/com/lothrazar/cyclic/fluid/FluidSlimeHolder.java +++ b/src/main/java/com/lothrazar/cyclic/fluid/FluidSlimeHolder.java @@ -11,8 +11,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.FlowingFluid; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -27,7 +26,8 @@ public class FluidSlimeHolder { public static final int COLOR = 0x51A03E; public static RegistryObject STILL = FluidRegistry.FLUIDS.register(id, () -> new SlimeFluidBlock.Source(makeProperties())); public static RegistryObject FLOWING = FluidRegistry.FLUIDS.register(id + "_flowing", () -> new SlimeFluidBlock.Flowing(makeProperties())); - public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new SlimeFluidBlock(STILL, Block.Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable())); + public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(id + "_block", () -> new SlimeFluidBlock(STILL, Block.Properties.of().liquid() + .noCollission().strength(100.0F).noLootTable())); public static RegistryObject BUCKET = ItemRegistry.ITEMS.register(id + "_bucket", () -> new BucketItem(STILL, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); public static RegistryObject test_fluid_type = FluidRegistry.FLUID_TYPES.register(id, () -> new FluidType(FluidType.Properties.create()) { diff --git a/src/main/java/com/lothrazar/cyclic/fluid/FluidWaxHolder.java b/src/main/java/com/lothrazar/cyclic/fluid/FluidWaxHolder.java index 33259d5ab..e9c69e1bc 100644 --- a/src/main/java/com/lothrazar/cyclic/fluid/FluidWaxHolder.java +++ b/src/main/java/com/lothrazar/cyclic/fluid/FluidWaxHolder.java @@ -11,8 +11,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.FlowingFluid; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -27,7 +26,8 @@ public class FluidWaxHolder { private static final String ID = "wax"; public static RegistryObject STILL = FluidRegistry.FLUIDS.register(ID, () -> new ForgeFlowingFluid.Source(makeProperties())); public static RegistryObject FLOWING = FluidRegistry.FLUIDS.register(ID + "_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties())); - public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(ID + "_block", () -> new WaxFluidBlock(STILL, Block.Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable())); + public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(ID + "_block", () -> new WaxFluidBlock(STILL, Block.Properties.of().liquid() + .noCollission().strength(100.0F).noLootTable())); public static RegistryObject BUCKET = ItemRegistry.ITEMS.register(ID + "_bucket", () -> new BucketItem(STILL, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); public static RegistryObject test_fluid_type = FluidRegistry.FLUID_TYPES.register(ID, () -> new FluidType(FluidType.Properties.create()) { diff --git a/src/main/java/com/lothrazar/cyclic/fluid/FluidXpJuiceHolder.java b/src/main/java/com/lothrazar/cyclic/fluid/FluidXpJuiceHolder.java index fa6c543f9..706a727d3 100644 --- a/src/main/java/com/lothrazar/cyclic/fluid/FluidXpJuiceHolder.java +++ b/src/main/java/com/lothrazar/cyclic/fluid/FluidXpJuiceHolder.java @@ -12,8 +12,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.FlowingFluid; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -30,7 +29,8 @@ public class FluidXpJuiceHolder { public static RegistryObject STILL = FluidRegistry.FLUIDS.register(ID, () -> new ForgeFlowingFluid.Source(makeProperties())); public static RegistryObject FLOWING = FluidRegistry.FLUIDS.register(ID + "_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties())); // .noDrops() became noLootTable() - public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(ID + "_block", () -> new XpJuiceFluidBlock(STILL, Block.Properties.of(Material.WATER).noCollission().lightLevel(s -> 8).strength(100.0F).noLootTable())); + public static RegistryObject BLOCK = BlockRegistry.BLOCKS.register(ID + "_block", () -> new XpJuiceFluidBlock(STILL, Block.Properties.of().liquid() + .noCollission().lightLevel(s -> 8).strength(100.0F).noLootTable())); public static RegistryObject BUCKET = ItemRegistry.ITEMS.register(ID + "_bucket", () -> new BucketItem(STILL, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); public static RegistryObject test_fluid_type = FluidRegistry.FLUID_TYPES.register(ID, () -> new FluidType(FluidType.Properties.create()) { diff --git a/src/main/java/com/lothrazar/cyclic/gui/ButtonTextured.java b/src/main/java/com/lothrazar/cyclic/gui/ButtonTextured.java index 72acaa085..1d1c3103e 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/ButtonTextured.java +++ b/src/main/java/com/lothrazar/cyclic/gui/ButtonTextured.java @@ -6,7 +6,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraftforge.client.gui.widget.ExtendedButton; @@ -17,7 +17,7 @@ public class ButtonTextured extends ExtendedButton implements IHasTooltip { private TextureEnum textureId; - private List tooltip; + private List tooltips; public int xOffset = 0; public int yOffset = 0; @@ -37,17 +37,17 @@ public void setTextureId(TextureEnum id) { } @Override - public void renderWidget(PoseStack ms, int mouseX, int mouseY, float partial) { - super.renderWidget(ms, mouseX, mouseY, partial); + public void renderWidget(GuiGraphics gg, int mouseX, int mouseY, float partial) { + super.renderWidget(gg, mouseX, mouseY, partial); // Minecraft minecraft = Minecraft.getInstance(); // minecraft.getTextureManager().bind(TextureRegistry.WIDGETS); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TextureRegistry.WIDGETS); + // RenderSystem.setShader(GameRenderer::getPositionTexShader); + // RenderSystem.setShaderTexture(0, TextureRegistry.WIDGETS); // GL11.glColor4f(1.0F, 1.0F, 1.0F, this.alpha); // GL11.glEnable(GL11.GL_BLEND); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (textureId != null) { - GuiComponent.blit(ms, + gg.blit(TextureRegistry.WIDGETS, this.getX() + textureId.getOffsetX(), this.getY() + textureId.getOffsetY(), textureId.getX() + xOffset, textureId.getY() + yOffset, textureId.getWidth() - yOffset, textureId.getHeight() - yOffset); @@ -56,18 +56,18 @@ public void renderWidget(PoseStack ms, int mouseX, int mouseY, float partial) { } @Override - public List getTooltip() { - return tooltip; + public List getTooltips() { + return tooltips; } @Override public void setTooltip(String ttIn) { - tooltip = new ArrayList<>(); + tooltips = new ArrayList<>(); addTooltip(ttIn); } @Override public void addTooltip(String ttIn) { - tooltip.add(Component.translatable(ttIn)); + tooltips.add(Component.translatable(ttIn)); } } diff --git a/src/main/java/com/lothrazar/cyclic/gui/EnergyBar.java b/src/main/java/com/lothrazar/cyclic/gui/EnergyBar.java index 4717815f2..7706a5aa7 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/EnergyBar.java +++ b/src/main/java/com/lothrazar/cyclic/gui/EnergyBar.java @@ -5,13 +5,15 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; public class EnergyBar { - private Screen parent; private int x = 154; private int y = 8; public int capacity; @@ -20,10 +22,11 @@ public class EnergyBar { public int guiLeft; public int guiTop; public boolean visible = true; + private final Font font; - public EnergyBar(Screen parent, int cap) { - this.parent = parent; + public EnergyBar(Font font, int cap) { this.capacity = cap; + this.font=font; } public boolean isMouseover(int mouseX, int mouseY) { @@ -31,28 +34,28 @@ public boolean isMouseover(int mouseX, int mouseY) { && guiTop + y < mouseY && mouseY < guiTop + y + getHeight(); } - public void draw(PoseStack ms, float energ) { + public void draw(GuiGraphics gg, float energ) { if (!visible) { return; } int relX; int relY; // parent.getMinecraft().getTextureManager().bind(TextureRegistry.ENERGY_CTR); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TextureRegistry.ENERGY_BAR); +// RenderSystem.setShader(GameRenderer::getPositionTexShader); +// RenderSystem.setShaderTexture(0, TextureRegistry.ENERGY_BAR); relX = guiLeft + x; relY = guiTop + y; - Screen.blit(ms, relX, relY, 16, 0, width, getHeight(), 32, getHeight()); + gg.blit( TextureRegistry.ENERGY_BAR, relX, relY, 16, 0, width, getHeight(), 32, getHeight()); float pct = Math.min(energ / capacity, 1.0F); - Screen.blit(ms, relX, relY, 0, 0, width, getHeight() - (int) (getHeight() * pct), 32, getHeight()); + gg.blit( TextureRegistry.ENERGY_BAR, relX, relY, 0, 0, width, getHeight() - (int) (getHeight() * pct), 32, getHeight()); } - public void renderHoveredToolTip(PoseStack ms, int mouseX, int mouseY, int energ) { + public void renderHoveredToolTip(GuiGraphics ms, int mouseX, int mouseY, int energ) { if (visible && this.isMouseover(mouseX, mouseY)) { String tt = energ + "/" + this.capacity; List list = new ArrayList<>(); list.add(Component.translatable(tt)); - parent.renderComponentTooltip(ms, list, mouseX, mouseY); + ms.renderComponentTooltip(font, list, mouseX, mouseY); } } diff --git a/src/main/java/com/lothrazar/cyclic/gui/FluidBar.java b/src/main/java/com/lothrazar/cyclic/gui/FluidBar.java index 6ef092e00..7cfeb157a 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/FluidBar.java +++ b/src/main/java/com/lothrazar/cyclic/gui/FluidBar.java @@ -8,6 +8,8 @@ import com.lothrazar.cyclic.render.RenderUtils; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -18,7 +20,7 @@ public class FluidBar { public String emtpyTooltip = "0"; - private Screen parent; + private Font font; private int x; private int y; private int capacity; @@ -27,12 +29,12 @@ public class FluidBar { public int guiLeft; public int guiTop; - public FluidBar(Screen p, int cap) { + public FluidBar(Font p, int cap) { this(p, 132, 8, cap); } - public FluidBar(Screen p, int x, int y, int cap) { - parent = p; + public FluidBar(Font p, int x, int y, int cap) { + font = p; this.x = x; this.y = y; this.capacity = cap; @@ -54,12 +56,12 @@ public void setWidth(int width) { this.width = width; } - public void draw(PoseStack ms, FluidStack fluid) { + public void draw(GuiGraphics ms, FluidStack fluid) { final int u = 0, v = 0, x = guiLeft + getX(), y = guiTop + getY(); // parent.getMinecraft().getTextureManager().bind(TextureRegistry.FLUID_WIDGET); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TextureRegistry.FLUID_WIDGET); - Screen.blit(ms, +// RenderSystem.setShader(GameRenderer::getPositionTexShader); +// RenderSystem.setShaderTexture(0, TextureRegistry.FLUID_WIDGET); + ms.blit(TextureRegistry.FLUID_WIDGET, x, y, u, v, width, height, width, height); @@ -82,9 +84,9 @@ public void draw(PoseStack ms, FluidStack fluid) { } } - protected void drawTiledSprite(PoseStack stack, int xPosition, int yPosition, int yOffset, int desiredWidth, int desiredHeight, TextureAtlasSprite sprite) { + protected void drawTiledSprite(GuiGraphics stack, int xPosition, int yPosition, int yOffset, int desiredWidth, int desiredHeight, TextureAtlasSprite sprite) { //32 stack.getBlitOffset() ? - RenderUtils.drawTiledSprite(stack.last().pose(), xPosition, yPosition, yOffset, desiredWidth, desiredHeight, sprite, width - 2, width - 2, 32); + RenderUtils.drawTiledSprite(stack.pose().last().pose(), xPosition, yPosition, yOffset, desiredWidth, desiredHeight, sprite, width - 2, width - 2, 32); } public boolean isMouseover(int mouseX, int mouseY) { @@ -92,7 +94,7 @@ public boolean isMouseover(int mouseX, int mouseY) { && guiTop + y <= mouseY && mouseY <= guiTop + y + height; } - public void renderHoveredToolTip(PoseStack ms, int mouseX, int mouseY, FluidStack current) { + public void renderHoveredToolTip(GuiGraphics ms, int mouseX, int mouseY, FluidStack current) { if (this.isMouseover(mouseX, mouseY)) { this.renderTooltip(ms, mouseX, mouseY, current); } @@ -110,13 +112,13 @@ public int getCapacity() { return capacity; } - public void renderTooltip(PoseStack ms, int mouseX, int mouseY, FluidStack current) { + public void renderTooltip(GuiGraphics gg, int mouseX, int mouseY, FluidStack current) { String tt = emtpyTooltip; if (current != null && !current.isEmpty()) { tt = current.getAmount() + "/" + getCapacity() + " " + current.getDisplayName().getString(); } List list = new ArrayList<>(); list.add(Component.translatable(tt)); - parent.renderComponentTooltip(ms, list, mouseX, mouseY); + gg.renderComponentTooltip(font, list, mouseX, mouseY); } } diff --git a/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java b/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java index 9a67938cc..91b7abfe0 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java +++ b/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java @@ -62,7 +62,7 @@ public GuiSliderInteger(int x, int y, int width, int height, int field, * Call from Screen class to render tooltip during mouseover */ @Override - public List getTooltip() { + public List getTooltips() { return tooltip; } diff --git a/src/main/java/com/lothrazar/cyclic/gui/ScreenBase.java b/src/main/java/com/lothrazar/cyclic/gui/ScreenBase.java index 8cb894c36..c952a6db5 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/ScreenBase.java +++ b/src/main/java/com/lothrazar/cyclic/gui/ScreenBase.java @@ -7,6 +7,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -15,6 +16,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraftforge.client.gui.ScreenUtils; public abstract class ScreenBase extends AbstractContainerScreen { @@ -22,13 +24,14 @@ public ScreenBase(T screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); } - protected void drawBackground(PoseStack ms, ResourceLocation gui) { + protected void drawBackground(GuiGraphics ms, ResourceLocation gui) { // this.minecraft.getTextureManager().bind(gui); RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, gui); int relX = (this.width - this.imageWidth) / 2; int relY = (this.height - this.imageHeight) / 2; - this.blit(ms, relX, relY, 0, 0, this.imageWidth, this.imageHeight); + ms.blit(gui, relX, relY, 0, 0, this.imageWidth, this.imageHeight); + // ScreenUtils.drawTexturedModalRect(ms, relX, relY, relY, relY, relY, relX, relY); } @Override @@ -54,22 +57,22 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { return super.keyPressed(keyCode, scanCode, modifiers); } - protected void drawSlot(PoseStack ms, int x, int y, ResourceLocation texture) { + protected void drawSlot(GuiGraphics ms, int x, int y, ResourceLocation texture) { drawSlot(ms, x, y, texture, 18); } - protected void drawSlot(PoseStack ms, int x, int y, ResourceLocation texture, int size) { + protected void drawSlot(GuiGraphics ms, int x, int y, ResourceLocation texture, int size) { // this.minecraft.getTextureManager().bind(texture); RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, texture); - blit(ms, leftPos + x, topPos + y, 0, 0, size, size, size, size); + ms.blit(texture, leftPos + x, topPos + y, 0, 0, size, size, size, size); } - protected void drawSlot(PoseStack ms, int x, int y) { + protected void drawSlot(GuiGraphics ms, int x, int y) { drawSlot(ms, x, y, TextureRegistry.SLOT, 18); } - protected void drawSlotLarge(PoseStack ms, int x, int y) { + protected void drawSlotLarge(GuiGraphics ms, int x, int y) { drawSlot(ms, x, y, TextureRegistry.SLOT_LARGE, 26); } @@ -78,32 +81,30 @@ protected void drawSlotLarge(PoseStack ms, int x, int y) { * * @param name */ - protected void drawName(PoseStack ms, String name) { - drawString(ms, name, - (this.getXSize() - this.font.width(name)) / 2, - 6.0F); + protected void drawName(GuiGraphics ms, String name) { + drawString(ms, name, (this.getXSize() - this.font.width(name)) / 2, 6.0F); } - protected void drawString(PoseStack ms, String name, float x, float y) { - this.font.draw(ms, ChatUtil.lang(name), x, y, 4210752); + protected void drawString(GuiGraphics gg, String name, float x, float y) { + gg.drawString(font, ChatUtil.lang(name), x, y, 4210752, false); } - public void drawButtonTooltips(PoseStack ms, int mouseX, int mouseY) { + public void drawButtonTooltips(GuiGraphics gg, int mouseX, int mouseY) { for (GuiEventListener btn : this.children()) { if (btn instanceof IHasTooltip && btn.isMouseOver(mouseX, mouseY) - && btn instanceof AbstractWidget) { - ((AbstractWidget) btn).render(ms, mouseX, mouseY, 0); - List localTooltip = ((IHasTooltip) btn).getTooltip(); + && btn instanceof AbstractWidget ww) { + ww.render(gg, mouseX, mouseY, 0); + List localTooltip = ((IHasTooltip) btn).getTooltips(); if (localTooltip != null) { - this.renderComponentTooltip(ms, localTooltip, mouseX - leftPos, mouseY - topPos); + gg.renderComponentTooltip(font, localTooltip, mouseX - leftPos, mouseY - topPos); } } } for (GuiEventListener widget : this.children()) { if (widget instanceof IHasTooltip && widget.isMouseOver(mouseX, mouseY)) { IHasTooltip txt = (IHasTooltip) widget; - if (txt.getTooltip() != null) { - this.renderComponentTooltip(ms, txt.getTooltip(), mouseX - leftPos, mouseY - topPos); + if (txt.getTooltips() != null) { + gg.renderComponentTooltip(font, txt.getTooltips(), mouseX - leftPos, mouseY - topPos); } } } diff --git a/src/main/java/com/lothrazar/cyclic/gui/TextBoxAutosave.java b/src/main/java/com/lothrazar/cyclic/gui/TextBoxAutosave.java index bf5bcaad8..a453e3dda 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/TextBoxAutosave.java +++ b/src/main/java/com/lothrazar/cyclic/gui/TextBoxAutosave.java @@ -61,7 +61,7 @@ private void saveValue() { private int tileFieldId; private List tooltip; - public List getTooltip() { + public List getTooltips() { return tooltip; } diff --git a/src/main/java/com/lothrazar/cyclic/gui/TextboxInteger.java b/src/main/java/com/lothrazar/cyclic/gui/TextboxInteger.java index 51fd94432..0f9917078 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/TextboxInteger.java +++ b/src/main/java/com/lothrazar/cyclic/gui/TextboxInteger.java @@ -60,7 +60,7 @@ public boolean charTyped(char chr, int p) { } @Override - public List getTooltip() { + public List getTooltips() { return tooltip; } diff --git a/src/main/java/com/lothrazar/cyclic/gui/TexturedProgress.java b/src/main/java/com/lothrazar/cyclic/gui/TexturedProgress.java index 2284c0688..ee2164e9f 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/TexturedProgress.java +++ b/src/main/java/com/lothrazar/cyclic/gui/TexturedProgress.java @@ -5,6 +5,8 @@ import com.lothrazar.cyclic.data.Const; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; @@ -12,7 +14,7 @@ public class TexturedProgress { - protected final Screen parent; + protected final Font font; protected final int x; protected final int y; protected final int width; @@ -23,12 +25,12 @@ public class TexturedProgress { public int max = 1; protected boolean topDown = true; - public TexturedProgress(Screen parent, int x, int y, ResourceLocation texture) { + public TexturedProgress(Font parent, int x, int y, ResourceLocation texture) { this(parent, x, y, 14, 14, texture); } - public TexturedProgress(Screen parent, int x, int y, int width, int height, ResourceLocation texture) { - this.parent = parent; + public TexturedProgress(Font parent, int x, int y, int width, int height, ResourceLocation texture) { + this.font = parent; this.x = x; this.y = y; this.width = width; @@ -41,28 +43,28 @@ public boolean isMouseover(int mouseX, int mouseY) { && guiTop + y <= mouseY && mouseY <= guiTop + y + height; } - public void draw(PoseStack ms, float current) { + public void draw(GuiGraphics gg, float current) { int relX; int relY; - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, this.texture); +// RenderSystem.setShader(GameRenderer::getPositionTexShader); +// RenderSystem.setShaderTexture(0, this.texture); relX = guiLeft + x; relY = guiTop + y; if (this.topDown) { - Screen.blit(ms, relX, relY, 0, 0, width, height, width, height * 2); + gg.blit(texture, relX, relY, 0, 0, width, height, width, height * 2); int rHeight = height - (int) (height * Math.min(current / max, 1.0F)); - Screen.blit(ms, relX, relY, 0, height, width, rHeight, width, height * 2); + gg.blit(texture, relX, relY, 0, height, width, rHeight, width, height * 2); } else { //Left-Right mode - Screen.blit(ms, relX, relY, 0, height, width, height, width, height * 2); + gg.blit(texture, relX, relY, 0, height, width, height, width, height * 2); int rWidth = (int) (width * Math.min(current / max, 1.0F)); if (current != 0) { - Screen.blit(ms, relX, relY, 0, 0, width - rWidth, height, width, height * 2); + gg.blit(texture, relX, relY, 0, 0, width - rWidth, height, width, height * 2); } } } - public void renderHoveredToolTip(PoseStack ms, int mouseX, int mouseY, int curr) { + public void renderHoveredToolTip(GuiGraphics gg, int mouseX, int mouseY, int curr) { if (this.isMouseover(mouseX, mouseY) && curr > 0) { String display = ""; int seconds = curr / Const.TICKS_PER_SEC; @@ -81,7 +83,7 @@ else if (curr > Const.TICKS_PER_SEC * 5) { } List list = new ArrayList<>(); list.add(Component.translatable(display)); - parent.renderComponentTooltip(ms, list, mouseX, mouseY); + gg.renderComponentTooltip(font, list, mouseX, mouseY); } } diff --git a/src/main/java/com/lothrazar/cyclic/gui/TimerBar.java b/src/main/java/com/lothrazar/cyclic/gui/TimerBar.java index d67da89d6..e0991c4d3 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/TimerBar.java +++ b/src/main/java/com/lothrazar/cyclic/gui/TimerBar.java @@ -7,6 +7,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.renderer.GameRenderer; @@ -14,7 +16,7 @@ public class TimerBar { - private AbstractContainerScreen parent; + private Font font; private int x = 20; private int y = 98; public int capacity; @@ -25,8 +27,8 @@ public class TimerBar { public boolean showText = true; public boolean visible = true; - public TimerBar(AbstractContainerScreen parent, int x, int y, int cap) { - this.parent = parent; + public TimerBar(Font parent, int x, int y, int cap) { + this.font = parent; this.x = x; this.y = y; this.capacity = cap; @@ -37,26 +39,26 @@ public boolean isMouseover(int mouseX, int mouseY) { && guiTop + y < mouseY && mouseY < guiTop + y + height; } - public void draw(PoseStack ms, float timer) { + public void draw(GuiGraphics gg, float timer) { if (!visible) { return; } // parent.getMinecraft().getTextureManager().bind(TextureRegistry.PROGRESS); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TextureRegistry.PROGRESS); +// RenderSystem.setShader(GameRenderer::getPositionTexShader); +// RenderSystem.setShaderTexture(0, TextureRegistry.PROGRESS); float pct = Math.min(timer / capacity, 1.0F); - Screen.blit(ms, guiLeft + x, guiTop + y, + gg.blit(TextureRegistry.PROGRESS, guiLeft + x, guiTop + y, 0, 0, (int) (width * pct), height, width, height); if (showText) { - Minecraft.getInstance().font.draw(ms, "[" + ((int) timer) + "]", + gg.drawString(font, "[" + ((int) timer) + "]", guiLeft + x + 2, guiTop + y + 4, 4209792); } } - public void renderHoveredToolTip(PoseStack ms, int mouseX, int mouseY, int curr) { + public void renderHoveredToolTip(GuiGraphics gg, int mouseX, int mouseY, int curr) { if (this.isMouseover(mouseX, mouseY) && this.visible) { String display = ""; int seconds = curr / Const.TICKS_PER_SEC; @@ -75,7 +77,7 @@ else if (curr > Const.TICKS_PER_SEC * 20) { } List list = new ArrayList<>(); list.add(Component.translatable(display)); - parent.renderComponentTooltip(ms, list, mouseX, mouseY); + gg.renderComponentTooltip(font, list, mouseX, mouseY); } } } diff --git a/src/main/java/com/lothrazar/cyclic/item/CarbonPaperItem.java b/src/main/java/com/lothrazar/cyclic/item/CarbonPaperItem.java index f261c89a9..ed7f77d72 100644 --- a/src/main/java/com/lothrazar/cyclic/item/CarbonPaperItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/CarbonPaperItem.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.CauldronBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.minecraft.world.level.block.entity.SignText; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,10 +32,12 @@ public void appendHoverText(ItemStack stack, Level worldIn, List tool if (stack.hasTag()) { SignBlockEntity fakeSign = new SignBlockEntity(BlockPos.ZERO, Blocks.OAK_SIGN.defaultBlockState()); fakeSign.load(stack.getTag()); - tooltip.add(Component.translatable("[" + fakeSign.getColor().getSerializedName() + "]")); - for (int i = 0; i <= 3; i++) { +// tooltip.add(Component.translatable("[" + fakeSign.getColor().getSerializedName() + "]")); + for (int i = 0; i < SignText.LINES; i++) { // fakeSign.setText(line, p_212365_2_); - Component t = fakeSign.messages[i]; + SignText front = fakeSign.getFrontText(); + + Component t = front.getMessages(false)[i]; // t.applyTextStyle(TextFormatting.fromColorIndex(fakeSign.getTextColor().get)); tooltip.add(t); } @@ -51,7 +54,7 @@ public InteractionResult useOn(UseOnContext context) { // Direction side = context.getFace(); ItemStack held = player.getItemInHand(hand); BlockEntity tile = context.getLevel().getBlockEntity(pos); - if (player.level.getBlockState(pos).getBlock() instanceof CauldronBlock) { + if (player.level().getBlockState(pos).getBlock() instanceof CauldronBlock) { if (held.hasTag()) { //clean with cauldron held.setTag(null); @@ -67,10 +70,11 @@ public InteractionResult useOn(UseOnContext context) { //write to fake sign to parse nbt internally SignBlockEntity fakeSign = new SignBlockEntity(context.getClickedPos(), Blocks.OAK_SIGN.defaultBlockState()); fakeSign.load(held.getTag()); - sign.setColor(fakeSign.getColor()); +// sign.setColor(fakeSign.getColor()); for (int i = 0; i <= 3; i++) { // UtilChat.addChatMessage(player, fakeSign.getText(i).toString()); - sign.setMessage(i, fakeSign.messages[i]); + + sign.getFrontText().setMessage(i, fakeSign.getFrontText().getMessages(false)[i]); } ChatUtil.sendStatusMessage(player, "item.cyclic.carbon_paper.written"); } diff --git a/src/main/java/com/lothrazar/cyclic/item/ElevationWandItem.java b/src/main/java/com/lothrazar/cyclic/item/ElevationWandItem.java index 9e160aaa8..e0ca665ce 100644 --- a/src/main/java/com/lothrazar/cyclic/item/ElevationWandItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/ElevationWandItem.java @@ -23,7 +23,7 @@ public ElevationWandItem(Properties properties) { @Override public InteractionResult interactLivingEntity(ItemStack stack, Player playerIn, LivingEntity target, InteractionHand hand) { - return tryTeleport(playerIn.level, playerIn, target, stack) ? InteractionResult.SUCCESS : InteractionResult.CONSUME; + return tryTeleport(playerIn.level(), playerIn, target, stack) ? InteractionResult.SUCCESS : InteractionResult.CONSUME; } @Override diff --git a/src/main/java/com/lothrazar/cyclic/item/OreProspector.java b/src/main/java/com/lothrazar/cyclic/item/OreProspector.java index 98334d0d1..e075d36d8 100644 --- a/src/main/java/com/lothrazar/cyclic/item/OreProspector.java +++ b/src/main/java/com/lothrazar/cyclic/item/OreProspector.java @@ -62,7 +62,7 @@ public InteractionResult useOn(UseOnContext context) { ores.add(p); } } - held.getOrCreateTag().putString(NBT_DIM, LevelWorldUtil.dimensionToString(player.level)); + held.getOrCreateTag().putString(NBT_DIM, LevelWorldUtil.dimensionToString(player.level())); int i = 0; for (BlockPos p : ores) { CompoundTag tag = new CompoundTag(); diff --git a/src/main/java/com/lothrazar/cyclic/item/SleepingMatItem.java b/src/main/java/com/lothrazar/cyclic/item/SleepingMatItem.java index 223ef2181..7c209e582 100644 --- a/src/main/java/com/lothrazar/cyclic/item/SleepingMatItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/SleepingMatItem.java @@ -41,7 +41,7 @@ public Either trySleep(Player player, BlockPos if (ret != null) { return Either.left(ret); } - Level world = player.level; + Level world = player.level(); if (!world.isClientSide) { if (player.isSleeping() || !player.isAlive()) { return Either.left(Player.BedSleepingProblem.OTHER_PROBLEM); @@ -57,8 +57,8 @@ public Either trySleep(Player player, BlockPos player.startSleeping(at); player.getPersistentData().putBoolean(SleepingMatItem.CYCLIC_SLEEPING, true); player.sleepCounter = 0; // ObfuscationReflectionHelper.setPrivateValue(Player.class, player, 0, "sleepCounter"); - if (player.level instanceof ServerLevel) { - ((ServerLevel) player.level).updateSleepingPlayerList(); + if (player.level() instanceof ServerLevel sl) { + sl.updateSleepingPlayerList(); } ItemStackUtil.damageItem(player, itemstack); } diff --git a/src/main/java/com/lothrazar/cyclic/item/animal/ItemHorseEnder.java b/src/main/java/com/lothrazar/cyclic/item/animal/ItemHorseEnder.java index 13a67f7d7..72cd8a287 100644 --- a/src/main/java/com/lothrazar/cyclic/item/animal/ItemHorseEnder.java +++ b/src/main/java/com/lothrazar/cyclic/item/animal/ItemHorseEnder.java @@ -47,7 +47,7 @@ public ItemHorseEnder(Properties prop) { public static void onSuccess(LivingEntity liv) { SoundUtil.playSound(liv, SoundEvents.GENERIC_DRINK); - ParticleUtil.spawnParticle(liv.level, ParticleTypes.CRIT, liv.blockPosition(), 3); + ParticleUtil.spawnParticle(liv.level(), ParticleTypes.CRIT, liv.blockPosition(), 3); increment(liv, -1); // int current = ahorse.getPersistentData().getInt(NBT_KEYACTIVE); // UtilChat.addChatMessage(event.getPlayer(), UtilChat.lang("cyclic.carrot_ender.count") + current); diff --git a/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java b/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java index b8020aee8..db51c64cf 100644 --- a/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java +++ b/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java @@ -90,7 +90,7 @@ private void tryFireTick(ItemStack stack, LivingEntity living) { living.addEffect(eff); ItemStackUtil.damageItem(living, stack); SoundUtil.playSound(living, SoundEvents.FIRE_EXTINGUISH); - ParticleUtil.spawnParticle(living.level, ParticleTypes.DRIPPING_WATER, living.blockPosition(), 9); + ParticleUtil.spawnParticle(living.level(), ParticleTypes.DRIPPING_WATER, living.blockPosition(), 9); } } diff --git a/src/main/java/com/lothrazar/cyclic/item/bauble/SoulstoneCharm.java b/src/main/java/com/lothrazar/cyclic/item/bauble/SoulstoneCharm.java index 2b833abfd..10352701b 100644 --- a/src/main/java/com/lothrazar/cyclic/item/bauble/SoulstoneCharm.java +++ b/src/main/java/com/lothrazar/cyclic/item/bauble/SoulstoneCharm.java @@ -35,7 +35,7 @@ public static boolean checkTotemDeathProtection(DamageSource damageSourceIn, Pla player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); player.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); player.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); - player.level.broadcastEntityEvent(player, (byte) 35); + player.level().broadcastEntityEvent(player, (byte) 35); ItemStackUtil.damageItem(player, itemstack); return true; // } diff --git a/src/main/java/com/lothrazar/cyclic/item/boomerang/BoomerangEntity.java b/src/main/java/com/lothrazar/cyclic/item/boomerang/BoomerangEntity.java index 96a061bf5..89fb6db79 100644 --- a/src/main/java/com/lothrazar/cyclic/item/boomerang/BoomerangEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/boomerang/BoomerangEntity.java @@ -123,12 +123,12 @@ private void moveTowardsTarget() { private void tryPickupNearby() { Entity owner = getOwner(); - if (owner == null || level.isClientSide) { + if (owner == null || level().isClientSide) { return; } //try to find entities to pick up int range = 1; - List list = this.level.getEntities(this, + List list = level().getEntities(this, this.getBoundingBox().move(this.getDeltaMovement()).inflate(range, range, range)); for (Entity entityHit : list) { if (entityHit instanceof ItemEntity || entityHit instanceof ExperienceOrb) { @@ -142,9 +142,9 @@ private void tryToggleRedstone(final BlockPos pos) { Entity owner = getOwner(); if (owner instanceof Player) { try { - BlockState blockState = level.getBlockState(pos); + BlockState blockState = level().getBlockState(pos); Block block = blockState.getBlock(); - InteractionResult t = block.use(blockState, level, pos, (Player) owner, InteractionHand.MAIN_HAND, null); + InteractionResult t = block.use(blockState, level(), pos, (Player) owner, InteractionHand.MAIN_HAND, null); boolean hasTriggered = t == InteractionResult.SUCCESS; //block.onBlockActivated(world, pos, blockState, // (PlayerEntity) this.owner, Hand.MAIN_HAND, Direction.UP, 0.5F, 0.5F, 0.5F); if (hasTriggered) { @@ -190,7 +190,7 @@ private void dropAsItem() { } } else { - ItemStackUtil.drop(level, this.blockPosition().above(), boomerangThrown); + ItemStackUtil.drop(level(), this.blockPosition().above(), boomerangThrown); boomerangThrown = ItemStack.EMPTY; } } @@ -213,7 +213,7 @@ public void tick() { dropAsItem(); return; } - if (hasTriggeredRedstoneAlready() == false && level.isEmptyBlock(pos) == false) { + if (hasTriggeredRedstoneAlready() == false && level().isEmptyBlock(pos) == false) { tryToggleRedstone(pos); } tryPickupNearby(); @@ -236,7 +236,7 @@ protected void onHit(HitResult result) { } private void onImpactBlock(BlockHitResult mop) { - BlockState block = level.getBlockState(mop.getBlockPos()); + BlockState block = level().getBlockState(mop.getBlockPos()); //crops are 0.0, farmland 0.6, leaves are 0.2 etc // if (this.canHarvest(block, mop.getPos(), mop.getFace())) { // if (this.owner instanceof PlayerEntity) { @@ -267,15 +267,15 @@ private void onImpactEntity(EntityHitResult entityRayTrace) { } switch (this.boomerangType) { case CARRY: - if (!entityHit.level.isClientSide) { + if (!entityHit.level().isClientSide) { entityHit.startRiding(this); } break; case DAMAGE: if (entityHit instanceof LivingEntity) { LivingEntity live = (LivingEntity) entityHit; - float damage = Mth.nextFloat(level.random, DAMAGE_MIN, DAMAGE_MAX); - boolean attackSucc = live.hurt(level.damageSources().thrown(this, owner), damage); + float damage = Mth.nextFloat(level().random, DAMAGE_MIN, DAMAGE_MAX); + boolean attackSucc = live.hurt(level().damageSources().thrown(this, owner), damage); if (attackSucc && live.isAlive() == false) { // ("killed one"); } diff --git a/src/main/java/com/lothrazar/cyclic/item/builder/PacketSwapBlock.java b/src/main/java/com/lothrazar/cyclic/item/builder/PacketSwapBlock.java index fcaee3a64..8d57d4cd0 100644 --- a/src/main/java/com/lothrazar/cyclic/item/builder/PacketSwapBlock.java +++ b/src/main/java/com/lothrazar/cyclic/item/builder/PacketSwapBlock.java @@ -56,7 +56,7 @@ public static void handle(PacketSwapBlock message, Supplier { ServerPlayer player = ctx.get().getSender(); ItemStack itemStackHeld = player.getItemInHand(message.hand); - BlockState targetState = BuilderActionType.getBlockState(player.level, itemStackHeld); + BlockState targetState = BuilderActionType.getBlockState(player.level(), itemStackHeld); if (targetState == null || itemStackHeld.getItem() instanceof BuilderItem == false) { return; } @@ -200,7 +200,7 @@ else if (side == Direction.EAST || side == Direction.WEST) { } List retPlaces = new ArrayList(); for (BlockPos p : places) { - if (!world.getBlockState(p).getMaterial().isReplaceable()) { + if (!world.getBlockState(p).canBeReplaced()) { //i am not replaceable. so i am a solid block or somethign if (!style.isReplaceable()) { continue; diff --git a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java index 5a1bb7603..dbdd69902 100644 --- a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java +++ b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java @@ -16,6 +16,7 @@ import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.inventory.ResultSlot; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeType; @@ -25,7 +26,7 @@ public class CraftingBagContainer extends ContainerBase implements IContainerCraftingAction { - private final CraftingContainer craftMatrix = new CraftingContainer(this, 3, 3); + private final TransientCraftingContainer craftMatrix = new TransientCraftingContainer(this, 3, 3); private final ResultContainer craftResult = new ResultContainer(); // public int slot = -1; @@ -74,7 +75,7 @@ public boolean mayPlace(ItemStack stack) { public void removed(Player playerIn) { // onContainerClosed super.removed(playerIn); this.craftResult.setItem(0, ItemStack.EMPTY); - if (playerIn.level.isClientSide == false) { + if (playerIn.level().isClientSide == false) { IItemHandler handler = bag.getCapability(ForgeCapabilities.ITEM_HANDLER).orElse(null); if (handler != null) for (int i = 0; i < 9; i++) { @@ -87,7 +88,7 @@ public void removed(Player playerIn) { // onContainerClosed @Override public void slotsChanged(Container inventory) { - Level world = playerInventory.player.level; + Level world = playerInventory.player.level(); if (!world.isClientSide) { ServerPlayer player = (ServerPlayer) playerInventory.player; ItemStack itemstack = ItemStack.EMPTY; diff --git a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagScreen.java b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagScreen.java index 0cec0facd..a7078cc8b 100644 --- a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagScreen.java +++ b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagScreen.java @@ -8,6 +8,8 @@ import com.lothrazar.cyclic.registry.PacketRegistry; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -18,7 +20,7 @@ public CraftingBagScreen(CraftingBagContainer screenContainer, Inventory inv, Co } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -45,13 +47,13 @@ public void init() { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { super.renderLabels(ms, mouseX, mouseY); this.drawButtonTooltips(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int x, int y) { + protected void renderBg(GuiGraphics ms, float partialTicks, int x, int y) { this.drawBackground(ms, TextureRegistry.V_CRAFTING); } } diff --git a/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickContainer.java b/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickContainer.java index 54bf18c8f..48d62aee0 100644 --- a/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickContainer.java +++ b/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickContainer.java @@ -14,6 +14,7 @@ import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.inventory.ResultSlot; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeType; @@ -21,7 +22,7 @@ public class CraftingStickContainer extends ContainerBase implements IContainerCraftingAction { - private final CraftingContainer craftMatrix = new CraftingContainer(this, 3, 3); + private final TransientCraftingContainer craftMatrix = new TransientCraftingContainer(this, 3, 3); final ResultContainer craftResult = new ResultContainer(); //does NOT save inventory into the stack, very simple and plain @@ -48,7 +49,7 @@ public void removed(Player playerIn) { @Override public void slotsChanged(Container inventory) { - Level world = playerInventory.player.level; + Level world = playerInventory.player.level(); if (!world.isClientSide) { ServerPlayer player = (ServerPlayer) playerInventory.player; ItemStack itemstack = ItemStack.EMPTY; diff --git a/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickScreen.java b/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickScreen.java index e11d1b519..06c86ac8a 100644 --- a/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickScreen.java +++ b/src/main/java/com/lothrazar/cyclic/item/crafting/simple/CraftingStickScreen.java @@ -8,6 +8,8 @@ import com.lothrazar.cyclic.registry.PacketRegistry; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -18,7 +20,7 @@ public CraftingStickScreen(CraftingStickContainer screenContainer, Inventory inv } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -46,13 +48,13 @@ public void init() { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { super.renderLabels(ms, mouseX, mouseY); this.drawButtonTooltips(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int x, int y) { + protected void renderBg(GuiGraphics ms, float partialTicks, int x, int y) { this.drawBackground(ms, TextureRegistry.V_CRAFTING); } } diff --git a/src/main/java/com/lothrazar/cyclic/item/datacard/BlockstateCard.java b/src/main/java/com/lothrazar/cyclic/item/datacard/BlockstateCard.java index 459f74d37..56692b452 100644 --- a/src/main/java/com/lothrazar/cyclic/item/datacard/BlockstateCard.java +++ b/src/main/java/com/lothrazar/cyclic/item/datacard/BlockstateCard.java @@ -94,7 +94,7 @@ public InteractionResult useOn(UseOnContext context) { } //wait wait wait does it exist for (int i = 0; i < stateTags.size(); ++i) { - BlockState stateFound = NbtUtils.readBlockState(player.level.holderLookup(Registries.BLOCK), stateTags.getCompound(i)); + BlockState stateFound = NbtUtils.readBlockState(player.level().holderLookup(Registries.BLOCK), stateTags.getCompound(i)); if (stateFound.equals(state)) { return InteractionResult.PASS; } diff --git a/src/main/java/com/lothrazar/cyclic/item/datacard/EnderBucket.java b/src/main/java/com/lothrazar/cyclic/item/datacard/EnderBucket.java index 46b215750..474f14ce1 100644 --- a/src/main/java/com/lothrazar/cyclic/item/datacard/EnderBucket.java +++ b/src/main/java/com/lothrazar/cyclic/item/datacard/EnderBucket.java @@ -61,7 +61,7 @@ public InteractionResult useOn(UseOnContext context) { ItemStack held = player.getItemInHand(hand); player.swing(hand); TagDataUtil.setItemStackBlockPos(held, pos); - held.getOrCreateTag().putString(NBT_DIM, LevelWorldUtil.dimensionToString(player.level)); + held.getOrCreateTag().putString(NBT_DIM, LevelWorldUtil.dimensionToString(player.level())); TagDataUtil.setItemStackNBTVal(held, NBT_SIDE, side.ordinal()); TagDataUtil.setItemStackNBTVal(held, NBT_SIDE + "facing", player.getDirection().ordinal()); ChatUtil.sendStatusMessage(player, ChatUtil.lang("item.location.saved") diff --git a/src/main/java/com/lothrazar/cyclic/item/datacard/LocationGpsCard.java b/src/main/java/com/lothrazar/cyclic/item/datacard/LocationGpsCard.java index 76ed87e58..762f8cddf 100644 --- a/src/main/java/com/lothrazar/cyclic/item/datacard/LocationGpsCard.java +++ b/src/main/java/com/lothrazar/cyclic/item/datacard/LocationGpsCard.java @@ -63,14 +63,14 @@ public InteractionResult useOn(UseOnContext context) { Player player = context.getPlayer(); InteractionHand hand = context.getHand(); player.swing(hand); - if (player.level.isClientSide) { + if (player.level().isClientSide) { return InteractionResult.PASS; } BlockPos pos = context.getClickedPos(); Direction side = context.getClickedFace(); ItemStack held = player.getItemInHand(hand); TagDataUtil.setItemStackBlockPos(held, pos); - held.getOrCreateTag().putString(NBT_DIM, LevelWorldUtil.dimensionToString(player.level)); + held.getOrCreateTag().putString(NBT_DIM, LevelWorldUtil.dimensionToString(player.level())); TagDataUtil.setItemStackNBTVal(held, NBT_SIDE, side.ordinal()); TagDataUtil.setItemStackNBTVal(held, NBT_SIDE + "facing", player.getDirection().ordinal()); ChatUtil.sendStatusMessage(player, ChatUtil.lang("item.location.saved") + ChatUtil.blockPosToString(pos)); diff --git a/src/main/java/com/lothrazar/cyclic/item/datacard/SettingsCard.java b/src/main/java/com/lothrazar/cyclic/item/datacard/SettingsCard.java index 3920f3b9f..e2906658b 100644 --- a/src/main/java/com/lothrazar/cyclic/item/datacard/SettingsCard.java +++ b/src/main/java/com/lothrazar/cyclic/item/datacard/SettingsCard.java @@ -52,9 +52,9 @@ public InteractionResult useOn(UseOnContext context) { // Direction side = context.getFace(); ItemStack held = player.getItemInHand(hand); player.swing(hand); - BlockEntity tile = player.level.getBlockEntity(pos); + BlockEntity tile = player.level().getBlockEntity(pos); //am i doing a READ or a WRITE - if (player.level.getBlockState(pos).getBlock() == Blocks.BEDROCK) { + if (player.level().getBlockState(pos).getBlock() == Blocks.BEDROCK) { // Blocks.BEDROCK.isu held.setTag(null); //clear ChatUtil.addChatMessage(player, getDescriptionId() + ".deleted"); diff --git a/src/main/java/com/lothrazar/cyclic/item/datacard/filter/ScreenFilterCard.java b/src/main/java/com/lothrazar/cyclic/item/datacard/filter/ScreenFilterCard.java index 24ce560f2..45248e8a4 100644 --- a/src/main/java/com/lothrazar/cyclic/item/datacard/filter/ScreenFilterCard.java +++ b/src/main/java/com/lothrazar/cyclic/item/datacard/filter/ScreenFilterCard.java @@ -9,6 +9,7 @@ import com.lothrazar.cyclic.registry.PacketRegistry; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -23,7 +24,7 @@ public ScreenFilterCard(ContainerFilterCard screenContainer, Inventory inv, Comp } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); @@ -43,7 +44,7 @@ public void init() { } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { super.renderLabels(ms, mouseX, mouseY); this.drawButtonTooltips(ms, mouseX, mouseY); boolean filter = screenContainer.bag.getOrCreateTag().getBoolean("filter"); @@ -52,7 +53,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); for (int i = 0; i < 9; i++) { int y = 31; diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/AntimatterEvaporatorWandItem.java b/src/main/java/com/lothrazar/cyclic/item/elemental/AntimatterEvaporatorWandItem.java index d054bc6e6..8c99f5999 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/AntimatterEvaporatorWandItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/AntimatterEvaporatorWandItem.java @@ -139,7 +139,7 @@ public static void toggleMode(Player player, ItemStack stack) { EvaporateMode mode = EvaporateMode.values()[stack.getOrCreateTag().getInt(NBT_MODE)]; stack.getOrCreateTag().putInt(NBT_MODE, mode.getNext().ordinal()); player.getCooldowns().addCooldown(stack.getItem(), COOLDOWN); - if (player.level.isClientSide) { + if (player.level().isClientSide) { player.displayClientMessage(getModeTooltip(stack), true); SoundUtil.playSound(player, SoundRegistry.TOOL_MODE.get()); } diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/DarkFireEntity.java b/src/main/java/com/lothrazar/cyclic/item/elemental/DarkFireEntity.java index 8206f495e..2a145e286 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/DarkFireEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/DarkFireEntity.java @@ -46,10 +46,10 @@ protected void onHit(HitResult result) { Entity target = entityRayTrace.getEntity(); if (target.isAlive()) { //DamageSource.thrown(this, this.getOwner()) - target.hurt(level.damageSources().thrown(this, this.getOwner()), Mth.nextInt(level.random, 4, 8)); - if (!level.isClientSide && target.isOnFire() == false + target.hurt(level().damageSources().thrown(this, this.getOwner()), Mth.nextInt(level().random, 4, 8)); + if (!level().isClientSide && target.isOnFire() == false && target instanceof LivingEntity living) { - living.hurt(level.damageSources().magic(), Mth.nextInt(level.random, 3, 5)); + living.hurt(level().damageSources().magic(), Mth.nextInt(level().random, 3, 5)); living.addEffect(new MobEffectInstance(MobEffects.WITHER, Const.TICKS_PER_SEC * 5, 1)); } } @@ -60,12 +60,12 @@ else if (type == HitResult.Type.BLOCK) { return; } final BlockPos pos = ray.getBlockPos(); - final Block blockHere = this.level.getBlockState(pos).getBlock(); + final Block blockHere = this.level().getBlockState(pos).getBlock(); if (blockHere == Blocks.SNOW || blockHere == Blocks.SNOW_BLOCK || blockHere == Blocks.SNOW || blockHere == Blocks.ICE) { - level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); + level().setBlock(pos, Blocks.AIR.defaultBlockState(), 3); } } this.remove(RemovalReason.DISCARDED); diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/EvokerFangItem.java b/src/main/java/com/lothrazar/cyclic/item/elemental/EvokerFangItem.java index 06fe60bb6..661589550 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/EvokerFangItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/EvokerFangItem.java @@ -51,8 +51,8 @@ private void summonFangRay(double startX, double startZ, Player player, double p } private void summonFangSingle(Player caster, double x, double y, double z, float yaw, int delay) { - EvokerFangs entityevokerfangs = new EvokerFangs(caster.level, x, y, z, yaw, delay, caster); - caster.level.addFreshEntity(entityevokerfangs); + EvokerFangs entityevokerfangs = new EvokerFangs(caster.level(), x, y, z, yaw, delay, caster); + caster.level().addFreshEntity(entityevokerfangs); // so. WE are using this hack because the entity has a MAGIC NUMBER of 6.0F hardcoded in a few places deep inside methods and if statements //this number is the damage that it deals. ( It should be a property ) // UtilNBT.setEntityBoolean(entityevokerfangs, NBT_FANG_FROMPLAYER); diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/FireEntity.java b/src/main/java/com/lothrazar/cyclic/item/elemental/FireEntity.java index 4a9ab0b6a..b7c1da5d3 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/FireEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/FireEntity.java @@ -43,9 +43,10 @@ protected void onHit(HitResult result) { //drop torch EntityHitResult entityRayTrace = (EntityHitResult) result; Entity target = entityRayTrace.getEntity(); + var level = level(); if (target.isAlive()) { target.hurt(level.damageSources().thrown(this, this.getOwner()), Mth.nextInt(level.random, 2, 6)); - if (!target.level.isClientSide && target.isOnFire() == false + if (!level.isClientSide && target.isOnFire() == false && target instanceof LivingEntity) { target.hurt(level.damageSources().inFire(), Mth.nextInt(level.random, 3, 5)); LivingEntity living = (LivingEntity) target; diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/FireballItem.java b/src/main/java/com/lothrazar/cyclic/item/elemental/FireballItem.java index 8455f6b71..a527254a9 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/FireballItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/FireballItem.java @@ -37,7 +37,7 @@ public static void tickHoldingFireball(Player player) { int fireProt = EnchantmentHelper.getEnchantmentLevel(Enchantments.FIRE_PROTECTION, player); if (fireProt == 0 && !player.isOnFire() && - player.level.random.nextDouble() < 0.03) { + player.level().random.nextDouble() < 0.03) { //i am holding fireball in my main hand //i am not on fire right now, i have no fire prot player.setRemainingFireTicks(30); // 20 ticks is one secondfireProt diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/FishingEnderEntity.java b/src/main/java/com/lothrazar/cyclic/item/elemental/FishingEnderEntity.java index 01a78aca2..debb228fe 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/FishingEnderEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/FishingEnderEntity.java @@ -20,10 +20,11 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.LootTables; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.LootDataManager; +import net.minecraft.world.level.storage.loot.LootDataType; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; @@ -50,6 +51,7 @@ protected Item getDefaultItem() { @Override protected void onHit(HitResult result) { HitResult.Type type = result.getType(); + var level = level(); if (type == HitResult.Type.ENTITY) { EntityHitResult entityRayTrace = (EntityHitResult) result; Entity target = entityRayTrace.getEntity(); @@ -67,26 +69,29 @@ else if (type == HitResult.Type.BLOCK) { if (ray.getDirection() != null) { pos = pos.relative(ray.getDirection()); } - if (TileFisher.isWater(this.level, pos)) { + if (TileFisher.isWater(level, pos)) { //fish! - if (!this.level.isClientSide) { - LootTables manager = level.getServer().getLootTables(); + if (!level.isClientSide) { + LootDataManager manager = level.getServer().getLootData(); if (manager == null) { return; } LootTable table = null; - if (level.random.nextDouble() < 0.10) // 10% junk, match current values unlike 1.10.2 - table = manager.get(BuiltInLootTables.FISHING_JUNK); - else // remaining 90% fish. ignore the 5% for treasure , this item just dont get that too bad - table = manager.get(BuiltInLootTables.FISHING_FISH); + if (level.random.nextDouble() < 0.10) { // 10% junk, match current values unlike 1.10.2 + table = manager.getElement(LootDataType.TABLE, BuiltInLootTables.FISHING_JUNK); + // table = manager.get(BuiltInLootTables.FISHING_JUNK); + } + else {// remaining 90% fish. ignore the 5% for treasure , this item just dont get that too bad + table = manager.getElement(LootDataType.TABLE, BuiltInLootTables.FISHING_FISH); + } if (table == null) { return; } final int luck = 2; final ItemStack fishingRod = new ItemStack(Items.FISHING_ROD); fishingRod.enchant(Enchantments.FISHING_LUCK, luck); - LootContext lootContext = new LootContext.Builder((ServerLevel) level) - .withLuck(luck).withRandom(level.random) + LootParams lootContext = new LootParams.Builder((ServerLevel) level) + .withLuck(luck)//.withRandom(level.random) .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) .withParameter(LootContextParams.TOOL, fishingRod) .create(LootContextParamSets.FISHING); diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/LightningEntity.java b/src/main/java/com/lothrazar/cyclic/item/elemental/LightningEntity.java index 6a2c7c160..9aa72c71a 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/LightningEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/LightningEntity.java @@ -39,18 +39,18 @@ protected void onHit(HitResult result) { EntityHitResult entityRayTrace = (EntityHitResult) result; Entity target = entityRayTrace.getEntity(); if (target.isAlive()) { - target.hurt(level.damageSources().thrown(this, this.getOwner()), 0); + target.hurt(level().damageSources().thrown(this, this.getOwner()), 0); // LightningBoltEntity lightningboltentity = new LightningBoltEntity(world, target.getPosX(), target.getPosY(), target.getPosZ(), false); - LightningBolt lightningboltentity = EntityType.LIGHTNING_BOLT.create(level); + LightningBolt lightningboltentity = EntityType.LIGHTNING_BOLT.create(level()); lightningboltentity.moveTo(target.getX(), target.getY(), target.getZ()); - level.addFreshEntity(lightningboltentity); + level().addFreshEntity(lightningboltentity); } } else if (type == HitResult.Type.BLOCK) { // BlockRayTraceResult bRayTrace = (BlockRayTraceResult) result; - LightningBolt lightningboltentity = EntityType.LIGHTNING_BOLT.create(level); + LightningBolt lightningboltentity = EntityType.LIGHTNING_BOLT.create(level()); lightningboltentity.moveTo(this.blockPosition().getX(), this.blockPosition().getY(), this.blockPosition().getZ()); - level.addFreshEntity(lightningboltentity); + level().addFreshEntity(lightningboltentity); } this.remove(RemovalReason.DISCARDED); } diff --git a/src/main/java/com/lothrazar/cyclic/item/elemental/SnowEntity.java b/src/main/java/com/lothrazar/cyclic/item/elemental/SnowEntity.java index ec75f0558..095f356a7 100644 --- a/src/main/java/com/lothrazar/cyclic/item/elemental/SnowEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/elemental/SnowEntity.java @@ -42,6 +42,7 @@ protected void onHit(HitResult result) { //drop torch EntityHitResult entityRayTrace = (EntityHitResult) result; Entity target = entityRayTrace.getEntity(); + var level = level(); if (target.isAlive() && target instanceof LivingEntity) { target.hurt(level.damageSources().thrown(this, this.getOwner()), Mth.nextInt(level.random, 2, 5)); target.hurt(level.damageSources().dryOut(), Mth.nextInt(level.random, 2, 3)); diff --git a/src/main/java/com/lothrazar/cyclic/item/ender/EnderBookScreen.java b/src/main/java/com/lothrazar/cyclic/item/ender/EnderBookScreen.java index c25694e66..a3f5da091 100644 --- a/src/main/java/com/lothrazar/cyclic/item/ender/EnderBookScreen.java +++ b/src/main/java/com/lothrazar/cyclic/item/ender/EnderBookScreen.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -14,19 +15,19 @@ public EnderBookScreen(EnderBookContainer screenContainer, Inventory inv, Compon } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { super.renderLabels(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); for (int i = 0; i < 9; i++) { int y = 31; diff --git a/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingItem.java b/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingItem.java index 8cf3d3ab6..350d365f4 100644 --- a/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingItem.java @@ -108,7 +108,7 @@ else if (spawnWorld != null && spawnWorldKey == Level.OVERWORLD) { @Override public void toggle(Player player, ItemStack held) { - this.attemptTeleport(player.level, player, held); + this.attemptTeleport(player.level(), player, held); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingSp.java b/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingSp.java index 900cef618..5051bc970 100644 --- a/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingSp.java +++ b/src/main/java/com/lothrazar/cyclic/item/ender/EnderWingSp.java @@ -69,7 +69,7 @@ private void attemptTeleport(Level worldIn, Player playerIn, ItemStack held) { @Override public void toggle(Player player, ItemStack held) { - this.attemptTeleport(player.level, player, held); + this.attemptTeleport(player.level(), player, held); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/item/ender/EntityDungeonEye.java b/src/main/java/com/lothrazar/cyclic/item/ender/EntityDungeonEye.java index b8cda7a4e..c7195f344 100644 --- a/src/main/java/com/lothrazar/cyclic/item/ender/EntityDungeonEye.java +++ b/src/main/java/com/lothrazar/cyclic/item/ender/EntityDungeonEye.java @@ -68,7 +68,7 @@ public void tick() { return; } // UtilParticle.spawnParticle(world, ParticleTypes.DRAGON_BREATH, this.getPosition(), 1); - if (!this.level.isClientSide) { + if (!this.level().isClientSide) { double posX = this.getX(); double posY = this.getY(); double posZ = this.getZ(); diff --git a/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java b/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java index 5e2e5dfe1..f36c64bf1 100644 --- a/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java @@ -98,7 +98,7 @@ private static boolean isOnStatic(ItemStack held) { //from ItemEvents- curios slot public static void onEntityUpdate(LivingTickEvent event) { //reduce check to only once per second instead of per tick - if (event.getEntity().level.getGameTime() % 20 == 0 && + if (event.getEntity().level().getGameTime() % 20 == 0 && event.getEntity() != null) { //some of the items need an off switch Player player = (Player) event.getEntity(); checkIfHelmOff(player); diff --git a/src/main/java/com/lothrazar/cyclic/item/equipment/MattockItem.java b/src/main/java/com/lothrazar/cyclic/item/equipment/MattockItem.java index 49b5b5437..6ecd5c509 100644 --- a/src/main/java/com/lothrazar/cyclic/item/equipment/MattockItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/equipment/MattockItem.java @@ -34,9 +34,9 @@ public MattockItem(Tiers tr, Properties builder, int radius) { @Override public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { - Level world = player.level; + Level level = player.level(); // this.getTier() - HitResult ray = getPlayerPOVHitResult(world, player, ClipContext.Fluid.NONE); + HitResult ray = getPlayerPOVHitResult(level, player, ClipContext.Fluid.NONE); int yoff = 0; if (radius == 2 && player.isCrouching()) { yoff = 1; @@ -62,7 +62,7 @@ else if (sideHit == Direction.EAST || sideHit == Direction.WEST) { shape = ShapeUtil.squareVerticalX(pos, x, y); } for (BlockPos posCurrent : shape) { - BlockState bsCurrent = world.getBlockState(posCurrent); + BlockState bsCurrent = level.getBlockState(posCurrent); if (bsCurrent.isAir()) { continue; } @@ -70,34 +70,34 @@ else if (sideHit == Direction.EAST || sideHit == Direction.WEST) { && player.mayUseItemAt(posCurrent, sideHit, stack) && ForgeEventFactory.doPlayerHarvestCheck(player, bsCurrent, true) && this.getDestroySpeed(stack, bsCurrent) > 1 - && (bsCurrent.canHarvestBlock(world, pos, player) + && (bsCurrent.canHarvestBlock(level, pos, player) || bsCurrent.is(this.getTier().getTag()) //this.getTier().getTag().contains(bsCurrent.getBlock()) ) //end of OR ) { - stack.mineBlock(world, bsCurrent, posCurrent, player); + stack.mineBlock(level, bsCurrent, posCurrent, player); Block blockCurrent = bsCurrent.getBlock(); - if (world.isClientSide) { - world.levelEvent(2001, posCurrent, Block.getId(bsCurrent)); + if (level.isClientSide) { + level.levelEvent(2001, posCurrent, Block.getId(bsCurrent)); //removedByPlayer - if (blockCurrent.onDestroyedByPlayer(bsCurrent, world, posCurrent, player, true, bsCurrent.getFluidState())) { - blockCurrent.destroy(world, posCurrent, bsCurrent); + if (blockCurrent.onDestroyedByPlayer(bsCurrent, level, posCurrent, player, true, bsCurrent.getFluidState())) { + blockCurrent.destroy(level, posCurrent, bsCurrent); } // stack.onBlockDestroyed(world, bsCurrent, posCurrent, player);//update tool damage } else if (player instanceof ServerPlayer) { //Server side, so this works ServerPlayer mp = (ServerPlayer) player; - int xpGivenOnDrop = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayer) player).gameMode.getGameModeForPlayer(), (ServerPlayer) player, posCurrent); + int xpGivenOnDrop = ForgeHooks.onBlockBreakEvent(level, ((ServerPlayer) player).gameMode.getGameModeForPlayer(), (ServerPlayer) player, posCurrent); if (xpGivenOnDrop >= 0) { - if (blockCurrent.onDestroyedByPlayer(bsCurrent, world, posCurrent, player, true, bsCurrent.getFluidState()) - && world instanceof ServerLevel) { - BlockEntity tile = world.getBlockEntity(posCurrent); - blockCurrent.destroy(world, posCurrent, bsCurrent); - blockCurrent.playerDestroy(world, player, posCurrent, bsCurrent, tile, stack); - blockCurrent.popExperience((ServerLevel) world, posCurrent, xpGivenOnDrop); + if (blockCurrent.onDestroyedByPlayer(bsCurrent, level, posCurrent, player, true, bsCurrent.getFluidState()) + && level instanceof ServerLevel) { + BlockEntity tile = level.getBlockEntity(posCurrent); + blockCurrent.destroy(level, posCurrent, bsCurrent); + blockCurrent.playerDestroy(level, player, posCurrent, bsCurrent, tile, stack); + blockCurrent.popExperience((ServerLevel) level, posCurrent, xpGivenOnDrop); } - mp.connection.send(new ClientboundBlockUpdatePacket(world, posCurrent)); + mp.connection.send(new ClientboundBlockUpdatePacket(level, posCurrent)); } } } diff --git a/src/main/java/com/lothrazar/cyclic/item/equipment/ShieldCyclicItem.java b/src/main/java/com/lothrazar/cyclic/item/equipment/ShieldCyclicItem.java index adedb9ff0..4c30cfc72 100644 --- a/src/main/java/com/lothrazar/cyclic/item/equipment/ShieldCyclicItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/equipment/ShieldCyclicItem.java @@ -156,11 +156,11 @@ public void onShieldBlock(ShieldBlockEvent event, Player playerIn) { reduceBlockedDamagePct = FLINT_PCT.get() / 100F; if (dmgSource.is(DamageTypes.MOB_PROJECTILE)) { //50% chance to not take durability from arrows - immuneToDamage = playerIn.level.random.nextDouble() < 0.5; // 50% chance TODO config and hardcoded in lang + immuneToDamage = playerIn.level().random.nextDouble() < 0.5; // 50% chance TODO config and hardcoded in lang } if (!dmgSource.is(DamageTypes.EXPLOSION) && dmgSource.is(DamageTypes.MOB_PROJECTILE) - && playerIn.level.random.nextDouble() < (FLINT_THORNS_PCT.get() / 100F)) { + && playerIn.level().random.nextDouble() < (FLINT_THORNS_PCT.get() / 100F)) { //ranged thorns thornsDmg = 1; } @@ -205,7 +205,7 @@ public void onShieldBlock(ShieldBlockEvent event, Player playerIn) { && event.getDamageSource().getDirectEntity() != null) { // instanceof EntityDamageSource eds Entity enemy = event.getDamageSource().getDirectEntity(); if (enemy instanceof LivingEntity liv) { - enemy.hurt(playerIn.level.damageSources().thorns(shieldHolder), thornsDmg); + enemy.hurt(playerIn.level().damageSources().thorns(shieldHolder), thornsDmg); } } //make some not take damage diff --git a/src/main/java/com/lothrazar/cyclic/item/food/inventorycake/ScreenCake.java b/src/main/java/com/lothrazar/cyclic/item/food/inventorycake/ScreenCake.java index 9b0c6bef1..303b92069 100644 --- a/src/main/java/com/lothrazar/cyclic/item/food/inventorycake/ScreenCake.java +++ b/src/main/java/com/lothrazar/cyclic/item/food/inventorycake/ScreenCake.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -14,19 +15,19 @@ public ScreenCake(ContainerCake screenContainer, Inventory inv, Component titleI } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) { super.renderLabels(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) { this.drawBackground(ms, TextureRegistry.INVENTORY); for (int row = 0; row < 3; row++) { for (int i = 0; i < 9; i++) { diff --git a/src/main/java/com/lothrazar/cyclic/item/lunchbox/ScreenLunchbox.java b/src/main/java/com/lothrazar/cyclic/item/lunchbox/ScreenLunchbox.java index 4b2503a70..b609a89d0 100644 --- a/src/main/java/com/lothrazar/cyclic/item/lunchbox/ScreenLunchbox.java +++ b/src/main/java/com/lothrazar/cyclic/item/lunchbox/ScreenLunchbox.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.gui.ScreenBase; import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -20,14 +21,14 @@ protected void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { this.renderBackground(ms); super.render(ms, mouseX, mouseY, partialTicks); this.renderTooltip(ms, mouseX, mouseY); } @Override - protected void renderBg(PoseStack ms, float partialTicks, int x, int y) { + protected void renderBg(GuiGraphics ms, float partialTicks, int x, int y) { this.drawBackground(ms, TextureRegistry.INVENTORY); for (int colPos = 0; colPos < ItemLunchbox.SLOTS; colPos++) { this.drawSlot(ms, 25 + colPos * Const.SQ, 35); diff --git a/src/main/java/com/lothrazar/cyclic/item/magicnet/EntityMagicNetEmpty.java b/src/main/java/com/lothrazar/cyclic/item/magicnet/EntityMagicNetEmpty.java index 3c5ff5091..2787a9324 100644 --- a/src/main/java/com/lothrazar/cyclic/item/magicnet/EntityMagicNetEmpty.java +++ b/src/main/java/com/lothrazar/cyclic/item/magicnet/EntityMagicNetEmpty.java @@ -50,6 +50,7 @@ protected void onHit(HitResult result) { HitResult.Type type = result.getType(); SimpleParticleType particleType = null; double targetHeightOffset = 0.0d; + var level=level(); if (type == HitResult.Type.ENTITY) { //now grab and kill the entity EntityHitResult entityRayTrace = (EntityHitResult) result; diff --git a/src/main/java/com/lothrazar/cyclic/item/random/RandomizerItem.java b/src/main/java/com/lothrazar/cyclic/item/random/RandomizerItem.java index a0d77694e..f0db819bc 100644 --- a/src/main/java/com/lothrazar/cyclic/item/random/RandomizerItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/random/RandomizerItem.java @@ -44,7 +44,7 @@ public InteractionResult useOn(UseOnContext context) { } BlockPos pos = context.getClickedPos(); Direction side = context.getClickedFace(); - if (player.level.isClientSide) { + if (player.level().isClientSide) { PacketRegistry.INSTANCE.sendToServer(new PacketRandomize(pos, side, context.getHand())); } EntityUtil.setCooldownItem(player, this, COOLDOWN); @@ -97,7 +97,7 @@ public static boolean canMove(BlockState stateHere, Level world, BlockPos p) { } if (world.getBlockEntity(p) == null && world.isEmptyBlock(p) == false - && stateHere.getMaterial().isLiquid() == false) { + && stateHere.liquid()== false) { return true; } return false; diff --git a/src/main/java/com/lothrazar/cyclic/item/redstone/LeverRemote.java b/src/main/java/com/lothrazar/cyclic/item/redstone/LeverRemote.java index a5155920e..83f31e9b1 100644 --- a/src/main/java/com/lothrazar/cyclic/item/redstone/LeverRemote.java +++ b/src/main/java/com/lothrazar/cyclic/item/redstone/LeverRemote.java @@ -65,7 +65,7 @@ public InteractionResult useOn(UseOnContext context) { if (world.getBlockState(pos).getBlock() instanceof LeverBlock) { TagDataUtil.setItemStackBlockPos(stack, pos); //and save dimension - stack.getOrCreateTag().putString("LeverDim", LevelWorldUtil.dimensionToString(player.level)); + stack.getOrCreateTag().putString("LeverDim", LevelWorldUtil.dimensionToString(player.level())); // UtilNBT.setItemStackNBTVal(stack, "LeverDim", player.dimension.getId()); if (world.isClientSide) { ChatUtil.sendStatusMessage(player, this.getDescriptionId() + ".saved"); @@ -97,7 +97,7 @@ private boolean trigger(ItemStack stack, Level world, Player player) { } String dimensionTarget = stack.getOrCreateTag().getString("LeverDim"); //check if we can avoid crossing dimensions - String currentDim = LevelWorldUtil.dimensionToString(player.level); + String currentDim = LevelWorldUtil.dimensionToString(player.level()); if (dimensionTarget.equalsIgnoreCase(currentDim)) { //same dim eh BlockState blockState = world.getBlockState(blockPos); if (blockState == null || blockState.getBlock() != Blocks.LEVER) { diff --git a/src/main/java/com/lothrazar/cyclic/item/rf/WandHypnoItem.java b/src/main/java/com/lothrazar/cyclic/item/rf/WandHypnoItem.java index 86f6b6383..5899a8d51 100644 --- a/src/main/java/com/lothrazar/cyclic/item/rf/WandHypnoItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/rf/WandHypnoItem.java @@ -44,7 +44,7 @@ public InteractionResultHolder use(Level worldIn, Player playerIn, In } private void doAction(ItemStack stack, Level world, Player player) { - if (!player.level.isClientSide) { + if (!world.isClientSide) { IEnergyStorage storage = stack.getCapability(ForgeCapabilities.ENERGY, null).orElse(null); final int cost = COST.get(); if (storage != null && storage.extractEnergy(cost, true) == cost) { diff --git a/src/main/java/com/lothrazar/cyclic/item/scythe/ScytheHarvest.java b/src/main/java/com/lothrazar/cyclic/item/scythe/ScytheHarvest.java index f8b2bd1c1..620c8e1da 100644 --- a/src/main/java/com/lothrazar/cyclic/item/scythe/ScytheHarvest.java +++ b/src/main/java/com/lothrazar/cyclic/item/scythe/ScytheHarvest.java @@ -33,7 +33,7 @@ public InteractionResult useOn(UseOnContext context) { pos = pos.relative(side); } Player player = context.getPlayer(); - if (player.level.isClientSide) { + if (player.level().isClientSide) { int radius = (context.getPlayer().isCrouching()) ? RADIUS.get() / 2 : RADIUS.get(); PacketRegistry.INSTANCE.sendToServer(new PacketHarvesting(pos, radius)); } diff --git a/src/main/java/com/lothrazar/cyclic/item/slingshot/LaserEntity.java b/src/main/java/com/lothrazar/cyclic/item/slingshot/LaserEntity.java index 5d32d892f..9ca1a4aa8 100644 --- a/src/main/java/com/lothrazar/cyclic/item/slingshot/LaserEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/slingshot/LaserEntity.java @@ -40,7 +40,7 @@ protected void onHit(HitResult result) { Entity target = entityRayTrace.getEntity(); Entity owner = getOwner(); if (target.isAlive()) { - target.hurt(level.damageSources().thrown(this, owner), Mth.nextInt(level.random, 1, 6)); + target.hurt(level().damageSources().thrown(this, owner), Mth.nextInt(level().random, 1, 6)); // if (target.level.random.nextDouble() < CHANCE_STUN && !target.level.isClientSide && target instanceof LivingEntity) { // LivingEntity living = (LivingEntity) target; // MobEffectInstance effect = new MobEffectInstance(PotionRegistry.PotionEffects.stun, Const.TICKS_PER_SEC * 2, 1); diff --git a/src/main/java/com/lothrazar/cyclic/item/slingshot/MagicMissileEntity.java b/src/main/java/com/lothrazar/cyclic/item/slingshot/MagicMissileEntity.java index 8f80b5ddb..9c90d372e 100644 --- a/src/main/java/com/lothrazar/cyclic/item/slingshot/MagicMissileEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/slingshot/MagicMissileEntity.java @@ -49,14 +49,15 @@ public void setTarget(LivingEntity target) { public void tick() { super.tick(); lifetime--; - if (!this.level.isClientSide && lifetime <= 0) { + var level = level(); + if (!level.isClientSide && lifetime <= 0) { this.kill(); //no target found ModCyclic.LOGGER.info(" server side Self I took too long " + targetEntity); return; } //ModCyclic.logger.error("UPDATE ET isclient==" + this.world.isRemote); - if (!this.level.isClientSide && + if (!level.isClientSide && (targetEntity == null || !targetEntity.isAlive())) { this.kill(); //no target found @@ -95,7 +96,7 @@ protected void onHit(HitResult result) { Entity target = entityRayTrace.getEntity(); Entity owner = getOwner(); if (target.isAlive()) { - target.hurt(level.damageSources().thrown(this, owner), Mth.nextInt(level.random, 1, 6)); + target.hurt(level().damageSources().thrown(this, owner), Mth.nextInt(level().random, 1, 6)); } } this.remove(RemovalReason.DISCARDED); diff --git a/src/main/java/com/lothrazar/cyclic/item/slingshot/StoneEntity.java b/src/main/java/com/lothrazar/cyclic/item/slingshot/StoneEntity.java index 515c7bf57..3d8ba4dc9 100644 --- a/src/main/java/com/lothrazar/cyclic/item/slingshot/StoneEntity.java +++ b/src/main/java/com/lothrazar/cyclic/item/slingshot/StoneEntity.java @@ -44,9 +44,10 @@ protected void onHit(HitResult result) { EntityHitResult entityRayTrace = (EntityHitResult) result; Entity target = entityRayTrace.getEntity(); Entity owner = getOwner(); + var level = level(); if (target.isAlive()) { target.hurt(level.damageSources().thrown(this, owner), Mth.nextInt(level.random, 2, 6)); - if (target.level.random.nextDouble() < CHANCE_STUN && !target.level.isClientSide && target instanceof LivingEntity) { + if (level.random.nextDouble() < CHANCE_STUN && !level.isClientSide && target instanceof LivingEntity) { LivingEntity living = (LivingEntity) target; MobEffectInstance effect = new MobEffectInstance(PotionEffectRegistry.STUN.get(), Const.TICKS_PER_SEC * 2, 1); effect.visible = false; diff --git a/src/main/java/com/lothrazar/cyclic/item/storagebag/ScreenStorageBag.java b/src/main/java/com/lothrazar/cyclic/item/storagebag/ScreenStorageBag.java index f6503cf66..fe2faa7a4 100644 --- a/src/main/java/com/lothrazar/cyclic/item/storagebag/ScreenStorageBag.java +++ b/src/main/java/com/lothrazar/cyclic/item/storagebag/ScreenStorageBag.java @@ -8,6 +8,7 @@ import com.lothrazar.cyclic.registry.TextureRegistry; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.nbt.CompoundTag; @@ -77,21 +78,21 @@ protected void init() { } @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(ms); - super.render(ms, mouseX, mouseY, partialTicks); - this.renderTooltip(ms, mouseX, mouseY); + public void render(GuiGraphics gg, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(gg); + super.render(gg, mouseX, mouseY, partialTicks); + this.renderTooltip(gg, mouseX, mouseY); } @Override - protected void renderLabels(PoseStack ms, int x, int y) {} + protected void renderLabels(GuiGraphics gg, int x, int y) {} @Override - protected void renderBg(PoseStack ms, float partialTicks, int x, int y) { - this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TextureRegistry.INVENTORY_SIDEBAR); - Screen.blit(ms, this.leftPos - 24, this.topPos, 0, 0, 27, 101, 27, 101); + protected void renderBg(GuiGraphics gg, float partialTicks, int x, int y) { + this.drawBackground(gg, TextureRegistry.INVENTORY_LARGE); +// RenderSystem.setShader(GameRenderer::getPositionTexShader); +// RenderSystem.setShaderTexture(0, TextureRegistry.INVENTORY_SIDEBAR); + gg.blit(TextureRegistry.INVENTORY_SIDEBAR, this.leftPos - 24, this.topPos, 0, 0, 27, 101, 27, 101);//todo; use screenbase? } private class ToggleButton extends ExtendedButton { diff --git a/src/main/java/com/lothrazar/cyclic/item/torchthrow/EntityTorchBolt.java b/src/main/java/com/lothrazar/cyclic/item/torchthrow/EntityTorchBolt.java index 85f841304..92fb5744c 100644 --- a/src/main/java/com/lothrazar/cyclic/item/torchthrow/EntityTorchBolt.java +++ b/src/main/java/com/lothrazar/cyclic/item/torchthrow/EntityTorchBolt.java @@ -40,7 +40,8 @@ protected Item getDefaultItem() { @Override protected void onHit(HitResult result) { - if (this.level.isClientSide) { + Level level = this.level(); + if (level.isClientSide) { return; } HitResult.Type type = result.getType(); @@ -50,16 +51,16 @@ protected void onHit(HitResult result) { EntityHitResult entityRayTrace = (EntityHitResult) result; Entity target = entityRayTrace.getEntity(); if (target.isAlive()) { - target.hurt(level.damageSources().thrown(this, this.getOwner()), 0); + target.hurt(level().damageSources().thrown(this, this.getOwner()), 0); } - ItemStackUtil.drop(level, target.blockPosition(), new ItemStack(Items.TORCH)); + ItemStackUtil.drop(level(), target.blockPosition(), new ItemStack(Items.TORCH)); } else if (type == HitResult.Type.BLOCK) { BlockHitResult bRayTrace = (BlockHitResult) result; Direction offset = bRayTrace.getDirection(); BlockPos pos = bRayTrace.getBlockPos().relative(offset); boolean itPlaced = false; - if (level.isEmptyBlock(pos) || level.getBlockState(pos).getMaterial().isReplaceable()) { + if (level.isEmptyBlock(pos) || level.getBlockState(pos).canBeReplaced()) { BlockState newstate = null; if (offset == Direction.UP || offset == Direction.DOWN) { newstate = Blocks.TORCH.defaultBlockState(); diff --git a/src/main/java/com/lothrazar/cyclic/item/transporter/TileTransporterItem.java b/src/main/java/com/lothrazar/cyclic/item/transporter/TileTransporterItem.java index aacbb5d6b..5a684dacc 100644 --- a/src/main/java/com/lothrazar/cyclic/item/transporter/TileTransporterItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/transporter/TileTransporterItem.java @@ -98,7 +98,7 @@ private boolean placeStoredTileEntity(Player player, ItemStack heldChestSack, Bl ChatUtil.addChatMessage(player, "Invalid block id " + res); return false; } - BlockState toPlace = NbtUtils.readBlockState(player.level.holderLookup(Registries.BLOCK), itemData.getCompound(KEY_BLOCKSTATE)); + BlockState toPlace = NbtUtils.readBlockState(player.level().holderLookup(Registries.BLOCK), itemData.getCompound(KEY_BLOCKSTATE)); //maybe get from player direction or offset face, but instead rely on that from saved data Level world = player.getCommandSenderWorld(); try { diff --git a/src/main/java/com/lothrazar/cyclic/net/PacketEntityLaser.java b/src/main/java/com/lothrazar/cyclic/net/PacketEntityLaser.java index db05d58a8..1bbe4bea0 100644 --- a/src/main/java/com/lothrazar/cyclic/net/PacketEntityLaser.java +++ b/src/main/java/com/lothrazar/cyclic/net/PacketEntityLaser.java @@ -50,7 +50,7 @@ public PacketEntityLaser(int eid, boolean cross) { public static void handle(PacketEntityLaser message, Supplier ctx) { ctx.get().enqueueWork(() -> { ServerPlayer sender = ctx.get().getSender(); - Level level = sender.level; + Level level = sender.level(); Entity target = level.getEntity(message.entityId); //validate also covers delay ItemStack stack = LaserItem.getIfHeld(sender); diff --git a/src/main/java/com/lothrazar/cyclic/net/PacketHarvesting.java b/src/main/java/com/lothrazar/cyclic/net/PacketHarvesting.java index 495872a7b..4739efbb1 100644 --- a/src/main/java/com/lothrazar/cyclic/net/PacketHarvesting.java +++ b/src/main/java/com/lothrazar/cyclic/net/PacketHarvesting.java @@ -58,7 +58,7 @@ public static void encode(PacketHarvesting msg, FriendlyByteBuf buf) { public static void handle(PacketHarvesting message, Supplier ctx) { ctx.get().enqueueWork(() -> { ServerPlayer sender = ctx.get().getSender(); - HarvestUtil.harvestShape(sender.level, message.pos, message.radius); + HarvestUtil.harvestShape(sender.level(), message.pos, message.radius); }); message.done(ctx); } diff --git a/src/main/java/com/lothrazar/cyclic/net/PacketRecordSound.java b/src/main/java/com/lothrazar/cyclic/net/PacketRecordSound.java index 7334be704..e2fe20d33 100644 --- a/src/main/java/com/lothrazar/cyclic/net/PacketRecordSound.java +++ b/src/main/java/com/lothrazar/cyclic/net/PacketRecordSound.java @@ -61,7 +61,7 @@ public static void handle(PacketRecordSound message, Supplier { //rotate type ServerPlayer sender = ctx.get().getSender(); - BlockEntity tile = sender.level.getBlockEntity(message.pos); + BlockEntity tile = sender.level().getBlockEntity(message.pos); if (tile instanceof TileSoundRecorder) { ((TileSoundRecorder) tile).onSoundHeard(message.sound); } diff --git a/src/main/java/com/lothrazar/cyclic/net/PacketRotateBlock.java b/src/main/java/com/lothrazar/cyclic/net/PacketRotateBlock.java index 83395dcff..bda68b968 100644 --- a/src/main/java/com/lothrazar/cyclic/net/PacketRotateBlock.java +++ b/src/main/java/com/lothrazar/cyclic/net/PacketRotateBlock.java @@ -63,14 +63,14 @@ public static void encode(PacketRotateBlock msg, FriendlyByteBuf buf) { public static void handle(PacketRotateBlock message, Supplier ctx) { ctx.get().enqueueWork(() -> { //rotate type - Level world = ctx.get().getSender().level; - boolean succ = BlockUtil.rotateBlockValidState(world, message.pos, message.side); + Level level = ctx.get().getSender().level(); + boolean succ = BlockUtil.rotateBlockValidState(level, message.pos, message.side); if (succ) { ServerPlayer player = ctx.get().getSender(); ItemStack itemStackHeld = player.getItemInHand(message.hand); ItemStackUtil.damageItem(player, itemStackHeld); - if (world.getBlockState(message.pos).getSoundType() != null) { - SoundUtil.playSoundFromServer(player, world.getBlockState(message.pos).getSoundType().getPlaceSound(), 1F, 1F); + if (level.getBlockState(message.pos).getSoundType() != null) { + SoundUtil.playSoundFromServer(player, level.getBlockState(message.pos).getSoundType().getPlaceSound(), 1F, 1F); } } }); diff --git a/src/main/java/com/lothrazar/cyclic/potion/effect/ButterEffect.java b/src/main/java/com/lothrazar/cyclic/potion/effect/ButterEffect.java index 1a1008da2..a0e86d726 100644 --- a/src/main/java/com/lothrazar/cyclic/potion/effect/ButterEffect.java +++ b/src/main/java/com/lothrazar/cyclic/potion/effect/ButterEffect.java @@ -23,11 +23,12 @@ public ButterEffect(MobEffectCategory typeIn, int liquidColorIn) { public void tick(LivingTickEvent event) { // delete me i guess LivingEntity living = event.getEntity(); - if (living.level.random.nextDouble() > DROP_CHANCE) { + var level = living.level(); + if (level.random.nextDouble() > DROP_CHANCE) { return; } List slots = null; - if (!living.isOnGround() || living.isSprinting()) { + if (!living.onGround() || living.isSprinting()) { int amplifier = living.getEffect(this).getAmplifier(); //sprinting or jumping or something if (amplifier == Const.Potions.I) { @@ -40,9 +41,9 @@ public void tick(LivingTickEvent event) { if (slots == null) { return; } - int slotix = living.level.random.nextInt(slots.size()); + int slotix = level.random.nextInt(slots.size()); ItemStack dropMe = living.getItemBySlot(slots.get(slotix)); - ItemStackUtil.drop(living.level, living.blockPosition(), dropMe); + ItemStackUtil.drop(level, living.blockPosition(), dropMe); living.setItemSlot(slots.get(slotix), ItemStack.EMPTY); // for (EquipmentSlot slot : slots) { // stack = entity.getItemStackFromSlot(slot); diff --git a/src/main/java/com/lothrazar/cyclic/potion/effect/FrostEffect.java b/src/main/java/com/lothrazar/cyclic/potion/effect/FrostEffect.java index bd5ddf6ee..49a999940 100644 --- a/src/main/java/com/lothrazar/cyclic/potion/effect/FrostEffect.java +++ b/src/main/java/com/lothrazar/cyclic/potion/effect/FrostEffect.java @@ -17,6 +17,6 @@ public void tick(LivingTickEvent event) { // delete me i guess LivingEntity living = event.getEntity(); int amp = living.getEffect(this).getAmplifier(); - FrostWalkerEnchantment.onEntityMoved(living, living.level, living.blockPosition(), amp); + FrostWalkerEnchantment.onEntityMoved(living, living.level(), living.blockPosition(), amp); } } diff --git a/src/main/java/com/lothrazar/cyclic/potion/effect/MagneticEffect.java b/src/main/java/com/lothrazar/cyclic/potion/effect/MagneticEffect.java index a0ea13398..1078693e3 100644 --- a/src/main/java/com/lothrazar/cyclic/potion/effect/MagneticEffect.java +++ b/src/main/java/com/lothrazar/cyclic/potion/effect/MagneticEffect.java @@ -16,6 +16,6 @@ public MagneticEffect(MobEffectCategory typeIn, int liquidColorIn) { public void tick(LivingTickEvent event) { LivingEntity living = event.getEntity(); int amp = living.getEffect(this).getAmplifier(); - EntityUtil.moveEntityItemsInRegion(living.level, living.blockPosition(), 8 * amp, 1 + amp); + EntityUtil.moveEntityItemsInRegion(living.level(), living.blockPosition(), 8 * amp, 1 + amp); } } diff --git a/src/main/java/com/lothrazar/cyclic/potion/effect/SnowwalkEffect.java b/src/main/java/com/lothrazar/cyclic/potion/effect/SnowwalkEffect.java index 9f7327302..dcc406434 100644 --- a/src/main/java/com/lothrazar/cyclic/potion/effect/SnowwalkEffect.java +++ b/src/main/java/com/lothrazar/cyclic/potion/effect/SnowwalkEffect.java @@ -19,14 +19,14 @@ public SnowwalkEffect(MobEffectCategory typeIn, int liquidColorIn) { public void tick(LivingTickEvent event) { // delete me i guess LivingEntity living = event.getEntity(); - Level world = living.getLevel(); + Level level = living.level(); BlockPos blockpos = living.blockPosition(); BlockState blockstate = Blocks.SNOW.defaultBlockState(); living.getEffect(this).getAmplifier(); // TODO: radius? - if (world.isEmptyBlock(blockpos) && blockstate.canSurvive(world, blockpos)) { + if (level.isEmptyBlock(blockpos) && blockstate.canSurvive(level, blockpos)) { //world.getBlockState(blockpos).is(Blocks.AIR)) { //is air - world.setBlockAndUpdate(blockpos, blockstate); + level.setBlockAndUpdate(blockpos, blockstate); } } } diff --git a/src/main/java/com/lothrazar/cyclic/potion/effect/WaterwalkEffect.java b/src/main/java/com/lothrazar/cyclic/potion/effect/WaterwalkEffect.java index b4bc3f3f4..0cae35b53 100644 --- a/src/main/java/com/lothrazar/cyclic/potion/effect/WaterwalkEffect.java +++ b/src/main/java/com/lothrazar/cyclic/potion/effect/WaterwalkEffect.java @@ -17,7 +17,7 @@ public WaterwalkEffect(MobEffectCategory typeIn, int liquidColorIn) { public void tick(LivingTickEvent event) { LivingEntity entity = event.getEntity(); // living.getEffect(this).getAmplifier() - if (entity.isInWater() || entity.getLevel().getBlockState(entity.blockPosition()).is(Blocks.WATER)) { + if (entity.isInWater() || entity.level().getBlockState(entity.blockPosition()).is(Blocks.WATER)) { if (entity instanceof Player p) { if (p.isCrouching()) { return;// let them slip down into it diff --git a/src/main/java/com/lothrazar/cyclic/registry/BlockRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/BlockRegistry.java index 93d362088..36d879229 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/BlockRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/BlockRegistry.java @@ -137,8 +137,6 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockSetType; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; import net.minecraftforge.event.CreativeModeTabEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -177,163 +175,163 @@ public static void buildContents(CreativeModeTabEvent.Register event) { public static List BLOCKSCLIENTREGISTRY = new ArrayList<>(); // TODO: 1.19 ? refactor this public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ModCyclic.MODID); - public static final RegistryObject COMPRESSED_COBBLESTONE = BLOCKS.register("compressed_cobblestone", () -> new BlockSimple(Block.Properties.of(Material.STONE, DyeColor.GRAY).strength(1.0F, 7.0F)) { + public static final RegistryObject COMPRESSED_COBBLESTONE = BLOCKS.register("compressed_cobblestone", () -> new BlockSimple(Block.Properties.of().strength(1.0F, 7.0F)) { @Override public void appendHoverText(ItemStack stack, BlockGetter worldIn, List tooltip, TooltipFlag flagIn) {} }); - public static final RegistryObject FLINT_BLOCK = BLOCKS.register("flint_block", () -> new BlockSimple(Block.Properties.of(Material.STONE, DyeColor.BLACK).strength(1.3F, 5.0F)) { + public static final RegistryObject FLINT_BLOCK = BLOCKS.register("flint_block", () -> new BlockSimple(Block.Properties.of( ).strength(1.3F, 5.0F)) { @Override public void appendHoverText(ItemStack stack, BlockGetter worldIn, List tooltip, TooltipFlag flagIn) {} }); - public static final RegistryObject SPIKES_IRON = BLOCKS.register("spikes_iron", () -> new SpikesBlock(Block.Properties.of(Material.STONE), EnumSpikeType.PLAIN)); - public static final RegistryObject SPIKES_FIRE = BLOCKS.register("spikes_fire", () -> new SpikesBlock(Block.Properties.of(Material.STONE), EnumSpikeType.FIRE)); - public static final RegistryObject SPIKES_CURSE = BLOCKS.register("spikes_curse", () -> new SpikesBlock(Block.Properties.of(Material.STONE), EnumSpikeType.CURSE)); - public static final RegistryObject SPIKES_DIAMOND = BLOCKS.register("spikes_diamond", () -> new SpikesDiamond(Block.Properties.of(Material.METAL))); - public static final RegistryObject FLUIDHOPPER = BLOCKS.register("hopper_fluid", () -> new BlockFluidHopper(Block.Properties.of(Material.STONE))); - public static final RegistryObject HOPPER = BLOCKS.register("hopper", () -> new BlockSimpleHopper(Block.Properties.of(Material.WOOD))); - public static final RegistryObject HOPPERGOLD = BLOCKS.register("hopper_gold", () -> new BlockGoldHopper(Block.Properties.of(Material.METAL))); - public static final RegistryObject ANVILVOID = BLOCKS.register("anvil_void", () -> new BlockAnvilVoid(Block.Properties.of(Material.HEAVY_METAL))); - public static final RegistryObject FANSLAB = BLOCKS.register("fan_slab", () -> new BlockFanSlab(Block.Properties.of(Material.STONE))); - public static final RegistryObject ROTATOR = BLOCKS.register("rotator", () -> new BlockRotator(Block.Properties.of(Material.STONE))); - public static final RegistryObject DETECTORMOON = BLOCKS.register("detector_moon", () -> new BlockMoon(Block.Properties.of(Material.STONE))); - public static final RegistryObject DETECTORWEATHER = BLOCKS.register("detector_weather", () -> new BlockWeather(Block.Properties.of(Material.STONE))); - public static final RegistryObject TERRAGLASS = BLOCKS.register("terra_glass", () -> new BlockTerraGlass(Block.Properties.of(Material.STONE).sound(SoundType.GLASS))); - public static final RegistryObject SPRINKLER = BLOCKS.register("sprinkler", () -> new BlockSprinkler(Block.Properties.of(Material.STONE))); - public static final RegistryObject SHEARING = BLOCKS.register("shearing", () -> new BlockShearing(Block.Properties.of(Material.STONE))); - public static final RegistryObject DARK_GLASS_CONNECTED = BLOCKS.register("dark_glass_connected", () -> new DarkGlassConnectedBlock(Block.Properties.of(Material.DIRT))); - public static final RegistryObject GLASS_CONNECTED = BLOCKS.register("glass_connected", () -> new GlassConnectedBlock(Block.Properties.of(Material.GLASS).strength(0.3F))); - public static final RegistryObject ENDER_ITEM_SHELF = BLOCKS.register("ender_item_shelf", () -> new BlockItemShelf(Block.Properties.of(Material.WOOD))); - public static final RegistryObject DOORBELL = BLOCKS.register("doorbell", () -> new DoorbellButton(Block.Properties.of(Material.WOOD))); - public static final RegistryObject WIRELESS_ENERGY = BLOCKS.register("wireless_energy", () -> new BlockWirelessEnergy(Block.Properties.of(Material.METAL))); - public static final RegistryObject WIRELESS_ITEM = BLOCKS.register("wireless_item", () -> new BlockWirelessItem(Block.Properties.of(Material.METAL))); - public static final RegistryObject WIRELESS_FLUID = BLOCKS.register("wireless_fluid", () -> new BlockWirelessFluid(Block.Properties.of(Material.METAL))); - public static final RegistryObject SOUND_RECORDER = BLOCKS.register("sound_recorder", () -> new BlockSoundRecorder(Block.Properties.of(Material.METAL))); - public static final RegistryObject SOUND_PLAYER = BLOCKS.register("sound_player", () -> new BlockSoundPlayer(Block.Properties.of(Material.METAL))); - public static final RegistryObject GENERATOR_FUEL = BLOCKS.register("generator_fuel", () -> new BlockGeneratorFuel(Block.Properties.of(Material.METAL))); - public static final RegistryObject GENERATOR_FOOD = BLOCKS.register("generator_food", () -> new BlockGeneratorFood(Block.Properties.of(Material.METAL))); - public static final RegistryObject GENERATOR_FLUID = BLOCKS.register("generator_fluid", () -> new BlockGeneratorFluid(Block.Properties.of(Material.METAL))); - public static final RegistryObject GENERATOR_ITEM = BLOCKS.register("generator_item", () -> new BlockGeneratorDrops(Block.Properties.of(Material.METAL))); - public static final RegistryObject PACKAGER = BLOCKS.register("packager", () -> new BlockPackager(Block.Properties.of(Material.METAL))); - public static final RegistryObject TERRA_PRETA = BLOCKS.register("terra_preta", () -> new BlockTerraPreta(Block.Properties.of(Material.DIRT).sound(SoundType.GRAVEL))); - public static final RegistryObject LIGHT_CAMO = BLOCKS.register("light_camo", () -> new BlockLightCamo(Block.Properties.of(Material.METAL))); - public static final RegistryObject LASER = BLOCKS.register("laser", () -> new BlockLaser(Block.Properties.of(Material.METAL))); - public static final RegistryObject FLOWER_CYAN = BLOCKS.register("flower_cyan", () -> new FlowerSimpleBlock(Block.Properties.of(Material.PLANT, DyeColor.CYAN))); - public static final RegistryObject FLOWER_PURPLE_TULIP = BLOCKS.register("flower_purple_tulip", () -> new FlowerSimpleBlock(Block.Properties.of(Material.PLANT, DyeColor.PURPLE))); - public static final RegistryObject FLOWER_LIME_CARNATION = BLOCKS.register("flower_lime_carnation", () -> new FlowerSimpleBlock(Block.Properties.of(Material.PLANT, DyeColor.LIME))); - public static final RegistryObject FLOWER_ABSALON_TULIP = BLOCKS.register("flower_absalon_tulip", () -> new FlowerSimpleBlock(Block.Properties.of(Material.PLANT, DyeColor.BROWN))); - public static final RegistryObject MEMBRANE = BLOCKS.register("membrane", () -> new MembraneBlock(Block.Properties.of(Material.DIRT))); - public static final RegistryObject LAMP = BLOCKS.register("lamp", () -> new MembraneLamp(Block.Properties.of(Material.STONE, DyeColor.WHITE))); - public static final RegistryObject SOIL = BLOCKS.register("soil", () -> new SoilBlock(Block.Properties.of(Material.DIRT).sound(SoundType.ROOTED_DIRT))); - public static final RegistryObject CLOUD = BLOCKS.register("cloud", () -> new CloudBlock(Block.Properties.of(Material.DIRT))); - public static final RegistryObject CLOUD_MEMBRANE = BLOCKS.register("cloud_membrane", () -> new CloudPlayerBlock(Block.Properties.of(Material.DIRT))); - public static final RegistryObject GHOST = BLOCKS.register("ghost", () -> new GhostBlock(Block.Properties.of(Material.STONE), false)); - public static final RegistryObject GHOST_PHANTOM = BLOCKS.register("ghost_phantom", () -> new GhostBlock(Block.Properties.of(Material.STONE), true)); - public static final RegistryObject WORKBENCH = BLOCKS.register("workbench", () -> new BlockWorkbench(Block.Properties.of(Material.STONE))); - public static final RegistryObject OBSIDIAN_PRESSURE_PLATE = BLOCKS.register("obsidian_pressure_plate", () -> new PressurePlateMetal(Block.Properties.of(Material.METAL, Blocks.OBSIDIAN.defaultMaterialColor()).noCollission().strength(0.5F))); - public static final RegistryObject GOLD_BARS = BLOCKS.register("gold_bars", () -> new MetalBarsBlock(Block.Properties.of(Material.METAL, MaterialColor.NONE).strength(3.0F, 6.0F))); - public static final RegistryObject GOLD_CHAIN = BLOCKS.register("gold_chain", () -> new ChainBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).strength(1).sound(SoundType.CHAIN).noOcclusion())); - public static final RegistryObject GOLD_LANTERN = BLOCKS.register("gold_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 14))); - public static final RegistryObject GOLD_SOUL_LANTERN = BLOCKS.register("gold_soul_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 15))); - public static final RegistryObject COPPER_BARS = BLOCKS.register("copper_bars", () -> new MetalBarsBlock(Block.Properties.of(Material.METAL, MaterialColor.NONE).strength(3.0F, 6.0F))); - public static final RegistryObject COPPER_CHAIN = BLOCKS.register("copper_chain", () -> new ChainBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).strength(1.0F).sound(SoundType.CHAIN).noOcclusion())); - public static final RegistryObject COPPER_LANTERN = BLOCKS.register("copper_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 12))); //soul_lantern=10 - public static final RegistryObject COPPER_SOUL_LANTERN = BLOCKS.register("copper_soul_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 13))); //soul_lantern=10 - public static final RegistryObject COPPER_PRESSURE_PLATE = BLOCKS.register("copper_pressure_plate", () -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.MOBS, Block.Properties.of(Material.METAL, Blocks.COPPER_BLOCK.defaultMaterialColor()).noCollission().strength(0.5F), BlockSetType.STONE) { + public static final RegistryObject SPIKES_IRON = BLOCKS.register("spikes_iron", () -> new SpikesBlock(Block.Properties.of(), EnumSpikeType.PLAIN)); + public static final RegistryObject SPIKES_FIRE = BLOCKS.register("spikes_fire", () -> new SpikesBlock(Block.Properties.of(), EnumSpikeType.FIRE)); + public static final RegistryObject SPIKES_CURSE = BLOCKS.register("spikes_curse", () -> new SpikesBlock(Block.Properties.of(), EnumSpikeType.CURSE)); + public static final RegistryObject SPIKES_DIAMOND = BLOCKS.register("spikes_diamond", () -> new SpikesDiamond(Block.Properties.of())); + public static final RegistryObject FLUIDHOPPER = BLOCKS.register("hopper_fluid", () -> new BlockFluidHopper(Block.Properties.of())); + public static final RegistryObject HOPPER = BLOCKS.register("hopper", () -> new BlockSimpleHopper(Block.Properties.of())); + public static final RegistryObject HOPPERGOLD = BLOCKS.register("hopper_gold", () -> new BlockGoldHopper(Block.Properties.of())); + public static final RegistryObject ANVILVOID = BLOCKS.register("anvil_void", () -> new BlockAnvilVoid(Block.Properties.of())); + public static final RegistryObject FANSLAB = BLOCKS.register("fan_slab", () -> new BlockFanSlab(Block.Properties.of())); + public static final RegistryObject ROTATOR = BLOCKS.register("rotator", () -> new BlockRotator(Block.Properties.of())); + public static final RegistryObject DETECTORMOON = BLOCKS.register("detector_moon", () -> new BlockMoon(Block.Properties.of())); + public static final RegistryObject DETECTORWEATHER = BLOCKS.register("detector_weather", () -> new BlockWeather(Block.Properties.of())); + public static final RegistryObject TERRAGLASS = BLOCKS.register("terra_glass", () -> new BlockTerraGlass(Block.Properties.of().sound(SoundType.GLASS))); + public static final RegistryObject SPRINKLER = BLOCKS.register("sprinkler", () -> new BlockSprinkler(Block.Properties.of())); + public static final RegistryObject SHEARING = BLOCKS.register("shearing", () -> new BlockShearing(Block.Properties.of())); + public static final RegistryObject DARK_GLASS_CONNECTED = BLOCKS.register("dark_glass_connected", () -> new DarkGlassConnectedBlock(Block.Properties.of())); + public static final RegistryObject GLASS_CONNECTED = BLOCKS.register("glass_connected", () -> new GlassConnectedBlock(Block.Properties.of().sound(SoundType.GLASS).strength(0.3F))); + public static final RegistryObject ENDER_ITEM_SHELF = BLOCKS.register("ender_item_shelf", () -> new BlockItemShelf(Block.Properties.of())); + public static final RegistryObject DOORBELL = BLOCKS.register("doorbell", () -> new DoorbellButton(Block.Properties.of())); + public static final RegistryObject WIRELESS_ENERGY = BLOCKS.register("wireless_energy", () -> new BlockWirelessEnergy(Block.Properties.of())); + public static final RegistryObject WIRELESS_ITEM = BLOCKS.register("wireless_item", () -> new BlockWirelessItem(Block.Properties.of())); + public static final RegistryObject WIRELESS_FLUID = BLOCKS.register("wireless_fluid", () -> new BlockWirelessFluid(Block.Properties.of())); + public static final RegistryObject SOUND_RECORDER = BLOCKS.register("sound_recorder", () -> new BlockSoundRecorder(Block.Properties.of())); + public static final RegistryObject SOUND_PLAYER = BLOCKS.register("sound_player", () -> new BlockSoundPlayer(Block.Properties.of())); + public static final RegistryObject GENERATOR_FUEL = BLOCKS.register("generator_fuel", () -> new BlockGeneratorFuel(Block.Properties.of())); + public static final RegistryObject GENERATOR_FOOD = BLOCKS.register("generator_food", () -> new BlockGeneratorFood(Block.Properties.of())); + public static final RegistryObject GENERATOR_FLUID = BLOCKS.register("generator_fluid", () -> new BlockGeneratorFluid(Block.Properties.of())); + public static final RegistryObject GENERATOR_ITEM = BLOCKS.register("generator_item", () -> new BlockGeneratorDrops(Block.Properties.of())); + public static final RegistryObject PACKAGER = BLOCKS.register("packager", () -> new BlockPackager(Block.Properties.of())); + public static final RegistryObject TERRA_PRETA = BLOCKS.register("terra_preta", () -> new BlockTerraPreta(Block.Properties.of().sound(SoundType.GRAVEL))); + public static final RegistryObject LIGHT_CAMO = BLOCKS.register("light_camo", () -> new BlockLightCamo(Block.Properties.of())); + public static final RegistryObject LASER = BLOCKS.register("laser", () -> new BlockLaser(Block.Properties.of())); + public static final RegistryObject FLOWER_CYAN = BLOCKS.register("flower_cyan", () -> new FlowerSimpleBlock(Block.Properties.of( ))); + public static final RegistryObject FLOWER_PURPLE_TULIP = BLOCKS.register("flower_purple_tulip", () -> new FlowerSimpleBlock(Block.Properties.of( ))); + public static final RegistryObject FLOWER_LIME_CARNATION = BLOCKS.register("flower_lime_carnation", () -> new FlowerSimpleBlock(Block.Properties.of( ))); + public static final RegistryObject FLOWER_ABSALON_TULIP = BLOCKS.register("flower_absalon_tulip", () -> new FlowerSimpleBlock(Block.Properties.of( ))); + public static final RegistryObject MEMBRANE = BLOCKS.register("membrane", () -> new MembraneBlock(Block.Properties.of())); + public static final RegistryObject LAMP = BLOCKS.register("lamp", () -> new MembraneLamp(Block.Properties.of( ))); + public static final RegistryObject SOIL = BLOCKS.register("soil", () -> new SoilBlock(Block.Properties.of().sound(SoundType.ROOTED_DIRT))); + public static final RegistryObject CLOUD = BLOCKS.register("cloud", () -> new CloudBlock(Block.Properties.of())); + public static final RegistryObject CLOUD_MEMBRANE = BLOCKS.register("cloud_membrane", () -> new CloudPlayerBlock(Block.Properties.of())); + public static final RegistryObject GHOST = BLOCKS.register("ghost", () -> new GhostBlock(Block.Properties.of(), false)); + public static final RegistryObject GHOST_PHANTOM = BLOCKS.register("ghost_phantom", () -> new GhostBlock(Block.Properties.of(), true)); + public static final RegistryObject WORKBENCH = BLOCKS.register("workbench", () -> new BlockWorkbench(Block.Properties.of())); + public static final RegistryObject OBSIDIAN_PRESSURE_PLATE = BLOCKS.register("obsidian_pressure_plate", () -> new PressurePlateMetal(Block.Properties.of( ).noCollission().strength(0.5F))); + public static final RegistryObject GOLD_BARS = BLOCKS.register("gold_bars", () -> new MetalBarsBlock(Block.Properties.of( ).strength(3.0F, 6.0F))); + public static final RegistryObject GOLD_CHAIN = BLOCKS.register("gold_chain", () -> new ChainBlock(BlockBehaviour.Properties.of( ).strength(1).sound(SoundType.CHAIN).noOcclusion())); + public static final RegistryObject GOLD_LANTERN = BLOCKS.register("gold_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of( ).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 14))); + public static final RegistryObject GOLD_SOUL_LANTERN = BLOCKS.register("gold_soul_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of( ).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 15))); + public static final RegistryObject COPPER_BARS = BLOCKS.register("copper_bars", () -> new MetalBarsBlock(Block.Properties.of( ).strength(3.0F, 6.0F))); + public static final RegistryObject COPPER_CHAIN = BLOCKS.register("copper_chain", () -> new ChainBlock(BlockBehaviour.Properties.of( ).strength(1.0F).sound(SoundType.CHAIN).noOcclusion())); + public static final RegistryObject COPPER_LANTERN = BLOCKS.register("copper_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of( ).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 12))); //soul_lantern=10 + public static final RegistryObject COPPER_SOUL_LANTERN = BLOCKS.register("copper_soul_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of( ).noOcclusion().strength(1.5F).sound(SoundType.LANTERN).lightLevel(p -> 13))); //soul_lantern=10 + public static final RegistryObject COPPER_PRESSURE_PLATE = BLOCKS.register("copper_pressure_plate", () -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.MOBS, Block.Properties.of( ).noCollission().strength(0.5F), BlockSetType.STONE) { @Override protected int getSignalForState(BlockState st) { return st.getValue(POWERED) ? 8 : 0; } }); - public static final RegistryObject NETHERITE_BARS = BLOCKS.register("netherite_bars", () -> new MetalBarsBlock(Block.Properties.of(Material.METAL, MaterialColor.NONE).strength(6.0F, 12.0F))); - public static final RegistryObject NETHERTIE_CHAIN = BLOCKS.register("netherite_chain", () -> new ChainBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).strength(5.0F, 6.0F).sound(SoundType.CHAIN).noOcclusion())); - public static final RegistryObject NETHERITE_LANTERN = BLOCKS.register("netherite_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).noOcclusion().strength(3.5F).sound(SoundType.LANTERN).lightLevel(p -> 15))); // same as lantern=15 - public static final RegistryObject NETHERITE_PRESSURE_PLATE = BLOCKS.register("netherite_pressure_plate", () -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.MOBS, Block.Properties.of(Material.METAL, Blocks.COPPER_BLOCK.defaultMaterialColor()).noCollission().strength(0.5F), BlockSetType.STONE)); - public static final RegistryObject SPONGE_LAVA = BLOCKS.register("sponge_lava", () -> new LavaSpongeBlock(Block.Properties.of(Material.SPONGE).sound(SoundType.SPORE_BLOSSOM).lightLevel(p -> 2))); - public static final RegistryObject SPONGE_MILK = BLOCKS.register("sponge_milk", () -> new MilkSpongeBlock(Block.Properties.of(Material.SPONGE).lightLevel(p -> 1))); - public static final RegistryObject CRUSHER = BLOCKS.register("crusher", () -> new BlockCrusher(Block.Properties.of(Material.METAL))); - public static final RegistryObject PEACE_CANDLE = BLOCKS.register("peace_candle", () -> new CandlePeaceBlock(Block.Properties.of(Material.STONE) + public static final RegistryObject NETHERITE_BARS = BLOCKS.register("netherite_bars", () -> new MetalBarsBlock(Block.Properties.of( ).strength(6.0F, 12.0F))); + public static final RegistryObject NETHERTIE_CHAIN = BLOCKS.register("netherite_chain", () -> new ChainBlock(BlockBehaviour.Properties.of( ).strength(5.0F, 6.0F).sound(SoundType.CHAIN).noOcclusion())); + public static final RegistryObject NETHERITE_LANTERN = BLOCKS.register("netherite_lantern", () -> new LanternBlock(BlockBehaviour.Properties.of( ).noOcclusion().strength(3.5F).sound(SoundType.LANTERN).lightLevel(p -> 15))); // same as lantern=15 + public static final RegistryObject NETHERITE_PRESSURE_PLATE = BLOCKS.register("netherite_pressure_plate", () -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.MOBS, Block.Properties.of( ).noCollission().strength(0.5F), BlockSetType.STONE)); + public static final RegistryObject SPONGE_LAVA = BLOCKS.register("sponge_lava", () -> new LavaSpongeBlock(Block.Properties.of().sound(SoundType.SPORE_BLOSSOM).lightLevel(p -> 2))); + public static final RegistryObject SPONGE_MILK = BLOCKS.register("sponge_milk", () -> new MilkSpongeBlock(Block.Properties.of().lightLevel(p -> 1))); + public static final RegistryObject CRUSHER = BLOCKS.register("crusher", () -> new BlockCrusher(Block.Properties.of())); + public static final RegistryObject PEACE_CANDLE = BLOCKS.register("peace_candle", () -> new CandlePeaceBlock(Block.Properties.of() .lightLevel(p -> p.getValue(BlockCyclic.LIT) ? 6 : 0))); - public static final RegistryObject WATER_CANDLE = BLOCKS.register("water_candle", () -> new CandleWaterBlock(Block.Properties.of(Material.STONE) + public static final RegistryObject WATER_CANDLE = BLOCKS.register("water_candle", () -> new CandleWaterBlock(Block.Properties.of() .lightLevel(p -> p.getValue(BlockCyclic.LIT) ? 1 : 0))); - public static final RegistryObject TELEPORT = BLOCKS.register("teleport", () -> new BlockTeleport(Block.Properties.of(Material.STONE))); - public static final RegistryObject APPLE_SPROUT_EMERALD = BLOCKS.register("apple_sprout_emerald", () -> new AppleCropBlock(Block.Properties.of(Material.PLANT), false)); - public static final RegistryObject APPLE_SPROUT_DIAMOND = BLOCKS.register("apple_sprout_diamond", () -> new AppleCropBlock(Block.Properties.of(Material.PLANT), false)); - public static final RegistryObject APPLE_SPROUT = BLOCKS.register("apple_sprout", () -> new AppleCropBlock(Block.Properties.of(Material.PLANT), true)); - public static final RegistryObject COMPUTER_SHAPE = BLOCKS.register("computer_shape", () -> new BlockShapedata(Block.Properties.of(Material.METAL))); - public static final RegistryObject SCAFFOLD_FRAGILE = BLOCKS.register("scaffold_fragile", () -> new BlockScaffolding(Block.Properties.of(Material.WOOD), true)); - public static final RegistryObject SCAFFOLD_RESPONSIVE = BLOCKS.register("scaffold_responsive", () -> new BlockScaffoldingResponsive(Block.Properties.of(Material.WOOD), false)); - public static final RegistryObject SCAFFOLD_REPLACE = BLOCKS.register("scaffold_replace", () -> new BlockScaffoldingReplace(Block.Properties.of(Material.WOOD))); - public static final RegistryObject DARK_GLASS = BLOCKS.register("dark_glass", () -> new DarkGlassBlock(Block.Properties.of(Material.DIRT))); - public static final RegistryObject PEAT_UNBAKED = BLOCKS.register("peat_unbaked", () -> new PeatBlock(Block.Properties.of(Material.DIRT).sound(SoundType.GRAVEL))); - public static final RegistryObject PEAT_BAKED = BLOCKS.register("peat_baked", () -> new PeatFuelBlock(Block.Properties.of(Material.DIRT).sound(SoundType.GRAVEL))); - public static final RegistryObject PEAT_FARM = BLOCKS.register("peat_farm", () -> new BlockPeatFarm(Block.Properties.of(Material.STONE))); - public static final RegistryObject SOLIDIFIER = BLOCKS.register("solidifier", () -> new BlockSolidifier(Block.Properties.of(Material.STONE))); - public static final RegistryObject MELTER = BLOCKS.register("melter", () -> new BlockMelter(Block.Properties.of(Material.STONE))); - public static final RegistryObject BATTERY = BLOCKS.register("battery", () -> new BlockBattery(Block.Properties.of(Material.STONE))); - public static final RegistryObject CASK = BLOCKS.register("cask", () -> new BlockCask(Block.Properties.of(Material.WOOD))); - public static final RegistryObject CRATE = BLOCKS.register("crate", () -> new BlockCrate(Block.Properties.of(Material.WOOD))); - public static final RegistryObject CRATE_MINI = BLOCKS.register("crate_mini", () -> new BlockCrateMini(Block.Properties.of(Material.WOOD))); - public static final RegistryObject EYE_REDSTONE = BLOCKS.register("eye_redstone", () -> new BlockEye(Block.Properties.of(Material.WOOD))); - public static final RegistryObject EYE_TELEPORT = BLOCKS.register("eye_teleport", () -> new BlockEyeTp(Block.Properties.of(Material.WOOD))); - public static final RegistryObject PLACER = BLOCKS.register("placer", () -> new BlockPlacer(Block.Properties.of(Material.STONE))); - public static final RegistryObject BREAKER = BLOCKS.register("breaker", () -> new BlockBreaker(Block.Properties.of(Material.STONE))); - public static final RegistryObject DROPPER = BLOCKS.register("dropper", () -> new BlockDropper(Block.Properties.of(Material.METAL))); - public static final RegistryObject FORESTER = BLOCKS.register("forester", () -> new BlockForester(Block.Properties.of(Material.METAL))); - public static final RegistryObject HARVESTER = BLOCKS.register("harvester", () -> new BlockHarvester(Block.Properties.of(Material.STONE))); - public static final RegistryObject MINER = BLOCKS.register("miner", () -> new BlockMiner(Block.Properties.of(Material.METAL))); - public static final RegistryObject PLACER_FLUID = BLOCKS.register("placer_fluid", () -> new BlockPlacerFluid(Block.Properties.of(Material.METAL))); - public static final RegistryObject USER = BLOCKS.register("user", () -> new BlockUser(Block.Properties.of(Material.STONE))); - public static final RegistryObject COLLECTOR = BLOCKS.register("collector", () -> new BlockItemCollector(Block.Properties.of(Material.STONE))); - public static final RegistryObject COLLECTOR_FLUID = BLOCKS.register("collector_fluid", () -> new BlockFluidCollect(Block.Properties.of(Material.STONE))); - public static final RegistryObject STRUCTURE = BLOCKS.register("structure", () -> new BlockStructure(Block.Properties.of(Material.STONE))); - public static final RegistryObject UNCRAFTER = BLOCKS.register("uncrafter", () -> new BlockUncraft(Block.Properties.of(Material.METAL))); - public static final RegistryObject CRAFTER = BLOCKS.register("crafter", () -> new BlockCrafter(Block.Properties.of(Material.METAL))); - public static final RegistryObject CONVEYOR = BLOCKS.register("conveyor", () -> new BlockConveyor(Block.Properties.of(Material.METAL))); - public static final RegistryObject TANK = BLOCKS.register("tank", () -> new BlockFluidTank(Block.Properties.of(Material.STONE))); - public static final RegistryObject ANVIL = BLOCKS.register("anvil", () -> new BlockAnvilAuto(Block.Properties.of(Material.HEAVY_METAL).sound(SoundType.ANVIL))); - public static final RegistryObject ANVIL_MAGMA = BLOCKS.register("anvil_magma", () -> new BlockAnvilMagma(Block.Properties.of(Material.HEAVY_METAL).sound(SoundType.ANVIL))); - public static final RegistryObject BEACON = BLOCKS.register("beacon", () -> new BlockPotion(Block.Properties.of(Material.METAL))); - public static final RegistryObject BEACON_REDSTONE = BLOCKS.register("beacon_redstone", () -> new BlockBeaconRedstone(Block.Properties.of(Material.STONE).lightLevel(p -> 4))); - public static final RegistryObject ANTI_BEACON = BLOCKS.register("anti_beacon", () -> new BlockAntiBeacon(Block.Properties.of(Material.STONE).lightLevel(p -> 2))); - public static final RegistryObject SOUNDPROOFING_GHOST = BLOCKS.register("soundproofing_ghost", () -> new SoundmufflerBlockGhost(Block.Properties.of(Material.STONE))); - public static final RegistryObject SOUNDPROOFING = BLOCKS.register("soundproofing", () -> new SoundmufflerBlock(Block.Properties.of(Material.STONE))); - public static final RegistryObject CLOCK = BLOCKS.register("clock", () -> new BlockRedstoneClock(Block.Properties.of(Material.STONE))); - public static final RegistryObject WIRELESS_RECEIVER = BLOCKS.register("wireless_receiver", () -> new BlockWirelessRec(Block.Properties.of(Material.STONE))); - public static final RegistryObject WIRELESS_TRANSMITTER = BLOCKS.register("wireless_transmitter", () -> new BlockWirelessTransmit(Block.Properties.of(Material.STONE))); - public static final RegistryObject FISHER = BLOCKS.register("fisher", () -> new BlockFisher(Block.Properties.of(Material.STONE))); - public static final RegistryObject DISENCHANTER = BLOCKS.register("disenchanter", () -> new BlockDisenchant(Block.Properties.of(Material.STONE))); - public static final RegistryObject EXPERIENCE_PYLON = BLOCKS.register("experience_pylon", () -> new BlockExpPylon(Block.Properties.of(Material.STONE))); - public static final RegistryObject FAN = BLOCKS.register("fan", () -> new BlockFan(Block.Properties.of(Material.STONE))); - public static final RegistryObject TRASH = BLOCKS.register("trash", () -> new BlockTrash(Block.Properties.of(Material.STONE))); - public static final RegistryObject DICE = BLOCKS.register("dice", () -> new BlockDice(Block.Properties.of(Material.STONE))); - public static final RegistryObject SCREEN = BLOCKS.register("screen", () -> new BlockScreentext(Block.Properties.of(Material.METAL))); - public static final RegistryObject DETECTOR_ITEM = BLOCKS.register("detector_item", () -> new BlockDetectorItem(Block.Properties.of(Material.STONE))); - public static final RegistryObject DETECTOR_ENTITY = BLOCKS.register("detector_entity", () -> new BlockDetector(Block.Properties.of(Material.STONE))); - public static final RegistryObject ENERGY_PIPE = BLOCKS.register("energy_pipe", () -> new BlockCableEnergy(Block.Properties.of(Material.WOOL).sound(SoundType.STONE))); - public static final RegistryObject ITEM_PIPE = BLOCKS.register("item_pipe", () -> new BlockCableItem(Block.Properties.of(Material.WOOL).sound(SoundType.STONE))); - public static final RegistryObject FLUID_PIPE = BLOCKS.register("fluid_pipe", () -> new BlockCableFluid(Block.Properties.of(Material.WOOL).sound(SoundType.STONE))); - public static final RegistryObject PLATE_LAUNCH = BLOCKS.register("plate_launch", () -> new LaunchBlock(Block.Properties.of(Material.STONE), false)); - public static final RegistryObject PLATE_LAUNCH_REDSTONE = BLOCKS.register("plate_launch_redstone", () -> new LaunchBlock(Block.Properties.of(Material.STONE), true)); - public static final RegistryObject BATTERY_INFINITE = BLOCKS.register("battery_infinite", () -> new BlockBatteryInfinite(Block.Properties.of(Material.STONE))); - public static final RegistryObject ITEM_INFINITE = BLOCKS.register("item_infinite", () -> new BlockItemInfinite(Block.Properties.of(Material.STONE))); - public static final RegistryObject FIREPLACE = BLOCKS.register("fireplace", () -> new FireplaceBlock(Block.Properties.of(Material.STONE))); - public static final RegistryObject UNBREAKABLE_BLOCK = BLOCKS.register("unbreakable_block", () -> new UnbreakableBlock(Block.Properties.of(Material.STONE))); //stable, only changes with player interaction - public static final RegistryObject UNBREAKABLE_REACTIVE = BLOCKS.register("unbreakable_reactive", () -> new UnbreakablePoweredBlock(Block.Properties.of(Material.STONE))); //reactive and unstable, ignores players and reads redstone - public static final RegistryObject ENDER_SHELF = BLOCKS.register("ender_shelf", () -> new BlockEnderShelf(Block.Properties.of(Material.STONE))); - public static final RegistryObject ENDER_CONTROLLER = BLOCKS.register("ender_controller", () -> new BlockEnderCtrl(Block.Properties.of(Material.STONE))); - public static final RegistryObject MAGNET_BLOCK = BLOCKS.register("magnet_block", () -> new BlockMagnetPanel(Block.Properties.of(Material.STONE))); - public static final RegistryObject BUTTON_BASALT = BLOCKS.register("button_basalt", () -> new ButtonBlockMat(Block.Properties.of(Material.STONE), 30, true, 4)); - public static final RegistryObject BUTTON_BLACKSTONE = BLOCKS.register("button_blackstone", () -> new ButtonBlockMat(Block.Properties.of(Material.STONE), 20, true, 8)); - public static final RegistryObject BATTERY_CLAY = BLOCKS.register("battery_clay", () -> new ClayBattery(Block.Properties.of(Material.STONE)));// NOGUI - public static final RegistryObject GENERATOR_SOLAR = BLOCKS.register("generator_solar", () -> new BlockGeneratorSolar(Block.Properties.of(Material.STONE))); // NOGUI - public static final RegistryObject NO_SOLICITING = BLOCKS.register("no_soliciting", () -> new BlockAltarNoTraders(Block.Properties.of(Material.STONE) + public static final RegistryObject TELEPORT = BLOCKS.register("teleport", () -> new BlockTeleport(Block.Properties.of())); + public static final RegistryObject APPLE_SPROUT_EMERALD = BLOCKS.register("apple_sprout_emerald", () -> new AppleCropBlock(Block.Properties.of(), false)); + public static final RegistryObject APPLE_SPROUT_DIAMOND = BLOCKS.register("apple_sprout_diamond", () -> new AppleCropBlock(Block.Properties.of(), false)); + public static final RegistryObject APPLE_SPROUT = BLOCKS.register("apple_sprout", () -> new AppleCropBlock(Block.Properties.of(), true)); + public static final RegistryObject COMPUTER_SHAPE = BLOCKS.register("computer_shape", () -> new BlockShapedata(Block.Properties.of())); + public static final RegistryObject SCAFFOLD_FRAGILE = BLOCKS.register("scaffold_fragile", () -> new BlockScaffolding(Block.Properties.of(), true)); + public static final RegistryObject SCAFFOLD_RESPONSIVE = BLOCKS.register("scaffold_responsive", () -> new BlockScaffoldingResponsive(Block.Properties.of(), false)); + public static final RegistryObject SCAFFOLD_REPLACE = BLOCKS.register("scaffold_replace", () -> new BlockScaffoldingReplace(Block.Properties.of())); + public static final RegistryObject DARK_GLASS = BLOCKS.register("dark_glass", () -> new DarkGlassBlock(Block.Properties.of())); + public static final RegistryObject PEAT_UNBAKED = BLOCKS.register("peat_unbaked", () -> new PeatBlock(Block.Properties.of().sound(SoundType.GRAVEL))); + public static final RegistryObject PEAT_BAKED = BLOCKS.register("peat_baked", () -> new PeatFuelBlock(Block.Properties.of().sound(SoundType.GRAVEL))); + public static final RegistryObject PEAT_FARM = BLOCKS.register("peat_farm", () -> new BlockPeatFarm(Block.Properties.of())); + public static final RegistryObject SOLIDIFIER = BLOCKS.register("solidifier", () -> new BlockSolidifier(Block.Properties.of())); + public static final RegistryObject MELTER = BLOCKS.register("melter", () -> new BlockMelter(Block.Properties.of())); + public static final RegistryObject BATTERY = BLOCKS.register("battery", () -> new BlockBattery(Block.Properties.of())); + public static final RegistryObject CASK = BLOCKS.register("cask", () -> new BlockCask(Block.Properties.of())); + public static final RegistryObject CRATE = BLOCKS.register("crate", () -> new BlockCrate(Block.Properties.of())); + public static final RegistryObject CRATE_MINI = BLOCKS.register("crate_mini", () -> new BlockCrateMini(Block.Properties.of())); + public static final RegistryObject EYE_REDSTONE = BLOCKS.register("eye_redstone", () -> new BlockEye(Block.Properties.of())); + public static final RegistryObject EYE_TELEPORT = BLOCKS.register("eye_teleport", () -> new BlockEyeTp(Block.Properties.of())); + public static final RegistryObject PLACER = BLOCKS.register("placer", () -> new BlockPlacer(Block.Properties.of())); + public static final RegistryObject BREAKER = BLOCKS.register("breaker", () -> new BlockBreaker(Block.Properties.of())); + public static final RegistryObject DROPPER = BLOCKS.register("dropper", () -> new BlockDropper(Block.Properties.of())); + public static final RegistryObject FORESTER = BLOCKS.register("forester", () -> new BlockForester(Block.Properties.of())); + public static final RegistryObject HARVESTER = BLOCKS.register("harvester", () -> new BlockHarvester(Block.Properties.of())); + public static final RegistryObject MINER = BLOCKS.register("miner", () -> new BlockMiner(Block.Properties.of())); + public static final RegistryObject PLACER_FLUID = BLOCKS.register("placer_fluid", () -> new BlockPlacerFluid(Block.Properties.of())); + public static final RegistryObject USER = BLOCKS.register("user", () -> new BlockUser(Block.Properties.of())); + public static final RegistryObject COLLECTOR = BLOCKS.register("collector", () -> new BlockItemCollector(Block.Properties.of())); + public static final RegistryObject COLLECTOR_FLUID = BLOCKS.register("collector_fluid", () -> new BlockFluidCollect(Block.Properties.of())); + public static final RegistryObject STRUCTURE = BLOCKS.register("structure", () -> new BlockStructure(Block.Properties.of())); + public static final RegistryObject UNCRAFTER = BLOCKS.register("uncrafter", () -> new BlockUncraft(Block.Properties.of())); + public static final RegistryObject CRAFTER = BLOCKS.register("crafter", () -> new BlockCrafter(Block.Properties.of())); + public static final RegistryObject CONVEYOR = BLOCKS.register("conveyor", () -> new BlockConveyor(Block.Properties.of())); + public static final RegistryObject TANK = BLOCKS.register("tank", () -> new BlockFluidTank(Block.Properties.of())); + public static final RegistryObject ANVIL = BLOCKS.register("anvil", () -> new BlockAnvilAuto(Block.Properties.of().sound(SoundType.ANVIL))); + public static final RegistryObject ANVIL_MAGMA = BLOCKS.register("anvil_magma", () -> new BlockAnvilMagma(Block.Properties.of().sound(SoundType.ANVIL))); + public static final RegistryObject BEACON = BLOCKS.register("beacon", () -> new BlockPotion(Block.Properties.of())); + public static final RegistryObject BEACON_REDSTONE = BLOCKS.register("beacon_redstone", () -> new BlockBeaconRedstone(Block.Properties.of().lightLevel(p -> 4))); + public static final RegistryObject ANTI_BEACON = BLOCKS.register("anti_beacon", () -> new BlockAntiBeacon(Block.Properties.of().lightLevel(p -> 2))); + public static final RegistryObject SOUNDPROOFING_GHOST = BLOCKS.register("soundproofing_ghost", () -> new SoundmufflerBlockGhost(Block.Properties.of())); + public static final RegistryObject SOUNDPROOFING = BLOCKS.register("soundproofing", () -> new SoundmufflerBlock(Block.Properties.of())); + public static final RegistryObject CLOCK = BLOCKS.register("clock", () -> new BlockRedstoneClock(Block.Properties.of())); + public static final RegistryObject WIRELESS_RECEIVER = BLOCKS.register("wireless_receiver", () -> new BlockWirelessRec(Block.Properties.of())); + public static final RegistryObject WIRELESS_TRANSMITTER = BLOCKS.register("wireless_transmitter", () -> new BlockWirelessTransmit(Block.Properties.of())); + public static final RegistryObject FISHER = BLOCKS.register("fisher", () -> new BlockFisher(Block.Properties.of())); + public static final RegistryObject DISENCHANTER = BLOCKS.register("disenchanter", () -> new BlockDisenchant(Block.Properties.of())); + public static final RegistryObject EXPERIENCE_PYLON = BLOCKS.register("experience_pylon", () -> new BlockExpPylon(Block.Properties.of())); + public static final RegistryObject FAN = BLOCKS.register("fan", () -> new BlockFan(Block.Properties.of())); + public static final RegistryObject TRASH = BLOCKS.register("trash", () -> new BlockTrash(Block.Properties.of())); + public static final RegistryObject DICE = BLOCKS.register("dice", () -> new BlockDice(Block.Properties.of())); + public static final RegistryObject SCREEN = BLOCKS.register("screen", () -> new BlockScreentext(Block.Properties.of())); + public static final RegistryObject DETECTOR_ITEM = BLOCKS.register("detector_item", () -> new BlockDetectorItem(Block.Properties.of())); + public static final RegistryObject DETECTOR_ENTITY = BLOCKS.register("detector_entity", () -> new BlockDetector(Block.Properties.of())); + public static final RegistryObject ENERGY_PIPE = BLOCKS.register("energy_pipe", () -> new BlockCableEnergy(Block.Properties.of().sound(SoundType.STONE))); + public static final RegistryObject ITEM_PIPE = BLOCKS.register("item_pipe", () -> new BlockCableItem(Block.Properties.of().sound(SoundType.STONE))); + public static final RegistryObject FLUID_PIPE = BLOCKS.register("fluid_pipe", () -> new BlockCableFluid(Block.Properties.of().sound(SoundType.STONE))); + public static final RegistryObject PLATE_LAUNCH = BLOCKS.register("plate_launch", () -> new LaunchBlock(Block.Properties.of(), false)); + public static final RegistryObject PLATE_LAUNCH_REDSTONE = BLOCKS.register("plate_launch_redstone", () -> new LaunchBlock(Block.Properties.of(), true)); + public static final RegistryObject BATTERY_INFINITE = BLOCKS.register("battery_infinite", () -> new BlockBatteryInfinite(Block.Properties.of())); + public static final RegistryObject ITEM_INFINITE = BLOCKS.register("item_infinite", () -> new BlockItemInfinite(Block.Properties.of())); + public static final RegistryObject FIREPLACE = BLOCKS.register("fireplace", () -> new FireplaceBlock(Block.Properties.of())); + public static final RegistryObject UNBREAKABLE_BLOCK = BLOCKS.register("unbreakable_block", () -> new UnbreakableBlock(Block.Properties.of())); //stable, only changes with player interaction + public static final RegistryObject UNBREAKABLE_REACTIVE = BLOCKS.register("unbreakable_reactive", () -> new UnbreakablePoweredBlock(Block.Properties.of())); //reactive and unstable, ignores players and reads redstone + public static final RegistryObject ENDER_SHELF = BLOCKS.register("ender_shelf", () -> new BlockEnderShelf(Block.Properties.of())); + public static final RegistryObject ENDER_CONTROLLER = BLOCKS.register("ender_controller", () -> new BlockEnderCtrl(Block.Properties.of())); + public static final RegistryObject MAGNET_BLOCK = BLOCKS.register("magnet_block", () -> new BlockMagnetPanel(Block.Properties.of())); + public static final RegistryObject BUTTON_BASALT = BLOCKS.register("button_basalt", () -> new ButtonBlockMat(Block.Properties.of(), 30, true, 4)); + public static final RegistryObject BUTTON_BLACKSTONE = BLOCKS.register("button_blackstone", () -> new ButtonBlockMat(Block.Properties.of(), 20, true, 8)); + public static final RegistryObject BATTERY_CLAY = BLOCKS.register("battery_clay", () -> new ClayBattery(Block.Properties.of()));// NOGUI + public static final RegistryObject GENERATOR_SOLAR = BLOCKS.register("generator_solar", () -> new BlockGeneratorSolar(Block.Properties.of())); // NOGUI + public static final RegistryObject NO_SOLICITING = BLOCKS.register("no_soliciting", () -> new BlockAltarNoTraders(Block.Properties.of() .lightLevel(p -> p.getValue(BlockCyclic.LIT) ? 3 : 0))); - public static final RegistryObject ALTAR_DESTRUCTION = BLOCKS.register("altar_destruction", () -> new BlockDestruction(Block.Properties.of(Material.STONE))); - public static final RegistryObject WAXED_REDSTONE = BLOCKS.register("waxed_redstone", () -> new BlockWaxedRedstone(Block.Properties.of(Material.METAL, MaterialColor.FIRE))); + public static final RegistryObject ALTAR_DESTRUCTION = BLOCKS.register("altar_destruction", () -> new BlockDestruction(Block.Properties.of())); + public static final RegistryObject WAXED_REDSTONE = BLOCKS.register("waxed_redstone", () -> new BlockWaxedRedstone(Block.Properties.of())); // , MaterialColor.FIRE // - // public static final RegistryObject PLATE_VECTOR= BLOCKS.register("plate_vector", () -> new Block(Block.Properties.of(Material.STONE))); - // public static final RegistryObject ENCHANTER = BLOCKS.register("enchanter", () -> new Block(Block.Properties.of(Material.STONE))); + // public static final RegistryObject PLATE_VECTOR= BLOCKS.register("plate_vector", () -> new Block(Block.Properties.of())); + // public static final RegistryObject ENCHANTER = BLOCKS.register("enchanter", () -> new Block(Block.Properties.of())); } diff --git a/src/main/java/com/lothrazar/cyclic/registry/ClientRegistryCyclic.java b/src/main/java/com/lothrazar/cyclic/registry/ClientRegistryCyclic.java index 5e03bead6..f67cc3583 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/ClientRegistryCyclic.java +++ b/src/main/java/com/lothrazar/cyclic/registry/ClientRegistryCyclic.java @@ -92,7 +92,8 @@ public boolean conflicts(IKeyConflictContext other) { int x = 10; // ManaConfig.MANA_HUD_X.get(); int y = 10; // ManaConfig.MANA_HUD_Y.get(); //TODO: client-config if (x >= 0 && y >= 0) { - gui.getFont().draw(poseStack, toDisplay, x, y, 0xFF0000); // client config color + poseStack.drawString(gui.getFont(), toDisplay, x, y, 0xFF0000); +// gui.getFont().draw(poseStack, toDisplay, x, y, 0xFF0000); // client config color } } }; diff --git a/src/main/java/com/lothrazar/cyclic/registry/ItemRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/ItemRegistry.java index 74beee6db..d4e7b8a44 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/ItemRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/ItemRegistry.java @@ -126,8 +126,7 @@ import net.minecraft.world.item.PickaxeItem; import net.minecraft.world.item.ShovelItem; import net.minecraft.world.item.SwordItem; -import net.minecraft.world.item.Tiers; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraft.world.item.Tiers; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; @@ -136,8 +135,7 @@ public class ItemRegistry { public static List ITEMSFIXME = new ArrayList<>(); public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ModCyclic.MODID); - - public static void buildTab(CreativeModeTabEvent.Register event, String modid, Item icon, DeferredRegister items) {} + static final int SMALLPOTIONDUR = 20 * 90; // 1:30 static final int LARGEPOTIONDUR = 3 * 20 * 60; // 3:00 diff --git a/src/main/java/com/lothrazar/cyclic/registry/MenuTypeRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/MenuTypeRegistry.java index 335a86883..2fdc1c465 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/MenuTypeRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/MenuTypeRegistry.java @@ -68,57 +68,57 @@ public class MenuTypeRegistry { public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, ModCyclic.MODID); - public static final RegistryObject> COLLECTOR = CONTAINERS.register("collector", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerItemCollector(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> PEAT_FARM = CONTAINERS.register("peat_farm", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPeatFarm(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> BATTERY = CONTAINERS.register("battery", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerBattery(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> BATTERY_CLAY = CONTAINERS.register("battery_clay", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerClayBattery(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> HARVESTER = CONTAINERS.register("harvester", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerHarvester(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> ANVIL = CONTAINERS.register("anvil", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerAnvil(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> PLACER = CONTAINERS.register("placer", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPlacer(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> STRUCTURE = CONTAINERS.register("structure", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerStructure(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> MELTER = CONTAINERS.register("melter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerMelter(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> SOLIDIFIER = CONTAINERS.register("solidifier", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerSolidifier(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> BREAKER = CONTAINERS.register("breaker", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerBreaker(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> EXPERIENCE_PYLON = CONTAINERS.register("experience_pylon", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerExpPylon(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> USER = CONTAINERS.register("user", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerUser(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> DETECTOR_ENTITY = CONTAINERS.register("detector_entity", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDetector(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> DETECTOR_ITEM = CONTAINERS.register("detector_item", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDetectorItem(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> DISENCHANTER = CONTAINERS.register("disenchanter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDisenchant(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> WIRELESS_TRANSMITTER = CONTAINERS.register("wireless_transmitter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerTransmit(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> CLOCK = CONTAINERS.register("clock", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerClock(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> CRATE = CONTAINERS.register("crate", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrate(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> CRATE_MINI = CONTAINERS.register("crate_mini", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrateMini(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> PLACER_FLUID = CONTAINERS.register("placer_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPlacerFluid(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> COLLECTOR_FLUID = CONTAINERS.register("collector_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerFluidCollect(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> FAN = CONTAINERS.register("fan", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerFan(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> BEACON = CONTAINERS.register("beacon", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPotion(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> DROPPER = CONTAINERS.register("dropper", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDropper(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> FORESTER = CONTAINERS.register("forester", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerForester(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> MINER = CONTAINERS.register("miner", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerMiner(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> SCREEN = CONTAINERS.register("screen", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerScreentext(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> ANVIL_MAGMA = CONTAINERS.register("anvil_magma", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerAnvilMagma(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> UNCRAFTER = CONTAINERS.register("uncrafter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerUncraft(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> CRAFTER = CONTAINERS.register("crafter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrafter(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> COMPUTER_SHAPE = CONTAINERS.register("computer_shape", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerShapedata(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> WORKBENCH = CONTAINERS.register("workbench", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWorkbench(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> FISHER = CONTAINERS.register("fisher", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerFisher(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> LASER = CONTAINERS.register("laser", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerLaser(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> ITEM_PIPE = CONTAINERS.register("item_pipe", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCableItem(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> FLUID_PIPE = CONTAINERS.register("fluid_pipe", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCableFluid(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> ANVIL_VOID = CONTAINERS.register("anvil_void", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerAnvilVoid(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> WIRELESS_ENERGY = CONTAINERS.register("wireless_energy", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWirelessEnergy(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> WIRELESS_ITEM = CONTAINERS.register("wireless_item", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWirelessItem(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> WIRELESS_FLUID = CONTAINERS.register("wireless_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWirelessFluid(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> GENERATOR_FUEL = CONTAINERS.register("generator_fuel", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorFuel(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> GENERATOR_FOOD = CONTAINERS.register("generator_food", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorFood(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> GENERATOR_DROPS = CONTAINERS.register("generator_item", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorDrops(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> GENERATOR_FLUID = CONTAINERS.register("generator_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorFluid(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> GENERATOR_SOLAR = CONTAINERS.register("generator_solar", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorSolar(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> PACKAGER = CONTAINERS.register("packager", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPackager(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> SOUND_RECORDER = CONTAINERS.register("sound_recorder", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerSoundRecorder(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> SOUND_PLAYER = CONTAINERS.register("sound_player", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerSoundPlayer(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> CRUSHER = CONTAINERS.register("crusher", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrusher(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); - public static final RegistryObject> TELEPORT = CONTAINERS.register("teleport", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerTeleport(windowId, inv.player.level, data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> COLLECTOR = CONTAINERS.register("collector", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerItemCollector(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> PEAT_FARM = CONTAINERS.register("peat_farm", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPeatFarm(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> BATTERY = CONTAINERS.register("battery", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerBattery(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> BATTERY_CLAY = CONTAINERS.register("battery_clay", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerClayBattery(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> HARVESTER = CONTAINERS.register("harvester", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerHarvester(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> ANVIL = CONTAINERS.register("anvil", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerAnvil(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> PLACER = CONTAINERS.register("placer", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPlacer(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> STRUCTURE = CONTAINERS.register("structure", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerStructure(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> MELTER = CONTAINERS.register("melter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerMelter(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> SOLIDIFIER = CONTAINERS.register("solidifier", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerSolidifier(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> BREAKER = CONTAINERS.register("breaker", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerBreaker(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> EXPERIENCE_PYLON = CONTAINERS.register("experience_pylon", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerExpPylon(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> USER = CONTAINERS.register("user", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerUser(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> DETECTOR_ENTITY = CONTAINERS.register("detector_entity", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDetector(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> DETECTOR_ITEM = CONTAINERS.register("detector_item", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDetectorItem(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> DISENCHANTER = CONTAINERS.register("disenchanter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDisenchant(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> WIRELESS_TRANSMITTER = CONTAINERS.register("wireless_transmitter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerTransmit(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> CLOCK = CONTAINERS.register("clock", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerClock(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> CRATE = CONTAINERS.register("crate", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrate(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> CRATE_MINI = CONTAINERS.register("crate_mini", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrateMini(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> PLACER_FLUID = CONTAINERS.register("placer_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPlacerFluid(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> COLLECTOR_FLUID = CONTAINERS.register("collector_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerFluidCollect(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> FAN = CONTAINERS.register("fan", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerFan(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> BEACON = CONTAINERS.register("beacon", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPotion(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> DROPPER = CONTAINERS.register("dropper", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerDropper(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> FORESTER = CONTAINERS.register("forester", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerForester(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> MINER = CONTAINERS.register("miner", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerMiner(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> SCREEN = CONTAINERS.register("screen", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerScreentext(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> ANVIL_MAGMA = CONTAINERS.register("anvil_magma", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerAnvilMagma(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> UNCRAFTER = CONTAINERS.register("uncrafter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerUncraft(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> CRAFTER = CONTAINERS.register("crafter", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrafter(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> COMPUTER_SHAPE = CONTAINERS.register("computer_shape", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerShapedata(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> WORKBENCH = CONTAINERS.register("workbench", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWorkbench(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> FISHER = CONTAINERS.register("fisher", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerFisher(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> LASER = CONTAINERS.register("laser", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerLaser(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> ITEM_PIPE = CONTAINERS.register("item_pipe", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCableItem(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> FLUID_PIPE = CONTAINERS.register("fluid_pipe", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCableFluid(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> ANVIL_VOID = CONTAINERS.register("anvil_void", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerAnvilVoid(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> WIRELESS_ENERGY = CONTAINERS.register("wireless_energy", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWirelessEnergy(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> WIRELESS_ITEM = CONTAINERS.register("wireless_item", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWirelessItem(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> WIRELESS_FLUID = CONTAINERS.register("wireless_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerWirelessFluid(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> GENERATOR_FUEL = CONTAINERS.register("generator_fuel", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorFuel(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> GENERATOR_FOOD = CONTAINERS.register("generator_food", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorFood(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> GENERATOR_DROPS = CONTAINERS.register("generator_item", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorDrops(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> GENERATOR_FLUID = CONTAINERS.register("generator_fluid", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorFluid(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> GENERATOR_SOLAR = CONTAINERS.register("generator_solar", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerGeneratorSolar(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> PACKAGER = CONTAINERS.register("packager", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerPackager(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> SOUND_RECORDER = CONTAINERS.register("sound_recorder", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerSoundRecorder(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> SOUND_PLAYER = CONTAINERS.register("sound_player", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerSoundPlayer(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> CRUSHER = CONTAINERS.register("crusher", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerCrusher(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); + public static final RegistryObject> TELEPORT = CONTAINERS.register("teleport", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerTeleport(windowId, inv.player.level(), data.readBlockPos(), inv, inv.player))); // Items with containers public static final RegistryObject> ENDER_BOOK = CONTAINERS.register("ender_book", () -> IForgeMenuType.create((windowId, inv, data) -> new EnderBookContainer(windowId, inv, inv.player))); public static final RegistryObject> STORAGE_BAG = CONTAINERS.register("storage_bag", () -> IForgeMenuType.create((windowId, inv, data) -> new ContainerStorageBag(windowId, inv, inv.player, data.readInt()))); diff --git a/src/main/java/com/lothrazar/cyclic/registry/PotionEffectRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/PotionEffectRegistry.java index f07dde7b8..6c30b160c 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/PotionEffectRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/PotionEffectRegistry.java @@ -33,9 +33,9 @@ public class PotionEffectRegistry { public static final RegistryObject ANTIGRAVITY = MOB_EFFECTS.register("antigravity", () -> new CyclicMobEffect(MobEffectCategory.BENEFICIAL, 0x730043) .addAttributeModifier(ForgeMod.ENTITY_GRAVITY.get(), "5207DE5E-7CE8-4030-940E-514C1F160890", -0.015, AttributeModifier.Operation.ADDITION)); //default gravity is +0.08 public static final RegistryObject ATTACK_RANGE = MOB_EFFECTS.register("attack_range", () -> new CyclicMobEffect(MobEffectCategory.BENEFICIAL, 0x35db77) - .addAttributeModifier(ForgeMod.ATTACK_RANGE.get(), "5207DE5E-7CE8-4030-940E-514C1F160890", 2, AttributeModifier.Operation.MULTIPLY_TOTAL)); + .addAttributeModifier(ForgeMod.ENTITY_REACH.get(), "5207DE5E-7CE8-4030-940E-514C1F160890", 2, AttributeModifier.Operation.MULTIPLY_TOTAL)); public static final RegistryObject REACH_DISTANCE = MOB_EFFECTS.register("reach_distance", () -> new CyclicMobEffect(MobEffectCategory.BENEFICIAL, 0x500980) - .addAttributeModifier(ForgeMod.REACH_DISTANCE.get(), "5207DE5E-7CE8-4030-940E-514C1F160890", 2, AttributeModifier.Operation.MULTIPLY_TOTAL)); + .addAttributeModifier(ForgeMod.BLOCK_REACH.get(), "5207DE5E-7CE8-4030-940E-514C1F160890", 2, AttributeModifier.Operation.MULTIPLY_TOTAL)); public static final RegistryObject BUTTERFINGERS = MOB_EFFECTS.register("butter", () -> new ButterEffect(MobEffectCategory.HARMFUL, 0xe5e500)); public static final RegistryObject FROST_WALKER = MOB_EFFECTS.register("frost_walker", () -> new FrostEffect(MobEffectCategory.BENEFICIAL, 0x42f4d7)); public static final RegistryObject MAGNETIC = MOB_EFFECTS.register("magnetic", () -> new MagneticEffect(MobEffectCategory.NEUTRAL, 0x224BAF)); diff --git a/src/main/java/com/lothrazar/cyclic/render/FakeBlockRenderTypes.java b/src/main/java/com/lothrazar/cyclic/render/FakeBlockRenderTypes.java index 7b4cc6d3d..8c2286e33 100644 --- a/src/main/java/com/lothrazar/cyclic/render/FakeBlockRenderTypes.java +++ b/src/main/java/com/lothrazar/cyclic/render/FakeBlockRenderTypes.java @@ -41,7 +41,7 @@ public FakeBlockRenderTypes(String nameIn, VertexFormat formatIn, VertexFormat.M public static final RenderType FAKE_BLOCK = create(ModCyclic.MODID + ":fakeblock", DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, BUFFERSIZE, CRUMBLING, SORT, RenderType.CompositeState.builder() - .setShaderState(BLOCK_SHADER) //1.17 new - maybe BLOCK_SHADER + .setShaderState(RENDERTYPE_SOLID_SHADER) //1.17 was - BLOCK_SHADER .setLayeringState(POLYGON_OFFSET_LAYERING) // VIEW_OFFSET_Z_LAYERING) // .setShadeModelState(SMOOTH_SHADE) .setLightmapState(NO_LIGHTMAP) .setTextureState(BLOCK_SHEET_MIPPED) @@ -56,7 +56,7 @@ public FakeBlockRenderTypes(String nameIn, VertexFormat formatIn, VertexFormat.M public static final RenderType TRANSPARENT_COLOUR = create(ModCyclic.MODID + ":transparentcolour", DefaultVertexFormat.POSITION_COLOR, VertexFormat.Mode.QUADS, BUFFERSIZE, CRUMBLING, SORT, RenderType.CompositeState.builder() - .setShaderState(BLOCK_SHADER) //1.17 new + .setShaderState(RENDERTYPE_SOLID_SHADER) //1.17 was BLOCK_SHADER .setTransparencyState(ADDITIVE_TRANSPARENCY) .setTextureState(NO_TEXTURE) .setDepthTestState(NO_DEPTH_TEST) diff --git a/src/main/java/com/lothrazar/cyclic/render/RenderMiningLaser.java b/src/main/java/com/lothrazar/cyclic/render/RenderMiningLaser.java index f768e5ee6..a0ab1f50e 100644 --- a/src/main/java/com/lothrazar/cyclic/render/RenderMiningLaser.java +++ b/src/main/java/com/lothrazar/cyclic/render/RenderMiningLaser.java @@ -17,7 +17,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.event.RenderLevelLastEvent; +import net.minecraftforge.client.event.RenderLevelStageEvent; /** * Citation/source/author @@ -35,7 +35,7 @@ private static float calculateLaserFlickerModifier(long gameTime) { public static final int RANGE = 18; - public static void renderLaser(RenderLevelLastEvent event, Player player, float ticks, + public static void renderLaser(RenderLevelStageEvent event, Player player, float ticks, ItemStack stack, InteractionHand hand) { Vec3 playerPos = player.getEyePosition(ticks); HitResult trace = player.pick(RANGE, 0.0F, false); @@ -52,10 +52,10 @@ public static void renderLaser(RenderLevelLastEvent event, Player player, float * https://github.com/Direwolf20-MC/MiningGadgets * */ - public static void drawLasers(InteractionHand activeHand, ItemStack stack, RenderLevelLastEvent event, Vec3 from, HitResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, Player player, float ticks, float speedModifier) { + public static void drawLasers(InteractionHand activeHand, ItemStack stack, RenderLevelStageEvent event, Vec3 from, HitResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, Player player, float ticks, float speedModifier) { VertexConsumer builder; double distance = Math.max(1, from.subtract(trace.getLocation()).length()); - long gameTime = player.level.getGameTime(); + long gameTime = player.level().getGameTime(); double v = gameTime * speedModifier; float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime); float beam2r = 100f / 255f; diff --git a/src/main/java/com/lothrazar/cyclic/render/RenderUtils.java b/src/main/java/com/lothrazar/cyclic/render/RenderUtils.java index 3a75d8194..4f4bf0158 100644 --- a/src/main/java/com/lothrazar/cyclic/render/RenderUtils.java +++ b/src/main/java/com/lothrazar/cyclic/render/RenderUtils.java @@ -37,7 +37,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.event.RenderLevelLastEvent; +import net.minecraftforge.client.event.RenderLevelStageEvent; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidStack; @@ -368,7 +368,7 @@ public static BlockHitResult getLookingAt(Player player, int range) { * @param coords * @param alpha */ - public static void renderColourCubes(RenderLevelLastEvent evt, Map coords, float alpha) { + public static void renderColourCubes(RenderLevelStageEvent evt, Map coords, float alpha) { LocalPlayer player = Minecraft.getInstance().player; if (player == null) { return; diff --git a/src/main/java/com/lothrazar/cyclic/util/AttributesUtil.java b/src/main/java/com/lothrazar/cyclic/util/AttributesUtil.java index c61b9426c..d2b289be3 100644 --- a/src/main/java/com/lothrazar/cyclic/util/AttributesUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/AttributesUtil.java @@ -86,14 +86,14 @@ public static int reset(Attribute attribute, Collection players) { //ench public static void removePlayerReach(UUID id, Player player) { - AttributeInstance attr = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance attr = player.getAttribute(ForgeMod.BLOCK_REACH.get()); attr.removeModifier(id); } // ench public static void setPlayerReach(UUID id, Player player, int reachBoost) { removePlayerReach(id, player); - AttributeInstance attr = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance attr = player.getAttribute(ForgeMod.BLOCK_REACH.get()); //vanilla is 5, so +11 it becomes 16 AttributeModifier enchantment = new AttributeModifier(id, "ReachEnchantmentCyclic", reachBoost, AttributeModifier.Operation.ADDITION); attr.addPermanentModifier(enchantment); diff --git a/src/main/java/com/lothrazar/cyclic/util/BlockUtil.java b/src/main/java/com/lothrazar/cyclic/util/BlockUtil.java index de1c9807d..85ba87ee2 100644 --- a/src/main/java/com/lothrazar/cyclic/util/BlockUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/BlockUtil.java @@ -134,7 +134,7 @@ public static boolean placeStateSafe(Level world, Player player, BlockPos placeP // ok its a soft (isReplaceable == true) block so try to break it first try to destroy it // unless it is liquid, don't try to destroy liquid //blockHere.getMaterial(stateHere) - if (stateHere.getMaterial().isLiquid() == false) { + if (stateHere.liquid() == false) { boolean dropBlock = true; if (world.isClientSide == false) { world.destroyBlock(placePos, dropBlock); diff --git a/src/main/java/com/lothrazar/cyclic/util/ChatUtil.java b/src/main/java/com/lothrazar/cyclic/util/ChatUtil.java index e0e8a149f..565252b22 100644 --- a/src/main/java/com/lothrazar/cyclic/util/ChatUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/ChatUtil.java @@ -10,7 +10,7 @@ public class ChatUtil { public static void addChatMessage(Player player, MutableComponent message) { - if (player.level.isClientSide) { + if (player.level().isClientSide) { player.sendSystemMessage(message); } } @@ -24,7 +24,7 @@ public static void addServerChatMessage(Player player, String message) { } public static void addServerChatMessage(Player player, Component message) { - if (!player.level.isClientSide) { + if (!player.level().isClientSide) { player.sendSystemMessage(message); } } @@ -38,7 +38,7 @@ public static void sendStatusMessage(Player player, String message) { } public static void sendStatusMessage(Player player, Component nameTextComponent) { - if (player.level.isClientSide) { + if (player.level().isClientSide) { player.displayClientMessage(nameTextComponent, true); } } @@ -53,6 +53,6 @@ public static String lang(String message) { } public static void sendFeedback(CommandContext ctx, String string) { - ctx.getSource().sendSuccess(ilang(string), false); + ctx.getSource().sendSuccess(() -> ilang(string), false); // ilang(string) } } diff --git a/src/main/java/com/lothrazar/cyclic/util/EntityUtil.java b/src/main/java/com/lothrazar/cyclic/util/EntityUtil.java index 77883c2df..194e8b55d 100644 --- a/src/main/java/com/lothrazar/cyclic/util/EntityUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/EntityUtil.java @@ -62,8 +62,8 @@ public class EntityUtil { private static final int TICKS_FALLDIST_SYNC = 22; //tick every so often public static boolean haveSameDimension(Entity tamed, Entity owner) { - return LevelWorldUtil.dimensionToString(tamed.level).equalsIgnoreCase( - LevelWorldUtil.dimensionToString(owner.level)); + return LevelWorldUtil.dimensionToString(tamed.level()).equalsIgnoreCase( + LevelWorldUtil.dimensionToString(owner.level())); } public static boolean isTamedByPlayer(Entity entity, Player player) { diff --git a/src/main/java/com/lothrazar/cyclic/util/HarvestUtil.java b/src/main/java/com/lothrazar/cyclic/util/HarvestUtil.java index 1a0cb134e..941d90ac4 100644 --- a/src/main/java/com/lothrazar/cyclic/util/HarvestUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/HarvestUtil.java @@ -160,7 +160,8 @@ public static IntegerProperty getAgeProp(BlockState blockState) { if (blockState.getBlock() instanceof CropBlock) { CropBlock crops = (CropBlock) blockState.getBlock(); //better mod compatibility if they dont use 'age' - return crops.getAgeProperty(); + + return CropBlock.AGE; // protected :( crops.getAgeProperty(); } String age = CropBlock.AGE.getName(); ResourceLocation bid = ForgeRegistries.BLOCKS.getKey(blockState.getBlock()); diff --git a/src/main/java/com/lothrazar/cyclic/util/ItemStackUtil.java b/src/main/java/com/lothrazar/cyclic/util/ItemStackUtil.java index b1356d4c0..5ae4a3b72 100644 --- a/src/main/java/com/lothrazar/cyclic/util/ItemStackUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/ItemStackUtil.java @@ -73,7 +73,7 @@ public static void damageItem(LivingEntity player, ItemStack stack) { } public static void damageItemRandomly(LivingEntity player, ItemStack stack) { - if (player.level.random.nextDouble() < 0.001) { + if (player.level().random.nextDouble() < 0.001) { damageItem(player, stack); } } @@ -90,8 +90,8 @@ public static void drop(Level world, BlockPos pos, ItemStack drop) { public static boolean matches(ItemStack current, ItemStack in) { //first one fails if size is off - return ItemStack.isSame(current, in) - && ItemStack.tagMatches(current, in); + return ItemStack.isSameItem(current, in) + && ItemStack.isSameItemSameTags(current, in); } public static void shrink(Player player, ItemStack stac) { diff --git a/src/main/java/com/lothrazar/cyclic/util/PlayerUtil.java b/src/main/java/com/lothrazar/cyclic/util/PlayerUtil.java index 93d84ed78..3b9e9f870 100644 --- a/src/main/java/com/lothrazar/cyclic/util/PlayerUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/PlayerUtil.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.net.PacketPlayerSyncToClient; import com.lothrazar.cyclic.registry.PacketRegistry; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -112,7 +113,7 @@ public static Optional getPlayerHome(ServerPlayer player) { BlockPos respawnPos = player.getRespawnPosition(); Optional optional = Optional.empty(); if (respawnPos != null) { - optional = Player.findRespawnPositionAndUseSpawnBlock(player.getLevel(), respawnPos, 0.0F, true, true); + optional = Player.findRespawnPositionAndUseSpawnBlock((ServerLevel) player.level(), respawnPos, 0.0F, true, true); } // optional = Player.findRespawnPositionAndUseSpawnBlock(player.getLevel(), respawnPos, 0.0F, true, true); return optional; diff --git a/src/main/java/com/lothrazar/cyclic/util/SoundUtil.java b/src/main/java/com/lothrazar/cyclic/util/SoundUtil.java index e0d61c4f7..c5baefc6a 100644 --- a/src/main/java/com/lothrazar/cyclic/util/SoundUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/SoundUtil.java @@ -32,7 +32,7 @@ public static void playSound(Entity entityIn, SoundEvent soundIn, float volume) } public static void playSound(Entity entityIn, SoundEvent soundIn, float volume, float pitch) { - if (entityIn != null && entityIn.level.isClientSide) { + if (entityIn != null && entityIn.level().isClientSide) { entityIn.playSound(soundIn, volume, pitch); } } @@ -77,7 +77,7 @@ public static void playSoundFromServerById(ServerLevel world, BlockPos pos, Stri public static void playSoundById(Player player, String sid) { //do the thing SoundEvent sound = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(sid)); - if (sound != null && player.level.isClientSide) { + if (sound != null && player.level().isClientSide) { SoundUtil.playSound(player, sound); } } diff --git a/src/main/java/com/lothrazar/cyclic/world/DimensionTransit.java b/src/main/java/com/lothrazar/cyclic/world/DimensionTransit.java index 4c8fd422c..3116b9d5f 100644 --- a/src/main/java/com/lothrazar/cyclic/world/DimensionTransit.java +++ b/src/main/java/com/lothrazar/cyclic/world/DimensionTransit.java @@ -36,7 +36,7 @@ private BlockPos moveToSafeCoords(ServerLevel world, BlockPos pos) { int tries = 10; while (tries > 0) { tries--; - if (world.getBlockState(pos).getMaterial().isSolid()) { + if (world.getBlockState(pos).isSolid()) { pos = pos.above(); } } @@ -54,7 +54,7 @@ public Entity placeEntity(Entity newEntity, ServerLevel currentWorld, ServerLeve } public void teleport(Player player) { - if (!player.isCreative() && !player.level.isClientSide) { + if (!player.isCreative() && !player.level().isClientSide) { player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 200, 200, false, false)); } if (this.world != null) {