Skip to content

Commit

Permalink
switch to a linked list
Browse files Browse the repository at this point in the history
reformatted javadoc
re-based
  • Loading branch information
PrototypeTrousers committed Apr 9, 2021
1 parent a05d86d commit 3c9479e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
9 changes: 4 additions & 5 deletions src/main/java/gregtech/api/capability/INotifiableHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import gregtech.api.metatileentity.MetaTileEntity;

import java.util.Iterator;
import java.util.List;
import java.util.LinkedList;

/**
* For Item and Fluid handlers capable of notifying entities when
Expand All @@ -14,6 +14,7 @@ public interface INotifiableHandler {
/**
* Notifies the entities of the changes in their inventories
* An iterator is used to remove invalid TileEntities
*
* @param isExport boolean specifying if a handler is an output handler
*/

Expand All @@ -31,13 +32,11 @@ default void notifyMetaTileEntitiesOfChange(boolean isExport) {
}

/**
* returns a List containing the notifiable MetaTileEntities
* @return
* @return a List containing the notifiable MetaTileEntities
*/
List<MetaTileEntity> getNotifiableMetaTileEntities();
LinkedList<MetaTileEntity> getNotifiableMetaTileEntities();

/**
*
* @param metaTileEntity MetaTileEntity to be notified
*/
default void addNotifiableMetaTileEntity(MetaTileEntity metaTileEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import gregtech.api.capability.INotifiableHandler;
import gregtech.api.metatileentity.MetaTileEntity;

import java.util.ArrayList;
import java.util.List;
import java.util.LinkedList;

public class NotifiableFilteredFluidHandler extends FilteredFluidHandler implements INotifiableHandler {

List<MetaTileEntity> entitiesToNotify = new ArrayList<>();
LinkedList<MetaTileEntity> entitiesToNotify = new LinkedList<>();
private final boolean isExport;

public NotifiableFilteredFluidHandler(int capacity, MetaTileEntity entityToNotify, boolean isExport) {
Expand All @@ -24,7 +23,7 @@ protected void onContentsChanged() {
}

@Override
public List<MetaTileEntity> getNotifiableMetaTileEntities() {
public LinkedList<MetaTileEntity> getNotifiableMetaTileEntities() {
return this.entitiesToNotify;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import gregtech.api.metatileentity.MetaTileEntity;
import net.minecraftforge.fluids.FluidTank;

import java.util.ArrayList;
import java.util.List;
import java.util.LinkedList;

public class NotifiableFluidTank extends FluidTank implements INotifiableHandler {

List<MetaTileEntity> entitiesToNotify = new ArrayList<>();
LinkedList<MetaTileEntity> entitiesToNotify = new LinkedList<>();
private final boolean isExport;

public NotifiableFluidTank(int capacity, MetaTileEntity entityToNotify, boolean isExport) {
Expand All @@ -25,7 +24,7 @@ protected void onContentsChanged() {
}

@Override
public List<MetaTileEntity> getNotifiableMetaTileEntities() {
public LinkedList<MetaTileEntity> getNotifiableMetaTileEntities() {
return this.entitiesToNotify;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;

import java.util.ArrayList;
import java.util.List;
import java.util.LinkedList;

public class NotifiableItemStackHandler extends ItemStackHandler implements IItemHandlerModifiable, INotifiableHandler {

List<MetaTileEntity> entitiesToNotify = new ArrayList<>();
LinkedList<MetaTileEntity> entitiesToNotify = new LinkedList<>();
private final boolean isExport;

public NotifiableItemStackHandler(int slots, MetaTileEntity entityToNotify, boolean isExport) {
Expand All @@ -26,7 +25,7 @@ public void onContentsChanged(int slot) {
}

@Override
public List<MetaTileEntity> getNotifiableMetaTileEntities() {
public LinkedList<MetaTileEntity> getNotifiableMetaTileEntities() {
return this.entitiesToNotify;
}
}

0 comments on commit 3c9479e

Please sign in to comment.