-
Notifications
You must be signed in to change notification settings - Fork 12
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
Showing
27 changed files
with
345 additions
and
90 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
21 changes: 21 additions & 0 deletions
21
client/src/main/java/com/fox2code/foxloader/client/gui/ContainerWrapped.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,21 @@ | ||
package com.fox2code.foxloader.client.gui; | ||
|
||
import net.minecraft.src.client.gui.Container; | ||
|
||
/** | ||
* Tells FoxLoader that the container is a wrapped container. | ||
* <p> | ||
* If your container has client side only inventory slots please use {@link InventoryClientOnly} too | ||
*/ | ||
public interface ContainerWrapped { | ||
Container getParentContainer(); | ||
|
||
static Container getNetworkContainer(Container container) { | ||
int antiSoftLock = 0; | ||
while (container instanceof ContainerWrapped) { | ||
container = ((ContainerWrapped) container).getParentContainer(); | ||
if (antiSoftLock++>100) return null; | ||
} | ||
return container; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
client/src/main/java/com/fox2code/foxloader/client/gui/InventoryBasicClientOnly.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,9 @@ | ||
package com.fox2code.foxloader.client.gui; | ||
|
||
import net.minecraft.src.client.inventory.InventoryBasic; | ||
|
||
public class InventoryBasicClientOnly extends InventoryBasic implements InventoryClientOnly { | ||
public InventoryBasicClientOnly(String var1, int var2) { | ||
super(var1, var2); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
client/src/main/java/com/fox2code/foxloader/client/gui/InventoryClientOnly.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,9 @@ | ||
package com.fox2code.foxloader.client.gui; | ||
|
||
import net.minecraft.src.client.inventory.IInventory; | ||
|
||
/** | ||
* Mark a {@link IInventory} as client side only, and to avoid any network inconsistencies | ||
*/ | ||
public interface InventoryClientOnly extends IInventory { | ||
} |
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
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
27 changes: 27 additions & 0 deletions
27
client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiIngameMenu.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,27 @@ | ||
package com.fox2code.foxloader.client.mixins; | ||
|
||
import com.fox2code.foxloader.client.gui.GuiModList; | ||
import com.fox2code.foxloader.client.gui.GuiUpdateButton; | ||
import net.minecraft.src.client.gui.GuiButton; | ||
import net.minecraft.src.client.gui.GuiIngameMenu; | ||
import net.minecraft.src.client.gui.GuiScreen; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(GuiIngameMenu.class) | ||
public class MixinGuiIngameMenu extends GuiScreen { | ||
@Inject(method = "initGui", at = @At(value = "RETURN")) | ||
public void onInitGui(CallbackInfo ci) { | ||
this.controlList.add(new GuiUpdateButton(500, this.width - 62, 2, 60, 20, "Mods")); | ||
} | ||
|
||
@Inject(method = "actionPerformed", at = @At(value = "HEAD"), cancellable = true) | ||
public void onActionPerformed(GuiButton var1, CallbackInfo ci) { | ||
if (var1.id == 500) { | ||
this.mc.displayGuiScreen(new GuiModList(this)); | ||
ci.cancel(); | ||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.