mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-21 12:32:09 +00:00
Streamline codepaths and add SU compat for permission checking
This commit is contained in:
1 parent
bd76be4f6f
commit
5b0b9ba3c5
5 files changed
+211
-154
No files matched your search
@@ -1,12 +1,10 @@
|
||||
package com.gtnewhorizon.structurelib.item;
|
||||
|
||||
import static com.gtnewhorizon.structurelib.StructureLibAPI.MOD_ID;
|
||||
import static net.minecraft.util.EnumChatFormatting.BLUE;
|
||||
import static net.minecraft.util.StatCollector.translateToLocal;
|
||||
import static net.minecraft.util.StatCollector.translateToLocalFormatted;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gtnewhorizon.structurelib.StructureLib;
|
||||
import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor;
|
||||
import com.gtnewhorizon.structurelib.alignment.constructable.ConstructableUtility;
|
||||
import com.gtnewhorizon.structurelib.gui.GuiScreenConfigureChannels;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -16,15 +14,14 @@ import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.gtnewhorizon.structurelib.StructureLib;
|
||||
import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor;
|
||||
import com.gtnewhorizon.structurelib.alignment.constructable.ConstructableUtility;
|
||||
import com.gtnewhorizon.structurelib.gui.GuiScreenConfigureChannels;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import static com.gtnewhorizon.structurelib.StructureLibAPI.MOD_ID;
|
||||
import static net.minecraft.util.EnumChatFormatting.BLUE;
|
||||
import static net.minecraft.util.StatCollector.translateToLocal;
|
||||
import static net.minecraft.util.StatCollector.translateToLocalFormatted;
|
||||
|
||||
public class ItemConstructableTrigger extends Item {
|
||||
|
||||
@@ -32,6 +29,12 @@ public class ItemConstructableTrigger extends Item {
|
||||
|
||||
private static final IIcon[] textures = new IIcon[3];
|
||||
|
||||
public enum TriggerMode {
|
||||
BUILDING,
|
||||
UPDATING,
|
||||
REMOVING
|
||||
}
|
||||
|
||||
public ItemConstructableTrigger() {
|
||||
setUnlocalizedName("structurelib.constructableTrigger");
|
||||
setCreativeTab(StructureLib.creativeTab);
|
||||
@@ -86,13 +89,13 @@ public class ItemConstructableTrigger extends Item {
|
||||
+ StatCollector.translateToLocal("item.structurelib.constructableTrigger.modes." + mode);
|
||||
}
|
||||
|
||||
public static int getMode(ItemStack held) {
|
||||
public static TriggerMode getMode(ItemStack held) {
|
||||
if (held == null || !held.hasTagCompound() || !held.getTagCompound().hasKey(TAG_MODE)) {
|
||||
// default behavior
|
||||
return 0;
|
||||
return TriggerMode.BUILDING;
|
||||
}
|
||||
// get user-defined mode
|
||||
return held.getTagCompound().getInteger(TAG_MODE);
|
||||
return TriggerMode.values()[held.getTagCompound().getInteger(TAG_MODE)];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user