Fix #1275 block placement lag when constructing a massive greenhouse

This commit is contained in:
mezz committed 2016-06-03 15:26:57 -07:00
1 parent 69c024811f
commit 33d1685713
7 files changed
+22 -17

No files matched your search

@@ -6,7 +6,7 @@
package forestry.api.greenhouse;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -22,7 +22,7 @@ public interface IGreenhouseState {
float getExactHumidity();
List<IInternalBlock> getInternalBlocks();
Set<IInternalBlock> getInternalBlocks();
Collection<IMultiblockComponent> getGreenhouseComponents();
@@ -12,7 +12,7 @@ package forestry.greenhouse;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -45,8 +45,8 @@ public class FakeGreenhouseState implements IGreenhouseState {
}
@Override
public List<IInternalBlock> getInternalBlocks() {
return Collections.emptyList();
public Set<IInternalBlock> getInternalBlocks() {
return Collections.emptySet();
}
@Override
@@ -11,7 +11,7 @@
package forestry.greenhouse;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -24,10 +24,10 @@ public final class GreenhouseState implements IGreenhouseState {
private final float humidity;
private final float temperature;
private final List<IInternalBlock> internalBlocks;
private final Set<IInternalBlock> internalBlocks;
private final Collection<IMultiblockComponent> greenhouseComponents;
public GreenhouseState(float humidity, float temperature, List<IInternalBlock> internalBlocks, Collection<IMultiblockComponent> greenhouseComponents) {
public GreenhouseState(float humidity, float temperature, Set<IInternalBlock> internalBlocks, Collection<IMultiblockComponent> greenhouseComponents) {
this.humidity = humidity;
this.temperature = temperature;
this.internalBlocks = internalBlocks;
@@ -59,7 +59,7 @@ public final class GreenhouseState implements IGreenhouseState {
}
@Override
public List<IInternalBlock> getInternalBlocks() {
public Set<IInternalBlock> getInternalBlocks() {
return internalBlocks;
}
@@ -13,6 +13,7 @@ package forestry.greenhouse.multiblock;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
@@ -97,8 +98,8 @@ public class FakeGreenhouseController extends FakeMultiblockController implement
}
@Override
public List<IInternalBlock> getInternalBlocks() {
return Collections.emptyList();
public Set<IInternalBlock> getInternalBlocks() {
return Collections.emptySet();
}
@Override
@@ -19,7 +19,6 @@ import java.util.List;
import java.util.Set;
import java.util.Stack;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -78,7 +77,7 @@ import forestry.greenhouse.tiles.TileGreenhouseSprinkler;
public class GreenhouseController extends RectangularMultiblockControllerBase implements IGreenhouseControllerInternal, ILiquidTankTile {
private final List<IInternalBlock> internalBlocks = new ArrayList<>();
private final Set<IInternalBlock> internalBlocks = new HashSet<>();
private final Set<IGreenhouseComponent.Listener> listenerComponents = new HashSet<>();
private final Set<IGreenhouseComponent.Climatiser> climatiserComponents = new HashSet<>();
private final Set<IGreenhouseComponent.Active> activeComponents = new HashSet<>();
@@ -745,7 +744,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
}
@Override
public List<IInternalBlock> getInternalBlocks() {
public Set<IInternalBlock> getInternalBlocks() {
return internalBlocks;
}
@@ -12,7 +12,7 @@ package forestry.greenhouse.multiblock;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import forestry.api.greenhouse.IGreenhouseState;
import forestry.api.greenhouse.IInternalBlock;
@@ -53,7 +53,7 @@ public interface IGreenhouseControllerInternal extends IGreenhouseController, IM
IGreenhouseState createState();
/**
* @return A list with all internal block's of the greenhouse.
* @return All internal blocks of the greenhouse.
*/
List<IInternalBlock> getInternalBlocks();
Set<IInternalBlock> getInternalBlocks();
}
@@ -74,4 +74,9 @@ public class InternalBlock implements IInternalBlock {
IInternalBlock internalBlock = (IInternalBlock) obj;
return internalBlock.getPos().equals(getPos());
}
@Override
public int hashCode() {
return pos.hashCode();
}
}