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