This commit is contained in:
parent
82058f5ba6
commit
f69fdca129
7 changed files with 27 additions and 34 deletions
|
@ -69,10 +69,10 @@ dependencies {
|
|||
//quiltMod "org.codeberg.CRModders:cosmic-quilt:${cosmic_quilt_version}"
|
||||
implementation "dev.crmodders:cosmicquilt:${cosmic_quilt_version}"
|
||||
|
||||
//quiltMod "quilt-mod:Flux.API:0.5.5"//0.5.5
|
||||
quiltMod "dev.crmodders:FluxAPI:${fluxapi_version}"//0.5.5
|
||||
quiltMod "quilt-mod:fluxapi:0.5.8r2"
|
||||
//quiltMod "dev.crmodders:FluxAPI:${fluxapi_version}"//0.5.5
|
||||
|
||||
quiltMod "com.github.ForwarD-NerN:BlockEntityPrototype:f7b5e94"
|
||||
quiltMod "com.github.ForwarD-NerN:BlockEntityPrototype:c4a5a6e"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -9,7 +9,7 @@ group=net.pietru
|
|||
id=omni_power
|
||||
|
||||
# Dependency Versions
|
||||
cosmic_reach_version=0.1.21
|
||||
cosmic_quilt_version=2.0.0
|
||||
cosmic_reach_version=0.1.22
|
||||
cosmic_quilt_version=2.0.2
|
||||
|
||||
fluxapi_version=0.5.6
|
||||
fluxapi_version=0.5.8
|
Binary file not shown.
|
@ -3,9 +3,9 @@ Mod for game Cosmic Reach.\
|
|||
Based on the example mod for the [Cosmic Quilt](https://codeberg.org/CRModders/cosmic-quilt) Loader
|
||||
|
||||
## Mod requires
|
||||
- Cosmic Reach (0.1.21+)
|
||||
- Cosmic Quilt (1.2.6+)
|
||||
- Flux API (0.5.7+)
|
||||
- Cosmic Reach (0.1.22+)
|
||||
- Cosmic Quilt (2.0.2+)
|
||||
- Flux API (0.5.8+)
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
|
|
@ -23,7 +23,7 @@ public class OmniPower implements ModInitializer {
|
|||
if (QuiltLoader.isModLoaded("becraft"))
|
||||
block_entities=true;
|
||||
System.out.println("OmniPower Mod Initialized!");
|
||||
BlockEvents.registerBlockEventAction(new Power(block_entities));
|
||||
BlockEvents.registerBlockEventAction(Power.class);
|
||||
for (String block:blocks) {
|
||||
BlockBuilderUtils.getBlockFromJson(new Identifier(MOD_ID, block));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package net.pietru.omni_power.blockevents;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
import finalforeach.cosmicreach.blockevents.actions.ActionId;
|
||||
import finalforeach.cosmicreach.blockevents.actions.IBlockAction;
|
||||
import finalforeach.cosmicreach.blocks.BlockPosition;
|
||||
import finalforeach.cosmicreach.blockevents.BlockEventTrigger;
|
||||
import finalforeach.cosmicreach.blockevents.IBlockEventAction;
|
||||
import finalforeach.cosmicreach.blocks.BlockState;
|
||||
import finalforeach.cosmicreach.world.Zone;
|
||||
import net.pietru.omni_power.OmniPower;
|
||||
|
@ -16,16 +16,16 @@ import ru.nern.becraft.bed.api.BlockEntity;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Power implements IBlockEventAction {
|
||||
@ActionId(id = OmniPower.MOD_ID+":power")
|
||||
public class Power implements IBlockAction {
|
||||
public static boolean block_entities = false;
|
||||
|
||||
public Power(boolean block_entities_enabled){
|
||||
block_entities=block_entities_enabled;
|
||||
}
|
||||
@Override
|
||||
public String getActionId() {
|
||||
System.out.println("Registering "+ OmniPower.MOD_ID+":power");
|
||||
return OmniPower.MOD_ID+":power";
|
||||
public String triggerId;
|
||||
public String cable_group;
|
||||
public boolean self_run = true;
|
||||
|
||||
public Power(){
|
||||
block_entities=OmniPower.block_entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,13 +34,6 @@ public class Power implements IBlockEventAction {
|
|||
}
|
||||
|
||||
public void act(BlockState srcBlockState, BlockEventTrigger blockEventTrigger, Zone zone, BlockPosition sourcePos) {
|
||||
OrderedMap<String, Object> p = blockEventTrigger.getParams();
|
||||
String triggerId = (String)p.get("triggerId");
|
||||
String cable_group = (String)p.get("cable_group");
|
||||
boolean self_run = true;
|
||||
if (p.containsKey("self_run")) {
|
||||
self_run = (boolean)p.get("self_run");
|
||||
}
|
||||
boolean source_be = false;
|
||||
BlockEntity source_entity = null;
|
||||
if (block_entities){
|
||||
|
@ -63,8 +56,8 @@ public class Power implements IBlockEventAction {
|
|||
if (targetBlockState==null || targetBlockState.stringId==null){
|
||||
continue;
|
||||
}
|
||||
if (to_check!=sourcePos || self_run){
|
||||
runTrigger(triggerId,to_check,zone);
|
||||
if (to_check!=sourcePos || this.self_run){
|
||||
runTrigger(this.triggerId,to_check,zone);
|
||||
}
|
||||
if (block_entities && source_be){
|
||||
BlockEntity target_entity = BEUtils.getBlockEntity(to_check);
|
||||
|
@ -73,7 +66,7 @@ public class Power implements IBlockEventAction {
|
|||
if (target_entity instanceof IPowerClient)
|
||||
((IPowerProducer)source_entity).send_to_client(target_entity);
|
||||
}
|
||||
if (targetBlockState.stringId.contains(cable_group)){
|
||||
if (targetBlockState.stringId.contains(this.cable_group)){
|
||||
power_transmitters.add(to_check);
|
||||
unchecked_blocks.addAll(get_touching_positions(zone,to_check,targetBlockState));
|
||||
}
|
||||
|
|
|
@ -31,22 +31,22 @@
|
|||
"depends": [
|
||||
{
|
||||
"id": "cosmic_quilt",
|
||||
"versions": ">=2.0.0"
|
||||
"versions": ">=2.0.2"
|
||||
},
|
||||
{
|
||||
"id": "cosmic_reach",
|
||||
"versions": ">=0.1.21"
|
||||
"versions": ">=0.1.22"
|
||||
},
|
||||
{
|
||||
"id": "fluxapi",
|
||||
"versions": ">=0.5.6"
|
||||
"versions": ">=0.5.8"
|
||||
}
|
||||
],
|
||||
|
||||
"suggests": [
|
||||
{
|
||||
"id": "becraft",
|
||||
"versions": ">=1.2.0"
|
||||
"versions": ">=1.2.1"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue