Sfoglia il codice sorgente

WIP pipe refactoring, bugfixes

1.11
Adrian Siekierka 2 anni fa
parent
commit
065b0a5bc9

+ 2
- 1
src/main/java/pl/asie/charset/api/pipes/IPipeView.java Vedi File

@@ -17,6 +17,7 @@
package pl.asie.charset.api.pipes;

import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;

import java.util.Collection;

@@ -24,7 +25,7 @@ import java.util.Collection;
* This interface is used for viewing items travelling through a pipe.
* Note that the pipe can decide the contents at its own discretion and
* that it is not necessarily exhaustive - the idea is to let other mods
* react - and only react - to the act of items travelling inside a pipe.
* react - and only react - to the action of items travelling inside a pipe.
*/
public interface IPipeView {
/**

+ 25
- 0
src/main/java/pl/asie/charset/lib/scheduler/ScheduledEvent.java Vedi File

@@ -0,0 +1,25 @@
package pl.asie.charset.lib.scheduler;

public final class ScheduledEvent {
private final Runnable runnable;
private boolean executed;

ScheduledEvent(Runnable runnable) {
this.runnable = runnable;
this.executed = false;
}

public boolean hasExecuted() {
return executed;
}

boolean run() {
if (!executed) {
runnable.run();
executed = true;
return true;
} else {
throw new RuntimeException("ScheduledEvent tried to execute twice!");
}
}
}

unmoved/WorldScheduler.java → src/main/java/pl/asie/charset/lib/scheduler/Scheduler.java Vedi File

@@ -1,4 +1,4 @@
package pl.asie.charset.lib;
package pl.asie.charset.lib.scheduler;

import gnu.trove.map.TLongObjectMap;
import gnu.trove.map.hash.TLongObjectHashMap;
@@ -10,22 +10,24 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.*;

// TODO: Implement saving? Ha, ha, I wish.
public class WorldScheduler {
public static final WorldScheduler INSTANCE = new WorldScheduler();
private final Map<World, TLongObjectMap<Queue<Runnable>>> schedule = new WeakHashMap<>();
public class Scheduler {
public static final Scheduler INSTANCE = new Scheduler();
private final Map<World, TLongObjectMap<Queue<ScheduledEvent>>> schedule = new WeakHashMap<>();

public void in(World world, int ticks, Runnable runnable) {
at(world, world.getTotalWorldTime() + ticks, runnable);
public ScheduledEvent in(World world, int ticks, Runnable runnable) {
return at(world, world.getTotalWorldTime() + ticks, runnable);
}

public void at(World world, long targetTime, Runnable runnable) {
TLongObjectMap<Queue<Runnable>> requests = schedule.computeIfAbsent(world, k -> new TLongObjectHashMap<>());
Queue<Runnable> queue = requests.get(targetTime);
public ScheduledEvent at(World world, long targetTime, Runnable runnable) {
TLongObjectMap<Queue<ScheduledEvent>> requests = schedule.computeIfAbsent(world, k -> new TLongObjectHashMap<>());
Queue<ScheduledEvent> queue = requests.get(targetTime);
if (queue == null) {
queue = new ArrayDeque<>();
requests.put(targetTime, queue);
}
queue.add(runnable);
ScheduledEvent event = new ScheduledEvent(runnable);
queue.add(event);
return event;
}

@SubscribeEvent
@@ -36,14 +38,14 @@ public class WorldScheduler {
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
TLongObjectMap<Queue<Runnable>> requests = schedule.get(event.world);
TLongObjectMap<Queue<ScheduledEvent>> requests = schedule.get(event.world);
if (requests != null) {
// We tick at the *end* of a phase, so the world time has
// already had 1 added to it.
long time = event.world.getTotalWorldTime() - 1;
Queue<Runnable> queue = requests.remove(time);
Queue<ScheduledEvent> queue = requests.remove(time);
if (queue != null) {
for (Runnable r : queue) {
for (ScheduledEvent r : queue) {
event.world.profiler.startSection(r.getClass().getName());
r.run();
event.world.profiler.endSection();

+ 4
- 0
src/main/java/pl/asie/charset/misc/scaffold/TileScaffold.java Vedi File

@@ -13,6 +13,10 @@ public class TileScaffold extends TileBase {
public static final UnlistedPropertyGeneric<ScaffoldCacheInfo> PROPERTY = new UnlistedPropertyGeneric<>("tile", ScaffoldCacheInfo.class);
private ItemMaterial plank;

public TileScaffold() {
plank = getPlankFromNBT(null);
}

public ItemMaterial getPlank() {
return plank;
}

+ 2
- 1
src/main/java/pl/asie/charset/pipes/pipe/PacketItemUpdate.java Vedi File

@@ -65,7 +65,7 @@ public class PacketItemUpdate extends PacketTile {
public void writeItemData(ByteBuf buf) {
buf.writeShort(item.id);
buf.writeByte(SpaceUtils.ordinal(item.input) | (SpaceUtils.ordinal(item.output) << 3));
buf.writeByte((item.reachedCenter ? 0x01 : 0) | (item.isStuck(null) ? 0x02 : 0) | (syncStack ? 0x04 : 0));
buf.writeByte((item.reachedCenter ? 0x01 : 0) | (item.isStuck(null) ? 0x02 : 0) | (syncStack ? 0x04 : 0) | (SpaceUtils.ordinal(item.renderDirection) << 4));
buf.writeByte(item.progress);

if (syncStack) {
@@ -111,6 +111,7 @@ public class PacketItemUpdate extends PacketTile {

item.input = SpaceUtils.getFacing(dirs & 7);
item.output = SpaceUtils.getFacing((dirs >> 3) & 7);
item.renderDirection = SpaceUtils.getFacing((flags >> 4) & 7);
item.reachedCenter = (flags & 0x01) != 0;
item.blocksSinceSync = 0;
if (addWhenDone) {

+ 51
- 83
src/main/java/pl/asie/charset/pipes/pipe/PipeItem.java Vedi File

@@ -16,6 +16,7 @@

package pl.asie.charset.pipes.pipe;

import com.google.common.collect.Lists;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -46,6 +47,7 @@ public class PipeItem {
byte blocksSinceSync;

protected EnumFacing input, output;
protected EnumFacing renderDirection;
protected boolean reachedCenter;
protected ItemStack stack = ItemStack.EMPTY;
protected int progress;
@@ -57,6 +59,16 @@ public class PipeItem {
private TilePipe owner;
private boolean stuck;

protected void updateRenderDirection() {
if (renderDirection == null || (getDirection() != null && getDirection().getAxis() != EnumFacing.Axis.Y)) {
renderDirection = getDirection();
}
}

public EnumFacing getRenderDirection() {
return renderDirection;
}

public PipeItem(TilePipe owner, ItemStack stack, EnumFacing side) {
this.id = nextId++;
this.owner = owner;
@@ -137,7 +149,11 @@ public class PipeItem {

// This version takes priority into account (filtered shifters are
// prioritized over unfiltered shifters at the same distance).
private int getInternalShifterStrength(IShifter shifter, EnumFacing dir) {
private int getInternalShifterStrength(PipeLogic.Direction dir) {
return getInternalShifterStrength(dir.dir, dir.shifter);
}

private int getInternalShifterStrength(EnumFacing dir, IShifter shifter) {
if (shifter == null) {
return 0;
} else {
@@ -159,7 +175,7 @@ public class PipeItem {
// Find the closest shifter affecting the item.
for (EnumFacing dir : EnumFacing.VALUES) {
IShifter p = owner.getNearestShifter(dir);
int ps = getInternalShifterStrength(p, dir);
int ps = getInternalShifterStrength(dir, p);
if (ps > 0 && ps < minimumShifterDistance
&& isShifterPushing(p, output)) {
minimumShifterDistance = ps;
@@ -170,7 +186,7 @@ public class PipeItem {
if (
(!foundShifter && activeShifterDistance > 0)
|| (foundShifter && activeShifterDistance != minimumShifterDistance)
|| (foundShifter && activeShifterDistance != getInternalShifterStrength(owner.getNearestShifter(output), output))
|| (foundShifter && activeShifterDistance != getInternalShifterStrength(output, owner.getNearestShifter(output)))
) {
TileEntity shifterTile = owner.getWorld().getTileEntity(owner.getPos().offset(output.getOpposite(), activeShifterDistance));

@@ -351,98 +367,46 @@ public class PipeItem {
return;
}

List<EnumFacing> directionList = new ArrayList<EnumFacing>();
List<EnumFacing> pressureList = new ArrayList<EnumFacing>();

activeShifterDistance = 0;

// Step 1: Make a list of all valid directions, as well as all shifters.
for (EnumFacing direction : EnumFacing.VALUES) {
if (isValidDirection(direction)) {
directionList.add(direction);
}

IShifter p = owner.getNearestShifter(direction);

if (p != null && isShifterPushing(p, direction)) {
pressureList.add(direction);
}
}

// Step 2: Sort the shifter list.
Collections.sort(pressureList, new Comparator<EnumFacing>() {
@Override
public int compare(EnumFacing o1, EnumFacing o2) {
return getInternalShifterStrength(owner.getNearestShifter(o1), o1) - getInternalShifterStrength(owner.getNearestShifter(o2), o2);
}
});

PipeLogic.Direction dir = null;

EnumFacing firstOutput = null;
for (PipeLogic.Direction iDir : owner.getLogic().getPressuredDirections()) {
if (!iDir.test(stack))
continue;

// Step 3: Pick the next path.
for (EnumFacing dir : pressureList) {
if (canMoveDirection(dir, true)) {
dir = iDir;
if (canMoveDirection(dir.dir, true)) {
// Pressurizer prioritizing valid direction, move.
this.output = dir;
activeShifterDistance = getInternalShifterStrength(owner.getNearestShifter(dir), dir);
this.output = dir.dir;
activeShifterDistance = getInternalShifterStrength(dir);
return;
} else if (pressureList.contains(dir.getOpposite())
&& owner.getShifterStrength(dir) == owner.getShifterStrength(dir.getOpposite())) {
} else if (owner.getLogic().hasPressure(dir.dir.getOpposite())
&& owner.getShifterStrength(dir.dir) == owner.getShifterStrength(dir.dir.getOpposite())) {
// Pressurizers freezing an item in place.
this.output = dir;
activeShifterDistance = getInternalShifterStrength(owner.getNearestShifter(dir), dir);
this.output = dir.dir;
activeShifterDistance = getInternalShifterStrength(dir);
return;
} else if (directionList.contains(dir) && firstOutput == null) {
firstOutput = dir;
}
}

directionList.removeAll(pressureList);
directionList.remove(input);

if (directionList.size() > 0) {
EnumFacing dir;
int i = 0;

// Step 3b: Pick the first "unforced" direction to scan.
// A direction opposite to input (aka. "straight line")
// takes priority.
if (directionList.contains(input.getOpposite())) {
dir = input.getOpposite();
directionList.remove(input.getOpposite());
} else if (directionList.size() > 1) {
Collections.shuffle(directionList);
dir = directionList.get(0);
i = 1;
} else if (directionList.size() == 1) {
this.output = directionList.get(0);
return;
} else {
this.output = null;
return;
}
activeShifterDistance = 0;

if (firstOutput == null) {
firstOutput = dir;
}
List<PipeLogic.Direction> directionList = Lists.newArrayList(owner.getLogic().getNonPressuredDirections());
Collections.shuffle(directionList);

while (!canMoveDirection(dir, true) && i < directionList.size()) {
dir = directionList.get(i);
i++;
for (int i = directionList.size() - 1; i >= 0; i--) {
PipeLogic.Direction iDir = directionList.get(i);
if (iDir.dir == input || !iDir.test(stack)) {
continue;
}

// Step 3c: If a valid, free direction has been found, use that.
// Otherwise, set it to the first output direction selected to
// prioritize that, for some reason.
if (canMoveDirection(dir, true)) {
this.output = dir;
} else {
this.output = firstOutput;
dir = iDir;
if (canMoveDirection(iDir.dir, true)) {
this.output = iDir.dir;
return;
}
} else {
this.output = firstOutput;
}

this.output = dir != null ? dir.dir : null;
}

private void onReachedCenter() {
@@ -455,6 +419,7 @@ public class PipeItem {

owner.updateObservers(stack);
calculateOutputDirection();
updateRenderDirection();
updateStuckFlag();
sendPacket(false);
}
@@ -532,9 +497,7 @@ public class PipeItem {
this.stuck = false;
this.progress = 0;

if (owner.getWorld().isRemote) {

}
updateRenderDirection();
}

public void readFromNBT(NBTTagCompound nbt) {
@@ -549,6 +512,10 @@ public class PipeItem {
if (nbt.hasKey("activePD")) {
activeShifterDistance = nbt.getInteger("activePD");
}
if (nbt.hasKey("rendir")) {
renderDirection = SpaceUtils.getFacing(nbt.getByte("rendir"));
}
updateRenderDirection();
}

public void writeToNBT(NBTTagCompound nbt) {
@@ -556,6 +523,7 @@ public class PipeItem {
nbt.setShort("p", (short) progress);
nbt.setByte("in", (byte) SpaceUtils.ordinal(input));
nbt.setByte("out", (byte) SpaceUtils.ordinal(output));
nbt.setByte("rendir", (byte) SpaceUtils.ordinal(renderDirection));
nbt.setBoolean("reachedCenter", reachedCenter);
if (stuck) {
nbt.setBoolean("stuck", stuck);

+ 67
- 43
src/main/java/pl/asie/charset/pipes/pipe/PipeLogic.java Vedi File

@@ -5,13 +5,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
import pl.asie.charset.ModCharset;
import pl.asie.charset.api.pipes.IShifter;
import pl.asie.charset.lib.capability.Capabilities;
import pl.asie.charset.lib.capability.CapabilityHelper;
import pl.asie.charset.pipes.PipeUtils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;

@@ -30,32 +28,50 @@ public class PipeLogic {
}

public static class Direction {
public final DirectionType type;
public final EnumFacing dir;
public final IShifter shifter;

private Direction(EnumFacing dir, IShifter shifter) {
private Direction(@Nonnull DirectionType type, @Nonnull EnumFacing dir, @Nullable IShifter shifter) {
this.type = type;
this.dir = dir;
this.shifter = shifter;
}

public boolean hasPressure() {
return shifter != null;
}

private boolean canShift() {
return shifter != null && shifter.isShifting() && shifter.getDirection() == dir;
}

public boolean test(ItemStack stack) {
return (shifter == null || (shifter.isShifting() && shifter.matches(stack)));
return type.acceptsItems && (shifter == null || (canShift() && shifter.matches(stack)));
}

public boolean test(FluidStack stack) {
return (shifter != null && (shifter.isShifting() && shifter.matches(stack)));
return type.acceptsFluids && (shifter != null && (canShift() && shifter.matches(stack)));
}
}

private final TilePipe owner;
private boolean isPressured;
private EnumMap<EnumFacing, DirectionType> directions = new EnumMap<EnumFacing, DirectionType>(EnumFacing.class);
private EnumMap<EnumFacing, IShifter> pressuredDirections = new EnumMap<EnumFacing, IShifter>(EnumFacing.class);
private byte pressuredDirMask;
private List<Direction> pressureDirections = new ArrayList<>(6);
private List<Direction> nonPressureDirections = new ArrayList<>(6);

public PipeLogic(TilePipe owner) {
this.owner = owner;
}

public Collection<Direction> getPressuredDirections() {
return pressureDirections;
}

public Collection<Direction> getNonPressuredDirections() {
return nonPressureDirections;
}

// This version takes priority into account (filtered shifters are
// prioritized over unfiltered shifters at the same distance).
private int getInternalShifterStrength(IShifter shifter, EnumFacing dir) {
@@ -66,59 +82,67 @@ public class PipeLogic {
}
}

public boolean hasPressure(EnumFacing direction) {
return isPressured ? directions.containsKey(direction) : pressuredDirections.containsKey(direction);
private DirectionType calcDirectionType(EnumFacing direction) {
TileEntity tile = owner.getNeighbourTile(direction);
boolean hasItem = CapabilityHelper.get(Capabilities.ITEM_INSERTION_HANDLER, tile, direction.getOpposite()) != null;
boolean hasFluid = CapabilityHelper.get(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, tile, direction.getOpposite()) != null;
DirectionType type = hasItem ? (hasFluid ? DirectionType.DUAL_TARGET : DirectionType.ITEM_TARGET) : (hasFluid ? DirectionType.FLUID_TARGET : null);
if (type == null) {
System.out.println("Type null! " + (tile != null ? tile.getClass().getName() : "null") + " " + owner.getPos().offset(direction) + " " + direction.getOpposite().getName());
}
return type;
}

public void updateDirections() {
List<EnumFacing> directionList = new ArrayList<EnumFacing>();
List<EnumFacing> pressureList = new ArrayList<EnumFacing>();
System.out.println("Update " + owner.getPos());

isPressured = false;
pressuredDirMask = 0;

Set<EnumFacing> directionSet = EnumSet.noneOf(EnumFacing.class);
List<IShifter> shifterList = new ArrayList<>(6);

// Step 1: Make a list of all valid directions, as well as all shifters.
for (EnumFacing direction : EnumFacing.VALUES) {
TilePipe pipe = PipeUtils.getPipe(owner.getWorld(), owner.getPos().offset(direction), direction.getOpposite());
if (pipe != null && pipe.getLogic().hasPressure(direction)) {
isPressured = true;
continue;
}

// TilePipe pipe = PipeUtils.getPipe(owner.getWorld(), owner.getPos().offset(direction), direction.getOpposite());
if (owner.connects(direction)) {
directionList.add(direction);
directionSet.add(direction);
}

IShifter p = owner.getNearestShifter(direction);

if (p != null && p.getDirection() == direction) {
pressureList.add(direction);
pressuredDirMask |= (1 << direction.ordinal());
shifterList.add(p);
}
}

// Step 2: Sort the shifter list.
Collections.sort(pressureList, new Comparator<EnumFacing>() {
@Override
public int compare(EnumFacing o1, EnumFacing o2) {
return getInternalShifterStrength(owner.getNearestShifter(o1), o1) - getInternalShifterStrength(owner.getNearestShifter(o2), o2);
Collections.sort(shifterList, Comparator.comparingInt(o -> getInternalShifterStrength(o, o.getDirection())));

pressureDirections.clear();
for (IShifter shifter : shifterList) {
DirectionType type = calcDirectionType(shifter.getDirection());
if (type != null) {
//noinspection ConstantConditions
pressureDirections.add(new Direction(type, shifter.getDirection(), shifter));
}
});

directions.clear();
pressuredDirections.clear();

for (EnumFacing direction : directionList) {
TileEntity tile = owner.getNeighbourTile(direction);
boolean hasItem = CapabilityHelper.get(Capabilities.ITEM_INSERTION_HANDLER, tile, direction.getOpposite()) != null;
boolean hasFluid = CapabilityHelper.get(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, tile, direction.getOpposite()) != null;
DirectionType type = hasItem ? (hasFluid ? DirectionType.DUAL_TARGET : DirectionType.FLUID_TARGET) : (hasFluid ? DirectionType.FLUID_TARGET : null);
if (type == null) {
ModCharset.logger.warn(owner.getPos().offset(direction) + " has connection but no DirectionType! Will be ignored.");
} else {
directions.put(direction, type);
if (pressureList.contains(direction)) {
pressuredDirections.put(direction, owner.getNearestShifter(direction));
}
directionSet.remove(shifter.getDirection());
}

nonPressureDirections.clear();
for (EnumFacing direction : directionSet) {
DirectionType type = calcDirectionType(direction);
if (type != null) {
nonPressureDirections.add(new Direction(type, direction, null));
}
}
}

public boolean hasPressure(EnumFacing direction) {
return (pressuredDirMask & (1 << direction.ordinal())) != 0;
}

public boolean hasPressure() {
return pressuredDirMask != 0;
}
}

+ 2
- 2
src/main/java/pl/asie/charset/pipes/pipe/SpecialRendererPipe.java Vedi File

@@ -314,7 +314,7 @@ public class SpecialRendererPipe extends DualTileEntitySpecialRenderer<TilePipe>

synchronized (part.getPipeItems()) {
for (PipeItem item : part.getPipeItems()) {
EnumFacing id = item.getDirection();
EnumFacing id = item.getRenderDirection();
ItemStack stack = item.getStack();
if (stack == null) {
continue;
@@ -384,7 +384,7 @@ public class SpecialRendererPipe extends DualTileEntitySpecialRenderer<TilePipe>

if (SLOW_ITEMS.size() > 0) {
for (PipeItem item : SLOW_ITEMS) {
EnumFacing id = item.getDirection();
EnumFacing id = item.getRenderDirection();
ItemStack stack = item.getStack();
float scale = getItemScale(item);
float[] offset = calculateItemOffset(item, partialTicks);

+ 35
- 7
src/main/java/pl/asie/charset/pipes/pipe/TilePipe.java Vedi File

@@ -85,6 +85,7 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick
}

public TilePipe() {
material = getMaterialFromNBT(null);
for (EnumFacing facing : EnumFacing.VALUES)
insertionHandlers[facing.ordinal()] = new InsertionHandler(facing);
}
@@ -156,7 +157,7 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick
fluid.readFromNBT(tag);
}

material = ItemMaterialRegistry.INSTANCE.getMaterial(nbt, "material", "stone", new ItemStack(Blocks.STONE));
material = getMaterialFromNBT(nbt);
connectionCache = nbt.getByte("cc");

if (!isClient) {
@@ -169,9 +170,13 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick
}
}

protected ItemMaterial getMaterialFromNBT(NBTTagCompound compound) {
return ItemMaterialRegistry.INSTANCE.getMaterial(compound, "material", "stone", new ItemStack(Blocks.STONE));
}

@Override
public void onPlacedBy(EntityLivingBase placer, ItemStack stack) {
material = ItemMaterialRegistry.INSTANCE.getMaterial(stack.getTagCompound(), "material", "stone", new ItemStack(Blocks.STONE));
material = getMaterialFromNBT(stack.getTagCompound());
color = stack.hasTagCompound() ? stack.getTagCompound().getByte("color") : 0;
markBlockForUpdate();
}
@@ -255,7 +260,7 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick
@Override
public void validate() {
super.validate();
neighborsUpdate = 0x3F;
scheduleFullNeighborUpdate();
scheduleRenderUpdate();
}

@@ -301,7 +306,12 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick
shifterDistance[i] = 0;
}

return oldDistance != shifterDistance[i];
if (oldDistance != shifterDistance[i]) {
logic.updateDirections();
return true;
} else {
return false;
}
}

private void propagateShifterChange(EnumFacing dir, IShifter shifter, int shifterDist) {
@@ -344,10 +354,12 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick
}
}

// TODO
// fluid.markFlowPath(null, false);
if (!getWorld().isRemote) {
logic.updateDirections();
}

if (sendPacket && connectionCache != oc) {
world.notifyNeighborsRespectDebug(pos, getBlockType(), false);
markBlockForUpdate();
}
}
@@ -603,13 +615,29 @@ public class TilePipe extends TileBase implements IConnectable, IPipeView, ITick

stringList.add(info.toString());

int directions = 0;
int pDirections = 0;
for (PipeLogic.Direction direction : getLogic().getPressuredDirections()) {
pDirections |= 1 << direction.dir.ordinal();
}
for (PipeLogic.Direction direction : getLogic().getNonPressuredDirections()) {
directions |= 1 << direction.dir.ordinal();
}

for (int i = 0; i <= 6; i++) {
EnumFacing facing = SpaceUtils.getFacing(i);
StringBuilder sideInfo = new StringBuilder();

sideInfo.append(facing != null ? facing.name().charAt(0) : 'C');
sideInfo.append(": ");
sideInfo.append(i < 6 && connects(facing) ? '+' : '-');
if (i < 6) {
sideInfo.append(connects(facing) ? '+' : '-');
sideInfo.append(
(((pDirections) & (1 << facing.ordinal())) != 0) ? '>' :
((((directions) & (1 << facing.ordinal())) != 0) ? '+' : '-'));
} else {
sideInfo.append("--");
}
sideInfo.append(" f" + fluid.tanks[i].type.name().charAt(0) + "(" + fluid.tanks[i].amount + ")");
if (i < 6) {
sideInfo.append(" s" + shifterDistance[i]);

+ 0
- 1
src/main/java/pl/asie/charset/tools/wrench/ItemWrench.java Vedi File

@@ -52,7 +52,6 @@ public class ItemWrench extends Item {
return false;
}

// TODO 1.11
@net.minecraftforge.fml.common.Optional.Method(modid = "mcmultipart")
public EnumActionResult tryRotateMultipart(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing targetFacing) {
Optional<IMultipartContainer> uio = MultipartHelper.getContainer(worldIn, pos);

Loading…
Annulla
Salva