mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Merge branch '1.11' into feature-CTM
This commit is contained in:
commit
ec1cf6c9cf
10 files changed
+131
-9
No files matched your search
@@ -446,6 +446,9 @@ public final class TransporterPathfinder
|
||||
}
|
||||
|
||||
double maxSearchDistance = start.distanceTo(finalNode) * 2;
|
||||
ArrayList<EnumFacing> directionsToCheck = new ArrayList<>();
|
||||
Coord4D[] neighbors = new Coord4D[EnumFacing.VALUES.length];
|
||||
TileEntity[] neighborEntities = new TileEntity[neighbors.length];
|
||||
|
||||
while(!openSet.isEmpty())
|
||||
{
|
||||
@@ -469,13 +472,34 @@ public final class TransporterPathfinder
|
||||
openSet.remove(currentNode);
|
||||
closedSet.add(currentNode);
|
||||
|
||||
TileEntity currentNodeTile = currentNode.getTileEntity(worldObj);
|
||||
ILogisticalTransporter currentNodeTransporter = null;
|
||||
if(currentNodeTile.hasCapability(Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, null))
|
||||
{
|
||||
currentNodeTransporter =
|
||||
CapabilityUtils.getCapability(currentNodeTile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, null);
|
||||
}
|
||||
|
||||
directionsToCheck.clear();
|
||||
for(EnumFacing direction : EnumFacing.VALUES)
|
||||
{
|
||||
Coord4D neighbor = currentNode.offset(direction);
|
||||
|
||||
if(transportStack.canInsertToTransporter(neighbor.getTileEntity(worldObj), direction))
|
||||
neighbors[direction.ordinal()] = neighbor;
|
||||
TileEntity neighborEntity = neighbor.getTileEntity(worldObj);
|
||||
neighborEntities[direction.ordinal()] = neighborEntity;
|
||||
if(currentNodeTransporter == null || currentNodeTransporter.canEmitTo(neighborEntity, direction))
|
||||
{
|
||||
TileEntity tile = neighbor.getTileEntity(worldObj);
|
||||
directionsToCheck.add(direction);
|
||||
}
|
||||
}
|
||||
|
||||
for(EnumFacing direction : directionsToCheck)
|
||||
{
|
||||
Coord4D neighbor = neighbors[direction.ordinal()];
|
||||
|
||||
if(transportStack.canInsertToTransporter(neighborEntities[direction.ordinal()], direction))
|
||||
{
|
||||
TileEntity tile = neighborEntities[direction.ordinal()];
|
||||
double tentativeG = gScore.get(currentNode) + CapabilityUtils.getCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, direction.getOpposite()).getCost();
|
||||
|
||||
if(closedSet.contains(neighbor))
|
||||
@@ -494,7 +518,7 @@ public final class TransporterPathfinder
|
||||
openSet.add(neighbor);
|
||||
}
|
||||
}
|
||||
else if(neighbor.equals(finalNode) && destChecker.isValid(transportStack, direction, neighbor.getTileEntity(worldObj)))
|
||||
else if(neighbor.equals(finalNode) && destChecker.isValid(transportStack, direction, neighborEntities[direction.ordinal()]))
|
||||
{
|
||||
side = direction;
|
||||
results = reconstructPath(navMap, currentNode);
|
||||
|
||||
@@ -16,6 +16,7 @@ import mekanism.common.Resource;
|
||||
import mekanism.common.block.states.BlockStateTransmitter.TransmitterType;
|
||||
import mekanism.common.integration.computer.CCPeripheral;
|
||||
import mekanism.common.integration.computer.OCDriver;
|
||||
import mekanism.common.integration.storagedrawer.StorageDrawerRecipeHandler;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -78,6 +79,11 @@ public final class MekanismHooks
|
||||
{
|
||||
//loadMettallurgy();
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("storagedrawers"))
|
||||
{
|
||||
StorageDrawerRecipeHandler.register();
|
||||
}
|
||||
}
|
||||
|
||||
@Method(modid = "IC2")
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package mekanism.common.integration.storagedrawer;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.IStorageDrawersApi;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandler;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mekanism.common.recipe.ShapelessMekanismRecipe;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StorageDrawerRecipeHandler
|
||||
{
|
||||
private StorageDrawerRecipeHandler(){}
|
||||
|
||||
public static void register()
|
||||
{
|
||||
IStorageDrawersApi api = StorageDrawersApi.instance();
|
||||
if(api == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
IRecipeHandlerRegistry recipeHandlerRegistry = api.recipeHandlerRegistry();
|
||||
recipeHandlerRegistry.registerRecipeHandler(ShapedMekanismRecipe.class, new ShapedMekanismRecipeHandler());
|
||||
recipeHandlerRegistry.registerRecipeHandler(ShapelessMekanismRecipe.class, new ShapelessMekanismRecipeHandler());
|
||||
}
|
||||
|
||||
private static class ShapedMekanismRecipeHandler implements IRecipeHandler
|
||||
{
|
||||
@Override
|
||||
public Object[] getInputAsArray (IRecipe recipe) {
|
||||
return ((ShapedMekanismRecipe) recipe).getInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputAsList (IRecipe recipe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ShapelessMekanismRecipeHandler implements IRecipeHandler
|
||||
{
|
||||
@Override
|
||||
public Object[] getInputAsArray (IRecipe recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputAsList (IRecipe recipe) {
|
||||
return ((ShapelessMekanismRecipe) recipe).getInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1566,6 +1566,13 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
return EnumSet.of(MekanismUtils.getLeft(facing), MekanismUtils.getRight(facing), EnumFacing.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sideIsConsumer(EnumFacing side)
|
||||
{
|
||||
return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing) || side == EnumFacing.DOWN;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileComponentSecurity getSecurity()
|
||||
{
|
||||
|
||||
@@ -421,6 +421,12 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
||||
return EnumSet.of(facing.getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sideIsConsumer(EnumFacing side)
|
||||
{
|
||||
return facing.getOpposite() == side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSetFacing(int side)
|
||||
{
|
||||
|
||||
@@ -394,6 +394,12 @@ public class TileEntityFactory extends TileEntityMachine implements IComputerInt
|
||||
{
|
||||
return configComponent.getSidesForData(TransmissionType.ENERGY, facing, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sideIsConsumer(EnumFacing side)
|
||||
{
|
||||
return configComponent.hasSideForData(TransmissionType.ENERGY, facing, 1, side);
|
||||
}
|
||||
|
||||
public void sortInventory()
|
||||
{
|
||||
|
||||
@@ -384,6 +384,12 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
|
||||
return EnumSet.of(facing.getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sideIsConsumer(EnumFacing side)
|
||||
{
|
||||
return facing.getOpposite() == side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSetFacing(int side)
|
||||
{
|
||||
|
||||
@@ -70,11 +70,11 @@ public class TileComponentConfig implements ITileComponent
|
||||
SideConfig config = getConfig(type);
|
||||
EnumFacing[] translatedFacings = MekanismUtils.getBaseOrientations(facing);
|
||||
|
||||
for(int i = 0; i < EnumFacing.VALUES.length; i++)
|
||||
for(EnumFacing sideToCheck : EnumFacing.values())
|
||||
{
|
||||
if(config.get(translatedFacings[i]) == dataIndex)
|
||||
if(config.get(translatedFacings[sideToCheck.ordinal()]) == dataIndex)
|
||||
{
|
||||
ret.add(translatedFacings[i]);
|
||||
ret.add(sideToCheck);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ public class TileComponentConfig implements ITileComponent
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return getConfig(type).get(sideToTest) == dataIndex;
|
||||
EnumFacing[] translatedFacings = MekanismUtils.getBaseOrientations(facing);
|
||||
return getConfig(type).get(translatedFacings[sideToTest.ordinal()]) == dataIndex;
|
||||
}
|
||||
|
||||
public void setCanEject(TransmissionType type, boolean eject)
|
||||
|
||||
Reference in new issue
Block a user