Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOVA-Energy Minecraft 1.11 Wrappers #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Except:
!LICENSE.txt
!Mod Energy Conversion.md

# Sources
!/src
Expand Down
56 changes: 56 additions & 0 deletions Mod Energy Conversion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
###Author:
[ExE Boss](https://github.com/ExE-Boss)

### About
This file contains my docs of mod energy conversion.
It was created by observing what ratios other mods used when implementing energy conversion.

# Recalculated Energy Conversions to remove infinite power generation loops
- Defined by Player:
- 1 EU = 1 FZ-Charge
- 3 EU = 25 RF
- Defined by Eloraam:
- 1 kW (RP2) = 1 McJ
- Defined by Thermal Expansion:
- 1 McJ = 25 RF

## Derived conversions:
- 3 EU = 1 McJ
- 3 EU = 1 kW (RP2)
- 1 EU = 40 J (Defined by AE)
- 1 McJ = 120 J (Prevents infinite loop)

---

Original file:

# Mod Energy Conversion by Unit
- 1 McJ = 3 EU (Probably from Forestry)
- 1 EU = 2 Unit
- 1 McJ = 5 Unit (<^ These lead to an infinite power generation loop, should redefine McJ:Unit to 1:6)
- 1 EU = 45 J (Average of AE and MMMPS)
- 1 McJ = 60 J (Leads to infinite loop)
- 1 kW (RP2) = 1 McJ (As defined by Eloraam)
- 1 kW (RP2) = ~3 EU
- 1 kW (RP2) = 60 J
- 1 kW (RP2) = 5-ish Units
- 3 EU = 25 RF
- 1 EU = 1 FZ-Charge
- 1 McJ = 25 RF

## Math behind some of the conversions
- 1 McJ = 3 EU = 1 kW (RP2)
- ~3 EU = 1 kW (RP2)
- 1 McJ = 5 Units = 2.5 EU
- 1 EU = 2 Units
- 20 J = 1 Unit = 0.5 EU
- 40 J = 1 EU (AE)
- 50 J = 1 EU (MMMPS)
- 60 J = 1 McJ = 1 kW (RP2)

---

# Licence
This work by [ExE Boss](https://github.com/ExE-Boss) is dual-licensed
under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/)
and a [GNU Lesser General Public License (LGPL) version 3](https://www.gnu.org/licenses/lgpl-3.0.html).
24 changes: 19 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
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.core:NovaCore:$novaVersion"
testCompile "nova.core:NovaCore:$novaVersion:wrappertests"
compile nova(nova_version)
}

nova {
wrappers {
"17" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$nova_version"
}
"18" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$nova_version"
}
}
"1_11" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.11:$nova_version"
runtime project(":minecraft:1.11")
}
}
}

publishing {
Expand All @@ -35,4 +49,4 @@ artifactory {
publishPom = true
}
}
}
}
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.energy
novaVersion = 0.1.0-SNAPSHOT
nova_version = 0.1.0-SNAPSHOT

packaging = jar
info.inceptionYear = 2016
Expand Down
6 changes: 6 additions & 0 deletions minecraft/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*

!/build.gradle
!/.gitignore

!/1.11
17 changes: 17 additions & 0 deletions minecraft/1.11/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ignore All
/*

# Sources
!/src

# github
!/.gitignore
!/README.md

# gradle
!/build.gradle
!/build.properties
!/settings.gradle
!/gradle.properties
!/gradlew*
!/gradle
73 changes: 73 additions & 0 deletions minecraft/1.11/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apply plugin: "maven-publish"
apply plugin: "com.jfrog.artifactory"
apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle"

idea.module.name = "Energy-MC-1.11"
archivesBaseName = "NOVA-Energy-Wrapper-MC1.11"

publishing {
publications {
main(MavenPublication) {
from components.java

artifactId archivesBaseName

artifact sourcesJar
artifact javadocJar

pom.withXml(writePom(project.properties))
}
}
}

artifactory {
publish {
defaults {
publications("main")
publishPom = true
}
}
}

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

artifacts {
archives jar
archives deobfJar
}

apply plugin: 'net.minecraftforge.gradle.forge'

minecraft {
version = property("minecraft.version") + "-" + property("forge.version")
mappings = 'snapshot_20161220'
runDir = "run"
}

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

processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include "mcmod.info"

// replace version and mcversion
expand "version": project.version, "mcversion": project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
}
10 changes: 10 additions & 0 deletions minecraft/1.11/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
group = nova.energy

minecraft.version = 1.11
forge.version = 13.19.1.2189
forgeGradleVersion = 2.2-SNAPSHOT

packaging = jar
info.inceptionYear = 2016
info.description = The NOVA-Minecraft Minecraft 1.11 wrapper.
info.organization.name = NOVA
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright (c) 2015 NOVA, All rights reserved.
* This library is free software, licensed under GNU Lesser General Public License version 3
*
* This file is part of NOVA.
*
* NOVA is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NOVA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NOVA. If not, see <http://www.gnu.org/licenses/>.
*/
package nova.energy.wrapper.mc.forge.v1_11.launch;

import net.minecraft.util.EnumFacing;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import nova.core.event.bus.GlobalEvents;
import nova.core.loader.Loadable;
import nova.core.loader.Mod;
import nova.core.wrapper.mc.forge.v1_11.util.WrapperEvent;
import nova.energy.EnergyStorage;
import nova.energy.wrapper.mc.forge.v1_11.wrapper.energy.backward.BWEnergyStorage;
import nova.energy.wrapper.mc.forge.v1_11.wrapper.energy.forward.FWEnergyStorage;

/**
* Compatibility with Forge Energy, which has been in Minecraft Forge since Minecraft 1.10.2.
*
* @author ExE Boss
*/
@Mod(id = NovaEnergyWrapper.id, name = NovaEnergyWrapper.name, version = NovaEnergyWrapper.version, novaVersion = "0.1.0")
public class NovaEnergyWrapper implements Loadable {

public static final String version = "0.0.1";
public static final String id = "nova-energy-wrapper";
public static final String name = "NOVA Energy";

private final GlobalEvents events;

public NovaEnergyWrapper(GlobalEvents events) {
this.events = events;
}

@Override
public void preInit() {
events.on(WrapperEvent.BWBlockCreate.class).bind(evt -> {
if (evt.novaBlock.getTileEntity() == null)
return;

IEnergyStorage energyCapability = null;
for (EnumFacing facing : EnumFacing.values()) {
if (!evt.novaBlock.getTileEntity().hasCapability(CapabilityEnergy.ENERGY, facing))
continue;

energyCapability = evt.novaBlock.getTileEntity().getCapability(CapabilityEnergy.ENERGY, facing);
if (energyCapability != null)
break; // NOVA-Energy is Unsided
}

if (energyCapability == null && evt.novaBlock.getTileEntity().hasCapability(CapabilityEnergy.ENERGY, null))
energyCapability = evt.novaBlock.getTileEntity().getCapability(CapabilityEnergy.ENERGY, null);

if (energyCapability != null)
evt.novaBlock.components.add(new BWEnergyStorage(energyCapability));
});

events.on(WrapperEvent.BWItemCreate.class).bind(evt -> {
if (evt.itemStack.isPresent() && evt.itemStack.get().hasCapability(CapabilityEnergy.ENERGY, null))
evt.novaItem.components.add(new BWEnergyStorage(evt.itemStack.get().getCapability(CapabilityEnergy.ENERGY, null)));
});

events.on(WrapperEvent.BWEntityCreate.class).bind(evt -> {
if (evt.mcEntity.hasCapability(CapabilityEnergy.ENERGY, null))
evt.novaEntity.components.add(new BWEnergyStorage(evt.mcEntity.getCapability(CapabilityEnergy.ENERGY, null)));
});

events.on(WrapperEvent.FWTileCreate.class).bind(evt -> {
if (evt.tileEntity == null)
return;

if (evt.novaBlock.components.has(EnergyStorage.class)) // Components are unsided
evt.tileEntity.addCapability(CapabilityEnergy.ENERGY, new FWEnergyStorage(evt.novaBlock.components.get(EnergyStorage.class)), null);
});

events.on(WrapperEvent.FWItemInitCapabilities.class).bind(evt -> {
if (evt.novaItem.components.has(EnergyStorage.class)) // Components are unsided
evt.capabilityProvider.addCapability(CapabilityEnergy.ENERGY, new FWEnergyStorage(evt.novaItem.components.get(EnergyStorage.class)), null);
});

events.on(WrapperEvent.FWEntityCreate.class).bind(evt -> {
if (evt.novaEntity.components.has(EnergyStorage.class)) // Components are unsided
evt.mcEntity.addCapability(CapabilityEnergy.ENERGY, new FWEnergyStorage(evt.novaEntity.components.get(EnergyStorage.class)), null);
});
}
}
Loading