-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TileThaumcraftInventory trying to send packets to the client on t…
…he client side (#57)
- Loading branch information
1 parent
ee6c8fa
commit 6a22635
Showing
16 changed files
with
116 additions
and
15 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
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
42 changes: 42 additions & 0 deletions
42
src/main/java/thecodex6824/thaumcraftfix/mixin/tile/TileThaumcraftInventoryMixin.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,42 @@ | ||
/** | ||
* Thaumcraft Fix | ||
* Copyright (c) 2024 TheCodex6824. | ||
* | ||
* This file is part of Thaumcraft Fix. | ||
* | ||
* Thaumcraft Fix is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Thaumcraft Fix is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package thecodex6824.thaumcraftfix.mixin.tile; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
|
||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import thaumcraft.common.tiles.TileThaumcraft; | ||
import thaumcraft.common.tiles.TileThaumcraftInventory; | ||
|
||
@Mixin(TileThaumcraftInventory.class) | ||
public class TileThaumcraftInventoryMixin extends TileThaumcraft { | ||
|
||
@WrapMethod(method = "syncSlots", remap = false) | ||
private void wrapSyncSlots(EntityPlayerMP player, Operation<Void> original) { | ||
if (!world.isRemote) { | ||
original.call(player); | ||
} | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"package": "thecodex6824.thaumcraftfix.mixin.tile", | ||
"refmap": "${refmap}", | ||
"minVersion": "${mixinminversion}", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"TileThaumcraftInventoryMixin" | ||
] | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/test/java/thecodex6824/thaumcraftfix/test/TestTileThaumcraftInventory.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,22 @@ | ||
package thecodex6824.thaumcraftfix.test; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import net.minecraft.init.Items; | ||
import net.minecraft.item.ItemStack; | ||
import thaumcraft.common.tiles.crafting.TileResearchTable; | ||
import thecodex6824.thaumcraftfix.test.lib.MockWorld; | ||
|
||
public class TestTileThaumcraftInventory { | ||
|
||
@Test | ||
public void testSyncSlotsClient() { | ||
TileResearchTable table = new TileResearchTable() { | ||
@Override | ||
public void markDirty() {} | ||
}; | ||
table.setWorld(new MockWorld(true)); | ||
table.setInventorySlotContents(1, new ItemStack(Items.PAPER, 64)); | ||
} | ||
|
||
} |
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