reformatted all src files (#141)
This commit is contained in:
@@ -19,26 +19,8 @@
|
||||
package appeng.parts.automation;
|
||||
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
@@ -67,344 +49,287 @@ import appeng.parts.PartModel;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.primitives.Ints;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
||||
public class PartExportBus extends PartSharedItemBus implements ICraftingRequester
|
||||
{
|
||||
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/export_bus_base" );
|
||||
public class PartExportBus extends PartSharedItemBus implements ICraftingRequester {
|
||||
public static final ResourceLocation MODEL_BASE = new ResourceLocation(AppEng.MOD_ID, "part/export_bus_base");
|
||||
|
||||
@PartModels
|
||||
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_off" ) );
|
||||
@PartModels
|
||||
public static final IPartModel MODELS_OFF = new PartModel(MODEL_BASE, new ResourceLocation(AppEng.MOD_ID, "part/export_bus_off"));
|
||||
|
||||
@PartModels
|
||||
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_on" ) );
|
||||
@PartModels
|
||||
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, new ResourceLocation(AppEng.MOD_ID, "part/export_bus_on"));
|
||||
|
||||
@PartModels
|
||||
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_has_channel" ) );
|
||||
@PartModels
|
||||
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE, new ResourceLocation(AppEng.MOD_ID, "part/export_bus_has_channel"));
|
||||
|
||||
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker( this, 9 );
|
||||
private final IActionSource mySrc;
|
||||
private long itemToSend = 1;
|
||||
private boolean didSomething = false;
|
||||
private int nextSlot = 0;
|
||||
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker(this, 9);
|
||||
private final IActionSource mySrc;
|
||||
private long itemToSend = 1;
|
||||
private boolean didSomething = false;
|
||||
private int nextSlot = 0;
|
||||
|
||||
@Reflected
|
||||
public PartExportBus( final ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
@Reflected
|
||||
public PartExportBus(final ItemStack is) {
|
||||
super(is);
|
||||
|
||||
this.getConfigManager().registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
this.getConfigManager().registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.getConfigManager().registerSetting( Settings.CRAFT_ONLY, YesNo.NO );
|
||||
this.getConfigManager().registerSetting( Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT );
|
||||
this.mySrc = new MachineSource( this );
|
||||
}
|
||||
this.getConfigManager().registerSetting(Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
|
||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||
this.getConfigManager().registerSetting(Settings.CRAFT_ONLY, YesNo.NO);
|
||||
this.getConfigManager().registerSetting(Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
|
||||
this.mySrc = new MachineSource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final NBTTagCompound extra )
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
this.craftingTracker.readFromNBT( extra );
|
||||
this.nextSlot = extra.getInteger( "nextSlot" );
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound extra) {
|
||||
super.readFromNBT(extra);
|
||||
this.craftingTracker.readFromNBT(extra);
|
||||
this.nextSlot = extra.getInteger("nextSlot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound extra )
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
this.craftingTracker.writeToNBT( extra );
|
||||
extra.setInteger( "nextSlot", this.nextSlot );
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound extra) {
|
||||
super.writeToNBT(extra);
|
||||
this.craftingTracker.writeToNBT(extra);
|
||||
extra.setInteger("nextSlot", this.nextSlot);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TickRateModulation doBusWork()
|
||||
{
|
||||
if( !this.getProxy().isActive() || !this.canDoBusWork() )
|
||||
{
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
@Override
|
||||
protected TickRateModulation doBusWork() {
|
||||
if (!this.getProxy().isActive() || !this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
this.itemToSend = this.calculateItemsToSend();
|
||||
this.didSomething = false;
|
||||
this.itemToSend = this.calculateItemsToSend();
|
||||
this.didSomething = false;
|
||||
|
||||
try
|
||||
{
|
||||
final InventoryAdaptor destination = this.getHandler();
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
final SchedulingMode schedulingMode = (SchedulingMode) this.getConfigManager().getSetting( Settings.SCHEDULING_MODE );
|
||||
try {
|
||||
final InventoryAdaptor destination = this.getHandler();
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting(Settings.FUZZY_MODE);
|
||||
final SchedulingMode schedulingMode = (SchedulingMode) this.getConfigManager().getSetting(Settings.SCHEDULING_MODE);
|
||||
|
||||
if( destination != null )
|
||||
{
|
||||
int x = 0;
|
||||
if (destination != null) {
|
||||
int x = 0;
|
||||
|
||||
for( x = 0; x < this.availableSlots() && this.itemToSend > 0; x++ )
|
||||
{
|
||||
final int slotToExport = this.getStartingSlot( schedulingMode, x );
|
||||
for (x = 0; x < this.availableSlots() && this.itemToSend > 0; x++) {
|
||||
final int slotToExport = this.getStartingSlot(schedulingMode, x);
|
||||
|
||||
final IAEItemStack ais = this.getConfig().getAEStackInSlot( slotToExport );
|
||||
final IAEItemStack ais = this.getConfig().getAEStackInSlot(slotToExport);
|
||||
|
||||
if( ais == null || this.itemToSend <= 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (ais == null || this.itemToSend <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( this.craftOnly() )
|
||||
{
|
||||
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
|
||||
if (this.craftOnly()) {
|
||||
this.didSomething = this.craftingTracker.handleCrafting(slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc) || this.didSomething;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
final long before = this.itemToSend;
|
||||
final long before = this.itemToSend;
|
||||
|
||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
for( final IAEItemStack o : ImmutableList.copyOf( inv.getStorageList().findFuzzy( ais, fzMode ) ) )
|
||||
{
|
||||
this.pushItemIntoTarget( destination, energy, inv, o );
|
||||
if( this.itemToSend <= 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( inv.getStorageList().findPrecise( ais ) != null )
|
||||
{
|
||||
this.pushItemIntoTarget( destination, energy, inv, ais );
|
||||
}
|
||||
}
|
||||
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
||||
for (final IAEItemStack o : ImmutableList.copyOf(inv.getStorageList().findFuzzy(ais, fzMode))) {
|
||||
this.pushItemIntoTarget(destination, energy, inv, o);
|
||||
if (this.itemToSend <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inv.getStorageList().findPrecise(ais) != null) {
|
||||
this.pushItemIntoTarget(destination, energy, inv, ais);
|
||||
}
|
||||
}
|
||||
|
||||
if( this.itemToSend == before && this.isCraftingEnabled() )
|
||||
{
|
||||
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
|
||||
}
|
||||
}
|
||||
if (this.itemToSend == before && this.isCraftingEnabled()) {
|
||||
this.didSomething = this.craftingTracker.handleCrafting(slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc) || this.didSomething;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateSchedulingMode( schedulingMode, x );
|
||||
}
|
||||
else
|
||||
{
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
this.updateSchedulingMode(schedulingMode, x);
|
||||
} else {
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
|
||||
return this.didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
return this.didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( final IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 4, 4, 12, 12, 12, 14 );
|
||||
bch.addBox( 5, 5, 14, 11, 11, 15 );
|
||||
bch.addBox( 6, 6, 15, 10, 10, 16 );
|
||||
bch.addBox( 6, 6, 11, 10, 10, 12 );
|
||||
}
|
||||
@Override
|
||||
public void getBoxes(final IPartCollisionHelper bch) {
|
||||
bch.addBox(4, 4, 12, 12, 12, 14);
|
||||
bch.addBox(5, 5, 14, 11, 11, 15);
|
||||
bch.addBox(6, 6, 15, 10, 10, 16);
|
||||
bch.addBox(6, 6, 11, 10, 10, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public float getCableConnectionLength(AECableType cable) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final EnumHand hand, final Vec3d pos) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
return new TickingRequest( TickRates.ExportBus.getMin(), TickRates.ExportBus.getMax(), this.isSleeping(), false );
|
||||
}
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(final IGridNode node) {
|
||||
return new TickingRequest(TickRates.ExportBus.getMin(), TickRates.ExportBus.getMax(), this.isSleeping(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneMode getRSMode()
|
||||
{
|
||||
return (RedstoneMode) this.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
@Override
|
||||
public RedstoneMode getRSMode() {
|
||||
return (RedstoneMode) this.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
|
||||
{
|
||||
return this.doBusWork();
|
||||
}
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(final IGridNode node, final int ticksSinceLastCall) {
|
||||
return this.doBusWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
return this.craftingTracker.getRequestedJobs();
|
||||
}
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return this.craftingTracker.getRequestedJobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems( final ICraftingLink link, final IAEItemStack items, final Actionable mode )
|
||||
{
|
||||
final InventoryAdaptor d = this.getHandler();
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(final ICraftingLink link, final IAEItemStack items, final Actionable mode) {
|
||||
final InventoryAdaptor d = this.getHandler();
|
||||
|
||||
try
|
||||
{
|
||||
if( d != null && this.getProxy().isActive() )
|
||||
{
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = items.getStackSize();
|
||||
try {
|
||||
if (d != null && this.getProxy().isActive()) {
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = items.getStackSize();
|
||||
|
||||
if( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 )
|
||||
{
|
||||
ItemStack inputStack = items.getCachedItemStack( items.getStackSize() );
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
ItemStack inputStack = items.getCachedItemStack(items.getStackSize());
|
||||
|
||||
ItemStack remaining;
|
||||
ItemStack remaining;
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
remaining = d.simulateAdd( inputStack );
|
||||
items.setCachedItemStack( inputStack );
|
||||
}
|
||||
else
|
||||
{
|
||||
remaining = d.addItems( inputStack );
|
||||
if( !remaining.isEmpty() )
|
||||
{
|
||||
items.setCachedItemStack( remaining );
|
||||
}
|
||||
}
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
remaining = d.simulateAdd(inputStack);
|
||||
items.setCachedItemStack(inputStack);
|
||||
} else {
|
||||
remaining = d.addItems(inputStack);
|
||||
if (!remaining.isEmpty()) {
|
||||
items.setCachedItemStack(remaining);
|
||||
}
|
||||
}
|
||||
|
||||
if( remaining == inputStack )
|
||||
{
|
||||
return items;
|
||||
}
|
||||
if (remaining == inputStack) {
|
||||
return items;
|
||||
}
|
||||
|
||||
return AEItemStack.fromItemStack( remaining );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
return AEItemStack.fromItemStack(remaining);
|
||||
}
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange( final ICraftingLink link )
|
||||
{
|
||||
this.craftingTracker.jobStateChange( link );
|
||||
}
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
this.craftingTracker.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSleeping()
|
||||
{
|
||||
return this.getHandler() == null || super.isSleeping();
|
||||
}
|
||||
@Override
|
||||
protected boolean isSleeping() {
|
||||
return this.getHandler() == null || super.isSleeping();
|
||||
}
|
||||
|
||||
private boolean craftOnly()
|
||||
{
|
||||
return this.getConfigManager().getSetting( Settings.CRAFT_ONLY ) == YesNo.YES;
|
||||
}
|
||||
private boolean craftOnly() {
|
||||
return this.getConfigManager().getSetting(Settings.CRAFT_ONLY) == YesNo.YES;
|
||||
}
|
||||
|
||||
private boolean isCraftingEnabled()
|
||||
{
|
||||
return this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0;
|
||||
}
|
||||
private boolean isCraftingEnabled() {
|
||||
return this.getInstalledUpgrades(Upgrades.CRAFTING) > 0;
|
||||
}
|
||||
|
||||
private void pushItemIntoTarget( final InventoryAdaptor d, final IEnergyGrid energy, final IMEInventory<IAEItemStack> inv, IAEItemStack org )
|
||||
{
|
||||
ItemStack inputStack = org.getCachedItemStack( org.getStackSize() );
|
||||
private void pushItemIntoTarget(final InventoryAdaptor d, final IEnergyGrid energy, final IMEInventory<IAEItemStack> inv, IAEItemStack org) {
|
||||
ItemStack inputStack = org.getCachedItemStack(org.getStackSize());
|
||||
|
||||
ItemStack remaining = d.simulateAdd( inputStack );
|
||||
ItemStack remaining = d.simulateAdd(inputStack);
|
||||
|
||||
// Store the stack in the cache for next time.
|
||||
if( !remaining.isEmpty() )
|
||||
{
|
||||
org.setCachedItemStack( remaining );
|
||||
if( remaining == inputStack )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Store the stack in the cache for next time.
|
||||
if (!remaining.isEmpty()) {
|
||||
org.setCachedItemStack(remaining);
|
||||
if (remaining == inputStack) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final long canFit = remaining.isEmpty() ? this.itemToSend : this.itemToSend - remaining.getCount();
|
||||
final long canFit = remaining.isEmpty() ? this.itemToSend : this.itemToSend - remaining.getCount();
|
||||
|
||||
if( canFit > 0 )
|
||||
{
|
||||
IAEItemStack ais = org.copy();
|
||||
ais.setStackSize( canFit );
|
||||
final IAEItemStack itemsToAdd = Platform.poweredExtraction( energy, inv, ais, this.mySrc );
|
||||
if (canFit > 0) {
|
||||
IAEItemStack ais = org.copy();
|
||||
ais.setStackSize(canFit);
|
||||
final IAEItemStack itemsToAdd = Platform.poweredExtraction(energy, inv, ais, this.mySrc);
|
||||
|
||||
if( itemsToAdd != null )
|
||||
{
|
||||
this.itemToSend -= itemsToAdd.getStackSize();
|
||||
if (itemsToAdd != null) {
|
||||
this.itemToSend -= itemsToAdd.getStackSize();
|
||||
|
||||
inputStack.setCount( Ints.saturatedCast( itemsToAdd.getStackSize() ) );
|
||||
inputStack.setCount(Ints.saturatedCast(itemsToAdd.getStackSize()));
|
||||
|
||||
final ItemStack failed = d.addItems( inputStack );
|
||||
if( !failed.isEmpty() )
|
||||
{
|
||||
ais.setStackSize( failed.getCount() );
|
||||
inv.injectItems( ais, Actionable.MODULATE, this.mySrc );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.didSomething = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
org.setCachedItemStack( inputStack );
|
||||
}
|
||||
}
|
||||
}
|
||||
final ItemStack failed = d.addItems(inputStack);
|
||||
if (!failed.isEmpty()) {
|
||||
ais.setStackSize(failed.getCount());
|
||||
inv.injectItems(ais, Actionable.MODULATE, this.mySrc);
|
||||
} else {
|
||||
this.didSomething = true;
|
||||
}
|
||||
} else {
|
||||
org.setCachedItemStack(inputStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getStartingSlot( final SchedulingMode schedulingMode, final int x )
|
||||
{
|
||||
if( schedulingMode == SchedulingMode.RANDOM )
|
||||
{
|
||||
return Platform.getRandom().nextInt( this.availableSlots() );
|
||||
}
|
||||
private int getStartingSlot(final SchedulingMode schedulingMode, final int x) {
|
||||
if (schedulingMode == SchedulingMode.RANDOM) {
|
||||
return Platform.getRandom().nextInt(this.availableSlots());
|
||||
}
|
||||
|
||||
if( schedulingMode == SchedulingMode.ROUNDROBIN )
|
||||
{
|
||||
return ( this.nextSlot + x ) % this.availableSlots();
|
||||
}
|
||||
if (schedulingMode == SchedulingMode.ROUNDROBIN) {
|
||||
return (this.nextSlot + x) % this.availableSlots();
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
private void updateSchedulingMode( final SchedulingMode schedulingMode, final int x )
|
||||
{
|
||||
if( schedulingMode == SchedulingMode.ROUNDROBIN )
|
||||
{
|
||||
this.nextSlot = ( this.nextSlot + x ) % this.availableSlots();
|
||||
}
|
||||
}
|
||||
private void updateSchedulingMode(final SchedulingMode schedulingMode, final int x) {
|
||||
if (schedulingMode == SchedulingMode.ROUNDROBIN) {
|
||||
this.nextSlot = (this.nextSlot + x) % this.availableSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartModel getStaticModels()
|
||||
{
|
||||
if( this.isActive() && this.isPowered() )
|
||||
{
|
||||
return MODELS_HAS_CHANNEL;
|
||||
}
|
||||
else if( this.isPowered() )
|
||||
{
|
||||
return MODELS_ON;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MODELS_OFF;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IPartModel getStaticModels() {
|
||||
if (this.isActive() && this.isPowered()) {
|
||||
return MODELS_HAS_CHANNEL;
|
||||
} else if (this.isPowered()) {
|
||||
return MODELS_ON;
|
||||
} else {
|
||||
return MODELS_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user