Skip to content

Commit

Permalink
Rename getObject/setObject hook on TileEntity
Browse files Browse the repository at this point in the history
because the name is asking for conflicts.
  • Loading branch information
bziemons committed Sep 25, 2022
1 parent de4f8b0 commit f55d227
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions common/logisticspipes/asm/LogisticsClassTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ public void visitCode() {
}
MethodVisitor mv;
{
mv = node.visitMethod(Opcodes.ACC_PUBLIC, "getObject", "()Llogisticspipes/asm/te/LPTileEntityObject;", null, null);
mv = node.visitMethod(Opcodes.ACC_PUBLIC, "getLPTileEntityObject", "()Llogisticspipes/asm/te/LPTileEntityObject;", null, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
Expand All @@ -538,7 +538,7 @@ public void visitCode() {
mv.visitEnd();
}
{
mv = node.visitMethod(Opcodes.ACC_PUBLIC, "setObject", "(Llogisticspipes/asm/te/LPTileEntityObject;)V", null, null);
mv = node.visitMethod(Opcodes.ACC_PUBLIC, "setLPTileEntityObject", "(Llogisticspipes/asm/te/LPTileEntityObject;)V", null, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
Expand Down
4 changes: 2 additions & 2 deletions common/logisticspipes/asm/te/ILPTEInformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public interface ILPTEInformation {

LPTileEntityObject getObject();
LPTileEntityObject getLPTileEntityObject();

void setObject(LPTileEntityObject object);
void setLPTileEntityObject(LPTileEntityObject object);
}
4 changes: 2 additions & 2 deletions common/logisticspipes/pipes/basic/CoreRoutedPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -1676,8 +1676,8 @@ protected void triggerConnectionCheck() {
@Override
public CacheHolder getCacheHolder() {
if (cacheHolder == null) {
if (container instanceof ILPTEInformation && ((ILPTEInformation) container).getObject() != null) {
cacheHolder = ((ILPTEInformation) container).getObject().getCacheHolder();
if (container instanceof ILPTEInformation && ((ILPTEInformation) container).getLPTileEntityObject() != null) {
cacheHolder = ((ILPTEInformation) container).getLPTileEntityObject().getCacheHolder();
} else {
cacheHolder = new CacheHolder();
}
Expand Down
10 changes: 5 additions & 5 deletions common/logisticspipes/proxy/td/TDDuctInformationProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ public boolean acceptItem(LPTravelingItem item, TileEntity from) {
Object cache = null;
Triplet<Integer, ItemIdentifier, Boolean> key = new Triplet<>(id, item.getItemIdentifierStack()
.getItem(), serverItem.getInfo()._transportMode == TransportMode.Active);
if (duct instanceof ILPTEInformation && ((ILPTEInformation) duct).getObject() != null) {
cache = ((ILPTEInformation) duct).getObject().getCacheHolder().getCacheFor(CacheTypes.Routing, key);
if (duct instanceof ILPTEInformation && ((ILPTEInformation) duct).getLPTileEntityObject() != null) {
cache = ((ILPTEInformation) duct).getLPTileEntityObject().getCacheHolder().getCacheFor(CacheTypes.Routing, key);
}
if (cache instanceof Route) {
//noinspection unchecked
Expand Down Expand Up @@ -285,8 +285,8 @@ public boolean acceptItem(LPTravelingItem item, TileEntity from) {
}
}
if (route != null) {
if (duct instanceof ILPTEInformation && ((ILPTEInformation) duct).getObject() != null) {
((ILPTEInformation) duct).getObject().getCacheHolder().setCache(CacheTypes.Routing, key, route);
if (duct instanceof ILPTEInformation && ((ILPTEInformation) duct).getLPTileEntityObject() != null) {
((ILPTEInformation) duct).getLPTileEntityObject().getCacheHolder().setCache(CacheTypes.Routing, key, route);
}
TravelingItem travelItem = new TravelingItem(item.getItemIdentifierStack().makeNormalStack(), getDuct(), route.copy(), (byte) serverItem.output.ordinal(), (byte) 1 /* Speed */);
//noinspection ConstantConditions
Expand Down Expand Up @@ -330,4 +330,4 @@ public List<RouteInfo> getConnectedPipes(EnumFacing from) {
}
return list;
}
}
}
6 changes: 3 additions & 3 deletions common/logisticspipes/routing/ServerRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ public void update(boolean doFullRefresh, CoreRoutedPipe pipe) {
}

private void ensureChangeListenerAttachedToPipe(CoreRoutedPipe pipe) {
if (pipe.container instanceof ILPTEInformation && ((ILPTEInformation) pipe.container).getObject() != null) {
if (!((ILPTEInformation) pipe.container).getObject().changeListeners.contains(localChangeListener)) {
((ILPTEInformation) pipe.container).getObject().changeListeners.add(localChangeListener);
if (pipe.container instanceof ILPTEInformation && ((ILPTEInformation) pipe.container).getLPTileEntityObject() != null) {
if (!((ILPTEInformation) pipe.container).getLPTileEntityObject().changeListeners.contains(localChangeListener)) {
((ILPTEInformation) pipe.container).getLPTileEntityObject().changeListeners.add(localChangeListener);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions common/logisticspipes/routing/pathfinder/PathFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,12 @@ private HashMap<CoreRoutedPipe, ExitRoute> getConnectedRoutingPipes(IPipeInforma
}

private void listTileEntity(TileEntity tile) {
if (changeListener != null && tile instanceof ILPTEInformation && ((ILPTEInformation) tile).getObject() != null) {
if (!((ILPTEInformation) tile).getObject().changeListeners.contains(changeListener)) {
((ILPTEInformation) tile).getObject().changeListeners.add(changeListener);
if (changeListener != null && tile instanceof ILPTEInformation && ((ILPTEInformation) tile).getLPTileEntityObject() != null) {
if (!((ILPTEInformation) tile).getLPTileEntityObject().changeListeners.contains(changeListener)) {
((ILPTEInformation) tile).getLPTileEntityObject().changeListeners.add(changeListener);
}
listenedPipes.add(((ILPTEInformation) tile).getObject().changeListeners);
touchedPipes.add(((ILPTEInformation) tile).getObject());
listenedPipes.add(((ILPTEInformation) tile).getLPTileEntityObject().changeListeners);
touchedPipes.add(((ILPTEInformation) tile).getLPTileEntityObject());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static void validate(final TileEntity tile) {
}

if (SimpleServiceLocator.pipeInformationManager.isPipe(tile, false, ConnectionType.UNDEFINED) || SimpleServiceLocator.specialtileconnection.isType(tile)) {
((ILPTEInformation) tile).setObject(new LPTileEntityObject());
((ILPTEInformation) tile).getObject().initialised = LPTickHandler.getWorldInfo(world).getWorldTick();
if (((ILPTEInformation) tile).getObject().initialised < 5) {
((ILPTEInformation) tile).setLPTileEntityObject(new LPTileEntityObject());
((ILPTEInformation) tile).getLPTileEntityObject().initialised = LPTickHandler.getWorldInfo(world).getWorldTick();
if (((ILPTEInformation) tile).getLPTileEntityObject().initialised < 5) {
return;
}
QueuedTasks.queueTask(() -> {
Expand All @@ -52,15 +52,15 @@ public static void validate(final TileEntity tile) {
continue;
}
TileEntity nextTile = newPos.getTileEntity(world);
if (nextTile != null && ((ILPTEInformation) nextTile).getObject() != null) {
if (nextTile != null && ((ILPTEInformation) nextTile).getLPTileEntityObject() != null) {
if (SimpleServiceLocator.pipeInformationManager.isItemPipe(nextTile)) {
SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(nextTile).refreshTileCacheOnSide(dir.getOpposite());
}
if (SimpleServiceLocator.pipeInformationManager.isItemPipe(tile)) {
SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(tile).refreshTileCacheOnSide(dir);
SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(tile).refreshTileCacheOnSide(dir.getOpposite());
}
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) nextTile).getObject().changeListeners)) {
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) nextTile).getLPTileEntityObject().changeListeners)) {
listener.pipeAdded(pos, dir.getOpposite());
}
}
Expand All @@ -78,7 +78,7 @@ public static void invalidate(final TileEntity tile) {
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).isRoutingPipe()) {
return;
}
if (((ILPTEInformation) tile).getObject() != null) {
if (((ILPTEInformation) tile).getLPTileEntityObject() != null) {
QueuedTasks.queueTask(() -> {
DoubleCoordinates pos = new DoubleCoordinates(tile);
for (EnumFacing dir : EnumFacing.VALUES) {
Expand All @@ -87,13 +87,13 @@ public static void invalidate(final TileEntity tile) {
continue;
}
TileEntity nextTile = newPos.getTileEntity(world);
if (nextTile != null && ((ILPTEInformation) nextTile).getObject() != null) {
if (nextTile != null && ((ILPTEInformation) nextTile).getLPTileEntityObject() != null) {
if (SimpleServiceLocator.pipeInformationManager.isItemPipe(nextTile)) {
SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(nextTile).refreshTileCacheOnSide(dir.getOpposite());
}
}
}
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) tile).getObject().changeListeners)) {
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) tile).getLPTileEntityObject().changeListeners)) {
listener.pipeRemoved(pos);
}
return null;
Expand Down Expand Up @@ -131,7 +131,7 @@ public static void handleBlockUpdate(final World world, final LPWorldInfo info,
return null;
});
}
if (tile == null || ((ILPTEInformation) tile).getObject() == null) {
if (!(tile instanceof ILPTEInformation) || ((ILPTEInformation) tile).getLPTileEntityObject() == null) {
return;
}
if (SimpleServiceLocator.pipeInformationManager.isItemPipe(tile) || SimpleServiceLocator.specialtileconnection.isType(tile)) {
Expand All @@ -143,13 +143,13 @@ public static void handleBlockUpdate(final World world, final LPWorldInfo info,
continue;
}
TileEntity nextTile = newPos.getTileEntity(world);
if (nextTile != null && ((ILPTEInformation) nextTile).getObject() != null) {
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) nextTile).getObject().changeListeners)) {
if (nextTile != null && ((ILPTEInformation) nextTile).getLPTileEntityObject() != null) {
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) nextTile).getLPTileEntityObject().changeListeners)) {
listener.pipeModified(pos);
}
}
}
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) tile).getObject().changeListeners)) {
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) tile).getLPTileEntityObject().changeListeners)) {
listener.pipeModified(pos);
}
info.getUpdateQueued().remove(pos);
Expand Down

0 comments on commit f55d227

Please sign in to comment.