All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.content.modular.BlockModule Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

The newest version!
/**
 * 
 */
package mmb.content.modular;

import mmb.NN;
import mmb.Nil;
import mmb.content.electric.Electricity;
import mmb.content.modular.gui.ModuleConfigHandler;
import mmb.content.modular.part.RotablePartEntry;
import mmb.engine.inv.Inventory;
import mmb.engine.inv.io.InventoryReader;
import mmb.engine.inv.io.InventoryWriter;
import mmb.engine.item.RotableItemEntry;
import mmb.engine.rotate.Side;

/**
 * An interface which provides addition/removal handling for the player.
 * @author oskar
 * @param  type of this module
 */
public interface BlockModule> extends RotablePartEntry, BlockModuleOrCore<
Tmodule, ModularBlock, BlockModule.BlockModuleParams>{
	//Provide the access points from a block
	public default @NN  Inventory provideInventory(ModularBlock blk, Side s) {
		return blk.i_inv(s);
	}
	public default @NN  InventoryWriter provideInput(ModularBlock blk, Side s) {
		return blk.i_in(s);
	}
	public default @NN  InventoryReader provideOutput(ModularBlock blk, Side s) {
		return blk.i_out(s);
	}
	public default           boolean provideSignal(ModularBlock blk, Side s) {
		return blk.i_signal(s);
	}
	public default @Nil Electricity provideElectricity(ModularBlock blk, Side s) {
		return blk.i_elec(s);
	}
	
	/**
	 * Provides signal for the block
	 * @param signal input signal
	 * @return a signal as seen by the block
	 */
	public default boolean decorateExternalSignal(boolean signal){
		return signal;
	}
	
	/**
	 * Runs the module
	 * @param block the block running this module
	 * @param storedSide side from a perspective of the block
	 * @param realSide side in the world
	 */
	public default void run(ModularBlock block, Side storedSide, Side realSide) {
		//unused
	}
	/**
	 * Called when a module is removed from a block
	 * @param info the information about breakage
	 */
	@Override
	public default void onBroken(BlockModuleParams info) {
		//empty
	}
	/**
	 * Called when a module is added to a block
	 * @param info the information about creation
	 */
	@Override
	public default void onAdded(BlockModuleParams info) {
		//empty
	}
	
	public static class BlockModuleParams>{
		@NN public final ModularBlock blk;
		@NN public final Side storedSide;
		@NN public final Side realSide;
		public BlockModuleParams(ModularBlock blk, Side storedSide, Side realSide) {
			this.blk = blk;
			this.storedSide = storedSide;
			this.realSide = realSide;
		}
	}
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy