mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 01:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a4d655c71 | ||
|
|
3639ade571 | ||
|
|
95daa9b035 | ||
|
|
f249fd2973 | ||
|
|
9f3f8243f9 | ||
|
|
23a5484ee8 | ||
|
|
4b5837cac2 | ||
|
|
1251427388 | ||
|
|
3e7d69f460 | ||
|
|
88725a144d | ||
|
|
123f22f20e |
No files matched your search
+9
-22
@@ -1,4 +1,4 @@
|
||||
//version: 1699290261
|
||||
//version: 1702141377
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
@@ -28,27 +28,12 @@ import java.util.concurrent.TimeUnit
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name 'forge'
|
||||
url 'https://maven.minecraftforge.net'
|
||||
}
|
||||
maven {
|
||||
// GTNH RetroFuturaGradle and ASM Fork
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
name 'sonatype'
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
maven {
|
||||
name 'Scala CI dependencies'
|
||||
url 'https://repo1.maven.org/maven2/'
|
||||
}
|
||||
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
@@ -69,7 +54,7 @@ plugins {
|
||||
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
|
||||
id 'com.modrinth.minotaur' version '2.+' apply false
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.26'
|
||||
}
|
||||
|
||||
print("You might want to check out './gradlew :faq' if your build fails.\n")
|
||||
@@ -302,7 +287,7 @@ if (apiPackage) {
|
||||
}
|
||||
|
||||
if (accessTransformersFile) {
|
||||
for (atFile in accessTransformersFile.split(",")) {
|
||||
for (atFile in accessTransformersFile.split(" ")) {
|
||||
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
|
||||
if (!getFile(targetFile).exists()) {
|
||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||
@@ -628,7 +613,7 @@ repositories {
|
||||
}
|
||||
maven {
|
||||
name = "ic2"
|
||||
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
|
||||
url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/")
|
||||
content {
|
||||
includeGroup "net.industrial-craft"
|
||||
}
|
||||
@@ -687,6 +672,8 @@ configurations.all {
|
||||
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
||||
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
||||
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
|
||||
|
||||
substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,12 +780,12 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def lwjgl3ifyVersion = '1.5.1'
|
||||
def lwjgl3ifyVersion = '1.5.7'
|
||||
if (modId != 'lwjgl3ify') {
|
||||
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
||||
}
|
||||
if (modId != 'hodgepodge') {
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
|
||||
}
|
||||
|
||||
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
|
||||
@@ -1310,7 +1297,7 @@ def addCurseForgeRelation(String type, String name) {
|
||||
|
||||
// Updating
|
||||
|
||||
def buildscriptGradleVersion = "8.2.1"
|
||||
def buildscriptGradleVersion = "8.5"
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
gradleVersion = buildscriptGradleVersion
|
||||
|
||||
+12
-12
@@ -1,22 +1,22 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.2.18:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.3.0:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.7.1:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
|
||||
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
|
||||
api('com.github.GTNewHorizons:BuildCraft:7.1.36:dev')
|
||||
api('com.github.GTNewHorizons:BuildCraft:7.1.38:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.6.2:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-280-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.77:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.1:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.12.1-GTNH:api') {transitive = false}
|
||||
implementation('com.github.GTNewHorizons:Chisel:2.12.0-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.19-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.6.5:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-304-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.3:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.06:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.3:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.12.2-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.12.3-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.0-GTNH:api') {transitive = false}
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -130,10 +130,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
|
||||
@@ -62,6 +62,7 @@ import crazypants.enderio.conduit.item.ItemItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.ItemBasicItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemBigItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemExistingItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemLimitedItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemModItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemPowerItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
|
||||
@@ -264,6 +265,7 @@ public class EnderIO {
|
||||
public static ItemBasicItemFilter itemBasicFilterUpgrade;
|
||||
public static ItemBigItemFilter itemBigFilterUpgrade;
|
||||
public static ItemExistingItemFilter itemExistingItemFilter;
|
||||
public static ItemLimitedItemFilter itemLimitedItemFilter;
|
||||
public static ItemModItemFilter itemModItemFilter;
|
||||
public static ItemPowerItemFilter itemPowerItemFilter;
|
||||
public static ItemExtractSpeedUpgrade itemExtractSpeedUpgrade;
|
||||
@@ -469,6 +471,7 @@ public class EnderIO {
|
||||
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
|
||||
itemBigFilterUpgrade = ItemBigItemFilter.create();
|
||||
itemExistingItemFilter = ItemExistingItemFilter.create();
|
||||
itemLimitedItemFilter = ItemLimitedItemFilter.create();
|
||||
itemModItemFilter = ItemModItemFilter.create();
|
||||
itemPowerItemFilter = ItemPowerItemFilter.create();
|
||||
itemExtractSpeedUpgrade = ItemExtractSpeedUpgrade.create();
|
||||
|
||||
@@ -18,6 +18,7 @@ public enum ModObject {
|
||||
itemBasicFilterUpgrade,
|
||||
itemBigFilterUpgrade,
|
||||
itemExistingItemFilter,
|
||||
itemLimitedItemFilter,
|
||||
itemModItemFilter,
|
||||
itemPowerItemFilter,
|
||||
itemExtractSpeedUpgrade,
|
||||
|
||||
@@ -641,8 +641,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (!player.isSneaking() || equipped == null || equipped.getItem() != EnderIO.itemYetaWench) {
|
||||
ITool tool = ToolUtil.getEquippedTool(player);
|
||||
if (!player.isSneaking() || tool == null || !tool.canUse(player.getCurrentEquippedItem(), player, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
ConduitUtil.openConduitGui(world, x, y, z, player);
|
||||
|
||||
@@ -601,6 +601,9 @@ public class ConduitRecipes {
|
||||
'f',
|
||||
advFilter);
|
||||
|
||||
ItemStack limitedFilter = new ItemStack(EnderIO.itemLimitedItemFilter, 1, 0);
|
||||
addShaped(limitedFilter, " ", "cfc", " ", 'c', new ItemStack(Items.comparator, 1, 0), 'f', advFilter);
|
||||
|
||||
ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter);
|
||||
addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.CycleButton;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.filter.FuzzyMode;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilter;
|
||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class LimitedItemFilterGui implements IItemFilterGui {
|
||||
|
||||
private static final int ID_WHITELIST = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_NBT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_META = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_ORE_DICT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_STICKY = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_FUZZY = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private final GuiContainerBaseEIO gui;
|
||||
|
||||
private final ToggleButton useMetaB;
|
||||
private final ToggleButton useNbtB;
|
||||
private final IconButton whiteListB;
|
||||
private final ToggleButton useOreDictB;
|
||||
private final ToggleButton stickyB;
|
||||
private final CycleButton<FuzzyMode> fuzzyB;
|
||||
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
private int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
final boolean isStickyModeAvailable;
|
||||
private boolean isInput;
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
|
||||
}
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
|
||||
this.gui = gui;
|
||||
this.isStickyModeAvailable = isStickyModeAvailable;
|
||||
this.filterContainer = filterContainer;
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.buttonIdOffset = buttonIdOffset;
|
||||
this.isInput = isInput;
|
||||
|
||||
filter = filterContainer.getItemFilter();
|
||||
|
||||
int butLeft = xOffset;
|
||||
int x = butLeft;
|
||||
int y = yOffset + 40;
|
||||
whiteListB = new IconButton(gui, ID_WHITELIST + buttonIdOffset, x, y, IconEIO.FILTER_WHITELIST);
|
||||
whiteListB.setToolTip(getWhitelistTooltips(false));
|
||||
|
||||
x += 16;
|
||||
useMetaB = new ToggleButton(gui, ID_META + buttonIdOffset, x, y, IconEIO.FILTER_META_OFF, IconEIO.FILTER_META);
|
||||
useMetaB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchMetaData"));
|
||||
useMetaB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreMetaData"));
|
||||
useMetaB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
stickyB = new ToggleButton(
|
||||
gui,
|
||||
ID_STICKY + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_STICKY_OFF,
|
||||
IconEIO.FILTER_STICKY);
|
||||
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
|
||||
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
|
||||
stickyB.setPaintSelectedBorder(false);
|
||||
|
||||
if (isStickyModeAvailable) x += 16;
|
||||
useOreDictB = new ToggleButton(
|
||||
gui,
|
||||
ID_ORE_DICT + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_ORE_DICT_OFF,
|
||||
IconEIO.FILTER_ORE_DICT);
|
||||
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
|
||||
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
useNbtB = new ToggleButton(gui, ID_NBT + buttonIdOffset, x, y, IconEIO.FILTER_NBT_OFF, IconEIO.FILTER_NBT);
|
||||
useNbtB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchNBT"));
|
||||
useNbtB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreNBT"));
|
||||
useNbtB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
}
|
||||
|
||||
public void createFilterSlots() {
|
||||
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
sendFilterChange();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int par3) {}
|
||||
|
||||
@Override
|
||||
public void updateButtons() {
|
||||
ItemFilter activeFilter = filter;
|
||||
|
||||
useNbtB.onGuiInit();
|
||||
useNbtB.setSelected(activeFilter.isMatchNBT());
|
||||
|
||||
useOreDictB.onGuiInit();
|
||||
useOreDictB.setSelected(activeFilter.isUseOreDict());
|
||||
|
||||
if (isStickyModeAvailable) {
|
||||
stickyB.onGuiInit();
|
||||
stickyB.setSelected(activeFilter.isSticky());
|
||||
}
|
||||
|
||||
fuzzyB.onGuiInit();
|
||||
fuzzyB.setMode(activeFilter.getFuzzyMode());
|
||||
|
||||
useMetaB.onGuiInit();
|
||||
useMetaB.setSelected(activeFilter.isMatchMeta());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
|
||||
if (guiButton.id == ID_META + buttonIdOffset) {
|
||||
filter.setMatchMeta(useMetaB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_NBT + buttonIdOffset) {
|
||||
filter.setMatchNBT(useNbtB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_STICKY + buttonIdOffset) {
|
||||
filter.setSticky(stickyB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_ORE_DICT + buttonIdOffset) {
|
||||
filter.setUseOreDict(useOreDictB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_FUZZY + buttonIdOffset) {
|
||||
filter.setFuzzyMode(fuzzyB.getMode());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_WHITELIST + buttonIdOffset) {
|
||||
filter.setBlacklist(!filter.isBlacklist());
|
||||
sendFilterChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFilterChange() {
|
||||
updateButtons();
|
||||
filterContainer.onFilterChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
useNbtB.detach();
|
||||
useMetaB.detach();
|
||||
useOreDictB.detach();
|
||||
whiteListB.detach();
|
||||
stickyB.detach();
|
||||
fuzzyB.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
gui.bindGuiTexture(1);
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset, 0, 238, 18 * 5, 18);
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset + 20, 0, 238, 18 * 5, 18);
|
||||
|
||||
}
|
||||
|
||||
private String[] getWhitelistTooltips(boolean isBlacklist) {
|
||||
if (isBlacklist) {
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.blacklist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1") };
|
||||
} else {
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.whitelist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1") };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.enderio.core.common.util.RoundRobinIterator;
|
||||
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilterLimited;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.invpanel.TileInventoryPanel;
|
||||
|
||||
@@ -155,6 +156,7 @@ public class NetworkedInventory {
|
||||
int numSlots = slotIndices.length;
|
||||
ItemStack extractItem = null;
|
||||
int maxExtracted = con.getMaximumExtracted(conDir);
|
||||
final IItemFilter filter = con.getInputFilter(conDir);
|
||||
|
||||
int slot = -1;
|
||||
int slotChecksPerTick = Math.min(numSlots, ItemConduitNetwork.MAX_SLOT_CHECK_PER_TICK);
|
||||
@@ -162,12 +164,23 @@ public class NetworkedInventory {
|
||||
int index = nextSlot(numSlots);
|
||||
slot = slotIndices[index];
|
||||
ItemStack item = getInventory().getStackInSlot(slot);
|
||||
if (canExtractItem(item)) {
|
||||
extractItem = item.copy();
|
||||
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
|
||||
if (doTransfer(extractItem, slot, maxExtracted)) {
|
||||
setNextStartingSlot(slot);
|
||||
return true;
|
||||
if (item != null) {
|
||||
if (filter != null && filter.isLimited()) {
|
||||
final int count = ((ItemFilterLimited) filter).getInsertLimitInv(getInventory(), item);
|
||||
if (count <= 0) {
|
||||
continue;
|
||||
} else if (count < item.stackSize) {
|
||||
item = item.copy();
|
||||
item.stackSize = count;
|
||||
}
|
||||
}
|
||||
if (canExtractItem(item)) {
|
||||
extractItem = item.copy();
|
||||
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
|
||||
if (doTransfer(extractItem, slot, maxExtracted)) {
|
||||
setNextStartingSlot(slot);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +196,11 @@ public class NetworkedInventory {
|
||||
if (filter == null) {
|
||||
return true;
|
||||
}
|
||||
return filter.doesItemPassFilter(this, itemStack);
|
||||
if (filter.isLimited()) {
|
||||
return filter.isValid() && ((ItemFilterLimited) filter).doesItemPassFilterInv(this, itemStack);
|
||||
} else {
|
||||
return filter.doesItemPassFilter(this, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean doTransfer(ItemStack extractedItem, int slot, int maxExtract) {
|
||||
@@ -278,7 +295,20 @@ public class NetworkedInventory {
|
||||
}
|
||||
IItemFilter filter = con.getOutputFilter(conDir);
|
||||
if (filter != null) {
|
||||
if (!filter.doesItemPassFilter(this, item)) {
|
||||
if (filter.isLimited()) {
|
||||
final int count = filter.getMaxCountThatCanPassFilter(item);
|
||||
if (count <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
final int maxInsert = ((ItemFilterLimited) filter).getInsertLimit(getInventory(), item);
|
||||
if (maxInsert <= 0) {
|
||||
return 0;
|
||||
} else if (maxInsert < item.stackSize) {
|
||||
item = item.copy();
|
||||
item.stackSize = maxInsert;
|
||||
}
|
||||
}
|
||||
} else if (!filter.doesItemPassFilter(this, item)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,18 @@ public interface IItemFilter {
|
||||
|
||||
boolean isValid();
|
||||
|
||||
default boolean isLimited() {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isSticky();
|
||||
|
||||
void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb);
|
||||
|
||||
default int getMaxCountThatCanPassFilter(ItemStack item) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getSlotCount();
|
||||
|
||||
default String getUnlocalizedName() {
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return isBlacklist ? !allow : allow;
|
||||
}
|
||||
|
||||
private boolean itemMatched(ItemStack item) {
|
||||
protected boolean itemMatched(ItemStack item) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return matched;
|
||||
}
|
||||
|
||||
private boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
|
||||
protected boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
|
||||
int[] ids1 = getCachedIds(filterItemIndex);
|
||||
if (ids1 == null || ids1.length == 0) {
|
||||
return false;
|
||||
@@ -164,8 +164,9 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isNBTMatch(ItemStack filter, ItemStack item) {
|
||||
if (filter.stackTagCompound == null && item.stackTagCompound == null) return true;
|
||||
protected boolean isNBTMatch(ItemStack filter, ItemStack item) {
|
||||
if (filter.stackTagCompound == null && (item.stackTagCompound == null || item.stackTagCompound.hasNoTags()))
|
||||
return true;
|
||||
if (filter.stackTagCompound == null || item.stackTagCompound == null) return false;
|
||||
if (!filter.getTagCompound().hasKey("GEN")) return filter.stackTagCompound.equals(item.stackTagCompound);
|
||||
NBTTagCompound filterTag = (NBTTagCompound) filter.getTagCompound().copy();
|
||||
@@ -202,7 +203,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return !isItemListEmpty();
|
||||
}
|
||||
|
||||
private boolean isItemListEmpty() {
|
||||
protected boolean isItemListEmpty() {
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
package crazypants.enderio.conduit.item.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.enderio.core.client.gui.widget.GhostSlot;
|
||||
|
||||
import cofh.lib.util.helpers.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.gui.item.IItemFilterGui;
|
||||
import crazypants.enderio.conduit.gui.item.ItemConduitFilterContainer;
|
||||
import crazypants.enderio.conduit.gui.item.LimitedItemFilterGui;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
|
||||
public class ItemFilterLimited extends ItemFilter {
|
||||
|
||||
public ItemFilterLimited() {
|
||||
this(10, true);
|
||||
}
|
||||
|
||||
public ItemFilterLimited(int numItems, boolean isAdvanced) {
|
||||
super(numItems, isAdvanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Limited Item Filter";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IItemFilterGui getGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
|
||||
ItemConduitFilterContainer cont = new ItemConduitFilterContainer(itemConduit, gui.getDir(), isInput);
|
||||
LimitedItemFilterGui limitedItemFilterGui = new LimitedItemFilterGui(gui, cont, !isInput, isInput);
|
||||
limitedItemFilterGui.createFilterSlots();
|
||||
return limitedItemFilterGui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
|
||||
int index = 0;
|
||||
int numRows = (int) (double) (items.length / 5);
|
||||
for (int row = 0; row < numRows; ++row) {
|
||||
for (int col = 0; col < 5; ++col) {
|
||||
int x = xOffset + col * 18;
|
||||
int y = yOffset + row * 20;
|
||||
slots.add(new ItemFilterGhostSlot(index, x, y, cb));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCountThatCanPassFilter(ItemStack item) {
|
||||
if (item == null || item.getItem() == null) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
ItemStack invStack = items[i];
|
||||
if (invStack != null && itemStackMatched(invStack, item, i)) {
|
||||
count += invStack.stackSize;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLimited() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getInsertLimit(ISidedInventory inv, ItemStack item) {
|
||||
if (item == null || item.getItem() == null) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack invStack = inv.getStackInSlot(i);
|
||||
if (invStack != null && itemStackMatched(invStack, item, i)) {
|
||||
count += invStack.stackSize;
|
||||
}
|
||||
}
|
||||
return getMaxCountThatCanPassFilter(item) - count;
|
||||
}
|
||||
|
||||
public int getInsertLimitInv(ISidedInventory inv, ItemStack item) {
|
||||
return -getInsertLimit(inv, item);
|
||||
}
|
||||
|
||||
public boolean doesCountPassFilter(int maxCount) {
|
||||
return maxCount > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesItemPassFilter(NetworkedInventory inv, ItemStack item) {
|
||||
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimit(inv.getInventory(), item));
|
||||
|
||||
}
|
||||
|
||||
// Filter in extract slot
|
||||
public boolean doesItemPassFilterInv(NetworkedInventory inv, ItemStack item) {
|
||||
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimitInv(inv.getInventory(), item));
|
||||
}
|
||||
|
||||
protected boolean itemStackMatched(ItemStack item, ItemStack filter, int slot) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean checkDamage = fuzzyMode != FuzzyMode.DISABLED;
|
||||
boolean damageMatched = false;
|
||||
if (checkDamage && item.getItem().isDamageable()) {
|
||||
damageMatched = fuzzyMode.compare(item);
|
||||
}
|
||||
|
||||
if (isItemListEmpty()) {
|
||||
if (checkDamage) {
|
||||
return damageMatched;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean matched = false;
|
||||
|
||||
if (filter != null && item.getItem() == filter.getItem()) {
|
||||
matched = true;
|
||||
|
||||
if (checkDamage && !damageMatched) {
|
||||
matched = false;
|
||||
} else if (matchMeta && item.getItemDamage() != filter.getItemDamage()) {
|
||||
matched = false;
|
||||
} else if (matchNBT && !isNBTMatch(item, filter)) {
|
||||
matched = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched && useOreDict && isOreDicMatch(filter, item)) {
|
||||
matched = true;
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
public boolean isOreDicMatch(ItemStack filter, ItemStack item) {
|
||||
int[] id_filter = OreDictionary.getOreIDs(filter);
|
||||
if (id_filter.length == 0) {
|
||||
return false;
|
||||
}
|
||||
int[] id_item = OreDictionary.getOreIDs(item);
|
||||
if (id_item.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int id1 : id_filter) {
|
||||
for (int id2 : id_item) {
|
||||
if (id1 == id2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int fromSlot, int amount) {
|
||||
if ((fromSlot < 0) || (fromSlot >= items.length)) {
|
||||
return null;
|
||||
}
|
||||
oreIds.set(fromSlot, null);
|
||||
ItemStack item = items[fromSlot];
|
||||
items[fromSlot] = null;
|
||||
return item.splitStack(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Limited" + super.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "gui.limited_item_filter";
|
||||
}
|
||||
|
||||
class ItemFilterGhostSlot extends GhostSlot {
|
||||
|
||||
private final int slot;
|
||||
private final Runnable cb;
|
||||
|
||||
private final int adjustOnShift;
|
||||
|
||||
ItemFilterGhostSlot(int slot, int x, int y, Runnable cb) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.slot = slot;
|
||||
this.cb = cb;
|
||||
this.displayStdOverlay = true;
|
||||
this.stackSizeLimit = 64;
|
||||
this.adjustOnShift = 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
stack = stack.copy();
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
if (Mouse.isButtonDown(0) || Mouse.getEventDWheel() > 0) {
|
||||
if (stack.stackSize - 1 == 1) {
|
||||
stack.stackSize += adjustOnShift - 2;
|
||||
} else {
|
||||
stack.stackSize = MathHelper
|
||||
.clamp(stack.stackSize + adjustOnShift - 1, 1, stack.getMaxStackSize());
|
||||
}
|
||||
} else if (Mouse.isButtonDown(1) || Mouse.getEventDWheel() < 0) {
|
||||
if (stack.stackSize + 1 == 1) {
|
||||
stack.stackSize++;
|
||||
} else {
|
||||
stack.stackSize = MathHelper
|
||||
.clamp(stack.stackSize - adjustOnShift + 1, 1, stack.getMaxStackSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
items[slot] = stack;
|
||||
cb.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return items[slot];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package crazypants.enderio.conduit.item.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import com.enderio.core.client.handlers.SpecialTooltipHandler;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.item.FilterRegister;
|
||||
|
||||
public class ItemLimitedItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
|
||||
|
||||
public static ItemLimitedItemFilter create() {
|
||||
ItemLimitedItemFilter result = new ItemLimitedItemFilter();
|
||||
result.init();
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ItemLimitedItemFilter() {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemLimitedItemFilter.unlocalisedName);
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(64);
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
GameRegistry.registerItem(this, ModObject.itemLimitedItemFilter.unlocalisedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemFilter createFilterFromStack(ItemStack stack) {
|
||||
IItemFilter filter = new ItemFilterLimited();
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("filter")) {
|
||||
filter.readFromNBT(stack.stackTagCompound.getCompoundTag("filter"));
|
||||
}
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
itemIcon = IIconRegister.registerIcon("enderio:limitedItemFilter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameForTooltip(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if (FilterRegister.isFilterSet(par1ItemStack)) {
|
||||
if (SpecialTooltipHandler.showAdvancedTooltips()) {
|
||||
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
|
||||
par3List.add(
|
||||
EnumChatFormatting.ITALIC
|
||||
+ EnderIO.lang.localize("itemConduitFilterUpgrade.clearConfigMethod"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,13 +154,17 @@ public final class Config {
|
||||
public static int travelStaffBlinkPauseTicks = 10;
|
||||
|
||||
public static boolean travelStaffEnabled = true;
|
||||
public static boolean travelStaffAllowInBaublesSlot = true;
|
||||
public static boolean travelStaffKeybindEnabled = true;
|
||||
public static boolean travelStaffBlinkEnabled = true;
|
||||
public static boolean travelStaffBlinkThroughSolidBlocksEnabled = true;
|
||||
public static boolean travelStaffBlinkThroughClearBlocksEnabled = true;
|
||||
public static boolean travelStaffBlinkThroughUnbreakableBlocksEnabled = false;
|
||||
public static String[] travelStaffBlinkBlackList = new String[] { "minecraft:bedrock", "Thaumcraft:blockWarded" };
|
||||
public static String travelStaffBaublesType = "UNIVERSAL";
|
||||
public static float travelAnchorZoomScale = 0.2f;
|
||||
public static boolean travelStaffSearchOptimize = true;
|
||||
public static boolean validateTravelEventServerside = true;
|
||||
|
||||
/** The max distance for travelling to a Travel Anchor. */
|
||||
public static int teleportStaffMaxDistance = 2048;
|
||||
@@ -1165,6 +1169,19 @@ public final class Config {
|
||||
"travelStaffEnabled",
|
||||
travelAnchorEnabled,
|
||||
"If set to false: the travel staff will not be craftable.").getBoolean(travelStaffEnabled);
|
||||
travelStaffAllowInBaublesSlot = config
|
||||
.get(
|
||||
sectionStaff.name,
|
||||
"travelStaffAllowInBaublesSlot",
|
||||
travelStaffAllowInBaublesSlot,
|
||||
"If true the travel staff can be put into Baubles slots (requires Baubles to be installed)")
|
||||
.getBoolean(travelStaffAllowInBaublesSlot);
|
||||
travelStaffKeybindEnabled = config.get(
|
||||
sectionStaff.name,
|
||||
"travelStaffKeybindEnabled",
|
||||
travelStaffKeybindEnabled,
|
||||
"If set to false: the Travel Staff Blink keybind will not be useable. (keybind allows when staff is anywhere in inventory, might not be wanted)")
|
||||
.getBoolean(travelStaffKeybindEnabled);
|
||||
travelStaffBlinkEnabled = config
|
||||
.get(
|
||||
sectionStaff.name,
|
||||
@@ -1198,6 +1215,13 @@ public final class Config {
|
||||
sectionStaff.name,
|
||||
travelStaffBlinkBlackList,
|
||||
"Lists the blocks that cannot be teleported through in the form 'modID:blockName'");
|
||||
travelStaffBaublesType = config.get(
|
||||
sectionStaff.name,
|
||||
"travelStaffBaublesType",
|
||||
travelStaffBaublesType,
|
||||
"The BaublesType the Travel Staff should be, 'AMULET', 'RING', 'BELT', or 'UNIVERSAL' (requires Baubles to be installed and travelStaffAllowInBaublesSlot to be on)")
|
||||
.getString();
|
||||
|
||||
travelAnchorZoomScale = config.getFloat(
|
||||
"travelAnchorZoomScale",
|
||||
sectionStaff.name,
|
||||
@@ -1214,6 +1238,13 @@ public final class Config {
|
||||
+ "This config is experimental, so if you encounter any strange behavior, please report to GTNH developer.")
|
||||
.getBoolean(travelStaffSearchOptimize);
|
||||
|
||||
validateTravelEventServerside = config.get(
|
||||
sectionStaff.name,
|
||||
"validateTravelEventServerside",
|
||||
validateTravelEventServerside,
|
||||
"If set to true: Server will validate if player actually can teleport. False will allow hacking, but also allows Staff of Traveling Keybind mod to work.")
|
||||
.getBoolean(validateTravelEventServerside);
|
||||
|
||||
teleportStaffMaxDistance = config
|
||||
.get(
|
||||
sectionStaff.name,
|
||||
@@ -2083,7 +2114,7 @@ public final class Config {
|
||||
sectionMagnet.name,
|
||||
"magnetAllowDeactivatedInBaublesSlot",
|
||||
magnetAllowDeactivatedInBaublesSlot,
|
||||
"If true the magnet can be put into the 'amulet' Baubles slot even if switched off (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
|
||||
"If true the magnet can be put into a Baubles slot even if switched off (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
|
||||
.getBoolean(magnetAllowDeactivatedInBaublesSlot);
|
||||
|
||||
magnetAllowPowerExtraction = config.get(
|
||||
@@ -2096,7 +2127,7 @@ public final class Config {
|
||||
sectionMagnet.name,
|
||||
"magnetBaublesType",
|
||||
magnetBaublesType,
|
||||
"The BaublesType the magnet should be, 'AMULET', 'RING' or 'BELT' (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
|
||||
"The BaublesType the magnet should be, 'AMULET', 'RING', 'BELT', or UNIVERSAL (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
|
||||
.getString();
|
||||
|
||||
useCombustionGenModel = config
|
||||
|
||||
@@ -27,6 +27,7 @@ public class PacketConfigSync implements IMessage, IMessageHandler<PacketConfigS
|
||||
buf.writeInt(Config.teleportStaffFailedBlinkDistance);
|
||||
buf.writeBoolean(Config.telepadLockCoords);
|
||||
buf.writeBoolean(Config.telepadLockDimension);
|
||||
buf.writeBoolean(Config.travelStaffKeybindEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,6 +47,7 @@ public class PacketConfigSync implements IMessage, IMessageHandler<PacketConfigS
|
||||
Config.teleportStaffFailedBlinkDistance = data.readInt();
|
||||
Config.telepadLockCoords = data.readBoolean();
|
||||
Config.telepadLockDimension = data.readBoolean();
|
||||
Config.travelStaffKeybindEnabled = data.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -206,6 +206,7 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
|
||||
if (player instanceof EntityPlayer && isActive(itemstack)
|
||||
&& hasPower(itemstack)
|
||||
@@ -222,17 +223,21 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return Config.magnetAllowInBaublesSlot && (Config.magnetAllowDeactivatedInBaublesSlot || isActive(itemstack));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
@@ -17,6 +18,7 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.api.teleport.IItemOfTravel;
|
||||
import crazypants.enderio.api.tool.IConduitControl;
|
||||
import crazypants.enderio.conduit.ConduitDisplayMode;
|
||||
import crazypants.enderio.config.Config;
|
||||
@@ -30,6 +32,7 @@ import crazypants.enderio.item.darksteel.upgrade.JumpUpgrade;
|
||||
import crazypants.enderio.item.darksteel.upgrade.SoundDetectorUpgrade;
|
||||
import crazypants.enderio.item.darksteel.upgrade.SpeedUpgrade;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.enderio.thaumcraft.GogglesOfRevealingUpgrade;
|
||||
import crazypants.util.BaublesUtil;
|
||||
|
||||
@@ -55,6 +58,10 @@ public class KeyTracker {
|
||||
|
||||
private final KeyBinding magnetKey;
|
||||
|
||||
private final KeyBinding staffOfTravelingTPKey;
|
||||
|
||||
private static long lastBlinkTick = -1;
|
||||
|
||||
public KeyTracker() {
|
||||
glideKey = new KeyBinding(
|
||||
EnderIO.lang.localize("keybind.glidertoggle"),
|
||||
@@ -106,6 +113,12 @@ public class KeyTracker {
|
||||
Keyboard.KEY_NONE,
|
||||
EnderIO.lang.localize("category.tools"));
|
||||
ClientRegistry.registerKeyBinding(magnetKey);
|
||||
|
||||
staffOfTravelingTPKey = new KeyBinding(
|
||||
EnderIO.lang.localize("keybind.staffoftravelingtp"),
|
||||
Keyboard.KEY_NONE,
|
||||
EnderIO.lang.localize("category.tools"));
|
||||
ClientRegistry.registerKeyBinding(staffOfTravelingTPKey);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -119,6 +132,7 @@ public class KeyTracker {
|
||||
handleSpeed();
|
||||
handleJump();
|
||||
handleMagnet();
|
||||
handleStaffOfTravelingTP();
|
||||
}
|
||||
|
||||
private void sendEnabledChatMessage(String messageBase, boolean isActive) {
|
||||
@@ -133,6 +147,37 @@ public class KeyTracker {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketUpgradeState(type, isActive));
|
||||
}
|
||||
|
||||
private void handleStaffOfTravelingTP() {
|
||||
if (staffOfTravelingTPKey.isPressed()) {
|
||||
if (Config.travelStaffKeybindEnabled) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null) {
|
||||
ItemStack travelItem = player.getHeldItem();
|
||||
if (travelItem == null || travelItem.getItem() == null
|
||||
|| !(travelItem.getItem() instanceof IItemOfTravel)) {
|
||||
travelItem = TravelController.instance.findTravelItemInInventoryOrBaubles(player);
|
||||
}
|
||||
|
||||
if (travelItem != null && travelItem.getItem() != null) {
|
||||
long ticksSinceBlink = EnderIO.proxy.getTickCount() - lastBlinkTick;
|
||||
if (ticksSinceBlink < 0) {
|
||||
lastBlinkTick = -1;
|
||||
}
|
||||
if (ticksSinceBlink >= Config.travelStaffBlinkPauseTicks) {
|
||||
if (TravelController.instance.doBlink(travelItem, player)) {
|
||||
lastBlinkTick = EnderIO.proxy.getTickCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TravelController.showMessage(
|
||||
Minecraft.getMinecraft().thePlayer,
|
||||
new ChatComponentTranslation("enderio.travelStaffKeybind.isDisabled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleMagnet() {
|
||||
if (magnetKey.isPressed()) {
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
@@ -489,11 +489,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio
|
||||
if (stack == null || stack.stackTagCompound == null) {
|
||||
return;
|
||||
}
|
||||
NBTTagCompound root = stack.stackTagCompound;
|
||||
if (!root.hasKey("eio.abstractMachine")) {
|
||||
return;
|
||||
}
|
||||
readCommon(root);
|
||||
readCommon(stack.stackTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,13 +4,20 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import crazypants.enderio.machine.capbank.TileCapBank;
|
||||
|
||||
public class ClientNetworkManager {
|
||||
|
||||
private static final ClientNetworkManager instance = new ClientNetworkManager();
|
||||
|
||||
static {
|
||||
MinecraftForge.EVENT_BUS.register(instance);
|
||||
}
|
||||
|
||||
public static ClientNetworkManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
@@ -53,4 +60,12 @@ public class ClientNetworkManager {
|
||||
CapBankClientNetwork network = getOrCreateNetwork(id);
|
||||
network.addMember(tileCapBank);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
if (event.world.isRemote) {
|
||||
networks.forEach((id, network) -> network.destroyNetwork());
|
||||
networks.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,14 +71,12 @@ public class BlockItemTank extends ItemBlockWithMetadata implements IAdvancedToo
|
||||
EnderIO.blockTank.addDetailedEntries(itemstack, entityplayer, list, flag);
|
||||
}
|
||||
|
||||
private static final FluidTank dummy = new SmartTank(FluidRegistry.WATER, 16000);
|
||||
|
||||
private FluidTank loadTank(ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
FluidTank tank = TileTank.loadTank(stack.getTagCompound());
|
||||
return tank != null ? tank : dummy;
|
||||
return tank != null ? tank : new SmartTank(FluidRegistry.WATER, 16000);
|
||||
}
|
||||
return dummy;
|
||||
return new SmartTank(FluidRegistry.WATER, 16000);
|
||||
}
|
||||
|
||||
private void saveTank(ItemStack stack, FluidTank tank) {
|
||||
|
||||
@@ -112,6 +112,6 @@ public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
|
||||
@Override
|
||||
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
|
||||
return isEquipped(ep);
|
||||
return (ep != null && equipped != null);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,7 +13,11 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import cofh.api.energy.ItemEnergyContainer;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -24,7 +29,8 @@ import crazypants.enderio.api.teleport.TravelSource;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
|
||||
public class ItemTravelStaff extends ItemEnergyContainer implements IItemOfTravel, IResourceTooltipProvider {
|
||||
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles|API")
|
||||
public class ItemTravelStaff extends ItemEnergyContainer implements IItemOfTravel, IResourceTooltipProvider, IBauble {
|
||||
|
||||
public static boolean isEquipped(EntityPlayer ep) {
|
||||
if (ep == null || ep.getCurrentEquippedItem() == null) {
|
||||
@@ -174,7 +180,7 @@ public class ItemTravelStaff extends ItemEnergyContainer implements IItemOfTrave
|
||||
|
||||
@Override
|
||||
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
|
||||
return isEquipped(ep);
|
||||
return (ep != null && equipped != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,7 +190,45 @@ public class ItemTravelStaff extends ItemEnergyContainer implements IItemOfTrave
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public BaubleType getBaubleType(ItemStack itemstack) {
|
||||
BaubleType t = null;
|
||||
try {
|
||||
t = BaubleType.valueOf(Config.travelStaffBaublesType);
|
||||
} catch (Exception e) {
|
||||
// NOP
|
||||
}
|
||||
return t != null ? t : BaubleType.AMULET;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return Config.travelStaffAllowInBaublesSlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles|API")
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return Config.renderDurabilityBar && super.showDurabilityBar(stack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -64,6 +65,7 @@ import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketLongDistanceTravelEvent;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
import crazypants.util.BaublesUtil;
|
||||
|
||||
public class TravelController {
|
||||
|
||||
@@ -124,6 +126,10 @@ public class TravelController {
|
||||
*/
|
||||
public String validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z, int powerUse,
|
||||
boolean conserveMotion, TravelSource source) {
|
||||
|
||||
// If config indicates to allow for 'hacking' the travel packet, then don't do any validation.
|
||||
if (!Config.validateTravelEventServerside) return null;
|
||||
|
||||
BlockCoord target = new BlockCoord(x, y, z);
|
||||
double dist = getDistanceSquared(toTp, target);
|
||||
// allow 15% overshoot to account for rounding
|
||||
@@ -152,6 +158,12 @@ public class TravelController {
|
||||
return null;
|
||||
case STAFF:
|
||||
case STAFF_BLINK:
|
||||
if (Config.travelStaffKeybindEnabled) {
|
||||
if (equippedItem == null || equippedItem.getItem() == null
|
||||
|| !(equippedItem.getItem() instanceof IItemOfTravel)) {
|
||||
equippedItem = findTravelItemInInventoryOrBaubles(toTp);
|
||||
}
|
||||
}
|
||||
if (equippedItem == null || !(equippedItem.getItem() instanceof IItemOfTravel)) return "not staff";
|
||||
if (!((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) return "staff not active";
|
||||
int energy = ((IItemOfTravel) equippedItem.getItem()).canExtractInternal(equippedItem, powerUse);
|
||||
@@ -607,25 +619,99 @@ public class TravelController {
|
||||
return getTravelItemTravelSource(ep) != null;
|
||||
}
|
||||
|
||||
/** Returns null if no travel item is equipped. */
|
||||
/** Returns null if no travel item is in inventory/baubles. */
|
||||
@Nullable
|
||||
public TravelSource getTravelItemTravelSource(EntityPlayer ep) {
|
||||
if (ep == null || ep.getCurrentEquippedItem() == null) {
|
||||
if (ep == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped = ep.getCurrentEquippedItem();
|
||||
if (equipped.getItem() instanceof ItemTeleportStaff) {
|
||||
if (((ItemTeleportStaff) equipped.getItem()).isActive(ep, equipped)) {
|
||||
return TravelSource.TELEPORT_STAFF;
|
||||
}
|
||||
} else if (equipped.getItem() instanceof IItemOfTravel) {
|
||||
if (((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
|
||||
return TravelSource.STAFF;
|
||||
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)) {
|
||||
equipped = findTravelItemInInventoryOrBaubles(ep);
|
||||
}
|
||||
|
||||
if (equipped != null) {
|
||||
if (equipped.getItem() instanceof ItemTeleportStaff) {
|
||||
if (((ItemTeleportStaff) equipped.getItem()).isActive(ep, equipped)) {
|
||||
return TravelSource.TELEPORT_STAFF;
|
||||
}
|
||||
} else if (equipped.getItem() instanceof IItemOfTravel) {
|
||||
if (((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
|
||||
return TravelSource.STAFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns null if no Travel item found in inventory/baubles. <br>
|
||||
* DO NOT CHANGE THIS CODE WITHOUT ALSO CHANGING
|
||||
* TravelController.{@link #findTravelItemSlotInInventoryOrBaubles(EntityPlayer)}
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStack findTravelItemInInventoryOrBaubles(EntityPlayer ep) {
|
||||
ItemStack travelItem = null;
|
||||
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = ep.inventory.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
|
||||
travelItem = stack;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (travelItem == null) {
|
||||
IInventory baubles = BaublesUtil.instance().getBaubles(ep);
|
||||
if (baubles != null) {
|
||||
for (int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
ItemStack stack = baubles.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
|
||||
travelItem = stack;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return travelItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses same code as {@link #findTravelItemInInventoryOrBaubles(EntityPlayer)}, but returns the slot of that
|
||||
* item.<br>
|
||||
* Baubles return value is unique/hacky, if <-1 return, then do the following to calculate the baubles slot:
|
||||
* "Math.abs(returnval)-2" <br>
|
||||
* Example: -3 return is Bauble slot 1, -2 return is Bauble slot 0
|
||||
*
|
||||
* @return -1 if no travel item found. 0 or more if item found in inventory. -2 or less if item found in Baubles.
|
||||
*/
|
||||
public int findTravelItemSlotInInventoryOrBaubles(EntityPlayer ep) {
|
||||
int travelItemSlot = -1;
|
||||
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = ep.inventory.getStackInSlot(i);
|
||||
if (stack != null && (stack.getItem() instanceof IItemOfTravel)) {
|
||||
travelItemSlot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (travelItemSlot == -1) {
|
||||
IInventory baubles = BaublesUtil.instance().getBaubles(ep);
|
||||
if (baubles != null) {
|
||||
for (int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
ItemStack stack = baubles.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
|
||||
travelItemSlot = -(i + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return travelItemSlot;
|
||||
}
|
||||
|
||||
public boolean travelToSelectedTarget(EntityPlayer player, TravelSource source, boolean conserveMomentum) {
|
||||
return travelToLocation(player, source, selectedCoord, conserveMomentum);
|
||||
}
|
||||
@@ -683,6 +769,10 @@ public class TravelController {
|
||||
}
|
||||
int requiredPower;
|
||||
ItemStack staff = player.getCurrentEquippedItem();
|
||||
if (staff == null || !(staff.getItem() instanceof IItemOfTravel)) {
|
||||
staff = findTravelItemInInventoryOrBaubles(player);
|
||||
}
|
||||
|
||||
requiredPower = getPower(player, source, coord, 0F);
|
||||
int canUsePower = getEnergyInTravelItem(staff);
|
||||
if (requiredPower > canUsePower) {
|
||||
@@ -1009,7 +1099,7 @@ public class TravelController {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void showMessage(EntityPlayer player, IChatComponent chatComponent) {
|
||||
public static void showMessage(EntityPlayer player, IChatComponent chatComponent) {
|
||||
if (Loader.isModLoaded("gtnhlib")) {
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
chatComponent.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
|
||||
|
||||
@@ -3,6 +3,7 @@ package crazypants.enderio.teleport.packet;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.server.S12PacketEntityVelocity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -18,6 +19,7 @@ import crazypants.enderio.api.teleport.IItemOfTravel;
|
||||
import crazypants.enderio.api.teleport.TeleportEntityEvent;
|
||||
import crazypants.enderio.api.teleport.TravelSource;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.util.BaublesUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketTravelEvent implements IMessage, IMessageHandler<PacketTravelEvent, IMessage> {
|
||||
@@ -128,18 +130,35 @@ public class PacketTravelEvent implements IMessage, IMessageHandler<PacketTravel
|
||||
if (conserveMotion) {
|
||||
Vector3d velocityVex = Util.getLookVecEio(player);
|
||||
S12PacketEntityVelocity p = new S12PacketEntityVelocity(
|
||||
toTp.getEntityId(),
|
||||
player.getEntityId(),
|
||||
velocityVex.x,
|
||||
velocityVex.y,
|
||||
velocityVex.z);
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(p);
|
||||
}
|
||||
|
||||
if (powerUse > 0 && player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof IItemOfTravel) {
|
||||
ItemStack item = player.getCurrentEquippedItem().copy();
|
||||
ItemStack travelItem = player.getCurrentEquippedItem();
|
||||
int itemSlot = -1;
|
||||
if (travelItem == null || travelItem.getItem() == null
|
||||
|| !(travelItem.getItem() instanceof IItemOfTravel)) {
|
||||
travelItem = TravelController.instance.findTravelItemInInventoryOrBaubles(player);
|
||||
itemSlot = TravelController.instance.findTravelItemSlotInInventoryOrBaubles(player);
|
||||
}
|
||||
if (powerUse > 0 && travelItem != null && travelItem.getItem() instanceof IItemOfTravel) {
|
||||
ItemStack item = travelItem.copy();
|
||||
((IItemOfTravel) item.getItem()).extractInternal(item, powerUse);
|
||||
toTp.setCurrentItemOrArmor(0, item);
|
||||
if (itemSlot == -1) {
|
||||
// Is held in players hand.
|
||||
player.setCurrentItemOrArmor(0, item);
|
||||
} else if (itemSlot > -1) {
|
||||
// Greater than -1 is an inventory slot.
|
||||
player.inventory.setInventorySlotContents(itemSlot, item);
|
||||
} else if (itemSlot < -1) {
|
||||
// Less than -1 is a bauble slot. Special calculation needed to determine ACTUAL Baubles slot
|
||||
int baubleSlot = Math.abs(itemSlot) - 2;
|
||||
IInventory baubles = BaublesUtil.instance().getBaubles(player);
|
||||
baubles.setInventorySlotContents(baubleSlot, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,11 @@ item.itemExistingItemFilter.tooltip.detailed.line5=content to the snapshot
|
||||
enderio.item.itemExistingItemFilter.filterUpdated=New items have been added to the snapshot
|
||||
enderio.item.itemExistingItemFilter.filterNotUpdated=The snapshot already covers all items in the inventory
|
||||
|
||||
item.itemLimitedItemFilter.name=Limited Item Filter
|
||||
item.itemLimitedItemFilter.tooltip.basic.line1=Upgrade for item conduits
|
||||
item.itemLimitedItemFilter.tooltip.detailed.line1=Filters items based on
|
||||
item.itemLimitedItemFilter.tooltip.detailed.line2=their stack size
|
||||
|
||||
item.itemModItemFilter.name=Mod Item Filter
|
||||
item.itemModItemFilter.tooltip.basic.line1=Upgrade for item conduits
|
||||
item.itemModItemFilter.tooltip.detailed.line1=Selects only items for a specified
|
||||
@@ -726,6 +731,7 @@ item.itemTravelStaff.tooltip.detailed.line3=activated by R-Click
|
||||
item.itemTravelStaff.tooltip.detailed.line4=Shift-R-Click will teleport the
|
||||
item.itemTravelStaff.tooltip.detailed.line5=player a short distance
|
||||
enderio.itemTravelStaff.notEnoughPower=Not enough power
|
||||
enderio.travelStaffKeybind.isDisabled=Travel Staff Blink Keybind Disabled!
|
||||
|
||||
item.itemTeleportStaff.name=Staff of Teleportation
|
||||
item.itemTeleportStaff.tooltip.detailed.line1=R-Click to teleport wherever you are looking
|
||||
@@ -1386,6 +1392,7 @@ enderio.keybind.jump=Jump
|
||||
enderio.keybind.stepassist=Step Assist
|
||||
enderio.keybind.yetawrenchmode=Yeta Wrench Mode
|
||||
enderio.keybind.magnet=Toggle Electromagnet
|
||||
enderio.keybind.staffoftravelingtp=Travel Staff Blink
|
||||
enderio.nei.alloysmelter=Alloy Smelter
|
||||
enderio.nei.enchanter=Enchanter
|
||||
enderio.nei.sagmill=SAG Mill
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Reference in new issue
Block a user