diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/InfSpriteTessellators.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/InfSpriteTessellators.java index 4702e7fe..f7f7dc4b 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/InfSpriteTessellators.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/InfSpriteTessellators.java @@ -1,16 +1,11 @@ package io.github.betterthanupdates.apron.compat; -import java.lang.invoke.LambdaMetafactory; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; -import java.lang.reflect.Field; import java.util.Arrays; import java.util.HashSet; import java.util.Set; -import java.util.function.BiFunction; import java.util.function.Consumer; -import java.util.function.IntFunction; import java.util.function.Supplier; import java.util.function.ToDoubleFunction; @@ -18,7 +13,6 @@ import net.mine_diver.infsprites.util.Util; import net.mine_diver.infsprites.util.compatibility.ForgePatcher; import org.lwjgl.opengl.GL11; -import overrideapi.utils.Reflection; import net.minecraft.client.render.Tessellator; @@ -72,9 +66,9 @@ public static Tessellator getWorldTessellator(int terrainId) { } else { Tessellator tessellator = (Tessellator)get(terrainId).get(); if (ACTIVE_WORLD_TESSELLATORS.add(terrainId)) { - tessellator.start(); + tessellator.startQuads(); Tessellator vanillaTessellator = (Tessellator)VANILLA_TESSELLATOR.get(); - tessellator.setOffset( + tessellator.translate( X_OFFSET_GETTER.applyAsDouble(vanillaTessellator), Y_OFFSET_GETTER.applyAsDouble(vanillaTessellator), Z_OFFSET_GETTER.applyAsDouble(vanillaTessellator) @@ -88,7 +82,7 @@ public static Tessellator getWorldTessellator(int terrainId) { public static void drawActiveWorldTessellators() { ACTIVE_WORLD_TESSELLATORS.forEach(terrainId -> { GL11.glBindTexture(3553, TextureManager.getTerrain(terrainId)); - ((Tessellator)tessellators[terrainId].get()).tessellate(); + ((Tessellator)tessellators[terrainId].get()).draw(); }); ACTIVE_WORLD_TESSELLATORS.clear(); GL11.glBindTexture(3553, TextureManager.getTerrain(0)); diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/betterthanwolves/BTWFireBlock.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/betterthanwolves/BTWFireBlock.java index 45cf0a65..cefbedf4 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/betterthanwolves/BTWFireBlock.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/betterthanwolves/BTWFireBlock.java @@ -1,11 +1,11 @@ package io.github.betterthanupdates.apron.compat.betterthanwolves; import net.minecraft.block.Block; -import net.minecraft.client.render.block.BlockRenderer; +import net.minecraft.client.render.block.BlockRenderManager; import net.minecraft.world.BlockView; import net.minecraft.world.World; public interface BTWFireBlock { void OnBlockDestroyedByFire(World world, int i, int j, int k); - boolean RenderFire(BlockRenderer renderBlocks, BlockView iBlockAccess, int i, int j, int k, Block block); + boolean RenderFire(BlockRenderManager renderBlocks, BlockView iBlockAccess, int i, int j, int k, Block block); } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/aether/TitleScreenMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/aether/TitleScreenMixin.java index 41d1139a..22d97fb4 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/aether/TitleScreenMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/aether/TitleScreenMixin.java @@ -3,9 +3,11 @@ import java.util.List; import fr.catcore.cursedmixinextensions.annotations.Public; +import net.minecraft.class_182; import org.lwjgl.opengl.GL11; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; @@ -20,18 +22,17 @@ import net.minecraft.GuiIngameAether; import net.minecraft.GuiMultiplayerAether; import net.minecraft.GuiSelectWorldAether; -import net.minecraft.client.SingleplayerInteractionManager; -import net.minecraft.client.entity.player.AbstractClientPlayerEntity; -import net.minecraft.client.gui.AchievementWidget; +import net.minecraft.SingleplayerInteractionManager; +import net.minecraft.class_591; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.hud.toast.AchievementToast; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.menu.TitleScreen; +import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.render.Tessellator; -import net.minecraft.client.render.TextRenderer; import net.minecraft.client.resource.language.TranslationStorage; +import net.minecraft.entity.player.ClientPlayerEntity; import net.minecraft.mod_Aether; -import net.minecraft.world.storage.WorldMetadata; -import net.minecraft.world.storage.WorldStorage; import io.github.betterthanupdates.apron.ReflectionUtils; import io.github.betterthanupdates.apron.mixin.client.ButtonWidgetAccessor; @@ -44,52 +45,61 @@ public abstract class TitleScreenMixin extends Screen { @Shadow private ButtonWidget multiplayerButton; - private WorldMetadata latestSave; + + @Unique + private class_591 latestSave; + @Unique private String hoverText; @Public + @Unique private static boolean mmactive = false; @Public + @Unique private static boolean renderOption = mod_Aether.worldMenu; @Public + @Unique private static boolean themeOption = mod_Aether.aetherMenu; @Public + @Unique private static int musicId = -1; @Public + @Unique private static boolean loadingWorld = false; @Public - private static AchievementWidget ach = null; + @Unique + private static AchievementToast ach = null; @Inject(method = "tick", at = @At("TAIL")) public void tick(CallbackInfo ci) { - final AbstractClientPlayerEntity player = this.client.player; - if (renderOption && player != null && !player.removed) { + final ClientPlayerEntity player = this.minecraft.player; + if (renderOption && player != null && !player.dead) { player.yaw += 0.2F; player.pitch = 0.0F; - ((EntityAccessor) player).setFallDistance(0.0F); + ((EntityAccessor) player).setField_1636(0.0F); } } - @Inject(method = "initVanillaScreen", at = @At("TAIL")) + @Inject(method = "init", at = @At("TAIL")) public void initVanillaScreen(CallbackInfo ci) { - final WorldStorage worldStorage = this.client.getWorldStorage(); - final List saves = worldStorage.getMetadata(); + final class_182 worldStorage = this.minecraft.method_2127(); + final List saves = worldStorage.method_1002(); if (!saves.isEmpty()) { latestSave = saves.get(0); } mmactive = true; - this.client.achievement = new GuiAchievementAether(this.client); + this.minecraft.field_2819 = new GuiAchievementAether(this.minecraft); if (!ReflectionUtils.isModLoaded("mod_InfSprites")) { this.setOverlay(); } if (musicId == -1 && !loadingWorld) { - this.client.soundHelper.playSound("aether.music.menu", 1.0F, 1.0F); + this.minecraft.soundManager.method_2009("aether.music.menu", 1.0F, 1.0F); - musicId = ((SoundHelperAccessor) this.client.soundHelper).getSoundUID(); - ((SoundHelperAccessor) this.client.soundHelper).setMusicCountdown(999999999); + musicId = ((SoundHelperAccessor) this.minecraft.soundManager).getField_2671(); + ((SoundHelperAccessor) this.minecraft.soundManager).setField_2675(999999999); } if (loadingWorld) { @@ -101,7 +111,7 @@ public void initVanillaScreen(CallbackInfo ci) { } private void setOverlay() { - this.client.overlay = new GuiIngameAether(this.client); + this.minecraft.inGameHud = new GuiIngameAether(this.minecraft); } @Inject(method = "render", at = @At("RETURN")) @@ -119,7 +129,7 @@ public void render(CallbackInfo ci) { } } - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/menu/TitleScreen;blit(IIIIII)V", ordinal = 0)) + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawTexture(IIIIII)V", ordinal = 0)) public void render$renderLogoPart1(Args args) { if (!themeOption && renderOption) { GL11.glPushMatrix(); @@ -135,7 +145,7 @@ public void render(CallbackInfo ci) { } } - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/menu/TitleScreen;blit(IIIIII)V", ordinal = 1)) + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawTexture(IIIIII)V", ordinal = 1)) public void render$renderLogoPart2(Args args) { if (renderOption) { args.set(0, 170); @@ -146,30 +156,30 @@ public void render(CallbackInfo ci) { } } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/menu/TitleScreen;blit(IIIIII)V", ordinal = 1, shift = At.Shift.AFTER)) + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawTexture(IIIIII)V", ordinal = 1, shift = At.Shift.AFTER)) public void render$hideSplashText(CallbackInfo ci) { if (!themeOption && renderOption) { GL11.glPopMatrix(); } } - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/menu/TitleScreen;drawTextWithShadowCentred(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V")) + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawCenteredTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;III)V")) public void render$drawSplashText(TitleScreen instance, TextRenderer textRenderer, String s, int i, int j, int k) { if (!renderOption) { - this.drawTextWithShadowCentred(textRenderer, s, i, j, k); + this.drawCenteredTextWithShadow(textRenderer, s, i, j, k); } } - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/menu/TitleScreen;drawTextWithShadow(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V", ordinal = 0)) + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;III)V", ordinal = 0)) public void render$modifyVersionText(Args args) { if (renderOption) { - args.set(2, this.width - this.textRenderer.getTextWidth(args.get(1)) - 5); + args.set(2, this.width - this.textRenderer.getWidth(args.get(1)) - 5); args.set(3, this.height - 20); args.set(4, 16777215); } } - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/menu/TitleScreen;drawTextWithShadow(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V", ordinal = 1)) + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;III)V", ordinal = 1)) public void render$modifyCopyrightText(Args args) { if (renderOption) { args.set(2, ((int) args.get(2)) - 3); @@ -207,11 +217,11 @@ protected void mouseReleased(int x, int y, int k) { @Inject(method = "buttonClicked", at = @At("HEAD")) public void buttonClicked(ButtonWidget button, CallbackInfo ci) { if (button.id == 1) { - this.client.openScreen(new GuiSelectWorldAether(this, musicId)); + this.minecraft.setScreen(new GuiSelectWorldAether(this, musicId)); } if (button.id == 2) { - this.client.openScreen(new GuiMultiplayerAether(this, musicId)); + this.minecraft.setScreen(new GuiMultiplayerAether(this, musicId)); } if (button.id == 5) { @@ -228,12 +238,12 @@ public void buttonClicked(ButtonWidget button, CallbackInfo ci) { } if (button.id == 7) { - this.client.openScreen(null); + this.minecraft.setScreen(null); mmactive = false; SoundSystem sound = SoundHelperAccessor.getSoundSystem(); sound.stop("sound_" + musicId); - ((SoundHelperAccessor) this.client.soundHelper).setMusicCountdown(6000); + ((SoundHelperAccessor) this.minecraft.soundManager).setField_2675(6000); musicId = -1; } @@ -245,56 +255,56 @@ private void addButtons() { buttons.removeIf(o -> ((ButtonWidget) o).id < 8); final TranslationStorage var1 = TranslationStorage.getInstance(); - this.buttons.add(new ButtonWidget(5, this.width - 24, 4, 20, 20, var1.translate("W"))); - this.buttons.add(new ButtonWidget(6, this.width - 48, 4, 20, 20, var1.translate("T"))); + this.buttons.add(new ButtonWidget(5, this.width - 24, 4, 20, 20, var1.get("W"))); + this.buttons.add(new ButtonWidget(6, this.width - 48, 4, 20, 20, var1.get("T"))); if (renderOption) { final int var5 = this.height / 4 + 20; if (themeOption) { - this.buttons.add(new GuiAetherButton(0, this.width / 4 - 100, var5 + 72, var1.translate("menu.options"))); - this.buttons.add(new GuiAetherButton(1, this.width / 4 - 100, var5, var1.translate("menu.singleplayer"))); - this.buttons.add(this.multiplayerButton = new GuiAetherButton(2, this.width / 4 - 100, var5 + 24, var1.translate("menu.multiplayer"))); - this.buttons.add(new GuiAetherButton(3, this.width / 4 - 100, var5 + 48, var1.translate("menu.mods"))); - this.buttons.add(new GuiAetherButton(4, this.width / 4 - 100, var5 + 96, var1.translate("menu.quit"))); + this.buttons.add(new GuiAetherButton(0, this.width / 4 - 100, var5 + 72, var1.get("menu.options"))); + this.buttons.add(new GuiAetherButton(1, this.width / 4 - 100, var5, var1.get("menu.singleplayer"))); + this.buttons.add(this.multiplayerButton = new GuiAetherButton(2, this.width / 4 - 100, var5 + 24, var1.get("menu.multiplayer"))); + this.buttons.add(new GuiAetherButton(3, this.width / 4 - 100, var5 + 48, var1.get("menu.mods"))); + this.buttons.add(new GuiAetherButton(4, this.width / 4 - 100, var5 + 96, var1.get("menu.quit"))); } else { - this.buttons.add(new ButtonWidget(0, this.width / 4 - 100, var5 + 72, var1.translate("menu.options"))); - this.buttons.add(new ButtonWidget(1, this.width / 4 - 100, var5, var1.translate("menu.singleplayer"))); - this.buttons.add(this.multiplayerButton = new ButtonWidget(2, this.width / 4 - 100, var5 + 24, var1.translate("menu.multiplayer"))); - this.buttons.add(new ButtonWidget(3, this.width / 4 - 100, var5 + 48, var1.translate("menu.mods"))); - this.buttons.add(new ButtonWidget(4, this.width / 4 - 100, var5 + 96, var1.translate("menu.quit"))); + this.buttons.add(new ButtonWidget(0, this.width / 4 - 100, var5 + 72, var1.get("menu.options"))); + this.buttons.add(new ButtonWidget(1, this.width / 4 - 100, var5, var1.get("menu.singleplayer"))); + this.buttons.add(this.multiplayerButton = new ButtonWidget(2, this.width / 4 - 100, var5 + 24, var1.get("menu.multiplayer"))); + this.buttons.add(new ButtonWidget(3, this.width / 4 - 100, var5 + 48, var1.get("menu.mods"))); + this.buttons.add(new ButtonWidget(4, this.width / 4 - 100, var5 + 96, var1.get("menu.quit"))); } - this.buttons.add(new ButtonWidget(7, this.width - 72, 4, 20, 20, var1.translate("Q"))); + this.buttons.add(new ButtonWidget(7, this.width - 72, 4, 20, 20, var1.get("Q"))); } else { final int var5 = this.height / 4 + 40; if (themeOption) { - this.buttons.add(new GuiAetherButton(0, this.width / 2 - 110, var5 + 72, 98, 20, var1.translate("menu.options"))); - this.buttons.add(new GuiAetherButton(1, this.width / 2 - 110, var5, var1.translate("menu.singleplayer"))); - this.buttons.add(this.multiplayerButton = new GuiAetherButton(2, this.width / 2 - 110, var5 + 24, var1.translate("menu.multiplayer"))); - this.buttons.add(new GuiAetherButton(3, this.width / 2 - 110, var5 + 48, var1.translate("menu.mods"))); - this.buttons.add(new GuiAetherButton(4, this.width / 2 + 2 - 10, var5 + 72, 98, 20, var1.translate("menu.quit"))); + this.buttons.add(new GuiAetherButton(0, this.width / 2 - 110, var5 + 72, 98, 20, var1.get("menu.options"))); + this.buttons.add(new GuiAetherButton(1, this.width / 2 - 110, var5, var1.get("menu.singleplayer"))); + this.buttons.add(this.multiplayerButton = new GuiAetherButton(2, this.width / 2 - 110, var5 + 24, var1.get("menu.multiplayer"))); + this.buttons.add(new GuiAetherButton(3, this.width / 2 - 110, var5 + 48, var1.get("menu.mods"))); + this.buttons.add(new GuiAetherButton(4, this.width / 2 + 2 - 10, var5 + 72, 98, 20, var1.get("menu.quit"))); } else { - this.buttons.add(new ButtonWidget(0, this.width / 2 - 110, var5 + 72, 98, 20, var1.translate("menu.options"))); - this.buttons.add(new ButtonWidget(1, this.width / 2 - 110, var5, var1.translate("menu.singleplayer"))); - this.buttons.add(this.multiplayerButton = new ButtonWidget(2, this.width / 2 - 110, var5 + 24, var1.translate("menu.multiplayer"))); - this.buttons.add(new ButtonWidget(3, this.width / 2 - 110, var5 + 48, var1.translate("menu.mods"))); - this.buttons.add(new ButtonWidget(4, this.width / 2 + 2 - 10, var5 + 72, 98, 20, var1.translate("menu.quit"))); + this.buttons.add(new ButtonWidget(0, this.width / 2 - 110, var5 + 72, 98, 20, var1.get("menu.options"))); + this.buttons.add(new ButtonWidget(1, this.width / 2 - 110, var5, var1.get("menu.singleplayer"))); + this.buttons.add(this.multiplayerButton = new ButtonWidget(2, this.width / 2 - 110, var5 + 24, var1.get("menu.multiplayer"))); + this.buttons.add(new ButtonWidget(3, this.width / 2 - 110, var5 + 48, var1.get("menu.mods"))); + this.buttons.add(new ButtonWidget(4, this.width / 2 + 2 - 10, var5 + 72, 98, 20, var1.get("menu.quit"))); } } } private void showWorldPreview() { if (this.latestSave != null) { - this.client.interactionManager = new SingleplayerInteractionManager(this.client); - this.client.options.hideHud = true; - this.client.options.thirdPerson = true; - this.client.createOrLoadWorld(latestSave.getFileName(), latestSave.getWorldName(), 0L); - ((WorldAccessor) this.client.world).setAutoSaveInterval(999999999); + this.minecraft.interactionManager = new SingleplayerInteractionManager(this.minecraft); + this.minecraft.options.hideHud = true; + this.minecraft.options.thirdPerson = true; + this.minecraft.method_2120(latestSave.method_1956(), latestSave.method_1958(), 0L); + ((WorldAccessor) this.minecraft.world).setField_212(999999999); } } private void hideWorldPreview() { - this.client.world = null; - this.client.player = null; + this.minecraft.world = null; + this.minecraft.player = null; } @Override @@ -304,7 +314,7 @@ public void renderBackground() { if (themeOption) { this.renderAetherBackground(); } else { - this.renderDirtBackground(0); + this.renderBackgroundTexture(0); } } @@ -312,26 +322,26 @@ public void renderAetherBackground() { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator tessellator = Tessellator.INSTANCE; - GL11.glBindTexture(3553, this.client.textureManager.getTextureId("/aether/gui/aetherBG.png")); + GL11.glBindTexture(3553, this.minecraft.textureManager.getTextureId("/aether/gui/aetherBG.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float f = 32.0F; - tessellator.start(); + tessellator.startQuads(); tessellator.color(0x999999); tessellator.vertex(0.0, this.height, 0.0, 0.0, (float) this.height / f); tessellator.vertex(this.width, this.height, 0.0, (float) this.width / f, (float) this.height / f); tessellator.vertex(this.width, 0.0, 0.0, (float) this.width / f, 0.0); tessellator.vertex(0.0, 0.0, 0.0, 0.0, 0.0); - tessellator.tessellate(); + tessellator.draw(); } @Override - public boolean isPauseScreen() { + public boolean shouldPause() { return false; } @Override - public void onClose() { - this.client.options.hideHud = false; - this.client.options.thirdPerson = false; + public void removed() { + this.minecraft.options.hideHud = false; + this.minecraft.options.thirdPerson = false; } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ArrowEntityMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ArrowEntityMixin.java index ba597cde..0d75da82 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ArrowEntityMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ArrowEntityMixin.java @@ -15,27 +15,27 @@ @Mixin(ArrowEntity.class) public abstract class ArrowEntityMixin extends Entity { @Shadow - private int inBlock; + private int field_1580; @Shadow - private int blockX; + private int field_1577; @Shadow - private int blockY; + private int field_1578; @Shadow - private int blockZ; + private int field_1579; public ArrowEntityMixin(World arg) { super(arg); } - @Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/projectile/ArrowEntity;shake:I", ordinal = 2, shift = At.Shift.AFTER)) + @Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/projectile/ArrowEntity;field_1575:I", ordinal = 2, shift = At.Shift.AFTER)) private void btw$tick(CallbackInfo ci) { - if (this.inBlock == mod_FCBetterThanWolves.fcBlockDetector.id) { - mod_FCBetterThanWolves.fcBlockDetector.onEntityCollision(this.world, this.blockX, this.blockY, this.blockZ, this); - } else if (this.inBlock == mod_FCBetterThanWolves.fcVase.id) { - ((FCBlockVase)mod_FCBetterThanWolves.fcVase).BreakVase(this.world, this.blockX, this.blockY, this.blockZ); + if (this.field_1580 == mod_FCBetterThanWolves.fcBlockDetector.id) { + mod_FCBetterThanWolves.fcBlockDetector.onEntityCollision(this.world, this.field_1577, this.field_1578, this.field_1579, this); + } else if (this.field_1580 == mod_FCBetterThanWolves.fcVase.id) { + ((FCBlockVase)mod_FCBetterThanWolves.fcVase).BreakVase(this.world, this.field_1577, this.field_1578, this.field_1579); } } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/BirchTreeFeatureMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/BirchTreeFeatureMixin.java index 80187d6d..21ab715d 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/BirchTreeFeatureMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/BirchTreeFeatureMixin.java @@ -8,7 +8,7 @@ import net.minecraft.FCUtilsMisc; import net.minecraft.block.Block; import net.minecraft.world.World; -import net.minecraft.world.feature.BirchTreeFeature; +import net.minecraft.world.gen.feature.BirchTreeFeature; @Mixin(BirchTreeFeature.class) public class BirchTreeFeatureMixin { @@ -35,7 +35,7 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int l2 = k - byte0; l2 <= k + byte0 && flag; ++l2) { if (i1 >= 0 && i1 < 128) { int j3 = world.getBlockId(i2, i1, l2); - if (!world.isAir(i2, i1, l2) && j3 != Block.LEAVES.id) { + if (!world.method_234(i2, i1, l2) && j3 != Block.LEAVES.id) { flag = false; } } else { @@ -49,9 +49,9 @@ public boolean generate(World world, Random random, int i, int j, int k) { return false; } else { int j1 = world.getBlockId(i, j - 1, k); - if ((j1 == Block.GRASS.id || j1 == Block.DIRT.id || FCUtilsMisc.CanPlantGrowOnBlock(world, i, j - 1, k, Block.SAPLING)) && j < 128 - l - 1) { - if (j1 == Block.GRASS.id) { - world.setBlockInChunk(i, j - 1, k, Block.DIRT.id); + if ((j1 == Block.GRASS_BLOCK.id || j1 == Block.DIRT.id || FCUtilsMisc.CanPlantGrowOnBlock(world, i, j - 1, k, Block.SAPLING)) && j < 128 - l - 1) { + if (j1 == Block.GRASS_BLOCK.id) { + world.method_200(i, j - 1, k, Block.DIRT.id); } for(int k1 = j - 3 + l; k1 <= j + l; ++k1) { @@ -64,8 +64,8 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int i4 = k - i3; i4 <= k + i3; ++i4) { int j4 = i4 - k; if ((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) - && !Block.FULL_OPAQUE[world.getBlockId(k3, k1, i4)]) { - world.setBlockWithMetadata(k3, k1, i4, Block.LEAVES.id, 2); + && !Block.BLOCKS_OPAQUE[world.getBlockId(k3, k1, i4)]) { + world.method_154(k3, k1, i4, Block.LEAVES.id, 2); } } } @@ -73,8 +73,8 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int l1 = 0; l1 < l; ++l1) { int k2 = world.getBlockId(i, j + l1, k); - if (world.isAir(i, j + l1, k) || k2 == Block.LEAVES.id) { - world.setBlockWithMetadata(i, j + l1, k, Block.LOG.id, 2); + if (world.method_234(i, j + l1, k) || k2 == Block.LEAVES.id) { + world.method_154(i, j + l1, k, Block.LOG.id, 2); } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CakeBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CakeBlockMixin.java index 4b79dff7..eadc11ca 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CakeBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CakeBlockMixin.java @@ -3,7 +3,7 @@ import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.block.Block; import net.minecraft.block.CakeBlock; -import net.minecraft.block.material.Material; +import net.minecraft.block.Material; import net.minecraft.world.BlockView; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; @@ -24,12 +24,12 @@ protected CakeBlockMixin(int i, Material arg) { } @Override - public void onBlockPlaced(World world, int i, int j, int k) { - super.onBlockPlaced(world, i, j, k); + public void onPlaced(World world, int i, int j, int k) { + super.onPlaced(world, i, j, k); boolean bReceivingRedstone = world.method_263(i, j, k); if (bReceivingRedstone) { this.SetRedstoneOn(world, i, j, k, true); - world.playSound((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, "mob.ghast.scream", 1.0F, world.rand.nextFloat() * 0.4F + 0.8F); + world.playSound((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, "mob.ghast.scream", 1.0F, world.field_214.nextFloat() * 0.4F + 0.8F); } } @@ -43,12 +43,12 @@ public void onBlockPlaced(World world, int i, int j, int k) { return this.GetEatState(arg, i, j, k); } - @ModifyVariable(method = "getOutlineShape", at = @At("HEAD"), ordinal = 0) + @ModifyVariable(method = "getBoundingBox", at = @At("HEAD"), ordinal = 0) private int btw$getOutlineShape(int var5, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { return this.GetEatState(arg, i, j, k); } - @ModifyVariable(method = "getTextureForSide(II)I", at = @At("HEAD"), ordinal = 1, argsOnly = true) + @ModifyVariable(method = "getTexture(II)I", at = @At("HEAD"), ordinal = 1, argsOnly = true) private int btw$getTextureForSide(int value) { return value & 7; } @@ -58,12 +58,12 @@ public void onBlockPlaced(World world, int i, int j, int k) { return this.GetEatState(arg, i, j, k) + 1; } - @Redirect(method = "method_1528", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockMeta(IIII)V")) + @Redirect(method = "method_1528", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;method_215(IIII)V")) private void btw$method_1528$2(World instance, int j, int k, int l, int i, @Local(ordinal = 3) int var6) { this.SetEatState(instance, i, j, k, var6); } - @Inject(method = "onAdjacentBlockUpdate", at = @At("TAIL")) + @Inject(method = "neighborUpdate", at = @At("TAIL")) private void addBTWCheck(World world, int i, int j, int k, int l, CallbackInfo callbackInfo) { if (this.canGrow(world, i, j, k)) { boolean bOn = this.IsRedstoneOn(world, i, j, k); @@ -71,7 +71,7 @@ private void addBTWCheck(World world, int i, int j, int k, int l, CallbackInfo c if (bOn != bReceivingRedstone) { this.SetRedstoneOn(world, i, j, k, bReceivingRedstone); if (bReceivingRedstone) { - world.playSound((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, "mob.ghast.scream", 1.0F, world.rand.nextFloat() * 0.4F + 0.8F); + world.playSound((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, "mob.ghast.scream", 1.0F, world.field_214.nextFloat() * 0.4F + 0.8F); } } } @@ -89,7 +89,7 @@ public void SetRedstoneOn(World world, int i, int j, int k, boolean bOn) { iMetaData |= 8; } - world.setBlockMeta(i, j, k, iMetaData); + world.method_215(i, j, k, iMetaData); } @Override @@ -101,7 +101,7 @@ public int GetEatState(BlockView iBlockAccess, int i, int j, int k) { public void SetEatState(World world, int i, int j, int k, int state) { int iMetaData = world.getBlockMeta(i, j, k) & 8; iMetaData |= state; - world.setBlockMeta(i, j, k, iMetaData); + world.method_215(i, j, k, iMetaData); } @Override diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ChestMinecartEntityMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ChestMinecartEntityMixin.java index 050b132f..5422da97 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ChestMinecartEntityMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/ChestMinecartEntityMixin.java @@ -9,14 +9,14 @@ import net.minecraft.block.Block; import net.minecraft.block.RailBlock; -import net.minecraft.entity.ChestMinecartEntity; import net.minecraft.entity.Entity; +import net.minecraft.entity.vehicle.MinecartEntity; import net.minecraft.mod_FCBetterThanWolves; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -@Mixin(ChestMinecartEntity.class) +@Mixin(MinecartEntity.class) public abstract class ChestMinecartEntityMixin extends Entity { @Shadow public int field_2273; @@ -50,19 +50,19 @@ public abstract class ChestMinecartEntityMixin extends Entity { private static int[][][] field_2281; @Shadow - public int type; + public int field_2275; @Shadow - public double pushX; + public double field_2277; @Shadow - public double pushZ; + public double field_2278; @Shadow private boolean field_2280; @Shadow - public int fuel; + public int field_2276; public ChestMinecartEntityMixin(World arg) { super(arg); @@ -82,7 +82,7 @@ public void tick() { --this.field_2272; } - if (this.world.isClient && this.field_2282 > 0) { + if (this.world.isRemote && this.field_2282 > 0) { if (this.field_2282 > 0) { double d = this.x + (this.field_2283 - this.x) / (double)this.field_2282; double d1 = this.y + (this.field_2284 - this.y) / (double)this.field_2282; @@ -100,17 +100,17 @@ public void tick() { this.yaw = (float)((double)this.yaw + d4 / (double)this.field_2282); this.pitch = (float)((double)this.pitch + (this.field_2287 - (double)this.pitch) / (double)this.field_2282); --this.field_2282; - this.setPosition(d, d1, d3); - this.setRotation(this.yaw, this.pitch); + this.method_1340(d, d1, d3); + this.method_1342(this.yaw, this.pitch); } else { - this.setPosition(this.x, this.y, this.z); - this.setRotation(this.yaw, this.pitch); + this.method_1340(this.x, this.y, this.z); + this.method_1342(this.yaw, this.pitch); } } else { this.prevX = this.x; this.prevY = this.y; this.prevZ = this.z; - this.yVelocity -= 0.04F; + this.velocityY -= 0.04F; int i = MathHelper.floor(this.x); int j = MathHelper.floor(this.y); int k = MathHelper.floor(this.z); @@ -122,18 +122,18 @@ public void tick() { boolean flag = false; double d5 = 0.0078125; int l = this.world.getBlockId(i, j, k); - if (RailBlock.isRail(l)) { + if (RailBlock.method_1107(l)) { Vec3d vec3d = this.method_1813(this.x, this.y, this.z); int i1 = this.world.getBlockMeta(i, j, k); this.y = (double)j; boolean flag1 = false; boolean flag2 = false; - if (l == Block.GOLDEN_RAIL.id) { + if (l == Block.POWERED_RAIL.id) { flag1 = (i1 & 8) != 0; flag2 = !flag1; } - if (((RailBlock)Block.BY_ID[l]).method_1108()) { + if (((RailBlock)Block.BLOCKS[l]).method_1108()) { i1 &= 7; } @@ -142,44 +142,44 @@ public void tick() { } if (i1 == 2) { - this.xVelocity -= d5; + this.velocityX -= d5; } if (i1 == 3) { - this.xVelocity += d5; + this.velocityX += d5; } if (i1 == 4) { - this.zVelocity += d5; + this.velocityZ += d5; } if (i1 == 5) { - this.zVelocity -= d5; + this.velocityZ -= d5; } int[][] ai = field_2281[i1]; double d9 = (double)(ai[1][0] - ai[0][0]); double d10 = (double)(ai[1][2] - ai[0][2]); double d11 = Math.sqrt(d9 * d9 + d10 * d10); - double d12 = this.xVelocity * d9 + this.zVelocity * d10; + double d12 = this.velocityX * d9 + this.velocityZ * d10; if (d12 < 0.0) { d9 = -d9; d10 = -d10; } - double d13 = Math.sqrt(this.xVelocity * this.xVelocity + this.zVelocity * this.zVelocity); - this.xVelocity = d13 * d9 / d11; - this.zVelocity = d13 * d10 / d11; + double d13 = Math.sqrt(this.velocityX * this.velocityX + this.velocityZ * this.velocityZ); + this.velocityX = d13 * d9 / d11; + this.velocityZ = d13 * d10 / d11; if (flag2) { - double d16 = Math.sqrt(this.xVelocity * this.xVelocity + this.zVelocity * this.zVelocity); + double d16 = Math.sqrt(this.velocityX * this.velocityX + this.velocityZ * this.velocityZ); if (d16 < 0.03) { - this.xVelocity *= 0.0; - this.yVelocity *= 0.0; - this.zVelocity *= 0.0; + this.velocityX *= 0.0; + this.velocityY *= 0.0; + this.velocityZ *= 0.0; } else { - this.xVelocity *= 0.5; - this.yVelocity *= 0.0; - this.zVelocity *= 0.5; + this.velocityX *= 0.5; + this.velocityY *= 0.0; + this.velocityZ *= 0.5; } } @@ -205,10 +205,10 @@ public void tick() { this.x = d18 + d9 * d17; this.z = d19 + d10 * d17; - this.setPosition(this.x, this.y + (double)this.standingEyeHeight, this.z); - double d23 = this.xVelocity; - double d25 = this.zVelocity; - if (this.passenger != null) { + this.method_1340(this.x, this.y + (double)this.eyeHeight, this.z); + double d23 = this.velocityX; + double d25 = this.velocityZ; + if (this.field_1594 != null) { d23 *= 0.75; d25 *= 0.75; } @@ -231,44 +231,44 @@ public void tick() { this.move(d23, 0.0, d25); if (ai[0][1] != 0 && MathHelper.floor(this.x) - i == ai[0][0] && MathHelper.floor(this.z) - k == ai[0][2]) { - this.setPosition(this.x, this.y + (double)ai[0][1], this.z); + this.method_1340(this.x, this.y + (double)ai[0][1], this.z); } else if (ai[1][1] != 0 && MathHelper.floor(this.x) - i == ai[1][0] && MathHelper.floor(this.z) - k == ai[1][2]) { - this.setPosition(this.x, this.y + (double)ai[1][1], this.z); + this.method_1340(this.x, this.y + (double)ai[1][1], this.z); } - if (this.passenger != null) { - this.xVelocity *= 0.997F; - this.yVelocity *= 0.0; - this.zVelocity *= 0.997F; + if (this.field_1594 != null) { + this.velocityX *= 0.997F; + this.velocityY *= 0.0; + this.velocityZ *= 0.997F; } else { - if (this.type == 2) { - double d27 = (double)MathHelper.sqrt(this.pushX * this.pushX + this.pushZ * this.pushZ); + if (this.field_2275 == 2) { + double d27 = (double)MathHelper.sqrt(this.field_2277 * this.field_2277 + this.field_2278 * this.field_2278); if (d27 > 0.01) { flag = true; - this.pushX /= d27; - this.pushZ /= d27; + this.field_2277 /= d27; + this.field_2278 /= d27; double d29 = 0.04; - this.xVelocity *= 0.8F; - this.yVelocity *= 0.0; - this.zVelocity *= 0.8F; - this.xVelocity += this.pushX * d29; - this.zVelocity += this.pushZ * d29; + this.velocityX *= 0.8F; + this.velocityY *= 0.0; + this.velocityZ *= 0.8F; + this.velocityX += this.field_2277 * d29; + this.velocityZ += this.field_2278 * d29; } else { - this.xVelocity *= 0.9F; - this.yVelocity *= 0.0; - this.zVelocity *= 0.9F; + this.velocityX *= 0.9F; + this.velocityY *= 0.0; + this.velocityZ *= 0.9F; } } // TODO: PATCH STARTS HERE if (mod_FCBetterThanWolves.fcDisableMinecartChanges) { - this.xVelocity *= 0.96F; - this.yVelocity *= 0.0; - this.zVelocity *= 0.96F; + this.velocityX *= 0.96F; + this.velocityY *= 0.0; + this.velocityZ *= 0.96F; } else { - this.xVelocity *= 0.985; - this.yVelocity *= 0.0; - this.zVelocity *= 0.985; + this.velocityX *= 0.985; + this.velocityY *= 0.0; + this.velocityZ *= 0.985; } // PATCH ENDS HERE } @@ -276,86 +276,86 @@ public void tick() { Vec3d vec3d1 = this.method_1813(this.x, this.y, this.z); if (vec3d1 != null && vec3d != null) { double d28 = (vec3d.y - vec3d1.y) * 0.05; - double d14 = Math.sqrt(this.xVelocity * this.xVelocity + this.zVelocity * this.zVelocity); + double d14 = Math.sqrt(this.velocityX * this.velocityX + this.velocityZ * this.velocityZ); if (d14 > 0.0) { - this.xVelocity = this.xVelocity / d14 * (d14 + d28); - this.zVelocity = this.zVelocity / d14 * (d14 + d28); + this.velocityX = this.velocityX / d14 * (d14 + d28); + this.velocityZ = this.velocityZ / d14 * (d14 + d28); } - this.setPosition(this.x, vec3d1.y, this.z); + this.method_1340(this.x, vec3d1.y, this.z); } int k1 = MathHelper.floor(this.x); int l1 = MathHelper.floor(this.z); if (k1 != i || l1 != k) { - double d15 = Math.sqrt(this.xVelocity * this.xVelocity + this.zVelocity * this.zVelocity); - this.xVelocity = d15 * (double)(k1 - i); - this.zVelocity = d15 * (double)(l1 - k); - } - - if (this.type == 2) { - double d30 = (double)MathHelper.sqrt(this.pushX * this.pushX + this.pushZ * this.pushZ); - if (d30 > 0.01 && this.xVelocity * this.xVelocity + this.zVelocity * this.zVelocity > 0.001) { - this.pushX /= d30; - this.pushZ /= d30; - if (this.pushX * this.xVelocity + this.pushZ * this.zVelocity < 0.0) { - this.pushX = 0.0; - this.pushZ = 0.0; + double d15 = Math.sqrt(this.velocityX * this.velocityX + this.velocityZ * this.velocityZ); + this.velocityX = d15 * (double)(k1 - i); + this.velocityZ = d15 * (double)(l1 - k); + } + + if (this.field_2275 == 2) { + double d30 = (double)MathHelper.sqrt(this.field_2277 * this.field_2277 + this.field_2278 * this.field_2278); + if (d30 > 0.01 && this.velocityX * this.velocityX + this.velocityZ * this.velocityZ > 0.001) { + this.field_2277 /= d30; + this.field_2278 /= d30; + if (this.field_2277 * this.velocityX + this.field_2278 * this.velocityZ < 0.0) { + this.field_2277 = 0.0; + this.field_2278 = 0.0; } else { - this.pushX = this.xVelocity; - this.pushZ = this.zVelocity; + this.field_2277 = this.velocityX; + this.field_2278 = this.velocityZ; } } } if (flag1) { - double d31 = Math.sqrt(this.xVelocity * this.xVelocity + this.zVelocity * this.zVelocity); + double d31 = Math.sqrt(this.velocityX * this.velocityX + this.velocityZ * this.velocityZ); if (d31 > 0.01) { double d32 = 0.06; - this.xVelocity += this.xVelocity / d31 * d32; - this.zVelocity += this.zVelocity / d31 * d32; + this.velocityX += this.velocityX / d31 * d32; + this.velocityZ += this.velocityZ / d31 * d32; } else if (i1 == 1) { - if (this.world.canSuffocate(i - 1, j, k)) { - this.xVelocity = 0.02; - } else if (this.world.canSuffocate(i + 1, j, k)) { - this.xVelocity = -0.02; + if (this.world.method_1780(i - 1, j, k)) { + this.velocityX = 0.02; + } else if (this.world.method_1780(i + 1, j, k)) { + this.velocityX = -0.02; } } else if (i1 == 0) { - if (this.world.canSuffocate(i, j, k - 1)) { - this.zVelocity = 0.02; - } else if (this.world.canSuffocate(i, j, k + 1)) { - this.zVelocity = -0.02; + if (this.world.method_1780(i, j, k - 1)) { + this.velocityZ = 0.02; + } else if (this.world.method_1780(i, j, k + 1)) { + this.velocityZ = -0.02; } } } } else { - if (this.xVelocity < -d2) { - this.xVelocity = -d2; + if (this.velocityX < -d2) { + this.velocityX = -d2; } - if (this.xVelocity > d2) { - this.xVelocity = d2; + if (this.velocityX > d2) { + this.velocityX = d2; } - if (this.zVelocity < -d2) { - this.zVelocity = -d2; + if (this.velocityZ < -d2) { + this.velocityZ = -d2; } - if (this.zVelocity > d2) { - this.zVelocity = d2; + if (this.velocityZ > d2) { + this.velocityZ = d2; } - if (this.onGround) { - this.xVelocity *= 0.5; - this.yVelocity *= 0.5; - this.zVelocity *= 0.5; + if (this.field_1623) { + this.velocityX *= 0.5; + this.velocityY *= 0.5; + this.velocityZ *= 0.5; } - this.move(this.xVelocity, this.yVelocity, this.zVelocity); - if (!this.onGround) { - this.xVelocity *= 0.95F; - this.yVelocity *= 0.95F; - this.zVelocity *= 0.95F; + this.move(this.velocityX, this.velocityY, this.velocityZ); + if (!this.field_1623) { + this.velocityX *= 0.95F; + this.velocityY *= 0.95F; + this.velocityZ *= 0.95F; } } @@ -384,25 +384,25 @@ public void tick() { this.field_2280 = !this.field_2280; } - this.setRotation(this.yaw, this.pitch); + this.method_1342(this.yaw, this.pitch); List list = this.world.getEntities(this, this.boundingBox.expand(0.2F, 0.0, 0.2F)); if (list != null && list.size() > 0) { for(int j1 = 0; j1 < list.size(); ++j1) { Entity entity = (Entity)list.get(j1); - if (entity != this.passenger && entity.method_1380() && entity instanceof ChestMinecartEntity) { + if (entity != this.field_1594 && entity.method_1380() && entity instanceof MinecartEntity) { entity.method_1353(this); } } } - if (this.passenger != null && this.passenger.removed) { - this.passenger = null; + if (this.field_1594 != null && this.field_1594.dead) { + this.field_1594 = null; } - if (flag && this.rand.nextInt(4) == 0) { - --this.fuel; - if (this.fuel < 0) { - this.pushX = this.pushZ = 0.0; + if (flag && this.random.nextInt(4) == 0) { + --this.field_2276; + if (this.field_2276 < 0) { + this.field_2277 = this.field_2278 = 0.0; } this.world.addParticle("largesmoke", this.x, this.y + 0.8, this.z, 0.0, 0.0, 0.0); diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CropBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CropBlockMixin.java index f66cacd7..d728bbb4 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CropBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/CropBlockMixin.java @@ -1,19 +1,13 @@ package io.github.betterthanupdates.apron.compat.mixin.client.betterthanwolves; -import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.FCISoil; import net.minecraft.FCUtilsMisc; import net.minecraft.block.Block; import net.minecraft.block.CropBlock; import net.minecraft.block.PlantBlock; import net.minecraft.world.World; -import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(CropBlock.class) public class CropBlockMixin extends PlantBlock { @@ -36,7 +30,7 @@ protected CropBlockMixin(int i, int j) { * @reason difficult to convert */ @Overwrite - private float growCropStage(World world, int i, int j, int k) { + private float method_997(World world, int i, int j, int k) { float f = 1.0F; int l = world.getBlockId(i, j, k - 1); int i1 = world.getBlockId(i, j, k + 1); @@ -61,7 +55,7 @@ private float growCropStage(World world, int i, int j, int k) { } } else if (FCUtilsMisc.CanPlantGrowOnBlock(world, l2, j - 1, i3, this)) { f1 = 1.0F; - Block blockBelow = Block.BY_ID[j3]; + Block blockBelow = Block.BLOCKS[j3]; if (blockBelow instanceof FCISoil && ((FCISoil)blockBelow).IsBlockHydrated(world, l2, j - 1, i3)) { f1 = 3.0F; } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/DetectorRailBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/DetectorRailBlockMixin.java index 02ccc808..63e6d3e3 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/DetectorRailBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/DetectorRailBlockMixin.java @@ -12,9 +12,9 @@ import net.minecraft.block.Block; import net.minecraft.block.DetectorRailBlock; import net.minecraft.block.RailBlock; -import net.minecraft.entity.ChestMinecartEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.vehicle.MinecartEntity; import net.minecraft.mod_FCBetterThanWolves; import net.minecraft.world.World; @@ -29,11 +29,11 @@ protected DetectorRailBlockMixin(int i, int j, boolean bl) { return -1; } - @ModifyVariable(method = "method_1144", ordinal = 5, at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/World;getEntities(Ljava/lang/Class;Lnet/minecraft/util/math/AxixAlignedBoundingBox;)Ljava/util/List;")) + @ModifyVariable(method = "method_1144", ordinal = 5, at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/World;method_175(Ljava/lang/Class;Lnet/minecraft/util/math/Box;)Ljava/util/List;")) private int btw$method_1144(int value, @Local List list, @Local World world, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { for(int listIndex = 0; listIndex < list.size(); ++listIndex) { - ChestMinecartEntity minecartEntity = (ChestMinecartEntity)list.get(listIndex); - if (ShouldPlateActivateBasedOnMinecart(world, i, j, k, minecartEntity.type, minecartEntity.passenger)) { + MinecartEntity minecartEntity = (MinecartEntity)list.get(listIndex); + if (ShouldPlateActivateBasedOnMinecart(world, i, j, k, minecartEntity.field_2275, minecartEntity.field_1594)) { value = 1; break; } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FCBlockCompanionCubeMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FCBlockCompanionCubeMixin.java index 9ef75ea2..2c4e96cc 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FCBlockCompanionCubeMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FCBlockCompanionCubeMixin.java @@ -8,7 +8,7 @@ @Mixin(FCBlockCompanionCube.class) public interface FCBlockCompanionCubeMixin { @Invoker("SpawnHearts") - public static void SpawnHearts(World world, int i, int j, int k) { + static void SpawnHearts(World world, int i, int j, int k) { throw new AssertionError(); } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FallingBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FallingBlockMixin.java index 48733b08..19dfdc1d 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FallingBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FallingBlockMixin.java @@ -4,14 +4,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.block.FallingBlock; +import net.minecraft.block.SandBlock; import net.minecraft.world.World; -@Mixin(FallingBlock.class) +@Mixin(SandBlock.class) public class FallingBlockMixin { @Inject(method = "method_435", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/World;getBlockId(III)I"), cancellable = true) private static void btw$method_435(World arg, int i, int j, int k, CallbackInfoReturnable cir) { - if (arg.isAir(i, j, k)) cir.setReturnValue(true); + if (arg.method_234(i, j, k)) cir.setReturnValue(true); } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FireBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FireBlockMixin.java index 9f2c75bc..cabf651d 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FireBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/FireBlockMixin.java @@ -8,7 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.block.FireBlock; import net.minecraft.client.render.Tessellator; -import net.minecraft.client.render.block.BlockRenderer; +import net.minecraft.client.render.block.BlockRenderManager; import net.minecraft.mod_FCBetterThanWolves; import net.minecraft.world.BlockView; import net.minecraft.world.World; @@ -28,7 +28,7 @@ public class FireBlockMixin implements BTWFireBlock { return mod_FCBetterThanWolves.iCustomFireRenderID; } - @Inject(method = "onScheduledTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/FireBlock;canPlaceAt(Lnet/minecraft/world/World;III)Z", shift = At.Shift.BY, by = 3), cancellable = true) + @Inject(method = "onTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/FireBlock;canPlaceAt(Lnet/minecraft/world/World;III)Z", shift = At.Shift.BY, by = 3), cancellable = true) private void addBTWFireCheck(World arg, int i, int j, int k, Random random, CallbackInfo callbackInfo, @Local(ordinal = 3) LocalIntRef var6) { if(arg.getBlockId(i, j - 1, k) == mod_FCBetterThanWolves.fcBBQ.id) { if(!((FCBlockBBQ)mod_FCBetterThanWolves.fcBBQ).IsBBQLit(arg, i, j - 1, k)) { @@ -49,7 +49,7 @@ public void OnBlockDestroyedByFire(World world, int i, int j, int k) { } } - @Inject(method = "fireTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlockId(III)I", ordinal = 1)) + @Inject(method = "method_1823", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlockId(III)I", ordinal = 1)) private void addBTWMethod(World arg, int i, int j, int k, int l, Random random, int m, CallbackInfo callbackInfo) { this.OnBlockDestroyedByFire(arg, i, j, k); } @@ -59,25 +59,25 @@ private boolean addBTWStokedFire(boolean original, @Local World arg, @Local(ordi return original || arg.getBlockId(i, j - 1, k) == mod_FCBetterThanWolves.fcStokedFire.id; } - @ModifyExpressionValue(method = "onAdjacentBlockUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;canSuffocate(III)Z")) + @ModifyExpressionValue(method = "neighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;method_1780(III)Z")) private boolean addBTWStonkedFireCheck_1(boolean original, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { return original && arg.getBlockId(i, j - 1, k) != mod_FCBetterThanWolves.fcStokedFire.id; } - @ModifyExpressionValue(method = "onBlockPlaced", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;canSuffocate(III)Z")) + @ModifyExpressionValue(method = "onPlaced", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;method_1780(III)Z")) private boolean addBTWStonkedFireCheck_2(boolean original, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { return original && arg.getBlockId(i, j - 1, k) != mod_FCBetterThanWolves.fcStokedFire.id; } @Override - public boolean RenderFire(BlockRenderer renderBlocks, BlockView iBlockAccess, int i, int j, int k, Block block) { + public boolean RenderFire(BlockRenderManager renderBlocks, BlockView iBlockAccess, int i, int j, int k, Block block) { Tessellator tessellator = Tessellator.INSTANCE; - int l = block.getTextureForSide(0); + int l = block.getTexture(0); if (renderBlocks.textureOverride >= 0) { l = renderBlocks.textureOverride; } - float f = block.getBrightness(iBlockAccess, i, j, k); + float f = block.getLuminance(iBlockAccess, i, j, k); tessellator.color(f, f, f); int i1 = (l & 15) << 4; int j1 = l & 240; @@ -86,7 +86,7 @@ public boolean RenderFire(BlockRenderer renderBlocks, BlockView iBlockAccess, in double d2 = (double)((float)j1 / 256.0F); double d3 = (double)(((float)j1 + 15.99F) / 256.0F); float f1 = 1.4F; - if (!iBlockAccess.canSuffocate(i, j - 1, k) + if (!iBlockAccess.method_1780(i, j - 1, k) && !Block.FIRE.method_1824(iBlockAccess, i, j - 1, k) && iBlockAccess.getBlockId(i, j - 1, k) != mod_FCBetterThanWolves.fcStokedFire.id) { float f2 = 0.2F; diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/HoeItemMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/HoeItemMixin.java index d842bd54..ef9e2aa4 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/HoeItemMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/HoeItemMixin.java @@ -19,10 +19,10 @@ public class HoeItemMixin { @Inject(method = "useOnBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlock(IIII)Z")) private void btw$useOnBlock(ItemStack itemstack, PlayerEntity entityplayer, World world, int i, int j, int k, int l, CallbackInfoReturnable cir, @Local(ordinal = 4) int i1) { - if (i1 == Block.GRASS.id) { + if (i1 == Block.GRASS_BLOCK.id) { int iPercentageChanceOfHempSeedDrop = 0; int iHoeID = itemstack.itemId; - if (iHoeID == Item.WOOD_HOE.id) { + if (iHoeID == Item.WOODEN_HOE.id) { iPercentageChanceOfHempSeedDrop = 1; } else if (iHoeID == Item.STONE_HOE.id) { iPercentageChanceOfHempSeedDrop = 2; @@ -30,20 +30,20 @@ public class HoeItemMixin { iPercentageChanceOfHempSeedDrop = 4; } else if (iHoeID == Item.DIAMOND_HOE.id) { iPercentageChanceOfHempSeedDrop = 8; - } else if (iHoeID == Item.GOLD_HOE.id) { + } else if (iHoeID == Item.GOLDEN_HOE.id) { iPercentageChanceOfHempSeedDrop = 16; } - if (world.rand.nextInt(100) < iPercentageChanceOfHempSeedDrop) { + if (world.field_214.nextInt(100) < iPercentageChanceOfHempSeedDrop) { float f = 0.7F; - float f1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F; + float f1 = world.field_214.nextFloat() * f + (1.0F - f) * 0.5F; float f2 = 1.2F; - float f3 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F; + float f3 = world.field_214.nextFloat() * f + (1.0F - f) * 0.5F; ItemEntity entityitem = new ItemEntity( world, (double)((float)i + f1), (double)((float)j + f2), (double)((float)k + f3), new ItemStack(mod_FCBetterThanWolves.fcHempSeeds) ); entityitem.pickupDelay = 10; - world.spawnEntity(entityitem); + world.method_210(entityitem); } } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/LargeOakTreeDecorationMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/LargeOakTreeDecorationMixin.java index d1b77860..455373cc 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/LargeOakTreeDecorationMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/LargeOakTreeDecorationMixin.java @@ -1,13 +1,10 @@ package io.github.betterthanupdates.apron.compat.mixin.client.betterthanwolves; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; @@ -15,16 +12,16 @@ import net.minecraft.block.Block; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import net.minecraft.world.decoration.LargeOakTreeDecoration; +import net.minecraft.world.gen.feature.LargeOakTreeFeature; -@Mixin(LargeOakTreeDecoration.class) +@Mixin(LargeOakTreeFeature.class) public class LargeOakTreeDecorationMixin { @Shadow @Final static byte[] field_645; @Shadow - World field_647; + World world; @Shadow int[] field_648; @@ -53,11 +50,11 @@ void method_615(int i, int j, int k, float f, byte byte0, int l) { ++l1; } else { ai1[byte2] = ai[byte2] + l1; - int i2 = this.field_647.getBlockId(ai1[0], ai1[1], ai1[2]); - if (!this.field_647.isAir(ai1[0], ai1[1], ai1[2]) && i2 != 18) { + int i2 = this.world.getBlockId(ai1[0], ai1[1], ai1[2]); + if (!this.world.method_234(ai1[0], ai1[1], ai1[2]) && i2 != 18) { ++l1; } else { - this.field_647.setBlockInChunk(ai1[0], ai1[1], ai1[2], l); + this.world.method_200(ai1[0], ai1[1], ai1[2], l); ++l1; } } @@ -104,8 +101,8 @@ int method_616(int[] ai, int[] ai1) { ai3[i] = ai[i] + j; ai3[byte1] = MathHelper.floor((double)ai[byte1] + (double)j * d); ai3[byte2] = MathHelper.floor((double)ai[byte2] + (double)j * d1); - int l = this.field_647.getBlockId(ai3[0], ai3[1], ai3[2]); - if (!this.field_647.isAir(ai3[0], ai3[1], ai3[2]) && l != 18) { + int l = this.world.getBlockId(ai3[0], ai3[1], ai3[2]); + if (!this.world.method_234(ai3[0], ai3[1], ai3[2]) && l != 18) { break; } } @@ -115,8 +112,8 @@ int method_616(int[] ai, int[] ai1) { } @ModifyConstant(method = "method_611", constant = @Constant(intValue = 3)) - private int btw$method_611(int three, @Local int i) { - if (FCUtilsMisc.CanPlantGrowOnBlock(this.field_647, this.field_648[0], this.field_648[1] - 1, this.field_648[2], Block.SAPLING)) { + private int btw$method_611(int three, @Local(ordinal = 0) int i) { + if (FCUtilsMisc.CanPlantGrowOnBlock(this.world, this.field_648[0], this.field_648[1] - 1, this.field_648[2], Block.SAPLING)) { return i; } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/MushroomBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/MushroomBlockMixin.java index ed9d5871..234373cc 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/MushroomBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/MushroomBlockMixin.java @@ -7,12 +7,12 @@ import net.minecraft.FCUtilsMisc; import net.minecraft.block.Block; -import net.minecraft.block.MushroomBlock; +import net.minecraft.block.MushroomPlantBlock; import net.minecraft.world.World; -@Mixin(MushroomBlock.class) +@Mixin(MushroomPlantBlock.class) public class MushroomBlockMixin { - @ModifyExpressionValue(method = "canGrow", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/MushroomBlock;canPlantOnTopOf(I)Z")) + @ModifyExpressionValue(method = "canGrow", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/MushroomPlantBlock;method_1683(I)Z")) private boolean btw$canGrow(boolean original, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { return original || FCUtilsMisc.CanPlantGrowOnBlock(arg, i, j - 1, k, (Block)(Object) this); } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/OakTreeFeatureMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/OakTreeFeatureMixin.java index 4bc05696..752bd2ea 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/OakTreeFeatureMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/OakTreeFeatureMixin.java @@ -8,7 +8,7 @@ import net.minecraft.FCUtilsMisc; import net.minecraft.block.Block; import net.minecraft.world.World; -import net.minecraft.world.feature.OakTreeFeature; +import net.minecraft.world.gen.feature.OakTreeFeature; @Mixin(OakTreeFeature.class) public class OakTreeFeatureMixin { @@ -35,7 +35,7 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int l2 = k - byte0; l2 <= k + byte0 && flag; ++l2) { if (i1 >= 0 && i1 < 128) { int j3 = world.getBlockId(i2, i1, l2); - if (!world.isAir(i2, i1, l2) && j3 != Block.LEAVES.id) { + if (!world.method_234(i2, i1, l2) && j3 != Block.LEAVES.id) { flag = false; } } else { @@ -49,9 +49,9 @@ public boolean generate(World world, Random random, int i, int j, int k) { return false; } else { int j1 = world.getBlockId(i, j - 1, k); - if ((j1 == Block.GRASS.id || j1 == Block.DIRT.id || FCUtilsMisc.CanPlantGrowOnBlock(world, i, j - 1, k, Block.SAPLING)) && j < 128 - l - 1) { - if (j1 == Block.GRASS.id) { - world.setBlockInChunk(i, j - 1, k, Block.DIRT.id); + if ((j1 == Block.GRASS_BLOCK.id || j1 == Block.DIRT.id || FCUtilsMisc.CanPlantGrowOnBlock(world, i, j - 1, k, Block.SAPLING)) && j < 128 - l - 1) { + if (j1 == Block.GRASS_BLOCK.id) { + world.method_200(i, j - 1, k, Block.DIRT.id); } for(int k1 = j - 3 + l; k1 <= j + l; ++k1) { @@ -64,8 +64,8 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int i4 = k - i3; i4 <= k + i3; ++i4) { int j4 = i4 - k; if ((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) - && !Block.FULL_OPAQUE[world.getBlockId(k3, k1, i4)]) { - world.setBlockInChunk(k3, k1, i4, Block.LEAVES.id); + && !Block.BLOCKS_OPAQUE[world.getBlockId(k3, k1, i4)]) { + world.method_200(k3, k1, i4, Block.LEAVES.id); } } } @@ -73,8 +73,8 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int l1 = 0; l1 < l; ++l1) { int k2 = world.getBlockId(i, j + l1, k); - if (world.isAir(i, j + l1, k) || k2 == Block.LEAVES.id) { - world.setBlockInChunk(i, j + l1, k, Block.LOG.id); + if (world.method_234(i, j + l1, k) || k2 == Block.LEAVES.id) { + world.method_200(i, j + l1, k, Block.LOG.id); } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/PlantBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/PlantBlockMixin.java index c4b68a3d..07cb2af7 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/PlantBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/PlantBlockMixin.java @@ -13,12 +13,12 @@ @Mixin(PlantBlock.class) public class PlantBlockMixin { - @ModifyExpressionValue(method = "canPlaceAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/PlantBlock;canPlantOnTopOf(I)Z")) + @ModifyExpressionValue(method = "canPlaceAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/PlantBlock;method_1683(I)Z")) private boolean btw$canPlaceAt(boolean original, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { return original || FCUtilsMisc.CanPlantGrowOnBlock(arg, i, j - 1, k, (Block)(Object) this); } - @ModifyExpressionValue(method = "canGrow", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/PlantBlock;canPlantOnTopOf(I)Z")) + @ModifyExpressionValue(method = "canGrow", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/PlantBlock;method_1683(I)Z")) private boolean btw$canGrow(boolean original, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k) { return original || FCUtilsMisc.CanPlantGrowOnBlock(arg, i, j - 1, k, (Block)(Object) this); } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SeedsItemMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SeedsItemMixin.java index 381e5d4b..e37dd68d 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SeedsItemMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SeedsItemMixin.java @@ -20,7 +20,7 @@ public class SeedsItemMixin { @ModifyExpressionValue(method = "useOnBlock", at = @At(value = "FIELD", target = "Lnet/minecraft/block/Block;id:I", ordinal = 0)) private int btw$useOnBlock(int value, @Local World world, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k, @Local(ordinal = 4) int i1) { - if (FCUtilsMisc.CanPlantGrowOnBlock(world, i, j, k, Block.BY_ID[this.cropBlockId])) { + if (FCUtilsMisc.CanPlantGrowOnBlock(world, i, j, k, Block.BLOCKS[this.cropBlockId])) { return i1; } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SpruceTreeFeatureMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SpruceTreeFeatureMixin.java index 4d5cf701..c4804aef 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SpruceTreeFeatureMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SpruceTreeFeatureMixin.java @@ -8,7 +8,7 @@ import net.minecraft.FCUtilsMisc; import net.minecraft.block.Block; import net.minecraft.world.World; -import net.minecraft.world.feature.SpruceTreeFeature; +import net.minecraft.world.gen.feature.SpruceTreeFeature; @Mixin(SpruceTreeFeature.class) public class SpruceTreeFeatureMixin { @@ -36,7 +36,7 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int j3 = k - j2; j3 <= k + j2 && flag; ++j3) { if (l1 >= 0 && l1 < 128) { int k3 = world.getBlockId(l2, l1, j3); - if (!world.isAir(l2, l1, j3) && k3 != Block.LEAVES.id) { + if (!world.method_234(l2, l1, j3) && k3 != Block.LEAVES.id) { flag = false; } } else { @@ -50,9 +50,9 @@ public boolean generate(World world, Random random, int i, int j, int k) { return false; } else { int i2 = world.getBlockId(i, j - 1, k); - if ((i2 == Block.GRASS.id || i2 == Block.DIRT.id || FCUtilsMisc.CanPlantGrowOnBlock(world, i, j - 1, k, Block.SAPLING)) && j < 128 - l - 1) { - if (i2 == Block.GRASS.id) { - world.setBlockInChunk(i, j - 1, k, Block.DIRT.id); + if ((i2 == Block.GRASS_BLOCK.id || i2 == Block.DIRT.id || FCUtilsMisc.CanPlantGrowOnBlock(world, i, j - 1, k, Block.SAPLING)) && j < 128 - l - 1) { + if (i2 == Block.GRASS_BLOCK.id) { + world.method_200(i, j - 1, k, Block.DIRT.id); } int k2 = random.nextInt(2); @@ -67,8 +67,8 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int k5 = k - k2; k5 <= k + k2; ++k5) { int l5 = k5 - k; - if ((Math.abs(j5) != k2 || Math.abs(l5) != k2 || k2 <= 0) && !Block.FULL_OPAQUE[world.getBlockId(l4, j4, k5)]) { - world.setBlockWithMetadata(l4, j4, k5, Block.LEAVES.id, 1); + if ((Math.abs(j5) != k2 || Math.abs(l5) != k2 || k2 <= 0) && !Block.BLOCKS_OPAQUE[world.getBlockId(l4, j4, k5)]) { + world.method_154(l4, j4, k5, Block.LEAVES.id, 1); } } } @@ -88,8 +88,8 @@ public boolean generate(World world, Random random, int i, int j, int k) { for(int k4 = 0; k4 < l - i4; ++k4) { int i5 = world.getBlockId(i, j + k4, k); - if (world.isAir(i, j + k4, k) || i5 == Block.LEAVES.id) { - world.setBlockWithMetadata(i, j + k4, k, Block.LOG.id, 1); + if (world.method_234(i, j + k4, k) || i5 == Block.LEAVES.id) { + world.method_154(i, j + k4, k, Block.LOG.id, 1); } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SugarCaneBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SugarCaneBlockMixin.java index 297aaaf0..046225e2 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SugarCaneBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/SugarCaneBlockMixin.java @@ -26,7 +26,7 @@ public class SugarCaneBlockMixin { @ModifyReturnValue(method = "canPlaceAt", at = @At(value = "RETURN", ordinal = 5)) private boolean btw$canPlaceAt(boolean original, @Local World arg, @Local(ordinal = 0) int i, @Local(ordinal = 1) int j, @Local(ordinal = 2) int k, @Local(ordinal = 3) int l) { - Block blockBelow = Block.BY_ID[l]; + Block blockBelow = Block.BLOCKS[l]; if (blockBelow instanceof FCISoil && ((FCISoil)blockBelow).IsBlockConsideredNeighbouringWater(arg, i, j - 1, k)) { return true; } else { diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/TallGrassBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/TallGrassBlockMixin.java index 47c4b776..3d52a500 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/TallGrassBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/TallGrassBlockMixin.java @@ -6,13 +6,12 @@ import com.llamalad7.mixinextras.sugar.Local; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; - -import net.minecraft.block.TallGrassBlock; +import net.minecraft.block.TallPlantBlock; import net.minecraft.mod_FCBetterThanWolves; -@Mixin(TallGrassBlock.class) +@Mixin(TallPlantBlock.class) public class TallGrassBlockMixin { - @ModifyReturnValue(method = "getDropId", at = @At("RETURN")) + @ModifyReturnValue(method = "getDroppedItemId", at = @At("RETURN")) private int btw$getDropId(int value, @Local Random random) { if (value == -1) { return random.nextInt(50) == 0 ? mod_FCBetterThanWolves.fcHempSeeds.id : -1; diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/WolfEntityMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/WolfEntityMixin.java index e3b0ef2c..a0d159de 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/WolfEntityMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/betterthanwolves/WolfEntityMixin.java @@ -4,35 +4,36 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.entity.AbstractAnimalEntity; import net.minecraft.entity.ItemEntity; -import net.minecraft.entity.animal.WolfEntity; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.WolfEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.FoodItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.food.FoodItem; import net.minecraft.mod_FCBetterThanWolves; -import net.minecraft.util.io.CompoundTag; -import net.minecraft.util.math.AxixAlignedBoundingBox; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @Mixin(WolfEntity.class) -public abstract class WolfEntityMixin extends AbstractAnimalEntity { +public abstract class WolfEntityMixin extends AnimalEntity { @Shadow - public abstract void setAngry(boolean bl); + public abstract void method_430(boolean bl); + @Unique private boolean bIsFed; public WolfEntityMixin(World arg) { @@ -44,27 +45,27 @@ public WolfEntityMixin(World arg) { this.bIsFed = false; } - @Inject(method = "writeAdditional", at = @At("RETURN")) - private void btw$writeAdditional(CompoundTag par1, CallbackInfo ci) { - par1.put("bIsFed", this.bIsFed); + @Inject(method = "writeNbt", at = @At("RETURN")) + private void btw$writeAdditional(NbtCompound par1, CallbackInfo ci) { + par1.putBoolean("bIsFed", this.bIsFed); } - @Inject(method = "readAdditional", at = @At("RETURN")) - private void btw$readAdditional(CompoundTag par1, CallbackInfo ci) { + @Inject(method = "readNbt", at = @At("RETURN")) + private void btw$readAdditional(NbtCompound par1, CallbackInfo ci) { this.bIsFed = par1.getBoolean("bIsFed"); } - @ModifyReturnValue(method = "getMobDrops", at = @At("RETURN")) + @ModifyReturnValue(method = "method_914", at = @At("RETURN")) private int btw$getMobDrops(int original) { - return !this.world.isClient ? mod_FCBetterThanWolves.fcWolfRaw.id : original; + return !this.world.isRemote ? mod_FCBetterThanWolves.fcWolfRaw.id : original; } - @Redirect(method = "tickHandSwing", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getPlayerByName(Ljava/lang/String;)Lnet/minecraft/entity/player/PlayerEntity;", ordinal = 0)) - private PlayerEntity btw$tickHandSwing(World instance, String s) { - PlayerEntity value = instance.getPlayerByName(s); + @WrapOperation(method = "method_910", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;method_177(Ljava/lang/String;)Lnet/minecraft/entity/player/PlayerEntity;", ordinal = 0)) + private PlayerEntity btw$tickHandSwing(World instance, String s, Operation original) { + PlayerEntity value = original.call(instance, s); - if (!this.world.isClient) { - value = this.world.getClosestPlayerTo(this, -1.0); + if (!this.world.isRemote) { + value = this.world.method_186(this, -1.0); } return value; @@ -72,7 +73,7 @@ public WolfEntityMixin(World arg) { @Inject(method = "tick", at = @At("RETURN")) private void btw$tick(CallbackInfo ci) { - if (!this.world.isClient && !this.removed) { + if (!this.world.isRemote && !this.dead) { this.CheckForLooseFood(); int chanceOfShitting = 1; if (this.IsDarkEnoughToAffectShitting()) { @@ -83,7 +84,7 @@ public WolfEntityMixin(World arg) { chanceOfShitting *= 4; } - if (this.world.rand.nextInt(96000) < chanceOfShitting) { + if (this.world.field_214.nextInt(96000) < chanceOfShitting) { this.Shit(); } } @@ -93,25 +94,25 @@ public boolean IsDarkEnoughToAffectShitting() { int i = MathHelper.floor(this.x); int j = MathHelper.floor(this.y); int k = MathHelper.floor(this.z); - int lightValue = this.world.placeBlock(i, j, k); + int lightValue = this.world.method_255(i, j, k); return lightValue <= 5; } public void CheckForLooseFood() { List collisionList = this.world - .getEntities( - ItemEntity.class, AxixAlignedBoundingBox.createAndAddToList(this.x - 2.5, this.y - 1.0, this.z - 2.5, this.x + 2.5, this.y + 1.0, this.z + 2.5) + .method_175( + ItemEntity.class, Box.createCached(this.x - 2.5, this.y - 1.0, this.z - 2.5, this.x + 2.5, this.y + 1.0, this.z + 2.5) ); if (!collisionList.isEmpty()) { for(int listIndex = 0; listIndex < collisionList.size(); ++listIndex) { ItemEntity entityItem = (ItemEntity)collisionList.get(listIndex); if (entityItem.pickupDelay == 0) { int iTempItemID = entityItem.stack.itemId; - Item tempItem = Item.byId[iTempItemID]; - if (tempItem instanceof FoodItem && ((FoodItem)tempItem).canWolvesEat()) { - this.world.playSound(this, "random.pop", 0.25F, ((this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); - entityItem.remove(); - this.addHealth(((FoodItem)Item.RAW_PORKCHOP).getHealAmount()); + Item tempItem = Item.ITEMS[iTempItemID]; + if (tempItem instanceof FoodItem && ((FoodItem)tempItem).isMeat()) { + this.world.playSound(this, "random.pop", 0.25F, ((this.world.field_214.nextFloat() - this.world.field_214.nextFloat()) * 0.7F + 1.0F) * 2.0F); + entityItem.markDead(); + this.method_939(((FoodItem)Item.RAW_PORKCHOP).getHealthRestored()); this.bIsFed = true; } } @@ -127,22 +128,22 @@ public void Shit() { this.world, this.x + (double)xOffset, this.y + (double)yOffset, this.z + (double)zOffset, new ItemStack(mod_FCBetterThanWolves.fcDung) ); float velocityFactor = 0.05F; - entityitem.xVelocity = (double)( + entityitem.velocityX = (double)( -(-MathHelper.sin(this.yaw / 180.0F * 3.141593F) * MathHelper.cos(this.pitch / 180.0F * 3.141593F)) * 10.0F * velocityFactor ); - entityitem.zVelocity = (double)( + entityitem.velocityZ = (double)( -(MathHelper.cos(this.yaw / 180.0F * 3.141593F) * MathHelper.cos(this.pitch / 180.0F * 3.141593F)) * 10.0F * velocityFactor ); - entityitem.yVelocity = (double)((float)this.world.rand.nextGaussian() * velocityFactor + 0.2F); + entityitem.velocityY = (double)((float)this.world.field_214.nextGaussian() * velocityFactor + 0.2F); entityitem.pickupDelay = 10; - this.world.spawnEntity(entityitem); + this.world.method_210(entityitem); this.world.playSound(this, "random.explode", 0.2F, 1.25F); - this.world.playSound(this, "mob.wolf.growl", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.world.playSound(this, "mob.wolf.growl", this.method_915(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); for(int counter = 0; counter < 5; ++counter) { - double smokeX = this.x + (double)(xOffset * 0.5F) + this.world.rand.nextDouble() * 0.25; - double smokeY = this.y + this.world.rand.nextDouble() * 0.5 + 0.25; - double smokeZ = this.z + (double)(zOffset * 0.5F) + this.world.rand.nextDouble() * 0.25; + double smokeX = this.x + (double)(xOffset * 0.5F) + this.world.field_214.nextDouble() * 0.25; + double smokeY = this.y + this.world.field_214.nextDouble() * 0.5 + 0.25; + double smokeZ = this.z + (double)(zOffset * 0.5F) + this.world.field_214.nextDouble() * 0.25; this.world.addParticle("smoke", smokeX, smokeY, smokeZ, 0.0, 0.0, 0.0); } @@ -151,26 +152,26 @@ public void Shit() { @ModifyExpressionValue(method = "damage", at = @At(value = "INVOKE", target = "Ljava/lang/String;equalsIgnoreCase(Ljava/lang/String;)Z", remap = false)) private boolean btw$damage(boolean value) { - return value || !this.world.isClient; + return value || !this.world.isRemote; } - @Inject(method = "interact", at = @At(value = "RETURN", ordinal = 1)) + @Inject(method = "method_1323", at = @At(value = "RETURN", ordinal = 1)) private void btw$interact$1(PlayerEntity par1, CallbackInfoReturnable cir) { this.bIsFed = true; } - @Inject(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/food/FoodItem;canWolvesEat()Z")) + @Inject(method = "method_1323", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/FoodItem;isMeat()Z")) private void btw$interact$2(PlayerEntity par1, CallbackInfoReturnable cir, @Local FoodItem itemfood) { - if (!(itemfood.canWolvesEat() && this.dataTracker.getInt(18) < 20)) { + if (!(itemfood.isMeat() && this.dataTracker.getInt(18) < 20)) { if (itemfood.id == mod_FCBetterThanWolves.fcWolfRaw.id || itemfood.id == mod_FCBetterThanWolves.fcWolfCooked.id) { - this.world.playSound(this, "mob.wolf.growl", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.setAngry(true); + this.world.playSound(this, "mob.wolf.growl", this.method_915(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.method_430(true); } } } - @ModifyExpressionValue(method = "interact", at = @At(value = "INVOKE", target = "Ljava/lang/String;equalsIgnoreCase(Ljava/lang/String;)Z", remap = false)) + @ModifyExpressionValue(method = "method_1323", at = @At(value = "INVOKE", target = "Ljava/lang/String;equalsIgnoreCase(Ljava/lang/String;)Z", remap = false)) private boolean btw$interact$3(boolean value) { - return value || !this.world.isClient; + return value || !this.world.isRemote; } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/incrediblefungus/FireBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/incrediblefungus/FireBlockMixin.java index b0439895..b2afc893 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/incrediblefungus/FireBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/incrediblefungus/FireBlockMixin.java @@ -8,13 +8,13 @@ import net.minecraft.block.Block; import net.minecraft.block.FireBlock; -import net.minecraft.block.material.Material; +import net.minecraft.block.Material; import net.minecraft.mod_Fungus; @Mixin(FireBlock.class) public abstract class FireBlockMixin extends Block { @Shadow - protected abstract void addBurnable(int i, int j, int k); + protected abstract void method_1822(int i, int j, int k); protected FireBlockMixin(int i, Material arg) { super(i, arg); @@ -22,6 +22,6 @@ protected FireBlockMixin(int i, Material arg) { @Inject(method = "init", at = @At("RETURN")) private void incrediblefungus$init(CallbackInfo ci) { - this.addBurnable(mod_Fungus.fungus.id, 300, 300); + this.method_1822(mod_Fungus.fungus.id, 300, 300); } } diff --git a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/somnia/BedBlockMixin.java b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/somnia/BedBlockMixin.java index e818ac8a..e4e5ebe1 100644 --- a/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/somnia/BedBlockMixin.java +++ b/apron-compat/src/main/java/io/github/betterthanupdates/apron/compat/mixin/client/somnia/BedBlockMixin.java @@ -8,7 +8,7 @@ import net.minecraft.block.BedBlock; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; +import net.minecraft.block.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.mod_Somnia; import net.minecraft.world.World; @@ -21,7 +21,7 @@ protected BedBlockMixin(int i, Material arg) { @Inject(method = "", at = @At("RETURN")) private void somnia$ctr(int par1, CallbackInfo ci) { - this.setSounds(Block.WOOL_SOUNDS); + this.setSoundGroup(Block.WOOL_SOUND_GROUP); } @Override @@ -29,7 +29,7 @@ public Block setHardness(float f) { return super.setHardness(0.8F); } - @Inject(method = "canUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;trySleep(III)Lnet/minecraft/util/SleepStatus;"), cancellable = true) + @Inject(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;method_495(III)Lnet/minecraft/class_141;"), cancellable = true) private void somnia$canUse(World world, int i, int j, int k, PlayerEntity entityplayer, CallbackInfoReturnable cir) { if (mod_Somnia.isValidActivation(world, entityplayer)) { mod_Somnia.openGuiBedIfPossible(entityplayer, world, i, j, k);