-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40ebae7
commit 82e9ffc
Showing
5 changed files
with
129 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/turniplabs/halplibe/mixin/mixins/GuiRenderItemMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package turniplabs.halplibe.mixin.mixins; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.client.gui.GuiRenderItem; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.player.inventory.slot.Slot; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import turniplabs.halplibe.HalpLibe; | ||
|
||
@Mixin( | ||
value = GuiRenderItem.class, | ||
remap = false | ||
) | ||
public class GuiRenderItemMixin extends Gui { | ||
|
||
@Shadow | ||
Minecraft mc; | ||
|
||
@Inject(method = "render(Lnet/minecraft/core/item/ItemStack;IIZLnet/minecraft/core/player/inventory/slot/Slot;)V", at = @At("HEAD")) | ||
public void render(ItemStack itemStack, int x, int y, boolean isSelected, Slot slot, CallbackInfo ci) { | ||
if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ | ||
slot.discovered = true; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/turniplabs/halplibe/mixin/mixins/MobPageMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package turniplabs.halplibe.mixin.mixins; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.guidebook.GuidebookSection; | ||
import net.minecraft.client.gui.guidebook.mobs.MobInfoRegistry; | ||
import net.minecraft.client.gui.guidebook.mobs.MobPage; | ||
import net.minecraft.client.render.FontRenderer; | ||
import net.minecraft.client.render.RenderEngine; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import turniplabs.halplibe.HalpLibe; | ||
|
||
@Mixin(value = MobPage.class, remap = false) | ||
public class MobPageMixin { | ||
@Shadow private boolean discovered; | ||
|
||
@Shadow @Final private static Minecraft mc; | ||
|
||
@Inject(method = "<init>", at = @At("RETURN")) | ||
private void onMobPageInit(GuidebookSection section, Class<?> mobClass, MobInfoRegistry.MobInfo mobInfo, CallbackInfo ci) { | ||
if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ | ||
discovered = true; | ||
} | ||
} | ||
|
||
@Inject(method = "renderForeground", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/guidebook/mobs/MobPage;discovered:Z", ordinal = 0, shift = At.Shift.AFTER)) | ||
public void setDiscovered(RenderEngine re, FontRenderer fr, int x, int y, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { | ||
if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ | ||
discovered = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,61 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "turniplabs.halplibe.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"accessors.BlockFireAccessor", | ||
"accessors.EntityFireflyFXAccessor", | ||
"accessors.EntityFXAccessor", | ||
"accessors.EntityListAccessor", | ||
"accessors.LanguageAccessor", | ||
"accessors.TileEntityAccessor", | ||
"accessors.WeightedRandomBagAccessor", | ||
"accessors.WeightedRandomBagEntryAccessor", | ||
"mixins.ArmorMaterialMixin", | ||
"mixins.BlockFireMixin", | ||
"mixins.BlockLanternFireflyMixin", | ||
"mixins.BlockMixin", | ||
"mixins.BlockSoundDispatcherMixin", | ||
"mixins.ContainerPlayerCreativeMixin", | ||
"mixins.EntityFireflyClusterMixin", | ||
"mixins.EntityFireflyFXMixin", | ||
"mixins.I18nMixin", | ||
"mixins.ItemJarMixin", | ||
"mixins.ItemStackJsonAdapterMixin", | ||
"mixins.RegistryMixin", | ||
"mixins.TileEntityBlastFurnaceMixin", | ||
"mixins.TileEntityFurnaceMixin", | ||
"mixins.commands.CommandsCoreMixin", | ||
"mixins.network.PacketMixin", | ||
"mixins.registry.BlockMixin", | ||
"mixins.registry.ItemMixin", | ||
"mixins.version.NetHandlerMixin" | ||
], | ||
"client": [ | ||
"accessors.RenderManagerAccessor", | ||
"accessors.TileEntityRendererAccessor", | ||
"mixins.EntityClientPlayerMPMixin", | ||
"mixins.GuiIngameMenuMixin", | ||
"mixins.MinecraftMixin", | ||
"mixins.PlayerRendererMixin", | ||
"mixins.RenderEngineMixin", | ||
"mixins.RenderGlobalMixin", | ||
"mixins.commands.CommandsClientMixin", | ||
"mixins.network.MinecraftMixin", | ||
"mixins.registry.MinecraftMixin", | ||
"mixins.version.NetClientHandlerMixin" | ||
], | ||
"server": [ | ||
"mixins.MinecraftServerMixin", | ||
"mixins.commands.CommandsServerMixin", | ||
"mixins.network.MinecraftServerMixin", | ||
"mixins.registry.MinecraftServerMixin", | ||
"mixins.version.NetLoginHandlerMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "turniplabs.halplibe.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"accessors.BlockFireAccessor", | ||
"accessors.EntityFireflyFXAccessor", | ||
"accessors.EntityFXAccessor", | ||
"accessors.EntityListAccessor", | ||
"accessors.LanguageAccessor", | ||
"accessors.TileEntityAccessor", | ||
"accessors.WeightedRandomBagAccessor", | ||
"accessors.WeightedRandomBagEntryAccessor", | ||
"mixins.ArmorMaterialMixin", | ||
"mixins.BlockFireMixin", | ||
"mixins.BlockLanternFireflyMixin", | ||
"mixins.BlockMixin", | ||
"mixins.BlockSoundDispatcherMixin", | ||
"mixins.ContainerPlayerCreativeMixin", | ||
"mixins.EntityFireflyClusterMixin", | ||
"mixins.EntityFireflyFXMixin", | ||
"mixins.I18nMixin", | ||
"mixins.ItemJarMixin", | ||
"mixins.ItemStackJsonAdapterMixin", | ||
"mixins.RegistryMixin", | ||
"mixins.TileEntityBlastFurnaceMixin", | ||
"mixins.TileEntityFurnaceMixin", | ||
"mixins.commands.CommandsCoreMixin", | ||
"mixins.network.PacketMixin", | ||
"mixins.registry.BlockMixin", | ||
"mixins.registry.ItemMixin", | ||
"mixins.version.NetHandlerMixin" | ||
], | ||
"client": [ | ||
"accessors.RenderManagerAccessor", | ||
"accessors.TileEntityRendererAccessor", | ||
"mixins.EntityClientPlayerMPMixin", | ||
"mixins.GuiIngameMenuMixin", | ||
"mixins.MinecraftMixin", | ||
"mixins.PlayerRendererMixin", | ||
"mixins.RenderEngineMixin", | ||
"mixins.RenderGlobalMixin", | ||
"mixins.commands.CommandsClientMixin", | ||
"mixins.network.MinecraftMixin", | ||
"mixins.registry.MinecraftMixin", | ||
"mixins.version.NetClientHandlerMixin", | ||
"mixins.MobPageMixin", | ||
"mixins.GuiRenderItemMixin" | ||
], | ||
"server": [ | ||
"mixins.MinecraftServerMixin", | ||
"mixins.commands.CommandsServerMixin", | ||
"mixins.network.MinecraftServerMixin", | ||
"mixins.registry.MinecraftServerMixin", | ||
"mixins.version.NetLoginHandlerMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |