mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-14 17:14:50 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f9bae85b7 | ||
|
|
0e29c1af62 | ||
|
|
c2eda5efbb | ||
|
|
e2d6b417b4 | ||
|
|
fc826d169a | ||
|
|
9242fdd23d | ||
|
|
0e60bba4ce | ||
|
|
9e1a7c7f3c |
No files matched your search
@@ -20,4 +20,8 @@ public interface IItemOfTravel extends IEnergyContainerItem {
|
||||
default int canExtractInternal(ItemStack equipped, int power) {
|
||||
return Config.strictTPItemChecking ? 0 : -1;
|
||||
}
|
||||
|
||||
default boolean isTeleportStaff(EntityPlayer player, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,6 @@ public final class Config {
|
||||
public static int travelAnchorCooldown = 0;
|
||||
public static boolean travelAnchorSneak = true;
|
||||
public static boolean travelAnchorSkipWarning = true;
|
||||
public static double travelAnchorSnapAngle = 0.175;
|
||||
|
||||
public static int travelStaffMaxDistance = 128;
|
||||
public static float travelStaffPowerPerBlockRF = 250;
|
||||
@@ -1168,14 +1167,6 @@ public final class Config {
|
||||
"Travel Anchors send a chat warning when skipping inaccessible anchors")
|
||||
.getBoolean(travelAnchorSkipWarning);
|
||||
|
||||
travelAnchorSnapAngle = Math.toRadians(
|
||||
config.get(
|
||||
sectionAnchor.name,
|
||||
"travelAnchorSnapAngle",
|
||||
Math.round(Math.toDegrees(travelAnchorSnapAngle)),
|
||||
"The maximum angle to snap to an anchor when selecting target")
|
||||
.getDouble(Math.toDegrees(travelAnchorSnapAngle)));
|
||||
|
||||
travelStaffMaxDistance = config
|
||||
.get(
|
||||
sectionStaff.name,
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockAlloySmelter.name";
|
||||
return "Alloy Smelter";
|
||||
}
|
||||
|
||||
public Mode getMode() {
|
||||
|
||||
@@ -33,12 +33,6 @@ public class TileBuffer extends AbstractPowerConsumerEntity implements IPaintabl
|
||||
super(new SlotDefinition(9, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
// getMachineName will return the key without the suffix ".name"
|
||||
return getMachineName() + ".name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return BlockItemBuffer.Type.get(this).getUnlocalizedName();
|
||||
|
||||
@@ -54,11 +54,6 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
|
||||
setCapacitor(new BasicCapacitor(0, io * 4, refCap.getMaxEnergyStored(), io));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockCrafter.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockCrafter.unlocalisedName;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSagMill.name";
|
||||
return ModObject.blockSagMill.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.gtnewhorizon.gtnhlib.geometry.CubeIterator;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.obelisk.xp.TileExperienceObelisk;
|
||||
@@ -299,7 +300,7 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockEnchanter.name";
|
||||
return ModObject.blockEnchanter.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -822,7 +822,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockFarmStation.name";
|
||||
return EnderIO.blockFarmStation.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-5
@@ -90,11 +90,6 @@ public class TileCombustionGenerator extends AbstractGeneratorEntity implements
|
||||
return mode != IoMode.PUSH && mode != IoMode.PUSH_PULL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockCombustionGenerator.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockCombustionGenerator.unlocalisedName;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class TileEntityStirlingGenerator extends AbstractGeneratorEntity impleme
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockStirlingGenerator.name";
|
||||
return "Stirling Generator";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -93,11 +93,6 @@ public class TileZombieGenerator extends AbstractGeneratorEntity
|
||||
minimumTankLevel = (int) (fuelTank.getCapacity() * 0.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockZombieGenerator.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockZombieGenerator.unlocalisedName;
|
||||
|
||||
@@ -11,6 +11,8 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.InventoryWrapper;
|
||||
|
||||
import crazypants.enderio.ModObject;
|
||||
|
||||
public class CompositeInventory implements ISidedInventory {
|
||||
|
||||
private final List<InvEntry> inventories = new ArrayList<>();
|
||||
@@ -155,7 +157,7 @@ public class CompositeInventory implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockHyperCube.name";
|
||||
return ModObject.blockHyperCube.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.enderio.core.common.util.PlayerUtil;
|
||||
import com.enderio.core.common.vecmath.VecmathUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
@@ -768,7 +769,7 @@ public class TileHyperCube extends TileEntityEio
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockHyperCube.name";
|
||||
return ModObject.blockHyperCube.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -369,11 +369,6 @@ public class TileInventoryPanel extends AbstractMachineEntity implements IFluidH
|
||||
nbtRoot.setBoolean("active", active);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockInventoryPanel.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockInventoryPanel.unlocalisedName;
|
||||
|
||||
@@ -157,11 +157,6 @@ public class TileKillerJoe extends AbstractMachineEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockKillerJoe.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockKillerJoe.unlocalisedName;
|
||||
|
||||
@@ -101,7 +101,7 @@ public class TilePowerMonitor extends AbstractPowerConsumerEntity implements IIn
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockPowerMonitor.name";
|
||||
return EnderIO.blockPowerMonitor.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -126,11 +126,6 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
|
||||
setCapacitor(new BasicCapacitor(powerPerTick * 8, getCapacitor().getMaxEnergyStored(), powerPerTick));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockAttractor.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockAttractor.unlocalisedName;
|
||||
|
||||
@@ -106,11 +106,6 @@ public class TileAversionObelisk extends AbstractPowerConsumerEntity implements
|
||||
bounds = AxisAlignedBB.getBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSpawnGuard.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSpawnGuard.unlocalisedName;
|
||||
|
||||
@@ -19,11 +19,6 @@ public class TileInhibitorObelisk extends AbstractPowerConsumerEntity implements
|
||||
super(new SlotDefinition(0, 0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockInhibitorObelisk.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockInhibitorObelisk.unlocalisedName;
|
||||
|
||||
@@ -121,11 +121,6 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity
|
||||
setCapacitor(Capacitors.ACTIVATED_CAPACITOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockWeatherObelisk.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockWeatherObelisk.unlocalisedName;
|
||||
|
||||
@@ -32,11 +32,6 @@ public class TileExperienceObelisk extends AbstractMachineEntity
|
||||
super(new SlotDefinition(0, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockExperienceObelisk.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockExperienceObelisk.unlocalisedName;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockPainter.name";
|
||||
return "Auto Painter";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -100,11 +100,6 @@ public class TileSliceAndSplice extends AbstractPoweredTaskEntity {
|
||||
super(new SlotDefinition(8, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSliceAndSplice.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSliceAndSplice.unlocalisedName;
|
||||
|
||||
@@ -113,11 +113,6 @@ public class TileSoulBinder extends AbstractPoweredTaskEntity implements IHaveEx
|
||||
return xpCont;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSoulBinder.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSoulBinder.unlocalisedName;
|
||||
|
||||
@@ -197,11 +197,6 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity implements IRa
|
||||
forceClientUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockPoweredSpawner.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockPoweredSpawner.unlocalisedName;
|
||||
|
||||
@@ -225,11 +225,6 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler, IT
|
||||
this.voidMode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockTank.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return "tank";
|
||||
|
||||
@@ -157,11 +157,6 @@ public class TileTransceiver extends AbstractPoweredTaskEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockTransceiver.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockTransceiver.unlocalisedName;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.enderio.core.common.vecmath.Vector3d;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.conduit.item.FilterRegister;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
@@ -211,7 +212,7 @@ public class TileVacuumChest extends TileEntityEio
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockVacuumChest.name";
|
||||
return ModObject.blockVacuumChest.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler,
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockVat.name";
|
||||
return ModObject.blockVat.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -106,6 +106,11 @@ public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTeleportStaff(EntityPlayer player, ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack item) {
|
||||
// Has infinite energy, always report as being full of energy for any validation-code purposes.
|
||||
|
||||
@@ -135,6 +135,18 @@ public class TravelController {
|
||||
// allow 4 blocks of c/s player pos desync
|
||||
if (getPower(toTp, source, target, -4F) > powerUse) return "power use too little";
|
||||
ItemStack equippedItem = toTp.getCurrentEquippedItem();
|
||||
|
||||
if (equippedItem == null || !(equippedItem.getItem() instanceof IItemOfTravel)
|
||||
|| !((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) {
|
||||
for (ItemStack armor : toTp.inventory.armorInventory) {
|
||||
if (armor != null && armor.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) armor.getItem()).isActive(toTp, armor)) {
|
||||
equippedItem = armor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (source) {
|
||||
case TELEPAD:
|
||||
// this source is invalid for this type of packet
|
||||
@@ -172,10 +184,9 @@ public class TravelController {
|
||||
return null;
|
||||
case TELEPORT_STAFF_BLINK:
|
||||
case TELEPORT_STAFF:
|
||||
// tp staff is creative version of traveling staff
|
||||
// no energy check or anything else needed
|
||||
// but the player must actually be equipped with one of these
|
||||
if (equippedItem != null && equippedItem.getItem() instanceof ItemTeleportStaff) {
|
||||
if (equippedItem != null && equippedItem.getItem() instanceof IItemOfTravel travelItem
|
||||
&& travelItem.isActive(toTp, equippedItem)
|
||||
&& travelItem.isTeleportStaff(toTp, equippedItem)) {
|
||||
return null;
|
||||
}
|
||||
return "not staff";
|
||||
@@ -557,6 +568,19 @@ public class TravelController {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped = ep.getCurrentEquippedItem();
|
||||
|
||||
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)
|
||||
|| !((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
|
||||
for (ItemStack armor : ep.inventory.armorInventory) {
|
||||
if (armor != null && armor.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) armor.getItem()).isActive(ep, armor)) {
|
||||
equipped = armor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (BackhandUtil.backhandLoaded) {
|
||||
final ItemStack offhand = BackhandUtils.getOffhandItem(ep);
|
||||
if (offhand != null && offhand.getItem() != null) {
|
||||
@@ -567,7 +591,6 @@ public class TravelController {
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack equipped = ep.getCurrentEquippedItem();
|
||||
if (checkInventoryAndBaubles) {
|
||||
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)
|
||||
|| !((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
|
||||
@@ -589,6 +612,13 @@ public class TravelController {
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStack findTravelItemInInventoryOrBaubles(EntityPlayer ep) {
|
||||
for (ItemStack armor : ep.inventory.armorInventory) {
|
||||
if (armor != null && armor.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) armor.getItem()).isActive(ep, armor)) {
|
||||
return armor;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack travelItem = null;
|
||||
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = ep.inventory.getStackInSlot(i);
|
||||
@@ -626,6 +656,14 @@ public class TravelController {
|
||||
* @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) {
|
||||
for (int i = 0; i < ep.inventory.armorInventory.length; i++) {
|
||||
ItemStack armor = ep.inventory.armorInventory[i];
|
||||
if (armor != null && armor.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) armor.getItem()).isActive(ep, armor)) {
|
||||
return ep.inventory.mainInventory.length + i;
|
||||
}
|
||||
}
|
||||
|
||||
int travelItemSlot = -1;
|
||||
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = ep.inventory.getStackInSlot(i);
|
||||
@@ -741,10 +779,7 @@ public class TravelController {
|
||||
|
||||
for (Table.Cell<Double, Double, BlockCoord> cell : possibleDestinations.cellSet()) {
|
||||
if (cell.getColumnKey() <= maxDistance) {
|
||||
// If the client hasn't selected a target, the server shouldn't try to force one,
|
||||
// but checking if there is one just outside of range (below message) might still
|
||||
// be useful.
|
||||
return Optional.empty();
|
||||
return Optional.of(cell.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,12 +1104,9 @@ public class TravelController {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the nearest travel anchor within the configured angle (default ~10 degrees).
|
||||
Optional<BlockCoord> selectedBlock = findBlocksWithinAngle(
|
||||
player,
|
||||
candidates.keySet(),
|
||||
Config.travelAnchorSnapAngle,
|
||||
Double.MAX_VALUE).values().stream().findFirst();
|
||||
// Find the nearest travel anchor within roughly 10 degrees.
|
||||
Optional<BlockCoord> selectedBlock = findBlocksWithinAngle(player, candidates.keySet(), 0.175, Double.MAX_VALUE)
|
||||
.values().stream().findFirst();
|
||||
selectedCoord = selectedBlock.orElse(null);
|
||||
}
|
||||
|
||||
@@ -1225,4 +1257,9 @@ public class TravelController {
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void forceUpdateTarget(EntityPlayer player) {
|
||||
updateSelectedTarget(player);
|
||||
}
|
||||
}
|
||||
@@ -651,8 +651,6 @@ tile.blockWeatherObelisk.tooltip.detailed.line4=Liquid Sunshine: Sun
|
||||
tile.blockWeatherObelisk.tooltip.detailed.line5=Cloud Seed: Rain
|
||||
tile.blockWeatherObelisk.tooltip.detailed.line6=Concentrated Cloud Seed: Thunder
|
||||
|
||||
tile.blockInhibitorObelisk.name=Inhibitor Obelisk
|
||||
|
||||
tile.blockBuffer.name=Buffer
|
||||
tile.blockBuffer.item.name=Item Buffer
|
||||
tile.blockBuffer.power.name=Power Buffer
|
||||
|
||||
@@ -608,8 +608,6 @@ tile.blockExperienceObelisk.tooltip.detailed.line3=至相邻的储罐中
|
||||
tile.blockWeatherObelisk.name=气象方尖碑
|
||||
tile.blockWeatherObelisk.tooltip.detailed.line1=改变当前天气
|
||||
|
||||
tile.blockInhibitorObelisk.name=传送抑制方尖碑
|
||||
|
||||
tile.blockBuffer.item.name=物品缓存器
|
||||
tile.blockBuffer.power.name=能量缓存器
|
||||
tile.blockBuffer.omni.name=多功能缓存器
|
||||
|
||||
Reference in new issue
Block a user