This commit is contained in:
parent
c542083c95
commit
3a8fa37f12
@ -9,7 +9,16 @@ import net.minecraft.world.World;
|
||||
* Action That Can Be Performed With Energy
|
||||
*/
|
||||
public class Action {
|
||||
/**
|
||||
* Action Function
|
||||
*/
|
||||
public interface ActionFunction {
|
||||
/**
|
||||
* Run Function
|
||||
* @param world World
|
||||
* @param pos Block Position
|
||||
* @param state Block State
|
||||
*/
|
||||
void run(World world, BlockPos pos, BlockState state);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,10 @@ public interface InfuserAction {
|
||||
*/
|
||||
void run(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Get Output Item For Display In REI
|
||||
* @return Output Item
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
InfuserOutputItem display();
|
||||
|
||||
@ -71,7 +75,7 @@ public interface InfuserAction {
|
||||
}
|
||||
|
||||
/**
|
||||
* Infuser Action That Creates Some Particles
|
||||
* Infuser Action That Creates Particles
|
||||
*/
|
||||
class ParticleAction implements InfuserAction {
|
||||
@Override
|
||||
|
@ -21,6 +21,7 @@ public class InfuserEntry {
|
||||
* Success Chance
|
||||
*/
|
||||
public final double successChance;
|
||||
|
||||
private final InfuserAction[] success;
|
||||
private final InfuserAction[] fail;
|
||||
|
||||
@ -61,6 +62,11 @@ public class InfuserEntry {
|
||||
weightedList.pick(world.random).run(world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get All REI Display Output Items
|
||||
* @param isFail Get Failure Items Instead Of Success Items
|
||||
* @return All REI Display Output Items
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
public List<InfuserOutputItem> getOutputItems(boolean isFail) {
|
||||
InfuserAction[] actionList = isFail ? fail : success;
|
||||
@ -71,6 +77,11 @@ public class InfuserEntry {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Chance For One Action
|
||||
* @param isFail Is A Failure Action
|
||||
* @return Chance
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
public double getSingleChance(boolean isFail) {
|
||||
return (1d / (double) (isFail ? fail.length : success.length)) * (isFail ? 1d - successChance : successChance);
|
||||
|
@ -4,11 +4,25 @@ import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Output Item For Display In REI
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class InfuserOutputItem {
|
||||
/**
|
||||
* Is This A Real Item
|
||||
*/
|
||||
public final boolean outputsItem;
|
||||
/**
|
||||
* Display Item
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
|
||||
/**
|
||||
* Create Display Item
|
||||
* @param outputsItem Is This A Real Item
|
||||
* @param item Display Item
|
||||
*/
|
||||
public InfuserOutputItem(boolean outputsItem, ItemStack item) {
|
||||
this.outputsItem = outputsItem;
|
||||
this.stack = item;
|
||||
|
Reference in New Issue
Block a user