Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
plugins {
id "java"
id "nova.gradle" version "0.2.5"
id "nova.gradle" version "0.2.6"
id "maven-publish"
id "com.jfrog.artifactory" version "3.1.1"
}


apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle"

dependencies {
compile nova(novaVersion)
compile nova(nova_version)
}

nova {
wrappers {
"17" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$novaVersion"
wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$nova_version"
runtime project(":minecraft:1.7")
}

"18" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$novaVersion"
wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$nova_version"
runtime project(":minecraft:1.8")
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = 0.0.1-SNAPSHOT
group = nova.minecraft
novaVersion = 0.1.0-SNAPSHOT
nova_version = 0.1.0-SNAPSHOT

packaging = jar
info.inceptionYear = 2015
Expand Down
1 change: 1 addition & 0 deletions minecraft/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
!/build.gradle
!/.gitignore

!/1.11
!/1.8
!/1.7
10 changes: 8 additions & 2 deletions minecraft/1.7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ artifactory {
}
}

task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}

artifacts {
archives jar
archives deobfJar
}

apply plugin: "forge"
Expand All @@ -42,8 +48,8 @@ minecraft {

dependencies {
compile rootProject
compile "nova.core:NOVA-Core:${property("nova.version")}"
compile "nova.core:NOVA-Core-Wrapper-MC1.7:${property("nova.version")}:deobf"
compile group: "nova.core", name: "NOVA-Core", version: property("nova_version"), changing: true
compile group: "nova.core", name: "NOVA-Core-Wrapper-MC1.7", version: property("nova_version"), classifier: "deobf", changing: true
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion minecraft/1.7/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
group = nova.minecraft

nova.version = 0.1.0-SNAPSHOT
minecraft.version = 1.7.10
forge.version = 10.13.4.1448-1.7.10
forgeGradleVersion = 1.2-SNAPSHOT

packaging = jar
info.inceptionYear = 2015
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package nova.minecraft.wrapper.mc.forge.v1_7_10.depmodules;

import nova.minecraft.redstone.Redstone;
import nova.minecraft.wrapper.mc.forge.v1_7_10.wrapper.redstone.forward.FWRedstone;
import se.jbee.inject.bind.BinderModule;

/**
* @author Calclavia
*/
public class ComponentModule extends BinderModule {
@Override
protected void declare() {
bind(Redstone.class).to(FWRedstone.class);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package nova.minecraft.redstone;
package nova.minecraft.wrapper.mc.forge.v1_7_10.launch;

import nova.minecraft.wrapper.mc.forge.v1_7_10.depmodules.ComponentModule;
import nova.core.block.Block;
import nova.core.event.bus.GlobalEvents;
import nova.core.loader.Loadable;
import nova.core.loader.Mod;
import nova.core.world.World;
import nova.core.wrapper.mc.forge.v17.util.WrapperEvent;
import nova.minecraft.redstone.Redstone;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;

import java.util.Optional;
Expand All @@ -14,7 +16,7 @@
* The Minecraft native loader
* @author Calclavia
*/
@Mod(id = "redstone-minecraft", name = "Redstone Minecraft", version = "0.0.1", novaVersion = "0.0.1", priority = 1, modules = { ComponentModule.class })
@Mod(id = "nova-minecraft-wrapper", name = "NOVA Minecraft", version = "0.0.1", novaVersion = "0.0.1", priority = 1, modules = { ComponentModule.class })
public class RedstoneAPI implements Loadable {

private final GlobalEvents events;
Expand All @@ -25,11 +27,17 @@ public RedstoneAPI(GlobalEvents events) {

@Override
public void preInit() {
events.on(WrapperEvent.RedstoneConnect.class).bind(evt -> evt.canConnect = getRedstoneNode(evt.world, evt.position).map(n -> n.canConnect.apply(null)).orElseGet(() -> false));
events.on(WrapperEvent.RedstoneConnect.class)
.bind(evt -> evt.canConnect = getRedstoneNode(evt.world, evt.position)
.map(n -> n.canConnect.apply(null)).orElseGet(() -> false));

events.on(WrapperEvent.StrongRedstone.class).bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position).map(Redstone::getOutputStrongPower).orElseGet(() -> 0));
events.on(WrapperEvent.StrongRedstone.class)
.bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position)
.map(Redstone::getOutputStrongPower).orElseGet(() -> 0));

events.on(WrapperEvent.WeakRedstone.class).bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position).map(Redstone::getOutputWeakPower).orElseGet(() -> 0));
events.on(WrapperEvent.WeakRedstone.class)
.bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position)
.map(Redstone::getOutputWeakPower).orElseGet(() -> 0));
}

public Optional<Redstone> getRedstoneNode(World world, Vector3D pos) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nova.minecraft.wrapper.mc.forge.v1_7_10.wrapper.redstone.backward;

import nova.core.block.Block;
import nova.core.util.Direction;
import nova.core.wrapper.mc.forge.v17.wrapper.block.backward.BWBlock;
import nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld;
import nova.minecraft.redstone.Redstone;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;

import java.util.function.Consumer;
import java.util.stream.IntStream;

/**
*
* @author ExE Boss
*/
public class BWRedstone extends Redstone {

private BWBlock block() {
return (BWBlock) getProvider();
}

private net.minecraft.world.World mcWorld() {
return ((BWWorld) block().world()).world();
}

public BWRedstone() {
this.canConnect = (Redstone otherRedstone) -> {
Block otherBlock = ((Block) otherRedstone.getProvider());
Vector3D otherPos = otherBlock.position();
Vector3D thisPos = block().position();
return block().mcBlock.canConnectRedstone(mcWorld(), otherBlock.x(), otherBlock.y(), otherBlock.z(), Direction.fromVector(thisPos.crossProduct(otherPos)).ordinal());
};
}

@Override
public void onInputPowerChange(Consumer<Redstone> action) {}

@Override
public int getOutputStrongPower() {
return IntStream.range(0, 6).map(side -> block().mcBlock.isProvidingStrongPower(mcWorld(), block().x(), block().y(), block().z(), side)).max().orElse(0);
}

@Override
public void setOutputStrongPower(int power) {}

@Override
public int getWeakPower(int side) {
return mcWorld().getIndirectPowerLevelTo(block().x(), block().y(), block().z(), side);
}

@Override
public int getInputWeakPower() {
return mcWorld().getStrongestIndirectPower(block().x(), block().y(), block().z());
}

@Override
public int getInputStrongPower() {
return mcWorld().getBlockPowerInput(block().x(), block().y(), block().z());
}

@Override
public int getOutputWeakPower() {
return IntStream.range(0, 6).map(side -> block().mcBlock.isProvidingWeakPower(mcWorld(), block().x(), block().y(), block().z(), side)).max().orElse(0);
}

@Override
public void setOutputWeakPower(int power) {}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package nova.minecraft.redstone;
package nova.minecraft.wrapper.mc.forge.v1_7_10.wrapper.redstone.forward;

import nova.core.block.Block;
import nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld;
import nova.minecraft.redstone.Redstone;

import java.util.function.Consumer;
import java.util.stream.IntStream;
Expand All @@ -11,7 +12,7 @@
* @author Calclavia
*/
//TODO: Create NodeVirtualRedstone (for MC blocks that are redstone, but don't implement NOVA)
public class NodeRedstone extends Redstone {
public class FWRedstone extends Redstone {
private boolean init = false;
private int inputStrongPower = 0;
private int inputWeakPower = 0;
Expand Down
10 changes: 8 additions & 2 deletions minecraft/1.8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ artifactory {
}
}

task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}

artifacts {
archives jar
archives deobfJar
}

apply plugin: "forge"
Expand All @@ -43,8 +49,8 @@ minecraft {

dependencies {
compile rootProject
compile "nova.core:NOVA-Core:${property("nova.version")}"
compile "nova.core:NOVA-Core-Wrapper-MC1.8:${property("nova.version")}:deobf"
compile group: "nova.core", name: "NOVA-Core", version: property("nova_version"), changing: true
compile group: "nova.core", name: "NOVA-Core-Wrapper-MC1.8", version: property("nova_version"), classifier: "deobf", changing: true
}

processResources {
Expand Down
4 changes: 2 additions & 2 deletions minecraft/1.8/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
group = nova.minecraft

nova.version = 0.1.0-SNAPSHOT
minecraft.version = 1.8
forge.version = 11.14.3.1446
forge.version = 11.14.3.1491
forgeGradleVersion = 1.2-SNAPSHOT

packaging = jar
info.inceptionYear = 2015
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package nova.minecraft.wrapper.mc.forge.v1_8.depmodules;

import nova.minecraft.wrapper.mc.forge.v1_8.wrapper.redstone.forward.FWRedstone;
import nova.minecraft.redstone.Redstone;
import se.jbee.inject.bind.BinderModule;

/**
* @author Calclavia
*/
public class ComponentModule extends BinderModule {
@Override
protected void declare() {
bind(Redstone.class).to(FWRedstone.class);
}
}
19 changes: 14 additions & 5 deletions .../nova/minecraft/redstone/RedstoneAPI.java → ...per/mc/forge/v1_8/launch/RedstoneAPI.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package nova.minecraft.redstone;
package nova.minecraft.wrapper.mc.forge.v1_8.launch;

import nova.core.block.Block;
import nova.core.event.bus.GlobalEvents;
import nova.core.loader.Loadable;
import nova.core.loader.Mod;
import nova.core.world.World;
import nova.core.wrapper.mc.forge.v18.util.WrapperEvent;
import nova.minecraft.redstone.Redstone;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;

import java.util.Optional;

import nova.minecraft.wrapper.mc.forge.v1_8.depmodules.ComponentModule;

/**
* The Minecraft native loader
* @author Calclavia
Expand All @@ -25,15 +28,21 @@ public RedstoneAPI(GlobalEvents events) {

@Override
public void preInit() {
events.on(WrapperEvent.RedstoneConnect.class).bind(evt -> evt.canConnect = getRedstoneNode(evt.world, evt.position).map(n -> n.canConnect.apply(null)).orElseGet(() -> false));
events.on(WrapperEvent.RedstoneConnect.class)
.bind(evt -> evt.canConnect = getRedstoneNode(evt.world, evt.position)
.map(n -> n.canConnect.apply(null)).orElseGet(() -> false));

events.on(WrapperEvent.StrongRedstone.class).bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position).map(Redstone::getOutputStrongPower).orElseGet(() -> 0));
events.on(WrapperEvent.StrongRedstone.class)
.bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position)
.map(Redstone::getOutputStrongPower).orElseGet(() -> 0));

events.on(WrapperEvent.WeakRedstone.class).bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position).map(Redstone::getOutputWeakPower).orElseGet(() -> 0));
events.on(WrapperEvent.WeakRedstone.class)
.bind(evt -> evt.power = getRedstoneNode(evt.world, evt.position)
.map(Redstone::getOutputWeakPower).orElseGet(() -> 0));
}

public Optional<Redstone> getRedstoneNode(World world, Vector3D pos) {
Optional<Block> blockOptional = world.getBlock(pos);
return blockOptional.flatMap(block -> block.components.getOp(Redstone.class));
}
}
}
Loading