Backported GUI features and necessary classes from 1.12.

This commit is contained in:
luisc committed 2021-09-30 21:44:30 -05:00
1 parent 8b6e84a8d4
commit 95d2814651
46 files changed
+3675 -520

No files matched your search

@@ -2,10 +2,15 @@ package noppes.npcs.containers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.MathHelper;
import noppes.npcs.scripted.IContainer;
import noppes.npcs.scripted.ScriptContainer;
public class ContainerNpcInterface extends Container{
private int posX, posZ;
public EntityPlayer player;
public IContainer scriptContainer;
public ContainerNpcInterface(EntityPlayer player){
posX = MathHelper.floor_double(player.posX);
@@ -18,4 +23,11 @@ public class ContainerNpcInterface extends Container{
return !player.isDead && posX == MathHelper.floor_double(player.posX) && posZ == MathHelper.floor_double(player.posZ);
}
public static IContainer getOrCreateIContainer(ContainerNpcInterface container) {
if (container.scriptContainer != null) {
return container.scriptContainer;
} else {
return container.scriptContainer = new ScriptContainer(container);
}
}
}