Compare commits
58 Commits
Author | SHA1 | Date | |
---|---|---|---|
261b67a74c | |||
ccd699cd05 | |||
fd37c72cfc | |||
c1b92eb7ae | |||
![]() |
826ab1cf3a | ||
9554b56931 | |||
![]() |
77a9fad5ce | ||
![]() |
9d4e7213eb | ||
03e5b50459 | |||
ea594cef3d | |||
ae4aef454e | |||
4e8222a884 | |||
c170c9d21d | |||
cf3aa58fa1 | |||
b7e996a9d7 | |||
58eacac28c | |||
![]() |
8c334a4cdd | ||
![]() |
fafde83d4c | ||
![]() |
e15a07bdb8 | ||
![]() |
e6f95908d7 | ||
![]() |
195b6a25dc | ||
![]() |
b539f986f8 | ||
ccf8c75b37 | |||
faa70ed224 | |||
![]() |
e8976365a2 | ||
f8984bec16 | |||
bfb3c3902e | |||
bb9bc335ff | |||
![]() |
93d45ceaeb | ||
![]() |
fb4c81d44b | ||
![]() |
c3a2e9922a | ||
![]() |
92cfb47f4f | ||
![]() |
80720d50ce | ||
9f0de8a250 | |||
![]() |
6b2cb0c105 | ||
![]() |
b075c521b2 | ||
![]() |
804feb4280 | ||
![]() |
6ee71f3dc1 | ||
![]() |
9141dcc8a2 | ||
![]() |
e28524864d | ||
![]() |
eb1eaf3fd7 | ||
adef051ff7 | |||
5ccc94e73a | |||
![]() |
6777030d57 | ||
![]() |
c4f8ffc2b9 | ||
![]() |
87d33ee9a1 | ||
![]() |
1a2e0f233b | ||
![]() |
374f1f1d24 | ||
6a932e6e56 | |||
181fdc196e | |||
fbdb595cd7 | |||
e3576cc07e | |||
9a69e0c15a | |||
3251370335 | |||
57fe4b6070 | |||
00e5ca976f | |||
fa777ca6e0 | |||
a3f53b1593 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -175,3 +175,4 @@ gradle-app.setting
|
|||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
run/
|
run/
|
||||||
|
src/main/java/com/sosnitzka/taiga/dev
|
||||||
|
10
README.md
10
README.md
@@ -15,7 +15,7 @@ Included:
|
|||||||
|
|
||||||
Download
|
Download
|
||||||
===============
|
===============
|
||||||
[Link coming](www.sosnitzka.com)
|
[TAIGA on CurseForge](http://minecraft.curseforge.com/projects/taiga-tinkers-alloying-addon/files)
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
===============
|
===============
|
||||||
@@ -23,14 +23,14 @@ Necessary:
|
|||||||
* Tinkers Construct for 1.10.2 + associated version of mantle
|
* Tinkers Construct for 1.10.2 + associated version of mantle
|
||||||
* Minecraft Forge 1.10.2
|
* Minecraft Forge 1.10.2
|
||||||
|
|
||||||
Tested with:
|
Latest tests done with:
|
||||||
|
|
||||||
* [Tinkers Construct 2.3.3a](http://minecraft.curseforge.com/projects/tinkers-construct/files)
|
* [Tinkers Construct 2.5.5](http://minecraft.curseforge.com/projects/tinkers-construct/files)
|
||||||
* [Minecraft Forge 12.18.1.2011](http://files.minecraftforge.net/)
|
* [Minecraft Forge 12.18.2.2107](http://files.minecraftforge.net/)
|
||||||
|
|
||||||
What's going on?
|
What's going on?
|
||||||
===
|
===
|
||||||
What's actually new?
|
What does the mod add?
|
||||||
* There are 16 kinds of new ores, seperated in 4 categories each: Arcane, solide, ethere and ratio metals.
|
* There are 16 kinds of new ores, seperated in 4 categories each: Arcane, solide, ethere and ratio metals.
|
||||||
* You are just able to combine some of them as neigbours in a "circle": Arcane <> Solide <> Ethere <> Ratio <> Arcane - you gonna check JEI for Recipes!
|
* You are just able to combine some of them as neigbours in a "circle": Arcane <> Solide <> Ethere <> Ratio <> Arcane - you gonna check JEI for Recipes!
|
||||||
* The hardness of the new tool depends on their parents. Not every alloy is hard enough, to mine the next alloy-level.
|
* The hardness of the new tool depends on their parents. Not every alloy is hard enough, to mine the next alloy-level.
|
||||||
|
100
build.gradle
100
build.gradle
@@ -1,4 +1,3 @@
|
|||||||
// For those who want the bleeding edge
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
@@ -12,7 +11,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||||
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.0.7'
|
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.0.8'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,30 +35,55 @@ repositories {
|
|||||||
group = "com.sosnitzka" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = "com.sosnitzka" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "taiga"
|
archivesBaseName = "taiga"
|
||||||
|
|
||||||
minecraft {
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
version = "1.10.2-12.18.1.2011"
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
runDir = "run"
|
|
||||||
|
|
||||||
// the mappings can be changed at any time, and must be in the following format.
|
|
||||||
// snapshot_YYYYMMDD snapshot are built nightly.
|
|
||||||
// stable_# stables are built at the discretion of the MCP team.
|
|
||||||
// Use non-default mappings at your own risk. they may not allways work.
|
|
||||||
// simply re-run your setup task after changing the mappings to update your workspace.
|
|
||||||
mappings = "snapshot_20160701"
|
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
|
||||||
|
|
||||||
replace "${version}", project.version
|
task buildInfo {
|
||||||
|
if (System.getenv().TAIGA_TAG != null) {
|
||||||
|
ext.revision = System.getenv().TAIGA_TAG
|
||||||
|
} else {
|
||||||
|
ext.revision = "snapshot"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (System.getenv().BUILD_NUMBER != null) {
|
||||||
|
ext.buildNum = System.getenv().BUILD_NUMBER
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def cmd = "git log \$(git tag --sort=-refname | sed -n '2p')..\$(git tag --sort=-refname | sed -n '1p') --oneline"
|
||||||
|
def proc = cmd.execute()
|
||||||
|
proc.waitFor()
|
||||||
|
if (proc.exitValue() == 0) {
|
||||||
|
ext.changes = proc.text.trim()
|
||||||
|
} else {
|
||||||
|
ext.changes = "N/A"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
version = project.buildInfo.revision
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = "1.10.2-12.18.2.2147"
|
||||||
|
runDir = "run"
|
||||||
|
mappings = "snapshot_20161101"
|
||||||
|
replace '@VERSION@', project.version
|
||||||
|
}
|
||||||
|
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
|
ext.mc_version = project.minecraft.version.split('-')[0]
|
||||||
|
version = "${mc_version}-${project.buildInfo.revision}"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//deobfCompile "codechicken:CodeChickenLib:1.9.4-2.0.2.39:deobf"
|
//deobfCompile "codechicken:CodeChickenLib:1.9.4-2.0.2.39:deobf"
|
||||||
//deobfCompile "codechicken:CodeChickenCore:1.9.4-2.0.3.65:deobf"
|
//deobfCompile "codechicken:CodeChickenCore:1.9.4-2.0.3.65:deobf"
|
||||||
//deobfCompile "codechicken:NotEnoughItems:1.9-${nei_version}:dev"
|
//deobfCompile "codechicken:NotEnoughItems:1.9-${nei_version}:dev"
|
||||||
deobfCompile "slimeknights.mantle:Mantle:1.10.2-0.10.3.jenkins161:deobf"
|
deobfCompile "slimeknights.mantle:Mantle:1.10.2-1.1.+:deobf"
|
||||||
//Old: deobfCompile "slimeknights.mantle:Mantle:1.9-0.10.0.jenkins132:deobf"
|
//Old: deobfCompile "slimeknights.mantle:Mantle:1.9-0.10.0.jenkins132:deobf"
|
||||||
deobfCompile "mezz.jei:jei_1.10.2:3.7.6.231"
|
deobfCompile "mezz.jei:jei_1.10.2:3.+"
|
||||||
deobfCompile "slimeknights:TConstruct:1.10-2.3.3a.jenkins271:deobf"
|
deobfCompile "slimeknights:TConstruct:1.10.2-2.6.+:deobf"
|
||||||
//compile files('libs/TConstruct-1.9-2.3.1.DEV.1d4c1de-deobf.jar')
|
//compile files('libs/TConstruct-1.9-2.3.1.DEV.1d4c1de-deobf.jar')
|
||||||
|
//compile group: 'com.google.guava', name: 'guava', version: '20.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -70,33 +94,6 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildInfo {
|
|
||||||
def cmd = "git name-rev --tags --name-only \$(git rev-parse HEAD)"
|
|
||||||
def proc = cmd.execute()
|
|
||||||
proc.waitFor()
|
|
||||||
if (proc.exitValue() == 0) {
|
|
||||||
project.ext.tag = proc.text.trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.getenv().BUILD_NUMBER != null) {
|
|
||||||
ext.buildNum = System.getenv().BUILD_NUMBER
|
|
||||||
}
|
|
||||||
|
|
||||||
project.ext.mc_version = project.minecraft.version.split('-')[0]
|
|
||||||
|
|
||||||
def cmd_changes = "git log `git describe --tags \$(git rev-list --tags --max-count=2) | sed -n '2p'`..`git describe --tags --abbrev=0` --oneline"
|
|
||||||
def proc_changes = cmd_changes.execute()
|
|
||||||
proc_changes.waitFor()
|
|
||||||
if (proc_changes.exitValue() == 0) {
|
|
||||||
project.ext.changes = proc_changes.text.trim()
|
|
||||||
} else {
|
|
||||||
project.ext.changes = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
version = tag ? "${mc_version}-${tag}" : "${mc_version}-snapshot"
|
|
||||||
|
|
||||||
//noinspection GroovyAssignabilityCheck
|
//noinspection GroovyAssignabilityCheck
|
||||||
processResources {
|
processResources {
|
||||||
// this will ensure that this task is redone when the versions change.
|
// this will ensure that this task is redone when the versions change.
|
||||||
@@ -118,6 +115,7 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task deobfJar(type: Jar) {
|
task deobfJar(type: Jar) {
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
classifier = 'deobf'
|
classifier = 'deobf'
|
||||||
}
|
}
|
||||||
@@ -128,15 +126,21 @@ artifacts {
|
|||||||
|
|
||||||
curseforge {
|
curseforge {
|
||||||
apiKey = System.getenv().CURSE_API_KEY ? System.getenv().CURSE_API_KEY : "devBuild"
|
apiKey = System.getenv().CURSE_API_KEY ? System.getenv().CURSE_API_KEY : "devBuild"
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
project {
|
project {
|
||||||
id = '247661'
|
id = '247661'
|
||||||
changelog = project.changes // A file can also be set using: changelog = file('changelog.txt')
|
changelog = project.buildInfo.changes // A file can also be set using: changelog = file('changelog.txt')
|
||||||
releaseType = 'release'
|
releaseType = 'release'
|
||||||
|
//addGameVersion '1.10.2'
|
||||||
|
//addGameVersion '1.10.1'
|
||||||
|
addArtifact deobfJar
|
||||||
|
|
||||||
mainArtifact(jar) {
|
mainArtifact(jar) {
|
||||||
displayName = "taiga-$project.tag"
|
displayName = "taiga-${project.buildInfo.revision}"
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relations {
|
||||||
|
requiredLibrary 'tinkers-construct'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,32 +1,43 @@
|
|||||||
package com.sosnitzka.taiga;
|
package com.sosnitzka.taiga;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import slimeknights.tconstruct.shared.TinkerFluids;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Fluids.*;
|
import static com.sosnitzka.taiga.Fluids.*;
|
||||||
import static com.sosnitzka.taiga.util.Utils.registerTinkerAlloys;
|
import static com.sosnitzka.taiga.util.Utils.registerTinkerAlloy;
|
||||||
|
|
||||||
public class Alloys {
|
public class Alloys {
|
||||||
|
|
||||||
static void register() {
|
/**
|
||||||
registerTinkerAlloys(nitroniteFluid, 2, tiberiumFluid, 4, vibraniumFluid, 3, nitroFluid, 3);
|
* Registers alloying in the smeltery
|
||||||
registerTinkerAlloys(bysmuidFluid, 1, rubiumFluid, 3, bismuthFluid, 2, anthraciteFluid, 3);
|
*/
|
||||||
registerTinkerAlloys(ultraniteFluid, 1, prometheumFluid, 3, adamantiteFluid, 2, radiant_enderium, 3);
|
public static void register() {
|
||||||
registerTinkerAlloys(astriumFluid, 1, arcaniteFluid, 3, karmesineFluid, 2, energy_enderium, 3);
|
registerTinkerAlloy(new FluidStack(triberiumFluid, 1), new FluidStack(tiberiumFluid, 5), new FluidStack(basaltFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(fractumFluid, 2), new FluidStack(triberiumFluid, 3), new FluidStack(TinkerFluids.obsidian, 3), new FluidStack(abyssumFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(violiumFluid, 2), new FluidStack(auroriumFluid, 3), new FluidStack(TinkerFluids.ardite, 2));
|
||||||
|
registerTinkerAlloy(new FluidStack(proxiiFluid, 3), new FluidStack(prometheumFluid, 3), new FluidStack(palladiumFluid, 3), new FluidStack(eezoFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(tritoniteFluid, 2), new FluidStack(TinkerFluids.cobalt, 3), new FluidStack(karmesineFluid, 2));
|
||||||
|
registerTinkerAlloy(new FluidStack(ignitzFluid, 2), new FluidStack(TinkerFluids.ardite, 2), new FluidStack(karmesineFluid, 2), new FluidStack(osramFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(imperomiteFluid, 2), new FluidStack(duraniteFluid, 3), new FluidStack(prometheumFluid, 1), new FluidStack(abyssumFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(solariumFluid, 2), new FluidStack(valyriumFluid, 2), new FluidStack(uruFluid, 2), new FluidStack(nucleumFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(adamantFluid, 3), new FluidStack(vibraniumFluid, 1), new FluidStack(solariumFluid, 1), new FluidStack(ioxFluid, 3));
|
||||||
|
registerTinkerAlloy(new FluidStack(nihiliteFluid, 1), new FluidStack(vibraniumFluid, 1), new FluidStack(solariumFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(seismumFluid, 4), new FluidStack(TinkerFluids.obsidian, 4), new FluidStack(triberiumFluid, 2), new FluidStack(eezoFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(astriumFluid, 2), new FluidStack(karmesineFluid, 3), new FluidStack(auroriumFluid, 2));
|
||||||
|
registerTinkerAlloy(new FluidStack(niobFluid, 3), new FluidStack(palladiumFluid, 3), new FluidStack(duraniteFluid, 1), new FluidStack(osramFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(yrdeenFluid, 3), new FluidStack(uruFluid, 3), new FluidStack(valyriumFluid, 3), new FluidStack(osramFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(yrdeenFluid, 3), new FluidStack(uruFluid, 3), new FluidStack(valyriumFluid, 3), new FluidStack(eezoFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(yrdeenFluid, 3), new FluidStack(uruFluid, 3), new FluidStack(valyriumFluid, 3), new FluidStack(abyssumFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(ioxFluid, 1), new FluidStack(eezoFluid, 2), new FluidStack(abyssumFluid, 2), new FluidStack(osramFluid, 2), new FluidStack(obsidioriteFluid, 9));
|
||||||
|
registerTinkerAlloy(new FluidStack(ioxFluid, 1), new FluidStack(eezoFluid, 2), new FluidStack(abyssumFluid, 2), new FluidStack(osramFluid, 2), new FluidStack(meteoriteFluid, 9), new FluidStack(TinkerFluids.obsidian, 9));
|
||||||
|
registerTinkerAlloy(new FluidStack(lumixFluid, 1), new FluidStack(palladiumFluid, 1), new FluidStack(karmesineFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(obsidioriteFluid, 1), new FluidStack(meteoriteFluid, 1), new FluidStack(TinkerFluids.obsidian, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(nucleumFluid, 3), new FluidStack(proxiiFluid, 3), new FluidStack(abyssumFluid, 1), new FluidStack(osramFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(nucleumFluid, 3), new FluidStack(imperomiteFluid, 3), new FluidStack(osramFluid, 1), new FluidStack(eezoFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(nucleumFluid, 3), new FluidStack(niobFluid, 3), new FluidStack(eezoFluid, 1), new FluidStack(abyssumFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(dyoniteFluid, 3), new FluidStack(triberiumFluid, 3), new FluidStack(fractumFluid, 1), new FluidStack(seismumFluid, 1), new FluidStack(osramFluid, 1));
|
||||||
|
registerTinkerAlloy(new FluidStack(dyoniteFluid, 3), new FluidStack(tiberiumFluid, 12), new FluidStack(fractumFluid, 1), new FluidStack(seismumFluid, 1), new FluidStack(osramFluid, 1));
|
||||||
|
|
||||||
registerTinkerAlloys(imperomiteFluid, 2, titaniteFluid, 3, palladiumFluid, 3, FluidRegistry.LAVA, 3);
|
|
||||||
registerTinkerAlloys(dyoniteFluid, 1, meteoriteFluid, 3, tiberiumFluid, 2, spectrumFluid, 3);
|
|
||||||
registerTinkerAlloys(solariumFluid, 2, vibraniumFluid, 4, ignititeFluid, 4, nitroFluid, 3);
|
|
||||||
registerTinkerAlloys(fractoryteFluid, 2, adamantiteFluid, 4, rubiumFluid, 2, FluidRegistry.LAVA, 3);
|
|
||||||
|
|
||||||
registerTinkerAlloys(aegisaltFluid, 1, eterniteFluid, 3, mindoriteFluid, 3, glimmercoalFluid, 3);
|
|
||||||
registerTinkerAlloys(noctunyxFluid, 1, mythrilFluid, 4, titaniteFluid, 2, spectrumFluid, 3);
|
|
||||||
registerTinkerAlloys(nucleumFluid, 1, palladiumFluid, 3, violiumFluid, 3, radiant_enderium, 3);
|
|
||||||
registerTinkerAlloys(seismodiumFluid, 2, ignititeFluid, 5, meteoriteFluid, 3, glimming_enderium, 3);
|
|
||||||
|
|
||||||
registerTinkerAlloys(lumixylFluid, 1, bismuthFluid, 3, prometheumFluid, 2, glimming_enderium, 6);
|
|
||||||
registerTinkerAlloys(terramiteFluid, 2, violiumFluid, 4, eterniteFluid, 2, energy_enderium, 3);
|
|
||||||
registerTinkerAlloys(cryptogenFluid, 1, mindoriteFluid, 4, arcaniteFluid, 2, anthraciteFluid, 3);
|
|
||||||
registerTinkerAlloys(proxideumFluid, 1, karmesineFluid, 3, mythrilFluid, 2, glimmercoalFluid, 3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
package com.sosnitzka.taiga;
|
package com.sosnitzka.taiga;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.sosnitzka.taiga.blocks.BlockLignite;
|
import com.sosnitzka.taiga.blocks.BlockCobble;
|
||||||
|
import com.sosnitzka.taiga.blocks.BlockMeteoriteRock;
|
||||||
import com.sosnitzka.taiga.blocks.BlockTiberium;
|
import com.sosnitzka.taiga.blocks.BlockTiberium;
|
||||||
import com.sosnitzka.taiga.generic.BasicBlock;
|
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||||
import com.sosnitzka.taiga.generic.BasicBlockGround;
|
|
||||||
import com.sosnitzka.taiga.util.Utils;
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -22,87 +22,78 @@ import static slimeknights.tconstruct.library.utils.HarvestLevels.*;
|
|||||||
public class Blocks {
|
public class Blocks {
|
||||||
|
|
||||||
|
|
||||||
/// /regular Ores / Blocks without extra abilites
|
// blocks and ores spawned via worldgen
|
||||||
public static Block basalt = new BasicBlock("basalt", Material.ROCK, 45.0f, 35.0f, OBSIDIAN);
|
public static Block basaltBlock = new BasicBlock("basalt_block", Material.ROCK, 45.0f, 35.0f, DIAMOND, PREFIX_BLOCK);
|
||||||
public static Block rottenGround = new BasicBlockGround("rotten_ground", Material.GROUND, 2.0f, 2.0f, STONE);
|
|
||||||
public static Block ligniteOre = new BlockLignite();
|
|
||||||
public static Block slagironOre = new BasicBlock("slagiron_ore", Material.ROCK, 3.0f, 5.0f, IRON);
|
|
||||||
public static Block slaggoldOre = new BasicBlock("slaggold_ore", Material.ROCK, 3.0f, 5.0f, IRON);
|
|
||||||
|
|
||||||
// Ores
|
|
||||||
// Group: Solide
|
|
||||||
public static Block titaniteOre = new BasicBlock("titanite_ore", Material.ROCK, 55.0f, 400.0f, TITANITE, PREFIX_ORE);
|
|
||||||
public static Block meteoriteOre = new BasicBlock("meteorite_ore", Material.ROCK, 60.0f, 500.0f, METEORITE, PREFIX_ORE);
|
|
||||||
public static Block vibraniumOre = new BasicBlock("vibranium_ore", Material.ROCK, 70.0f, 800.0f, VIBRANIUM, PREFIX_ORE);
|
|
||||||
public static Block adamantiteOre = new BasicBlock("adamantite_ore", Material.ROCK, 80.0f, 1000.0f, ADAMANTITE, PREFIX_ORE);
|
|
||||||
// Group: Arcane
|
|
||||||
public static Block prometheumOre = new BasicBlock("prometheum_ore", Material.ROCK, 35.0f, 35.0f, COBALT, 0.25f, PREFIX_ORE);
|
|
||||||
public static Block rubiumOre = new BasicBlock("rubium_ore", Material.ROCK, 13.0f, 15.0f, TITANITE, PREFIX_ORE);
|
|
||||||
public static Block tiberiumOre = new BlockTiberium();
|
public static Block tiberiumOre = new BlockTiberium();
|
||||||
public static Block arcaniteOre = new BasicBlock("arcanite_ore", Material.ROCK, 23.0f, 25.0f, METEORITE, PREFIX_ORE);
|
public static Block auroriumOre = new BasicBlock("aurorium_ore", Material.ROCK, 13.0f, 12f, COBALT, 0.2f, PREFIX_ORE);
|
||||||
// Group: Etheri
|
public static Block prometheumOre = new BasicBlock("prometheum_ore", Material.ROCK, 35.0f, 12f, DURANITE, 0.4f, PREFIX_ORE);
|
||||||
public static Block eterniteOre = new BasicBlock("eternite_ore", Material.ROCK, 24.0f, 25.0f, COBALT, PREFIX_ORE);
|
public static Block duraniteOre = new BasicBlock("duranite_ore", Material.ROCK, 80.0f, 70f, DURANITE, PREFIX_ORE);
|
||||||
public static Block mythrilOre = new BasicBlock("mythril_ore", Material.ROCK, 25.0f, 25.0f, TITANITE, PREFIX_ORE);
|
public static Block valyriumOre = new BasicBlock("valyrium_ore", Material.ROCK, 60.0f, 50f, VALYRIUM, PREFIX_ORE);
|
||||||
public static Block palladiumOre = new BasicBlock("palladium_ore", Material.ROCK, 25.0f, 25.0f, METEORITE, PREFIX_ORE);
|
public static Block vibraniumOre = new BasicBlock("vibranium_ore", Material.ROCK, 70.0f, 60f, VIBRANIUM, PREFIX_ORE);
|
||||||
public static Block ignititeOre = new BasicBlock("ignitite_ore", Material.ROCK, 23.0f, 25.0f, VIBRANIUM, PREFIX_ORE);
|
public static Block karmesineOre = new BasicBlock("karmesine_ore", Material.ROCK, 13.0f, 10f, COBALT, PREFIX_ORE);
|
||||||
// Group: Ratio
|
public static Block palladiumOre = new BasicBlock("palladium_ore", Material.ROCK, 25.0f, 15f, DURANITE, 0.4f, PREFIX_ORE);
|
||||||
public static Block violiumOre = new BasicBlock("violium_ore", Material.ROCK, 13.0f, 13.0f, COBALT, PREFIX_ORE);
|
public static Block uruOre = new BasicBlock("uru_ore", Material.ROCK, 25.0f, 15f, VALYRIUM, PREFIX_ORE);
|
||||||
public static Block bismuthOre = new BasicBlock("bismuth_ore", Material.ROCK, 8.0f, 8.0f, OBSIDIAN, PREFIX_ORE);
|
public static Block osramOre = new BasicBlock("osram_ore", Material.ROCK, 45.0f, 35.0f, COBALT, PREFIX_ORE);
|
||||||
public static Block mindoriteOre = new BasicBlock("mindorite_ore", Material.ROCK, 12.0f, 12.0f, TITANITE, PREFIX_ORE);
|
public static Block eezoOre = new BasicBlock("eezo_ore", Material.ROCK, 45.0f, 35.0f, COBALT, PREFIX_ORE);
|
||||||
public static Block karmesineOre = new BasicBlock("karmesine_ore", Material.ROCK, 13.0f, 15.0f, METEORITE, PREFIX_ORE);
|
public static Block abyssumOre = new BasicBlock("abyssum_ore", Material.ROCK, 45.0f, 35.0f, COBALT, PREFIX_ORE);
|
||||||
|
|
||||||
// Blocks
|
// Ore Casts
|
||||||
// Group: Solide
|
public static Block tiberiumBlock = new BasicBlock("tiberium_block", Material.ROCK, 30.0f, 15f, STONE, 1f, PREFIX_BLOCK);
|
||||||
public static Block titaniteBlock = new BasicBlock("titanite_block", Material.ROCK, 55.0f, 400.0f, 5, PREFIX_BLOCK);
|
public static Block auroriumBlock = new BasicBlock("aurorium_block", Material.ROCK, 13.0f, 15f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block meteoriteBlock = new BasicBlock("meteorite_block", Material.ROCK, 60.0f, 500.0f, 6, PREFIX_BLOCK);
|
public static Block prometheumBlock = new BasicBlock("prometheum_block", Material.ROCK, 35.0f, 15f, DURANITE, 0.5f, PREFIX_BLOCK);
|
||||||
public static Block vibraniumBlock = new BasicBlock("vibranium_block", Material.ROCK, 70.0f, 800.0f, 7, PREFIX_BLOCK);
|
public static Block duraniteBlock = new BasicBlock("duranite_block", Material.ROCK, 60.0f, 60f, DURANITE, PREFIX_BLOCK);
|
||||||
public static Block adamantiteBlock = new BasicBlock("adamantite_block", Material.ROCK, 80.0f, 1000.0f, 8, PREFIX_BLOCK);
|
public static Block valyriumBlock = new BasicBlock("valyrium_block", Material.ROCK, 70.0f, 70f, VALYRIUM, PREFIX_BLOCK);
|
||||||
// Group: Arcane
|
public static Block vibraniumBlock = new BasicBlock("vibranium_block", Material.ROCK, 80.0f, 80f, VIBRANIUM, PREFIX_BLOCK);
|
||||||
public static Block prometheumBlock = new BasicBlock("prometheum_block", Material.ROCK, 35.0f, 35.0f, 4, 0.25f, PREFIX_BLOCK);
|
public static Block karmesineBlock = new BasicBlock("karmesine_block", Material.ROCK, 13.0f, 12f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block rubiumBlock = new BasicBlock("rubium_block", Material.ROCK, 13.0f, 15.0f, 5, PREFIX_BLOCK);
|
public static Block palladiumBlock = new BasicBlock("palladium_block", Material.ROCK, 25.0f, 20f, DURANITE, 0.5f, PREFIX_BLOCK);
|
||||||
public static Block tiberiumBlock = new BasicBlock("tiberium_block", Material.ROCK, 30.0f, 30.0f, 6, 1f, PREFIX_BLOCK);
|
public static Block uruBlock = new BasicBlock("uru_block", Material.ROCK, 25.0f, 20f, VALYRIUM, PREFIX_BLOCK);
|
||||||
public static Block arcaniteBlock = new BasicBlock("arcanite_block", Material.ROCK, 23.0f, 25.0f, 7, PREFIX_BLOCK);
|
public static Block osramBlock = new BasicBlock("osram_block", Material.ROCK, 13.0f, 12f, COBALT, PREFIX_BLOCK);
|
||||||
// Group: Etheri
|
public static Block abyssumBlock = new BasicBlock("abyssum_block", Material.ROCK, 13.0f, 12f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block eterniteBlock = new BasicBlock("eternite_block", Material.ROCK, 24.0f, 25.0f, 4, PREFIX_BLOCK);
|
public static Block eezoBlock = new BasicBlock("eezo_block", Material.ROCK, 13.0f, 12f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block mythrilBlock = new BasicBlock("mythril_block", Material.ROCK, 25.0f, 25.0f, 5, PREFIX_BLOCK);
|
|
||||||
public static Block palladiumBlock = new BasicBlock("palladium_block", Material.ROCK, 25.0f, 25.0f, 6, PREFIX_BLOCK);
|
public static Block triberiumBlock = new BasicBlock("triberium_block", Material.ROCK, 30.0f, 15f, OBSIDIAN, 1f, PREFIX_BLOCK);
|
||||||
public static Block ignititeBlock = new BasicBlock("ignitite_block", Material.ROCK, 23.0f, 25.0f, 7, PREFIX_BLOCK);
|
public static Block fractumBlock = new BasicBlock("fractum_block", Material.ROCK, 25.0f, 25f, COBALT, PREFIX_BLOCK);
|
||||||
// Group: Ratio
|
public static Block violiumBlock = new BasicBlock("violium_block", Material.ROCK, 25.0f, 25f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block violiumBlock = new BasicBlock("violium_block", Material.ROCK, 13.0f, 13.0f, 4, PREFIX_BLOCK);
|
public static Block proxiiBlock = new BasicBlock("proxii_block", Material.ROCK, 25.0f, 25f, DURANITE, PREFIX_BLOCK);
|
||||||
public static Block bismuthBlock = new BasicBlock("bismuth_block", Material.ROCK, 8.0f, 8.0f, 5, PREFIX_BLOCK);
|
public static Block tritoniteBlock = new BasicBlock("tritonite_block", Material.ROCK, 25.0f, 25f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block mindoriteBlock = new BasicBlock("mindorite_block", Material.ROCK, 12.0f, 12.0f, 2, PREFIX_BLOCK);
|
public static Block ignitzBlock = new BasicBlock("ignitz_block", Material.ROCK, 23.0f, 20f, COBALT, PREFIX_BLOCK);
|
||||||
public static Block karmesineBlock = new BasicBlock("karmesine_block", Material.ROCK, 13.0f, 15.0f, 3, PREFIX_BLOCK);
|
public static Block imperomiteBlock = new BasicBlock("imperomite_block", Material.ROCK, 25.0f, 25f, DURANITE, PREFIX_BLOCK);
|
||||||
|
public static Block solariumBlock = new BasicBlock("solarium_block", Material.ROCK, 25.0f, 25f, VIBRANIUM, PREFIX_BLOCK);
|
||||||
|
public static Block nihiliteBlock = new BasicBlock("nihilite_block", Material.ROCK, 25.0f, 25f, VALYRIUM, PREFIX_BLOCK);
|
||||||
|
public static Block adamantBlock = new BasicBlock("adamant_block", Material.ROCK, 25.0f, 25f, VIBRANIUM, PREFIX_BLOCK);
|
||||||
|
public static Block dyoniteBlock = new BasicBlock("dyonite_block", Material.ROCK, 25.0f, 25f, DURANITE, PREFIX_BLOCK);
|
||||||
|
public static Block nucleumBlock = new BasicBlock("nucleum_block", Material.ROCK, 25.0f, 25f, VALYRIUM, PREFIX_BLOCK);
|
||||||
|
public static Block lumixBlock = new BasicBlock("lumix_block", Material.ROCK, 25.0f, 25f, COBALT, PREFIX_BLOCK);
|
||||||
|
public static Block seismumBlock = new BasicBlock("seismum_block", Material.ROCK, 25.0f, 25f, COBALT, PREFIX_BLOCK);
|
||||||
|
public static Block astriumBlock = new BasicBlock("astrium_block", Material.ROCK, 25.0f, 25f, COBALT, PREFIX_BLOCK);
|
||||||
|
public static Block niobBlock = new BasicBlock("niob_block", Material.ROCK, 25.0f, 25f, DURANITE, PREFIX_BLOCK);
|
||||||
|
public static Block yrdeenBlock = new BasicBlock("yrdeen_block", Material.ROCK, 25.0f, 25f, VALYRIUM, PREFIX_BLOCK);
|
||||||
|
public static Block ioxBlock = new BasicBlock("iox_block", Material.ROCK, 25.0f, 25f, DURANITE, PREFIX_BLOCK);
|
||||||
|
|
||||||
|
|
||||||
public static Block imperomiteBlock = new BasicBlock("imperomite_block", Material.ROCK, 24.0f, 25.0f, 5, PREFIX_BLOCK);
|
public static Block blockMeteoriteCobble = new BlockCobble("meteoritecobble_block", Material.ROCK, 35f, 10f, COBALT, 0.075f, PREFIX_BLOCK);
|
||||||
public static Block fractoryteBlock = new BasicBlock("fractoryte_block", Material.ROCK, 8.0f, 8.0f, 8, PREFIX_BLOCK);
|
public static Block blockObsidioriteCobble = new BlockCobble("obsidioritecobble_block", Material.ROCK, 60f, 20f, DURANITE, 0.035f, PREFIX_BLOCK);
|
||||||
public static Block noctunyxBlock = new BasicBlock("noctunyx_block", Material.ROCK, 60.0f, 500.0f, 6, PREFIX_BLOCK);
|
public static Block blockMeteorite = new BlockMeteoriteRock("meteorite_block", Material.ROCK, 70f, 2000f, COBALT, 0.15f, PREFIX_BLOCK, blockMeteoriteCobble.getDefaultState());
|
||||||
public static Block nitroniteBlock = new BasicBlock("nitronite_block", Material.ROCK, 13.0f, 15.0f, 7, PREFIX_BLOCK);
|
public static Block blockObsidiorite = new BlockMeteoriteRock("obsidiorite_block", Material.ROCK, 120f, 4000f, DURANITE, 0.2f, PREFIX_BLOCK, blockObsidioriteCobble.getDefaultState());
|
||||||
public static Block cryptogenBlock = new BasicBlock("cryptogen_block", Material.ROCK, 23.0f, 25.0f, 6, PREFIX_BLOCK);
|
|
||||||
public static Block seismodiumBlock = new BasicBlock("seismodium_block", Material.ROCK, 30.0f, 30.0f, 7, 1f, PREFIX_BLOCK);
|
|
||||||
public static Block aegisaltBlock = new BasicBlock("aegisalt_block", Material.ROCK, 13.0f, 13.0f, 5, PREFIX_BLOCK);
|
|
||||||
public static Block ultraniteBlock = new BasicBlock("ultranite_block", Material.ROCK, 13.0f, 15.0f, 8, PREFIX_BLOCK);
|
|
||||||
public static Block bysmuidBlock = new BasicBlock("bysmuid_block", Material.ROCK, 35.0f, 35.0f, 5, 0.25f, PREFIX_BLOCK);
|
|
||||||
public static Block nucleumBlock = new BasicBlock("nucleum_block", Material.ROCK, 25.0f, 25.0f, 4, PREFIX_BLOCK);
|
|
||||||
public static Block terramiteBlock = new BasicBlock("terramite_block", Material.ROCK, 70.0f, 800.0f, 4, PREFIX_BLOCK);
|
|
||||||
public static Block solariumBlock = new BasicBlock("solarium_block", Material.ROCK, 80.0f, 1000.0f, 5, PREFIX_BLOCK);
|
|
||||||
public static Block lumixylBlock = new BasicBlock("lumixyl_block", Material.ROCK, 12.0f, 12.0f, 5, PREFIX_BLOCK);
|
|
||||||
public static Block dyoniteBlock = new BasicBlock("dyonite_block", Material.ROCK, 23.0f, 25.0f, 4, PREFIX_BLOCK);
|
|
||||||
public static Block proxideumBlock = new BasicBlock("proxideum_block", Material.ROCK, 25.0f, 25.0f, 4, PREFIX_BLOCK);
|
|
||||||
public static Block astriumBlock = new BasicBlock("astrium_block", Material.ROCK, 55.0f, 400.0f, 7, PREFIX_BLOCK);
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers all materials' ingots and nuggets <br>
|
||||||
|
* Detailed summary: <br>
|
||||||
|
* Gets the ingots declared in the class (fields and reflection) and iterates through them: <br>
|
||||||
|
* Checks that the field is static, registers the field (item), and adds an oreDict entry if needed
|
||||||
|
*/
|
||||||
public static void register() {
|
public static void register() {
|
||||||
Field[] declaredFields = Blocks.class.getDeclaredFields();
|
Field[] declaredFields = Blocks.class.getDeclaredFields(); // Gets the fields (ingots) declared above
|
||||||
for (Field field : declaredFields) {
|
for (Field field : declaredFields) { // Iterates through the fields declared above
|
||||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) { // Checks that the fields are static
|
||||||
Class<?> targetType = field.getType();
|
Class<?> targetType = field.getType();
|
||||||
try {
|
try {
|
||||||
Block block = (Block) field.get(targetType);
|
Block block = (Block) field.get(targetType); // Gets the field as a BasicBlock which is then casted to an Block
|
||||||
Utils.registerBlockWithItem(block);
|
block.setCreativeTab(CreativeTab.tabTaigaBlock);
|
||||||
|
Utils.registerBlockWithItem(block); // Registers block and its item
|
||||||
if (block instanceof BasicBlock) {
|
if (block instanceof BasicBlock) { // Checks that the block is a BasicBlock
|
||||||
if (((BasicBlock) block).isOreDict()) {
|
if (((BasicBlock) block).isOreDict()) { // Checks that the block has an oreDict entry
|
||||||
String oreDictName;
|
String oreDictName;
|
||||||
String[] nameParts = block.getUnlocalizedName().replace("tile.", "").split("_");
|
String[] nameParts = block.getUnlocalizedName().replace("tile.", "").split("_");
|
||||||
|
|
||||||
@@ -111,7 +102,7 @@ public class Blocks {
|
|||||||
} else {
|
} else {
|
||||||
oreDictName = nameParts[0];
|
oreDictName = nameParts[0];
|
||||||
}
|
}
|
||||||
OreDictionary.registerOre(((BasicBlock) block).getOreDictPrefix() + StringUtils.capitalize(oreDictName), block);
|
OreDictionary.registerOre(((BasicBlock) block).getOreDictPrefix() + StringUtils.capitalize(oreDictName), block); // Registers the block's oreDict
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
@@ -119,8 +110,5 @@ public class Blocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OreDictionary.registerOre("nuggetIron", slagironOre);
|
|
||||||
OreDictionary.registerOre("nuggetGold", slaggoldOre);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
src/main/java/com/sosnitzka/taiga/CreativeTab.java
Normal file
26
src/main/java/com/sosnitzka/taiga/CreativeTab.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.sosnitzka.taiga;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.Blocks.adamantBlock;
|
||||||
|
import static com.sosnitzka.taiga.Items.solariumIngot;
|
||||||
|
|
||||||
|
|
||||||
|
public class CreativeTab {
|
||||||
|
|
||||||
|
public static final CreativeTabs tabTaigaBlock = new CreativeTabs("taiga_block") {
|
||||||
|
@Override
|
||||||
|
public Item getTabIconItem() {
|
||||||
|
return Item.getItemFromBlock(adamantBlock);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final CreativeTabs tabTaigaItem = new CreativeTabs("taiga_item") {
|
||||||
|
@Override
|
||||||
|
public Item getTabIconItem() {
|
||||||
|
return solariumIngot;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
@@ -3,76 +3,71 @@ package com.sosnitzka.taiga;
|
|||||||
|
|
||||||
import com.sosnitzka.taiga.generic.BasicTinkerFluid;
|
import com.sosnitzka.taiga.generic.BasicTinkerFluid;
|
||||||
import com.sosnitzka.taiga.util.Utils;
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
import net.minecraft.init.Blocks;
|
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
|
||||||
import slimeknights.tconstruct.smeltery.block.BlockMolten;
|
import slimeknights.tconstruct.smeltery.block.BlockMolten;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Items.*;
|
|
||||||
import static com.sosnitzka.taiga.util.Utils.registerFluid;
|
import static com.sosnitzka.taiga.util.Utils.registerFluid;
|
||||||
import static slimeknights.tconstruct.library.TinkerRegistry.registerMelting;
|
|
||||||
|
|
||||||
public class Fluids {
|
public class Fluids {
|
||||||
|
|
||||||
public static BasicTinkerFluid arcaniteFluid = new BasicTinkerFluid("arcanite", 0xFF272354, true, 538, 8, 3768);
|
public static BasicTinkerFluid basaltFluid = new BasicTinkerFluid("basalt_fluid", 0xFFe4ddc3, 550, 10, 6000);
|
||||||
public static BasicTinkerFluid titaniteFluid = new BasicTinkerFluid("titanite", 0xFFe0ede7, true, 942, 7, 1858);
|
public static BasicTinkerFluid tiberiumFluid = new BasicTinkerFluid("tiberium_fluid", 0xFF66f136, 400, 10, 8000);
|
||||||
public static BasicTinkerFluid adamantiteFluid = new BasicTinkerFluid("adamantite", 0xFFc45c82, true, 1100, 10, 3597);
|
public static BasicTinkerFluid auroriumFluid = new BasicTinkerFluid("aurorium_fluid", 0xFFefae94, 750, 10, 10000);
|
||||||
public static BasicTinkerFluid violiumFluid = new BasicTinkerFluid("violium", 0xFF264c4f, true, 875, 10, 3970);
|
public static BasicTinkerFluid prometheumFluid = new BasicTinkerFluid("prometheum_fluid", 0xFF271c29, 850, 10, 10000);
|
||||||
public static BasicTinkerFluid bismuthFluid = new BasicTinkerFluid("bismuth", 0xFF555555, true, 612, 9, 2552);
|
public static BasicTinkerFluid duraniteFluid = new BasicTinkerFluid("duranite_fluid", 0xFFacddeb, 10000, 10, 10000);
|
||||||
public static BasicTinkerFluid eterniteFluid = new BasicTinkerFluid("eternite", 0xFFfafa98, true, 542, 10, 3980);
|
public static BasicTinkerFluid valyriumFluid = new BasicTinkerFluid("valyrium_fluid", 0xFFe85c31, 1250, 10, 10000);
|
||||||
public static BasicTinkerFluid ignititeFluid = new BasicTinkerFluid("ignitite", 0xFFff6642, true, 422, 9, 3787);
|
public static BasicTinkerFluid vibraniumFluid = new BasicTinkerFluid("vibranium_fluid", 0xFFbad2d9, 1400, 10, 10000);
|
||||||
public static BasicTinkerFluid karmesineFluid = new BasicTinkerFluid("karmesine", 0xFFc16d6d, true, 499, 7, 3978);
|
public static BasicTinkerFluid karmesineFluid = new BasicTinkerFluid("karmesine_fluid", 0xFFeb484a, 750, 10, 9000);
|
||||||
public static BasicTinkerFluid meteoriteFluid = new BasicTinkerFluid("meteorite", 0xFF6e6a62, true, 942, 10, 2588);
|
public static BasicTinkerFluid palladiumFluid = new BasicTinkerFluid("palladium_fluid", 0xFFee8736, 690, 10, 10000);
|
||||||
public static BasicTinkerFluid mindoriteFluid = new BasicTinkerFluid("mindorite", 0xFF6bbbff, true, 671, 8, 2956);
|
public static BasicTinkerFluid uruFluid = new BasicTinkerFluid("uru_fluid", 0xFFbfb9f0, 1200, 10, 10000);
|
||||||
public static BasicTinkerFluid mythrilFluid = new BasicTinkerFluid("mythril", 0xFFa8c0ba, true, 841, 10, 1579);
|
public static BasicTinkerFluid osramFluid = new BasicTinkerFluid("osram_fluid", 0xFFffbc90, 800, 10, 4000);
|
||||||
public static BasicTinkerFluid palladiumFluid = new BasicTinkerFluid("palladium", 0xFFfe5c05, true, 786, 10, 3302);
|
public static BasicTinkerFluid abyssumFluid = new BasicTinkerFluid("abyssum_fluid", 0xFF21bcc2, 700, 10, 10000);
|
||||||
public static BasicTinkerFluid prometheumFluid = new BasicTinkerFluid("prometheum", 0xFF2b282f, true, 786, 2, 2256);
|
public static BasicTinkerFluid eezoFluid = new BasicTinkerFluid("eezo_fluid", 0xFF58798a, 450, 0, 1000);
|
||||||
public static BasicTinkerFluid tiberiumFluid = new BasicTinkerFluid("tiberium", 0xFF5f9e2d, true, 352, 10, 1553);
|
public static BasicTinkerFluid triberiumFluid = new BasicTinkerFluid("triberium_fluid", 0xFFe4ff00, 550, 10, 9000);
|
||||||
public static BasicTinkerFluid vibraniumFluid = new BasicTinkerFluid("vibranium", 0xFFc4ddc8, true, 1050, 9, 3402);
|
public static BasicTinkerFluid fractumFluid = new BasicTinkerFluid("fractum_fluid", 0xFFd2c583, 750, 10, 10000);
|
||||||
public static BasicTinkerFluid rubiumFluid = new BasicTinkerFluid("rubium", 0xFFe371b0, true, 200, 600, 1653);
|
public static BasicTinkerFluid violiumFluid = new BasicTinkerFluid("violium_fluid", 0xFFbfb0e2, 850, 10, 10000);
|
||||||
public static BasicTinkerFluid astriumFluid = new BasicTinkerFluid("astrium", 0xFF7a3b74, true, 810, 10, 1525);
|
public static BasicTinkerFluid proxiiFluid = new BasicTinkerFluid("proxii_fluid", 0xFFcefde1, 750, 10, 10000);
|
||||||
public static BasicTinkerFluid nitroniteFluid = new BasicTinkerFluid("nitronite", 0xFFdfe553, true, 680, 10, 2185);
|
public static BasicTinkerFluid tritoniteFluid = new BasicTinkerFluid("tritonite_fluid", 0xFF8edeff, 550, 10, 10000);
|
||||||
public static BasicTinkerFluid proxideumFluid = new BasicTinkerFluid("proxideum", 0xFF2f7177, true, 700, 9, 3859);
|
public static BasicTinkerFluid ignitzFluid = new BasicTinkerFluid("ignitz_fluid", 0xFFff284b, 950, 10, 6000);
|
||||||
public static BasicTinkerFluid noctunyxFluid = new BasicTinkerFluid("noctunyx", 0xFF5f5081, true, 712, 8, 3983);
|
public static BasicTinkerFluid imperomiteFluid = new BasicTinkerFluid("imperomite_fluid", 0xFF7fefa0, 900, 10, 10000);
|
||||||
public static BasicTinkerFluid imperomiteFluid = new BasicTinkerFluid("imperomite", 0xFFff6642, true, 510, 10, 2353);
|
public static BasicTinkerFluid solariumFluid = new BasicTinkerFluid("solarium_fluid", 0xFFfef864, 1500, 10, 2000);
|
||||||
public static BasicTinkerFluid cryptogenFluid = new BasicTinkerFluid("cryptogen", 0xFF9f8a4a, true, 560, 10, 3243);
|
public static BasicTinkerFluid nihiliteFluid = new BasicTinkerFluid("nihilite_fluid", 0xFF6645ba, 580, 10, 10000);
|
||||||
public static BasicTinkerFluid fractoryteFluid = new BasicTinkerFluid("fractoryte", 0xFF983f11, true, 670, 8, 3805);
|
public static BasicTinkerFluid adamantFluid = new BasicTinkerFluid("adamant_fluid", 0xFFff8efe, 1650, 10, 10000);
|
||||||
public static BasicTinkerFluid seismodiumFluid = new BasicTinkerFluid("seismodium", 0xFF46131D, true, 831, 10, 1837);
|
public static BasicTinkerFluid dyoniteFluid = new BasicTinkerFluid("dyonite_fluid", 0xFFffbd3f, 660, 10, 7000);
|
||||||
public static BasicTinkerFluid terramiteFluid = new BasicTinkerFluid("terramite", 0xFFa6b27a, true, 687, 10, 2121);
|
public static BasicTinkerFluid nucleumFluid = new BasicTinkerFluid("nucleum_fluid", 0xFFe6ff40, 490, 10, 10000);
|
||||||
public static BasicTinkerFluid lumixylFluid = new BasicTinkerFluid("lumixyl", 0xFFfbe8cb, true, 548, 10, 2165);
|
public static BasicTinkerFluid lumixFluid = new BasicTinkerFluid("lumix_fluid", 0xFFf9f3cc, 450, 10, 8000);
|
||||||
public static BasicTinkerFluid solariumFluid = new BasicTinkerFluid("solarium", 0xFFffc81d, true, 482, 8, 3232);
|
public static BasicTinkerFluid seismumFluid = new BasicTinkerFluid("seismum_fluid", 0xFFecbca8, 720, 10, 10000);
|
||||||
public static BasicTinkerFluid dyoniteFluid = new BasicTinkerFluid("dyonite", 0xFFff6743, true, 486, 8, 3269);
|
public static BasicTinkerFluid astriumFluid = new BasicTinkerFluid("astrium_fluid", 0xFF8f385f, 680, 10, 10000);
|
||||||
public static BasicTinkerFluid ultraniteFluid = new BasicTinkerFluid("ultranite", 0xFFf5f294, true, 941, 9, 1784);
|
public static BasicTinkerFluid niobFluid = new BasicTinkerFluid("niob_fluid", 0xFF7398b9, 550, 10, 10000);
|
||||||
public static BasicTinkerFluid nucleumFluid = new BasicTinkerFluid("nucleum", 0xFFa8ea3b, true, 813, 10, 2355);
|
public static BasicTinkerFluid yrdeenFluid = new BasicTinkerFluid("yrdeen_fluid", 0xFF8f385f, 710, 10, 10000);
|
||||||
public static BasicTinkerFluid aegisaltFluid = new BasicTinkerFluid("aegisalt", 0xFFb6af74, true, 660, 7, 2089);
|
public static BasicTinkerFluid ioxFluid = new BasicTinkerFluid("iox_fluid", 0xFF99323c, 900, 10, 10000);
|
||||||
public static BasicTinkerFluid bysmuidFluid = new BasicTinkerFluid("bysmuid", 0xFF7b97b0, true, 560, 8, 2674);
|
public static BasicTinkerFluid meteoriteFluid = new BasicTinkerFluid("meteorite_fluid", 0xFF374f3d, 950, 10, 7000);
|
||||||
|
public static BasicTinkerFluid obsidioriteFluid = new BasicTinkerFluid("obsidiorite_fluid", 0xFF224853, 1050, 10, 7000);
|
||||||
|
|
||||||
// Additional fluids to cast alloys
|
|
||||||
public static BasicTinkerFluid radiant_enderium = new BasicTinkerFluid("radiant_enderium", 0xFFbcea5d, false, 529, 10, 768);
|
|
||||||
public static BasicTinkerFluid glimming_enderium = new BasicTinkerFluid("glimming_enderium", 0xFFfffc98, false, 633, 10, 821);
|
|
||||||
public static BasicTinkerFluid energy_enderium = new BasicTinkerFluid("energy_enderium", 0xFFffb498, false, 562, 10, 421);
|
|
||||||
public static BasicTinkerFluid glimmercoalFluid = new BasicTinkerFluid("glimmercoal_fluid", 0xFFee7c28, false, 531, 10, 312);
|
|
||||||
public static BasicTinkerFluid nitroFluid = new BasicTinkerFluid("nitro_fluid", 0xFF223512, false, 405, 5, 772);
|
|
||||||
public static BasicTinkerFluid anthraciteFluid = new BasicTinkerFluid("anthracite_fluid", 0xFF111111, false, 500, 0, 632);
|
|
||||||
public static BasicTinkerFluid spectrumFluid = new BasicTinkerFluid("spectrum_fluid", 0xFF64748f, false, 600, 0, 512);
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers all materials' fluids <br>
|
||||||
|
* Detailed summary: <br>
|
||||||
|
* Gets the fluids declared in the class (fields and reflection) and iterates through them: <br>
|
||||||
|
* Checks that the field is static, registers the field (fluids), and registers the models on the client
|
||||||
|
*/
|
||||||
static void register() {
|
static void register() {
|
||||||
Field[] declaredFields = Fluids.class.getDeclaredFields();
|
Field[] declaredFields = Fluids.class.getDeclaredFields(); // Gets the blocks and ores declared above
|
||||||
for (Field field : declaredFields) {
|
for (Field field : declaredFields) { // Iterates through the fields declared above
|
||||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) { // Checks that the fields are static
|
||||||
Class<?> targetType = field.getType();
|
Class<?> targetType = field.getType();
|
||||||
try {
|
try {
|
||||||
BasicTinkerFluid fluid = (BasicTinkerFluid) field.get(targetType);
|
BasicTinkerFluid fluid = (BasicTinkerFluid) field.get(targetType); // Gets the field as a BasicTinkerFluid
|
||||||
registerFluid(fluid);
|
registerFluid(fluid); // Registers the fluid into the game along wit its bucket
|
||||||
|
|
||||||
BlockMolten block = new BlockMolten(fluid);
|
BlockMolten block = new BlockMolten(fluid);
|
||||||
|
// Sets names
|
||||||
block.setUnlocalizedName("molten_" + fluid.getName());
|
block.setUnlocalizedName("molten_" + fluid.getName());
|
||||||
block.setRegistryName(TAIGA.MODID, "molten_" + fluid.getName());
|
block.setRegistryName(TAIGA.MODID, "molten_" + fluid.getName());
|
||||||
|
// Registers the fluid in its block form and its corresponding item (block/fluid as item in inventory)
|
||||||
Utils.registerBlockWithItem(block);
|
Utils.registerBlockWithItem(block);
|
||||||
|
// Registers the fluid's model but only on the client side
|
||||||
TAIGA.proxy.registerFluidModels(fluid);
|
TAIGA.proxy.registerFluidModels(fluid);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -81,16 +76,11 @@ public class Fluids {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers special smeltery recipes (not alloying)
|
||||||
|
*/
|
||||||
static void registerfromItem() {
|
static void registerfromItem() {
|
||||||
registerMelting(radiant_pearl, radiant_enderium, 72);
|
TinkerRegistry.registerMelting(Blocks.blockMeteoriteCobble, meteoriteFluid, 144);
|
||||||
registerMelting(glimmer_pearl, glimming_enderium, 72);
|
|
||||||
registerMelting(energy_pearl, energy_enderium, 72);
|
|
||||||
registerMelting(glimmercoal, glimmercoalFluid, 72);
|
|
||||||
registerMelting(nitro_brick, nitroFluid, 72);
|
|
||||||
registerMelting(anthracite_dust, anthraciteFluid, 72);
|
|
||||||
registerMelting(spectrum_dust, spectrumFluid, 72);
|
|
||||||
registerMelting(Blocks.OBSIDIAN, FluidRegistry.LAVA, 432);
|
|
||||||
registerMelting(Blocks.NETHERRACK, FluidRegistry.LAVA, 48);
|
|
||||||
registerMelting(Blocks.STONE, FluidRegistry.LAVA, 144);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,10 +3,6 @@ package com.sosnitzka.taiga;
|
|||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.sosnitzka.taiga.generic.BasicItem;
|
import com.sosnitzka.taiga.generic.BasicItem;
|
||||||
import com.sosnitzka.taiga.items.ItemIronNugget;
|
|
||||||
import com.sosnitzka.taiga.items.ItemLignite;
|
|
||||||
import com.sosnitzka.taiga.items.ItemSlaggoldIngot;
|
|
||||||
import com.sosnitzka.taiga.items.ItemSlagironIngot;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
@@ -15,76 +11,166 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.util.Utils.PREFIX_INGOT;
|
import static com.sosnitzka.taiga.util.Utils.*;
|
||||||
import static com.sosnitzka.taiga.util.Utils.PREFIX_NUGGET;
|
|
||||||
|
|
||||||
public class Items {
|
public class Items {
|
||||||
public static ItemSlagironIngot slagironIngot = new ItemSlagironIngot();
|
|
||||||
public static Item lignite = new ItemLignite("lignite", "lignite");
|
|
||||||
public static Item lignite2 = new ItemLignite("lignite", "lignite2");
|
|
||||||
public static Item lignite3 = new ItemLignite("lignite", "lignite3");
|
|
||||||
public static ItemIronNugget iron_nugget = new ItemIronNugget();
|
|
||||||
public static ItemSlaggoldIngot slaggoldIngot = new ItemSlaggoldIngot();
|
|
||||||
public static Item fuel_brick = new BasicItem("fuel_brick");
|
|
||||||
|
|
||||||
public static Item glimmercoal = new BasicItem("glimmercoal");
|
public static Item ironNugget = new BasicItem("iron_nugget", PREFIX_NUGGET);
|
||||||
public static Item radiant_pearl = new BasicItem("radiant_pearl");
|
|
||||||
public static Item glimmer_pearl = new BasicItem("glimmer_pearl");
|
|
||||||
public static Item energy_pearl = new BasicItem("energy_pearl");
|
|
||||||
public static Item glimmerstone_dust = new BasicItem("glimmerstone_dust");
|
|
||||||
public static Item luminar_dust = new BasicItem("luminar_dust");
|
|
||||||
public static Item spectrum_dust = new BasicItem("spectrum_dust");
|
|
||||||
public static Item anthracite_dust = new BasicItem("anthracite_dust");
|
|
||||||
public static Item nitro_brick = new BasicItem("nitro_brick");
|
|
||||||
|
|
||||||
public static Item titaniteIngot = new BasicItem("titanite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item adamantiteIngot = new BasicItem("adamantite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item arcaniteIngot = new BasicItem("arcanite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item violiumIngot = new BasicItem("violium_ingot", PREFIX_INGOT);
|
|
||||||
public static Item bismuthIngot = new BasicItem("bismuth_ingot", PREFIX_INGOT);
|
|
||||||
public static Item eterniteIngot = new BasicItem("eternite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item ignititeIngot = new BasicItem("ignitite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item karmesineIngot = new BasicItem("karmesine_ingot", PREFIX_INGOT);
|
|
||||||
public static Item meteoriteIngot = new BasicItem("meteorite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item mindoriteIngot = new BasicItem("mindorite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item mythrilIngot = new BasicItem("mythril_ingot", PREFIX_INGOT);
|
|
||||||
public static Item palladiumIngot = new BasicItem("palladium_ingot", PREFIX_INGOT);
|
|
||||||
public static Item prometheumIngot = new BasicItem("prometheum_ingot", PREFIX_INGOT);
|
|
||||||
public static Item tiberiumIngot = new BasicItem("tiberium_ingot", PREFIX_INGOT);
|
public static Item tiberiumIngot = new BasicItem("tiberium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item tiberiumDust = new BasicItem("tiberium_dust", PREFIX_DUST);
|
||||||
|
public static Item tiberiumNugget = new BasicItem("tiberium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item auroriumIngot = new BasicItem("aurorium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item auroriumDust = new BasicItem("aurorium_dust", PREFIX_DUST);
|
||||||
|
public static Item auroriumNugget = new BasicItem("aurorium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item prometheumIngot = new BasicItem("prometheum_ingot", PREFIX_INGOT);
|
||||||
|
public static Item prometheumDust = new BasicItem("prometheum_dust", PREFIX_DUST);
|
||||||
|
public static Item prometheumNugget = new BasicItem("prometheum_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item duraniteIngot = new BasicItem("duranite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item duraniteDust = new BasicItem("duranite_dust", PREFIX_DUST);
|
||||||
|
public static Item duraniteNugget = new BasicItem("duranite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item valyriumIngot = new BasicItem("valyrium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item valyriumDust = new BasicItem("valyrium_dust", PREFIX_DUST);
|
||||||
|
public static Item valyriumNugget = new BasicItem("valyrium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
public static Item vibraniumIngot = new BasicItem("vibranium_ingot", PREFIX_INGOT);
|
public static Item vibraniumIngot = new BasicItem("vibranium_ingot", PREFIX_INGOT);
|
||||||
public static Item rubiumIngot = new BasicItem("rubium_ingot", PREFIX_INGOT);
|
public static Item vibraniumDust = new BasicItem("vibranium_dust", PREFIX_DUST);
|
||||||
|
public static Item vibraniumNugget = new BasicItem("vibranium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item karmesineIngot = new BasicItem("karmesine_ingot", PREFIX_INGOT);
|
||||||
|
public static Item karmesineDust = new BasicItem("karmesine_dust", PREFIX_DUST);
|
||||||
|
public static Item karmesineNugget = new BasicItem("karmesine_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item palladiumIngot = new BasicItem("palladium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item palladiumDust = new BasicItem("palladium_dust", PREFIX_DUST);
|
||||||
|
public static Item palladiumNugget = new BasicItem("palladium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item uruIngot = new BasicItem("uru_ingot", PREFIX_INGOT);
|
||||||
|
public static Item uruDust = new BasicItem("uru_dust", PREFIX_DUST);
|
||||||
|
public static Item uruNugget = new BasicItem("uru_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item osramIngot = new BasicItem("osram_ingot", PREFIX_INGOT);
|
||||||
|
public static Item osramDust = new BasicItem("osram_dust", PREFIX_DUST);
|
||||||
|
public static Item osramNugget = new BasicItem("osram_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item abyssumIngot = new BasicItem("abyssum_ingot", PREFIX_INGOT);
|
||||||
|
public static Item abyssumDust = new BasicItem("abyssum_dust", PREFIX_DUST);
|
||||||
|
public static Item abyssumNugget = new BasicItem("abyssum_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item eezoIngot = new BasicItem("eezo_ingot", PREFIX_INGOT);
|
||||||
|
public static Item eezoDust = new BasicItem("eezo_dust", PREFIX_DUST);
|
||||||
|
public static Item eezoNugget = new BasicItem("eezo_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item triberiumIngot = new BasicItem("triberium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item triberiumDust = new BasicItem("triberium_dust", PREFIX_DUST);
|
||||||
|
public static Item triberiumNugget = new BasicItem("triberium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item fractumIngot = new BasicItem("fractum_ingot", PREFIX_INGOT);
|
||||||
|
public static Item fractumDust = new BasicItem("fractum_dust", PREFIX_DUST);
|
||||||
|
public static Item fractumNugget = new BasicItem("fractum_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item violiumIngot = new BasicItem("violium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item violiumDust = new BasicItem("violium_dust", PREFIX_DUST);
|
||||||
|
public static Item violiumNugget = new BasicItem("violium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item proxiiIngot = new BasicItem("proxii_ingot", PREFIX_INGOT);
|
||||||
|
public static Item proxiiDust = new BasicItem("proxii_dust", PREFIX_DUST);
|
||||||
|
public static Item proxiiNugget = new BasicItem("proxii_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item tritoniteIngot = new BasicItem("tritonite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item tritoniteDust = new BasicItem("tritonite_dust", PREFIX_DUST);
|
||||||
|
public static Item tritoniteNugget = new BasicItem("tritonite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item ignitzIngot = new BasicItem("ignitz_ingot", PREFIX_INGOT);
|
||||||
|
public static Item ignitzDust = new BasicItem("ignitz_dust", PREFIX_DUST);
|
||||||
|
public static Item ignitzNugget = new BasicItem("ignitz_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item imperomiteIngot = new BasicItem("imperomite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item imperomiteDust = new BasicItem("imperomite_dust", PREFIX_DUST);
|
||||||
|
public static Item imperomiteNugget = new BasicItem("imperomite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item solariumIngot = new BasicItem("solarium_ingot", PREFIX_INGOT);
|
||||||
|
public static Item solariumDust = new BasicItem("solarium_dust", PREFIX_DUST);
|
||||||
|
public static Item solariumNugget = new BasicItem("solarium_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item nihiliteIngot = new BasicItem("nihilite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item nihiliteDust = new BasicItem("nihilite_dust", PREFIX_DUST);
|
||||||
|
public static Item nihiliteNugget = new BasicItem("nihilite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item adamantIngot = new BasicItem("adamant_ingot", PREFIX_INGOT);
|
||||||
|
public static Item adamantDust = new BasicItem("adamant_dust", PREFIX_DUST);
|
||||||
|
public static Item adamantNugget = new BasicItem("adamant_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item dyoniteIngot = new BasicItem("dyonite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item dyoniteDust = new BasicItem("dyonite_dust", PREFIX_DUST);
|
||||||
|
public static Item dyoniteNugget = new BasicItem("dyonite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item nucleumIngot = new BasicItem("nucleum_ingot", PREFIX_INGOT);
|
||||||
|
public static Item nucleumDust = new BasicItem("nucleum_dust", PREFIX_DUST);
|
||||||
|
public static Item nucleumNugget = new BasicItem("nucleum_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item lumixIngot = new BasicItem("lumix_ingot", PREFIX_INGOT);
|
||||||
|
public static Item lumixDust = new BasicItem("lumix_dust", PREFIX_DUST);
|
||||||
|
public static Item lumixNugget = new BasicItem("lumix_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item seismumIngot = new BasicItem("seismum_ingot", PREFIX_INGOT);
|
||||||
|
public static Item seismumDust = new BasicItem("seismum_dust", PREFIX_DUST);
|
||||||
|
public static Item seismumNugget = new BasicItem("seismum_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
public static Item astriumIngot = new BasicItem("astrium_ingot", PREFIX_INGOT);
|
public static Item astriumIngot = new BasicItem("astrium_ingot", PREFIX_INGOT);
|
||||||
public static Item nitroniteIngot = new BasicItem("nitronite_ingot", PREFIX_INGOT);
|
public static Item astriumDust = new BasicItem("astrium_dust", PREFIX_DUST);
|
||||||
public static Item proxideumIngot = new BasicItem("proxideum_ingot", PREFIX_INGOT);
|
public static Item astriumNugget = new BasicItem("astrium_nugget", PREFIX_NUGGET);
|
||||||
public static Item noctunyxIngot = new BasicItem("noctunyx_ingot", PREFIX_INGOT);
|
|
||||||
public static Item imperomiteIngot = new BasicItem("imperomite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item cryptogenIngot = new BasicItem("cryptogen_ingot", PREFIX_INGOT);
|
|
||||||
public static Item fractoryteIngot = new BasicItem("fractoryte_ingot", PREFIX_INGOT);
|
|
||||||
public static Item seismodiumIngot = new BasicItem("seismodium_ingot", PREFIX_INGOT);
|
|
||||||
public static Item terramiteIngot = new BasicItem("terramite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item lumixylIngot = new BasicItem("lumixyl_ingot", PREFIX_INGOT);
|
|
||||||
public static Item solariumIngot = new BasicItem("solarium_ingot", PREFIX_INGOT);
|
|
||||||
public static Item dyoniteIngot = new BasicItem("dyonite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item ultraniteIngot = new BasicItem("ultranite_ingot", PREFIX_INGOT);
|
|
||||||
public static Item nucleumIngot = new BasicItem("nucleum_ingot", PREFIX_INGOT);
|
|
||||||
public static Item aegisaltIngot = new BasicItem("aegisalt_ingot", PREFIX_INGOT);
|
|
||||||
public static Item bysmuidIngot = new BasicItem("bysmuid_ingot", PREFIX_INGOT);
|
|
||||||
|
|
||||||
public static Item tiberiumShardInstable = new BasicItem("tiberium_shard_instable");
|
public static Item niobIngot = new BasicItem("niob_ingot", PREFIX_INGOT);
|
||||||
public static Item tiberiumShardStable = new BasicItem("tiberium_nugget", PREFIX_NUGGET);
|
public static Item niobDust = new BasicItem("niob_dust", PREFIX_DUST);
|
||||||
|
public static Item niobNugget = new BasicItem("niob_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item yrdeenIngot = new BasicItem("yrdeen_ingot", PREFIX_INGOT);
|
||||||
|
public static Item yrdeenDust = new BasicItem("yrdeen_dust", PREFIX_DUST);
|
||||||
|
public static Item yrdeenNugget = new BasicItem("yrdeen_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item ioxIngot = new BasicItem("iox_ingot", PREFIX_INGOT);
|
||||||
|
public static Item ioxDust = new BasicItem("iox_dust", PREFIX_DUST);
|
||||||
|
public static Item ioxNugget = new BasicItem("iox_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item meteoriteIngot = new BasicItem("meteorite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item meteoriteDust = new BasicItem("meteorite_dust", PREFIX_DUST);
|
||||||
|
public static Item meteoriteNugget = new BasicItem("meteorite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item basaltIngot = new BasicItem("basalt_ingot", PREFIX_INGOT);
|
||||||
|
public static Item basaltDust = new BasicItem("basalt_dust", PREFIX_DUST);
|
||||||
|
public static Item basaltNugget = new BasicItem("basalt_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
public static Item obsidioriteIngot = new BasicItem("obsidiorite_ingot", PREFIX_INGOT);
|
||||||
|
public static Item obsidioriteDust = new BasicItem("obsidiorite_dust", PREFIX_DUST);
|
||||||
|
public static Item obsidioriteNugget = new BasicItem("obsidiorite_nugget", PREFIX_NUGGET);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers all materials' ingots and nuggets <br>
|
||||||
|
* Detailed summary: <br>
|
||||||
|
* Gets the ingots declared in the class (fields and reflection) and iterates through them: <br>
|
||||||
|
* Checks that the field is static, registers the field (item), and adds an oreDict entry if needed
|
||||||
|
*/
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
Field[] declaredFields = Items.class.getDeclaredFields();
|
Field[] declaredFields = Items.class.getDeclaredFields(); // Gets the fields (ingots) declared above
|
||||||
for (Field field : declaredFields) {
|
for (Field field : declaredFields) { // Iterates through the fields declared above
|
||||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) { // Checks that the fields are static
|
||||||
Class<?> targetType = field.getType();
|
Class<?> targetType = field.getType();
|
||||||
try {
|
try {
|
||||||
Item item = (Item) field.get(targetType);
|
Item item = (Item) field.get(targetType); // Gets the field as a BasicItem which is then casted to an Item
|
||||||
GameRegistry.register(item);
|
if (item.equals(ironNugget) && OreDictionary.doesOreNameExist("nuggetIron")) {
|
||||||
|
System.out.println("TAIGA: Skipped registration of nuggetIron which already exists.");
|
||||||
if (item instanceof BasicItem) {
|
continue;
|
||||||
if (((BasicItem) item).isOreDict()) {
|
}
|
||||||
|
item.setCreativeTab(CreativeTab.tabTaigaItem);
|
||||||
|
GameRegistry.register(item); // Registers the item into the game
|
||||||
|
if (item instanceof BasicItem) { // Checks that the item is a BasicItem
|
||||||
|
if (((BasicItem) item).isOreDict()) { // Checks if this item should be registered into the oreDict and registers it
|
||||||
String oreDictName;
|
String oreDictName;
|
||||||
String[] nameParts = item.getUnlocalizedName().replace("item.", "").split("_");
|
String[] nameParts = item.getUnlocalizedName().replace("item.", "").split("_");
|
||||||
|
|
||||||
@@ -94,7 +180,7 @@ public class Items {
|
|||||||
oreDictName = nameParts[0];
|
oreDictName = nameParts[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
OreDictionary.registerOre(((BasicItem) item).getOreDictPrefix() + StringUtils.capitalize(oreDictName), item);
|
OreDictionary.registerOre(((BasicItem) item).getOreDictPrefix() + StringUtils.capitalize(oreDictName), item); // Registers into oreDict
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
@@ -102,10 +188,6 @@ public class Items {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OreDictionary.registerOre("nuggetIron", iron_nugget);
|
|
||||||
OreDictionary.registerOre("ingotIron", slagironIngot);
|
|
||||||
OreDictionary.registerOre("ingotGold", slaggoldIngot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,20 +3,19 @@ package com.sosnitzka.taiga;
|
|||||||
|
|
||||||
import com.sosnitzka.taiga.traits.*;
|
import com.sosnitzka.taiga.traits.*;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import slimeknights.tconstruct.library.materials.HandleMaterialStats;
|
|
||||||
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
|
||||||
import slimeknights.tconstruct.library.materials.Material;
|
import slimeknights.tconstruct.library.materials.Material;
|
||||||
|
import slimeknights.tconstruct.library.materials.MaterialTypes;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
|
||||||
import static slimeknights.tconstruct.tools.TinkerMaterials.*;
|
import static com.sosnitzka.taiga.Fluids.obsidioriteFluid;
|
||||||
|
import static slimeknights.tconstruct.tools.TinkerTraits.*;
|
||||||
|
|
||||||
public class MaterialTraits {
|
public class MaterialTraits {
|
||||||
|
|
||||||
// new hardness levels
|
// new hardness levels
|
||||||
public static final int TITANITE = 5;
|
public static final int DURANITE = 5;
|
||||||
public static final int METEORITE = 6;
|
public static final int VALYRIUM = 6;
|
||||||
public static final int VIBRANIUM = 7;
|
public static final int VIBRANIUM = 7;
|
||||||
public static final int ADAMANTITE = 8;
|
|
||||||
|
|
||||||
// Init of new traits
|
// Init of new traits
|
||||||
public static final AbstractTrait instable = new TraitInstable();
|
public static final AbstractTrait instable = new TraitInstable();
|
||||||
@@ -35,52 +34,65 @@ public class MaterialTraits {
|
|||||||
public static final AbstractTrait dark = new TraitDark();
|
public static final AbstractTrait dark = new TraitDark();
|
||||||
public static final AbstractTrait bright = new TraitBright();
|
public static final AbstractTrait bright = new TraitBright();
|
||||||
public static final AbstractTrait slaughtering = new TraitSlaughtering();
|
public static final AbstractTrait slaughtering = new TraitSlaughtering();
|
||||||
public static final AbstractTrait haunted = new TraitHaunted();
|
|
||||||
public static final AbstractTrait fragile = new TraitFragile();
|
public static final AbstractTrait fragile = new TraitFragile();
|
||||||
public static final AbstractTrait dissolving = new TraitDissolving();
|
public static final AbstractTrait dissolving = new TraitDissolving();
|
||||||
public static final AbstractTrait organizing = new TraitOrganizing();
|
|
||||||
public static final AbstractTrait arcane = new TraitArcane();
|
public static final AbstractTrait arcane = new TraitArcane();
|
||||||
public static final AbstractTrait heroic = new TraitHeroic();
|
public static final AbstractTrait heroic = new TraitHeroic();
|
||||||
public static final AbstractTrait hollow = new TraitHollow();
|
public static final AbstractTrait hollow = new TraitHollow();
|
||||||
public static final AbstractTrait diffuse = new TraitDiffuse();
|
public static final AbstractTrait diffuse = new TraitDiffuse();
|
||||||
public static final AbstractTrait randomize = new TraitRandomize();
|
|
||||||
public static final AbstractTrait reviving = new TraitReviving();
|
public static final AbstractTrait reviving = new TraitReviving();
|
||||||
public static final AbstractTrait melting = new TraitMelting();
|
public static final AbstractTrait melting = new TraitMelting();
|
||||||
public static final AbstractTrait traditional = new TraitTraditional();
|
public static final AbstractTrait traditional = new TraitTraditional();
|
||||||
|
public static final AbstractTrait tantrum = new TraitTantrum();
|
||||||
|
public static final AbstractTrait catcher = new TraitCatcher();
|
||||||
|
public static final AbstractTrait congenial = new TraitCongenial();
|
||||||
|
public static final AbstractTrait souleater = new TraitSoulEater();
|
||||||
|
public static final AbstractTrait cursed = new TraitCursed();
|
||||||
|
public static final AbstractTrait ported = new TraitPorted();
|
||||||
|
public static final AbstractTrait decay = new TraitDecay();
|
||||||
|
public static final AbstractTrait whirl = new TraitWhirl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign traits to related materials. <br>
|
||||||
|
* <p>
|
||||||
|
* <p> Example:
|
||||||
|
* .addTrait(x, HandleMaterialStats.TYPE).addTrait(y, HeadMaterialStats.TYPE)
|
||||||
|
* .addTrait(z)
|
||||||
|
*/
|
||||||
|
|
||||||
public static Material arcanite = new Material("arcanite", TextFormatting.LIGHT_PURPLE).addTrait(arcane, HeadMaterialStats.TYPE).addTrait(blind, HandleMaterialStats.TYPE);
|
|
||||||
public static Material tiberium = new Material("tiberium", TextFormatting.GREEN).addTrait(instable);
|
public static Material tiberium = new Material("tiberium", TextFormatting.GREEN).addTrait(instable);
|
||||||
public static Material prometheum = new Material("prometheum", TextFormatting.DARK_PURPLE).addTrait(haunted, HeadMaterialStats.TYPE).addTrait(blind);
|
public static Material aurorium = new Material("aurorium", TextFormatting.RED).addTrait(arcane);
|
||||||
public static Material rubium = new Material("rubium", TextFormatting.RED).addTrait(enderference, HeadMaterialStats.TYPE).addTrait(blind);
|
public static Material prometheum = new Material("prometheum", TextFormatting.DARK_PURPLE).addTrait(blind, MaterialTypes.HANDLE).addTrait(catcher);
|
||||||
public static Material violium = new Material("violium", TextFormatting.DARK_GREEN).addTrait(stonebound, HandleMaterialStats.TYPE).addTrait(poisonous, HeadMaterialStats.TYPE);
|
public static Material duranite = new Material("duranite", TextFormatting.YELLOW).addTrait(analysing);
|
||||||
public static Material bismuth = new Material("bismuth", TextFormatting.GREEN).addTrait(splintering, HeadMaterialStats.TYPE).addTrait(splinters, HandleMaterialStats.TYPE);
|
public static Material valyrium = new Material("valyrium", TextFormatting.DARK_GRAY).addTrait(congenial);
|
||||||
public static Material karmesine = new Material("karmesine", TextFormatting.DARK_RED).addTrait(aridiculous, HandleMaterialStats.TYPE).addTrait(superheat, HeadMaterialStats.TYPE);
|
public static Material vibranium = new Material("vibranium", TextFormatting.GRAY).addTrait(resonance, MaterialTypes.HANDLE).addTrait(heroic, MaterialTypes.HEAD);
|
||||||
public static Material mindorite = new Material("mindorite", TextFormatting.AQUA).addTrait(cheap);
|
public static Material karmesine = new Material("karmesine", TextFormatting.RED).addTrait(slaughtering);
|
||||||
public static Material titanite = new Material("titanite", TextFormatting.GRAY).addTrait(shocking, HandleMaterialStats.TYPE).addTrait(sharp, HeadMaterialStats.TYPE);
|
public static Material palladium = new Material("palladium", TextFormatting.GOLD).addTrait(dark).addTrait(cursed);
|
||||||
public static Material meteorite = new Material("meteorite", TextFormatting.GRAY).addTrait(established, HandleMaterialStats.TYPE).addTrait(momentum, HeadMaterialStats.TYPE);
|
public static Material uru = new Material("uru", TextFormatting.DARK_RED).addTrait(diffuse);
|
||||||
public static Material adamantite = new Material("adamantite", TextFormatting.GRAY).addTrait(coldblooded, HeadMaterialStats.TYPE).addTrait(magnetic, HandleMaterialStats.TYPE);
|
public static Material basalt = new Material("basalt", TextFormatting.WHITE).addTrait(softy);
|
||||||
public static Material vibranium = new Material("vibranium", TextFormatting.GRAY).addTrait(resonance);
|
public static Material eezo = new Material("eezo", TextFormatting.GOLD).addTrait(dissolving);
|
||||||
public static Material ignitite = new Material("ignitite", TextFormatting.RED).addTrait(melting, HandleMaterialStats.TYPE).addTrait(flammable, HeadMaterialStats.TYPE);
|
public static Material triberium = new Material("triberium", TextFormatting.GREEN).addTrait(fragile);
|
||||||
public static Material palladium = new Material("palladium", TextFormatting.DARK_GRAY).addTrait(dark);
|
public static Material fractum = new Material("fractum", TextFormatting.DARK_RED).addTrait(fracture);
|
||||||
public static Material eternite = new Material("eternite", TextFormatting.AQUA).addTrait(writable2); //.addTrait(traditional)
|
public static Material violium = new Material("violium", TextFormatting.DARK_PURPLE).addTrait(arcane);
|
||||||
public static Material mythril = new Material("mythril", TextFormatting.GRAY).addTrait(holy, HeadMaterialStats.TYPE).addTrait(hellish, HandleMaterialStats.TYPE);
|
public static Material proxii = new Material("proxii", TextFormatting.LIGHT_PURPLE).addTrait(curvature);
|
||||||
|
public static Material tritonite = new Material("tritonite", TextFormatting.GOLD).addTrait(whirl);
|
||||||
|
public static Material ignitz = new Material("ignitz", TextFormatting.RED).addTrait(melting).addTrait(garishly, MaterialTypes.HANDLE);
|
||||||
|
public static Material imperomite = new Material("imperomite", TextFormatting.DARK_RED).addTrait(hollow);
|
||||||
|
public static Material solarium = new Material("solarium", TextFormatting.YELLOW).addTrait(pulverizing);
|
||||||
|
public static Material nihilite = new Material("nihilite", TextFormatting.BLACK).addTrait(souleater);
|
||||||
|
public static Material adamant = new Material("adamant", TextFormatting.GOLD);
|
||||||
|
public static Material dyonite = new Material("dyonite", TextFormatting.GREEN).addTrait(tantrum);
|
||||||
|
public static Material nucleum = new Material("nucleum", TextFormatting.YELLOW).addTrait(decay);
|
||||||
|
public static Material lumix = new Material("lumix", TextFormatting.YELLOW).addTrait(bright, MaterialTypes.HANDLE).addTrait(glimmer, MaterialTypes.HEAD);
|
||||||
|
public static Material seismum = new Material("seismum", TextFormatting.GREEN).addTrait(cascade);
|
||||||
|
public static Material astrium = new Material("astrium", TextFormatting.DARK_PURPLE).addTrait(ported);
|
||||||
|
public static Material niob = new Material("niob", TextFormatting.RED).addTrait(reviving);
|
||||||
|
public static Material yrdeen = new Material("yrdeen", TextFormatting.RED).addTrait(naturebound);
|
||||||
|
public static Material meteorite = new Material("meteorite", TextFormatting.DARK_GREEN).addTrait(crumbling, MaterialTypes.HEAD).addTrait(cheap);
|
||||||
|
public static Material obsidiorite = new Material("obsidiorite", obsidioriteFluid.getColor()).addTrait(alien);
|
||||||
|
|
||||||
|
public static Material osram = new Material("osram", TextFormatting.GOLD);
|
||||||
|
public static Material abyssum = new Material("abyssum", TextFormatting.GOLD);
|
||||||
|
public static Material iox = new Material("iox", TextFormatting.RED);
|
||||||
|
|
||||||
public static Material imperomite = new Material("imperomite", TextFormatting.DARK_RED).addTrait(cascade);
|
|
||||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED).addTrait(fracture);
|
|
||||||
public static Material noctunyx = new Material("noctunyx", TextFormatting.LIGHT_PURPLE).addTrait(hollow, HeadMaterialStats.TYPE).addTrait(reviving, HandleMaterialStats.TYPE);
|
|
||||||
public static Material nitronite = new Material("nitronite", TextFormatting.YELLOW).addTrait(uncertain);
|
|
||||||
public static Material cryptogen = new Material("cryptogen", TextFormatting.DARK_GREEN).addTrait(randomize);
|
|
||||||
public static Material seismodium = new Material("seismodium", TextFormatting.WHITE).addTrait(heroic).addTrait(fragile);
|
|
||||||
;
|
|
||||||
public static Material aegisalt = new Material("aegisalt", TextFormatting.AQUA).addTrait(analysing);
|
|
||||||
public static Material ultranite = new Material("ultranite", TextFormatting.AQUA).addTrait(pulverizing);
|
|
||||||
public static Material bysmuid = new Material("bysmuid", TextFormatting.AQUA).addTrait(organizing, HandleMaterialStats.TYPE).addTrait(melting, HeadMaterialStats.TYPE);
|
|
||||||
public static Material nucleum = new Material("nucleum", TextFormatting.AQUA).addTrait(diffuse).addTrait(bright, HeadMaterialStats.TYPE);
|
|
||||||
public static Material lumixyl = new Material("lumixyl", TextFormatting.YELLOW).addTrait(glimmer);
|
|
||||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY).addTrait(slaughtering, HeadMaterialStats.TYPE).addTrait(dissolving, HandleMaterialStats.TYPE);
|
|
||||||
public static Material terramite = new Material("terramite", TextFormatting.GRAY).addTrait(naturebound).addTrait(fragile);
|
|
||||||
public static Material solarium = new Material("solarium", TextFormatting.RED).addTrait(garishly);
|
|
||||||
public static Material astrium = new Material("astrium", TextFormatting.DARK_PURPLE).addTrait(curvature);
|
|
||||||
public static Material proxideum = new Material("proxideum", TextFormatting.LIGHT_PURPLE).addTrait(softy, HandleMaterialStats.TYPE).addTrait(lightweight);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,101 +1,67 @@
|
|||||||
package com.sosnitzka.taiga;
|
package com.sosnitzka.taiga;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sosnitzka.taiga.proxy.ServerProxy;
|
import com.sosnitzka.taiga.proxy.CommonProxy;
|
||||||
import com.sosnitzka.taiga.recipes.Crafting;
|
import com.sosnitzka.taiga.recipes.CraftingRegistry;
|
||||||
import com.sosnitzka.taiga.recipes.Smelting;
|
import com.sosnitzka.taiga.recipes.SmeltingRegistry;
|
||||||
import com.sosnitzka.taiga.util.FuelHandler;
|
import com.sosnitzka.taiga.world.WorldGen;
|
||||||
import com.sosnitzka.taiga.world.ZWorldGen;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import slimeknights.tconstruct.library.MaterialIntegration;
|
import slimeknights.tconstruct.library.MaterialIntegration;
|
||||||
import slimeknights.tconstruct.library.TinkerRegistry;
|
import slimeknights.tconstruct.library.materials.BowMaterialStats;
|
||||||
import slimeknights.tconstruct.library.materials.ExtraMaterialStats;
|
|
||||||
import slimeknights.tconstruct.library.materials.HandleMaterialStats;
|
|
||||||
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
|
||||||
import slimeknights.tconstruct.tools.TinkerMaterials;
|
import slimeknights.tconstruct.tools.TinkerMaterials;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Fluids.*;
|
import static com.sosnitzka.taiga.Fluids.*;
|
||||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.integrateMaterial;
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.integrateOre;
|
||||||
import static slimeknights.tconstruct.library.utils.HarvestLevels.*;
|
import static slimeknights.tconstruct.library.utils.HarvestLevels.*;
|
||||||
|
|
||||||
@Mod(modid = TAIGA.MODID, version = TAIGA.VERSION, dependencies = "required-after:tconstruct@[1.10-2.3.3,);" + "required-after:mantle@[1.10-0.10.3,)")
|
@Mod(modid = TAIGA.MODID, version = TAIGA.VERSION, guiFactory = TAIGA.GUIFACTORY, dependencies = "required-after:tconstruct@[1.10.2-2.5.0,);" + "required-after:mantle@[1.10.2-1.0.0,)")
|
||||||
public class TAIGA {
|
public class TAIGA {
|
||||||
|
|
||||||
public static final String MODID = "taiga";
|
public static final String MODID = "taiga";
|
||||||
public static final String VERSION = "${version}";
|
public static final String VERSION = "@VERSION@";
|
||||||
|
public static final String GUIFACTORY = "com.sosnitzka.taiga.TAIGAGuiFactory";
|
||||||
|
|
||||||
@SidedProxy(clientSide = "com.sosnitzka.taiga.proxy.ClientProxy", serverSide = "com.sosnitzka.taiga.proxy.ServerProxy")
|
@SidedProxy(clientSide = "com.sosnitzka.taiga.proxy.ClientProxy", serverSide = "com.sosnitzka.taiga.proxy.CommonProxy")
|
||||||
public static ServerProxy proxy;
|
public static CommonProxy proxy;
|
||||||
private List<MaterialIntegration> integrateList = Lists.newArrayList();
|
|
||||||
|
public static List<MaterialIntegration> integrateList = Lists.newArrayList(); // List of materials needed to be integrated
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent e) {
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
Items.register();
|
proxy.initConfig();
|
||||||
Fluids.register();
|
|
||||||
Blocks.register();
|
|
||||||
Fluids.registerfromItem();
|
|
||||||
Alloys.register();
|
|
||||||
|
|
||||||
// ARCANE ORES
|
Items.register(); // Registers items and its oreDict
|
||||||
registerTinkerMaterial("Tiberium", tiberium, tiberiumFluid, 223, 6.2f, 8.35f, 0.63f, 50, 50, OBSIDIAN, false, true);
|
Blocks.register(); // Registers blocks and its items form a long with its oreDict
|
||||||
registerTinkerMaterial("Rubium", rubium, rubiumFluid, 351, 5.15f, 7.00f, 1.05f, -100, 250, COBALT, false, true);
|
Fluids.register(); // Registers all fluids and its buckets
|
||||||
registerTinkerMaterial("Prometheum", prometheum, prometheumFluid, 539, 3.6f, 6.60f, 0.90f, 0, 150, TITANITE, false, true);
|
Fluids.registerfromItem(); // Registers some special smeltery recipes (not alloying)
|
||||||
registerTinkerMaterial("Arcanite", arcanite, arcaniteFluid, 698, 4.3f, 7.88f, 0.85f, -50, 150, METEORITE, false, true);
|
Alloys.register(); // Registers alloying recipes
|
||||||
// SOLIDE ORES
|
registerTinkerMaterials(); // Registers materials and associated fluids and stats into tconstruct
|
||||||
registerTinkerMaterial("Titanite", titanite, titaniteFluid, 811, 4.8f, 6.40f, 1.00f, -50, 150, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Meteorite", meteorite, meteoriteFluid, 823, 6.1f, 6.83f, 1.20f, -50, 200, METEORITE, false, true);
|
|
||||||
registerTinkerMaterial("Vibranium", vibranium, vibraniumFluid, 917, 7.45f, 7.17f, 1.15f, 50, 150, VIBRANIUM, false, true);
|
|
||||||
registerTinkerMaterial("Adamantite", adamantite, adamantiteFluid, 981, 8.9f, 9.11f, 1.20f, -200, 300, ADAMANTITE, false, true);
|
|
||||||
// ETHERE ORES
|
|
||||||
registerTinkerMaterial("Eternite", eternite, eterniteFluid, 592, 7.35f, 1.95f, 1.10f, 150, 150, COBALT, false, true);
|
|
||||||
registerTinkerMaterial("Mythril", mythril, mythrilFluid, 552, 8.75f, 2.87f, 0.98f, -100, 200, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Palladium", palladium, palladiumFluid, 578, 10.4f, 3.13f, 1.09f, 0, 100, METEORITE, false, true);
|
|
||||||
registerTinkerMaterial("Ignitite", ignitite, ignititeFluid, 673, 12.1f, 4.10f, 1.15f, -50, 150, VIBRANIUM, false, true);
|
|
||||||
// RATIO ORES
|
|
||||||
registerTinkerMaterial("Bismuth", bismuth, bismuthFluid, 235, 5.33f, 3.80f, 1.15f, 17, 117, OBSIDIAN, false, true);
|
|
||||||
registerTinkerMaterial("Violium", violium, violiumFluid, 427, 4.2f, 3.30f, 1.00f, 133, 150, COBALT, false, true);
|
|
||||||
registerTinkerMaterial("Mindorite", mindorite, mindoriteFluid, 458, 6.41f, 4.40f, 0.90f, 83, 100, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Karmesine", karmesine, karmesineFluid, 627, 6.75f, 5.10f, 0.99f, 0, 200, METEORITE, false, true);
|
|
||||||
// Material from alloys
|
|
||||||
registerTinkerMaterial("Nitronite", nitronite, nitroniteFluid, 745, 6.74f, 8.74f, 0.85f, 75, 93, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Bysmuid", bysmuid, bysmuidFluid, 305, 5.22f, 6.47f, 1.09f, -80, 197, COBALT, false, true);
|
|
||||||
registerTinkerMaterial("Ultranite", ultranite, ultraniteFluid, 1016, 5.72f, 6.76f, 1.02f, -120, 210, VIBRANIUM, false, true);
|
|
||||||
registerTinkerMaterial("Astrium", astrium, astriumFluid, 670, 5.28f, 9.14f, 0.91f, -45, 170, VIBRANIUM, false, true);
|
|
||||||
registerTinkerMaterial("Imperomite", imperomite, imperomiteFluid, 770, 11.60f, 3.57f, 1.05f, -38, 125, METEORITE, false, true);
|
|
||||||
registerTinkerMaterial("Dyonite", dyonite, dyoniteFluid, 733, 6.14f, 7.69f, 0.97f, -15, 140, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Solarium", solarium, solariumFluid, 1020, 13.78f, 4.64f, 1.15f, 0, 150, ADAMANTITE, false, true);
|
|
||||||
registerTinkerMaterial("Fractoryte", fractoryte, fractoryteFluid, 1071, 7.65f, 7.75f, 1.15f, -250, 283, METEORITE, false, true);
|
|
||||||
registerTinkerMaterial("Aegisalt", aegisalt, aegisaltFluid, 355, 8.88f, 3.18f, 1.00f, 175, 125, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Noctunyx", noctunyx, noctunyxFluid, 713, 10.43f, 3.25f, 0.99f, -125, 183, METEORITE, false, true);
|
|
||||||
registerTinkerMaterial("Nucleum", nucleum, nucleumFluid, 503, 11.30f, 3.22f, 1.05f, 100, 125, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Seismodium", seismodium, seismodiumFluid, 879, 13.85f, 4.19f, 1.17f, -75, 169, VIBRANIUM, false, true);
|
|
||||||
registerTinkerMaterial("Lumixyl", lumixyl, lumixylFluid, 357, 4.64f, 5.92f, 1.05f, 15, 130, COBALT, false, true);
|
|
||||||
registerTinkerMaterial("Terramite", terramite, terramiteFluid, 482, 7.25f, 2.85f, 1.03f, 208, 150, TITANITE, false, true);
|
|
||||||
registerTinkerMaterial("Cryptogen", cryptogen, cryptogenFluid, 538, 5.71f, 6.93f, 0.88f, 58, 117, METEORITE, false, true);
|
|
||||||
registerTinkerMaterial("Proxideum", proxideum, proxideumFluid, 597, 10.55f, 4.21f, 0.99f, -60, 200, METEORITE, false, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent e) {
|
public void init(FMLInitializationEvent e) {
|
||||||
proxy.registerStuff();
|
proxy.registerModels(); // Registers models on the client side
|
||||||
GameRegistry.registerWorldGenerator(new ZWorldGen(), 100);
|
GameRegistry.registerWorldGenerator(new WorldGen(), 100); // Generates ores
|
||||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
// GameRegistry.registerFuelHandler(new FuelHandler()); Registeres fuels' burn times
|
||||||
Smelting.register();
|
SmeltingRegistry.register(); // Registers smelting recipes
|
||||||
Crafting.register();
|
CraftingRegistry.register(); // Registers crafting recipes
|
||||||
|
|
||||||
harvestLevelNames.put(METEORITE, TinkerMaterials.bone.getTextColor() + "Meteorite");
|
// Adds new harvest levels' names
|
||||||
|
harvestLevelNames.put(DURANITE, TinkerMaterials.bone.getTextColor() + "Duranite");
|
||||||
|
harvestLevelNames.put(VALYRIUM, TinkerMaterials.bone.getTextColor() + "Valyrium");
|
||||||
harvestLevelNames.put(VIBRANIUM, TinkerMaterials.blueslime.getTextColor() + "Vibranium");
|
harvestLevelNames.put(VIBRANIUM, TinkerMaterials.blueslime.getTextColor() + "Vibranium");
|
||||||
harvestLevelNames.put(ADAMANTITE, TinkerMaterials.ardite.getTextColor() + "Adamantite");
|
|
||||||
harvestLevelNames.put(TITANITE, TinkerMaterials.silver.getTextColor() + "Titanite");
|
|
||||||
|
|
||||||
for (MaterialIntegration m : integrateList) {
|
for (MaterialIntegration m : integrateList) {
|
||||||
m.integrateRecipes();
|
m.integrateRecipes();
|
||||||
@@ -104,18 +70,58 @@ public class TAIGA {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent e) {
|
public void postInit(FMLPostInitializationEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerTinkerMaterial(String oreSuffix, slimeknights.tconstruct.library.materials.Material material, Fluid fluid, int headDura, float headSpeed, float headAttack, float handleMod, int handleDura, int extra, int headLevel, boolean craft, boolean cast) {
|
@EventHandler
|
||||||
TinkerRegistry.addMaterialStats(material, new HeadMaterialStats(headDura, headSpeed, headAttack, headLevel));
|
public void serverLoad(FMLServerStartingEvent event) {
|
||||||
TinkerRegistry.addMaterialStats(material, new HandleMaterialStats(handleMod, handleDura));
|
proxy.registerServerCommands(event);
|
||||||
TinkerRegistry.addMaterialStats(material, new ExtraMaterialStats(extra));
|
}
|
||||||
material.setFluid(fluid).setCraftable(craft).setCastable(cast);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers materials and associated fluids and stats into tconstruct
|
||||||
|
*/
|
||||||
|
private void registerTinkerMaterials() {
|
||||||
|
BowMaterialStats shitty = new BowMaterialStats(0.2f, 0.4f, -1f);
|
||||||
|
|
||||||
|
integrateMaterial("Tiberium", tiberium, tiberiumFluid, 80, 3.3f, 4f, 0.7f, -25, 50, DIAMOND, shitty, true, false);
|
||||||
|
integrateMaterial("Aurorium", aurorium, auroriumFluid, 750, 3.6f, 3.78f, 0.77f, 25, 130, COBALT, 0.45f, 1f, 1);
|
||||||
|
integrateMaterial("Prometheum", prometheum, prometheumFluid, 844, 4.75f, 6.6f, 1.2f, 25, 50, DURANITE, 0.2f, 0.6f, 3);
|
||||||
|
integrateMaterial("Duranite", duranite, duraniteFluid, 1550, 3.2f, 3.2f, 1.16f, 100, 100, DURANITE, 0.3f, 1.4f, 2);
|
||||||
|
integrateMaterial("Valyrium", valyrium, valyriumFluid, 1111, 5.37f, 4.8f, 1.30f, 100, 100, VALYRIUM, 1.1f, 1.2f, 4);
|
||||||
|
integrateMaterial("Vibranium", vibranium, vibraniumFluid, 1235, 7.62f, 8.1f, 1.3f, 100, 100, VIBRANIUM, 1.1f, 1.8f, 4);
|
||||||
|
integrateMaterial("Karmesine", karmesine, karmesineFluid, 444, 4.77f, 2.9f, 0.8f, 100, 50, COBALT, shitty, true, true);
|
||||||
|
integrateMaterial("Palladium", palladium, palladiumFluid, 797, 4.35f, 6.8f, 1.3f, 130, -50, DURANITE, .5f, .2f, 3);
|
||||||
|
integrateMaterial("Uru", uru, uruFluid, 877, 2f, 8.2f, 1.5f, -50, 175, VALYRIUM, 1.3f, 0.8f, 6);
|
||||||
|
integrateMaterial("Eezo", eezo, eezoFluid, 50, 14f, 3.5f, .1f, 10, 10, COBALT, shitty, true, false);
|
||||||
|
integrateMaterial("Basalt", basalt, basaltFluid, 200, 3, 2.5f, 0.5f, -25, 25, STONE, shitty, true, false);
|
||||||
|
integrateMaterial("Triberium", triberium, triberiumFluid, 223, 6.2f, 8.35f, 0.63f, 50, 50, DIAMOND, shitty, true, true);
|
||||||
|
integrateMaterial("Fractum", fractum, fractumFluid, 538, 5.71f, 6.93f, 0.88f, 58, 117, DIAMOND, shitty);
|
||||||
|
integrateMaterial("Violium", violium, violiumFluid, 925, 3.8f, 3.75f, .90f, 175, 50, COBALT, .45f, .95f, 1);
|
||||||
|
integrateMaterial("Proxii", proxii, proxiiFluid, 625, 6.8f, 4.21f, 1.25f, 80, 25, DURANITE, .35f, .5f, 3);
|
||||||
|
integrateMaterial("Tritonite", tritonite, tritoniteFluid, 780, 8f, 3.3f, 1.45f, -25, 150, COBALT, shitty);
|
||||||
|
integrateMaterial("Ignitz", ignitz, ignitzFluid, 350, 2f, 6.66f, .85f, 150, 250, COBALT, .8f, .8f, 3);
|
||||||
|
integrateMaterial("Imperomite", imperomite, imperomiteFluid, 1350, 4.65f, 5.9f, 1.15f, -100, 150, DURANITE, 1.2f, 1.8f, 2);
|
||||||
|
integrateMaterial("Solarium", solarium, solariumFluid, 1100, 13.78f, 7f, 1.25f, 150, 150, VIBRANIUM, .8f, 1.5f, 5);
|
||||||
|
integrateMaterial("Nihilite", nihilite, nihiliteFluid, 400, 2.8f, 4.50f, .77f, 350, 155, VALYRIUM, 1.5f, .8f, 3);
|
||||||
|
integrateMaterial("Adamant", adamant, adamantFluid, 1750, 6f, 6f, 2f, 0, 0, VIBRANIUM, .35f, 1.85f, 8);
|
||||||
|
integrateMaterial("Dyonite", dyonite, dyoniteFluid, 900, 6.45f, 5f, 0.66f, -50, 250, DURANITE, 2, .9f, -1);
|
||||||
|
integrateMaterial("Nucleum", nucleum, nucleumFluid, 505, 15.5f, 9.5f, 1.05f, 100, 125, VALYRIUM, shitty);
|
||||||
|
integrateMaterial("Lumix", lumix, lumixFluid, 666, 3.84f, 3.92f, 0.85f, 250, 200, COBALT, .8f, 1.3f, 1);
|
||||||
|
integrateMaterial("Seismum", seismum, seismumFluid, 780, 3.66f, 6.05f, .95f, 250, 50, COBALT, shitty);
|
||||||
|
integrateMaterial("Astrium", astrium, astriumFluid, 750, 8.35f, 5.4f, 0.95f, -100, 200, COBALT, .7f, .8f, 2);
|
||||||
|
integrateMaterial("Niob", niob, niobFluid, 700, 4.5f, 4.5f, 2f, 200, 50, COBALT, shitty);
|
||||||
|
integrateMaterial("Yrdeen", yrdeen, yrdeenFluid, 999, 9.1f, 3f, 1.35f, 150, 250, COBALT, shitty);
|
||||||
|
integrateMaterial("Meteorite", meteorite, meteoriteFluid, 1500, 1.5f, 1.5f, .5f, 0, 0, OBSIDIAN, shitty);
|
||||||
|
integrateMaterial("Obsidiorite", obsidiorite, obsidioriteFluid, 1500, .5f, .5f, 1, -100, 100, COBALT, shitty);
|
||||||
|
// when more traits / ideas are available
|
||||||
|
// integrateMaterial("Uru", uru, uruFluid, (552), 8.75f, 2.87f, 0.98f, -100, 200, DIAMOND);
|
||||||
|
// integrateMaterial("Osram", osram, osramFluid, 500, 5f, 3f, 0.8f, -50, 50, DIAMOND);
|
||||||
|
// integrateMaterial("Abyssum", abyssum, abyssumFluid, 100, 1f, 1f, 1f, 300, 300, DIAMOND);
|
||||||
|
integrateOre("Osram", osramFluid);
|
||||||
|
integrateOre("Abyssum", abyssumFluid);
|
||||||
|
integrateOre("Iox", ioxFluid);
|
||||||
|
|
||||||
|
|
||||||
proxy.setRenderInfo(material);
|
|
||||||
MaterialIntegration integration = new MaterialIntegration(material, fluid, oreSuffix);
|
|
||||||
integration.integrate();
|
|
||||||
integrateList.add(integration);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
352
src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java
Normal file
352
src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
package com.sosnitzka.taiga;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
import net.minecraftforge.common.config.Property;
|
||||||
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TAIGAConfiguration {
|
||||||
|
public static final String CATEGORY_NAME_GENERAL = "category_general";
|
||||||
|
public static final String CATEGORY_NAME_ORE_GEN = "category_ore_gen";
|
||||||
|
public static final String CATEGORY_NAME_ORE_VAL = "category_ore_val";
|
||||||
|
|
||||||
|
public static double speedFactorGeneral;
|
||||||
|
public static double attackFactorGeneral;
|
||||||
|
public static double durabilityFactorGeneral;
|
||||||
|
|
||||||
|
public static double ironFactor;
|
||||||
|
public static double titaniteFactor;
|
||||||
|
public static double adamantiteFactor;
|
||||||
|
public static double arcaniteFactor;
|
||||||
|
public static double violiumFactor;
|
||||||
|
public static double bismuthFactor;
|
||||||
|
public static double eterniteFactor;
|
||||||
|
public static double ignititeFactor;
|
||||||
|
public static double karmesineFactor;
|
||||||
|
public static double meteoriteFactor;
|
||||||
|
public static double mindoriteFactor;
|
||||||
|
public static double mythrilFactor;
|
||||||
|
public static double palladiumFactor;
|
||||||
|
public static double prometheumFactor;
|
||||||
|
public static double tiberiumFactor;
|
||||||
|
public static double vibraniumFactor;
|
||||||
|
public static double rubiumFactor;
|
||||||
|
public static double basaltFactor;
|
||||||
|
public static double rottengroundFactor;
|
||||||
|
public static double ligniteFactor;
|
||||||
|
|
||||||
|
public static boolean ironGen;
|
||||||
|
private static Configuration config = null;
|
||||||
|
|
||||||
|
public static void preInit() {
|
||||||
|
File configFile = new File(Loader.instance().getConfigDir(), "TAIGA.cfg");
|
||||||
|
config = new Configuration(configFile);
|
||||||
|
|
||||||
|
syncFromFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clientPreInit() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ConfigEventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Configuration getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void syncFromFile() {
|
||||||
|
syncConfig(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void syncFromGUI() {
|
||||||
|
syncConfig(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void syncFromFields() {
|
||||||
|
syncConfig(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void syncConfig(boolean loadConfigFromFile, boolean readFieldsFromConfig) {
|
||||||
|
if (loadConfigFromFile) {
|
||||||
|
config.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Declaration of general ore generation values: <br>
|
||||||
|
* Activation of additional ores (iron/gold) <br>
|
||||||
|
* Ore generation chance multiplier
|
||||||
|
*/
|
||||||
|
|
||||||
|
final boolean GENERATION_DEFAULT_VALUE = true;
|
||||||
|
final double RESFAC_MIN_VALUE = 0;
|
||||||
|
final double RESFAC_MAX_VALUE = 9999;
|
||||||
|
final double RESFAC_DEFAULT_VALUE = 1.0;
|
||||||
|
|
||||||
|
Property slagIronSwitch = config.get(CATEGORY_NAME_GENERAL, "SlagIron Switch", GENERATION_DEFAULT_VALUE);
|
||||||
|
slagIronSwitch.setComment("Switch ore on/off");
|
||||||
|
slagIronSwitch.setLanguageKey("gui.taiga_configuration.gen_slagiron");
|
||||||
|
Property slagGoldSwitch = config.get(CATEGORY_NAME_GENERAL, "SlagGold Switch", GENERATION_DEFAULT_VALUE);
|
||||||
|
slagGoldSwitch.setComment("Switch ore on/off");
|
||||||
|
slagGoldSwitch.setLanguageKey("gui.taiga_configuration.gen_slaggold");
|
||||||
|
Property ironSwitch = config.get(CATEGORY_NAME_GENERAL, "Extra Iron Switch", GENERATION_DEFAULT_VALUE);
|
||||||
|
ironSwitch.setComment("Switch ore on/off");
|
||||||
|
ironSwitch.setLanguageKey("gui.taiga_configuration.gen_iron");
|
||||||
|
|
||||||
|
Property durabilityFactorGeneralProp = config.get(CATEGORY_NAME_GENERAL, "Durability factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"General multiplier for all TAIGA materials", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
durabilityFactorGeneralProp.setLanguageKey("gui.taiga_configuration.durability_multiplier");
|
||||||
|
durabilityFactorGeneralProp.setRequiresMcRestart(true);
|
||||||
|
Property speedFactorGeneralProp = config.get(CATEGORY_NAME_GENERAL, "Speed factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"General multiplier for all TAIGA materials", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
speedFactorGeneralProp.setLanguageKey("gui.taiga_configuration.speed_multiplier");
|
||||||
|
speedFactorGeneralProp.setRequiresMcRestart(true);
|
||||||
|
Property attackFactorGeneralProp = config.get(CATEGORY_NAME_GENERAL, "Attack factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"General multiplier for all TAIGA materials", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
attackFactorGeneralProp.setLanguageKey("gui.taiga_configuration.attack_multiplier");
|
||||||
|
attackFactorGeneralProp.setRequiresMcRestart(true);
|
||||||
|
|
||||||
|
List<String> propOrderGeneral = new ArrayList<String>();
|
||||||
|
propOrderGeneral.add(ironSwitch.getName());
|
||||||
|
propOrderGeneral.add(slagIronSwitch.getName());
|
||||||
|
propOrderGeneral.add(slagGoldSwitch.getName());
|
||||||
|
propOrderGeneral.add(durabilityFactorGeneralProp.getName());
|
||||||
|
propOrderGeneral.add(speedFactorGeneralProp.getName());
|
||||||
|
propOrderGeneral.add(attackFactorGeneralProp.getName());
|
||||||
|
config.setCategoryPropertyOrder(CATEGORY_NAME_GENERAL, propOrderGeneral);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Declaration of specific ore generation values: <br>
|
||||||
|
* Generation chance multiplier
|
||||||
|
*/
|
||||||
|
Property ironFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Iron factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
ironFactorProp.setLanguageKey("gui.taiga_configuration.titanite_multiplier");
|
||||||
|
Property titaniteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Titanite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
titaniteFactorProp.setLanguageKey("gui.taiga_configuration.titanite_multiplier");
|
||||||
|
Property adamantiteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Adamantite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
adamantiteFactorProp.setLanguageKey("gui.taiga_configuration.adamantite_multiplier");
|
||||||
|
Property arcaniteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Arcanite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
arcaniteFactorProp.setLanguageKey("gui.taiga_configuration.arcanite_multiplier");
|
||||||
|
Property violiumFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Violium factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
violiumFactorProp.setLanguageKey("gui.taiga_configuration.violium_multiplier");
|
||||||
|
Property bismuthFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Bismuth factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
bismuthFactorProp.setLanguageKey("gui.taiga_configuration.bismuth_multiplier");
|
||||||
|
Property eterniteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Eternite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
eterniteFactorProp.setLanguageKey("gui.taiga_configuration.eternite_multiplier");
|
||||||
|
Property ignititeFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Ignitite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
ignititeFactorProp.setLanguageKey("gui.taiga_configuration.ignitite_multiplier");
|
||||||
|
Property karmesineFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Karmesine factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
karmesineFactorProp.setLanguageKey("gui.taiga_configuration.karmesine_multiplier");
|
||||||
|
Property meteoriteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Meteorite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
meteoriteFactorProp.setLanguageKey("gui.taiga_configuration.meteorite_multiplier");
|
||||||
|
Property mindoriteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Mindorite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
mindoriteFactorProp.setLanguageKey("gui.taiga_configuration.mindorite_multiplier");
|
||||||
|
Property mythrilFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Mythril factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
mythrilFactorProp.setLanguageKey("gui.taiga_configuration.mythril_multiplier");
|
||||||
|
Property palladiumFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Palladium factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
palladiumFactorProp.setLanguageKey("gui.taiga_configuration.palladium_multiplier");
|
||||||
|
Property prometheumFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Prometheum factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
prometheumFactorProp.setLanguageKey("gui.taiga_configuration.prometheum_multiplier");
|
||||||
|
Property tiberiumFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Tiberium factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
tiberiumFactorProp.setLanguageKey("gui.taiga_configuration.tiberium_multiplier");
|
||||||
|
Property vibraniumFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Vibranium factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
vibraniumFactorProp.setLanguageKey("gui.taiga_configuration.vibranium_multiplier");
|
||||||
|
Property rubiumFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Rubium factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
rubiumFactorProp.setLanguageKey("gui.taiga_configuration.rubium_multiplier");
|
||||||
|
// RottenGround + Basalt
|
||||||
|
Property basaltFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Basalt factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
basaltFactorProp.setLanguageKey("gui.taiga_configuration.basalt_multiplier");
|
||||||
|
Property rottengroundFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "RottenGround factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
rottengroundFactorProp.setLanguageKey("gui.taiga_configuration.rottenground_multiplier");
|
||||||
|
Property ligniteFactorProp = config.get(CATEGORY_NAME_ORE_GEN, "Lignite factor", RESFAC_DEFAULT_VALUE,
|
||||||
|
"specific generation multiplier", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
|
||||||
|
ligniteFactorProp.setLanguageKey("gui.taiga_configuration.lignite_multiplier");
|
||||||
|
|
||||||
|
List<String> propOrderOreGen = new ArrayList<String>();
|
||||||
|
propOrderOreGen.add(ironFactorProp.getName());
|
||||||
|
propOrderOreGen.add(ligniteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(basaltFactorProp.getName());
|
||||||
|
propOrderOreGen.add(rottengroundFactorProp.getName());
|
||||||
|
propOrderOreGen.add(titaniteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(adamantiteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(arcaniteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(violiumFactorProp.getName());
|
||||||
|
propOrderOreGen.add(bismuthFactorProp.getName());
|
||||||
|
propOrderOreGen.add(eterniteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(ignititeFactorProp.getName());
|
||||||
|
propOrderOreGen.add(karmesineFactorProp.getName());
|
||||||
|
propOrderOreGen.add(meteoriteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(mindoriteFactorProp.getName());
|
||||||
|
propOrderOreGen.add(mythrilFactorProp.getName());
|
||||||
|
propOrderOreGen.add(palladiumFactorProp.getName());
|
||||||
|
propOrderOreGen.add(prometheumFactorProp.getName());
|
||||||
|
propOrderOreGen.add(tiberiumFactorProp.getName());
|
||||||
|
propOrderOreGen.add(vibraniumFactorProp.getName());
|
||||||
|
propOrderOreGen.add(rubiumFactorProp.getName());
|
||||||
|
config.setCategoryPropertyOrder(CATEGORY_NAME_ORE_GEN, propOrderOreGen);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> propOrderOreVal = new ArrayList<String>();
|
||||||
|
config.setCategoryPropertyOrder(CATEGORY_NAME_ORE_VAL, propOrderOreVal);
|
||||||
|
|
||||||
|
|
||||||
|
if (readFieldsFromConfig) {
|
||||||
|
durabilityFactorGeneral = durabilityFactorGeneralProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (durabilityFactorGeneral > RESFAC_MAX_VALUE || durabilityFactorGeneral < RESFAC_MIN_VALUE) {
|
||||||
|
durabilityFactorGeneral = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
speedFactorGeneral = speedFactorGeneralProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (speedFactorGeneral > RESFAC_MAX_VALUE || speedFactorGeneral < RESFAC_MIN_VALUE) {
|
||||||
|
speedFactorGeneral = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
attackFactorGeneral = attackFactorGeneralProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (attackFactorGeneral > RESFAC_MAX_VALUE || attackFactorGeneral < RESFAC_MIN_VALUE) {
|
||||||
|
attackFactorGeneral = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
ironGen = ironSwitch.getBoolean(GENERATION_DEFAULT_VALUE);
|
||||||
|
ironFactor = ironFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (ironFactor > RESFAC_MAX_VALUE || ironFactor < RESFAC_MIN_VALUE) {
|
||||||
|
ironFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
titaniteFactor = titaniteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (titaniteFactor > RESFAC_MAX_VALUE || titaniteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
titaniteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
adamantiteFactor = adamantiteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (adamantiteFactor > RESFAC_MAX_VALUE || adamantiteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
adamantiteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
arcaniteFactor = arcaniteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (arcaniteFactor > RESFAC_MAX_VALUE || arcaniteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
arcaniteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
violiumFactor = violiumFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (violiumFactor > RESFAC_MAX_VALUE || violiumFactor < RESFAC_MIN_VALUE) {
|
||||||
|
violiumFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
bismuthFactor = bismuthFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (bismuthFactor > RESFAC_MAX_VALUE || bismuthFactor < RESFAC_MIN_VALUE) {
|
||||||
|
bismuthFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
eterniteFactor = eterniteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (eterniteFactor > RESFAC_MAX_VALUE || eterniteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
eterniteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
ignititeFactor = ignititeFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (ignititeFactor > RESFAC_MAX_VALUE || ignititeFactor < RESFAC_MIN_VALUE) {
|
||||||
|
ignititeFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
karmesineFactor = karmesineFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (karmesineFactor > RESFAC_MAX_VALUE || karmesineFactor < RESFAC_MIN_VALUE) {
|
||||||
|
karmesineFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
meteoriteFactor = meteoriteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (meteoriteFactor > RESFAC_MAX_VALUE || meteoriteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
meteoriteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
mindoriteFactor = mindoriteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (mindoriteFactor > RESFAC_MAX_VALUE || mindoriteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
mindoriteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
mythrilFactor = mythrilFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (mythrilFactor > RESFAC_MAX_VALUE || mythrilFactor < RESFAC_MIN_VALUE) {
|
||||||
|
mythrilFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
palladiumFactor = palladiumFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (palladiumFactor > RESFAC_MAX_VALUE || palladiumFactor < RESFAC_MIN_VALUE) {
|
||||||
|
palladiumFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
prometheumFactor = prometheumFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (prometheumFactor > RESFAC_MAX_VALUE || prometheumFactor < RESFAC_MIN_VALUE) {
|
||||||
|
prometheumFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
tiberiumFactor = tiberiumFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (tiberiumFactor > RESFAC_MAX_VALUE || tiberiumFactor < RESFAC_MIN_VALUE) {
|
||||||
|
tiberiumFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
vibraniumFactor = vibraniumFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (vibraniumFactor > RESFAC_MAX_VALUE || vibraniumFactor < RESFAC_MIN_VALUE) {
|
||||||
|
vibraniumFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
rubiumFactor = rubiumFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (rubiumFactor > RESFAC_MAX_VALUE || rubiumFactor < RESFAC_MIN_VALUE) {
|
||||||
|
rubiumFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
basaltFactor = basaltFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (basaltFactor > RESFAC_MAX_VALUE || basaltFactor < RESFAC_MIN_VALUE) {
|
||||||
|
basaltFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
rottengroundFactor = rottengroundFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (rottengroundFactor > RESFAC_MAX_VALUE || rottengroundFactor < RESFAC_MIN_VALUE) {
|
||||||
|
rottengroundFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
ligniteFactor = ligniteFactorProp.getDouble(RESFAC_DEFAULT_VALUE);
|
||||||
|
if (ligniteFactor > RESFAC_MAX_VALUE || ligniteFactor < RESFAC_MIN_VALUE) {
|
||||||
|
ligniteFactor = RESFAC_DEFAULT_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ironSwitch.set(ironGen);
|
||||||
|
durabilityFactorGeneralProp.set(durabilityFactorGeneral);
|
||||||
|
speedFactorGeneralProp.set(speedFactorGeneral);
|
||||||
|
attackFactorGeneralProp.set(attackFactorGeneral);
|
||||||
|
titaniteFactorProp.set(titaniteFactor);
|
||||||
|
adamantiteFactorProp.set(adamantiteFactor);
|
||||||
|
arcaniteFactorProp.set(arcaniteFactor);
|
||||||
|
violiumFactorProp.set(violiumFactor);
|
||||||
|
bismuthFactorProp.set(bismuthFactor);
|
||||||
|
eterniteFactorProp.set(eterniteFactor);
|
||||||
|
ignititeFactorProp.set(ignititeFactor);
|
||||||
|
karmesineFactorProp.set(karmesineFactor);
|
||||||
|
meteoriteFactorProp.set(meteoriteFactor);
|
||||||
|
mindoriteFactorProp.set(mindoriteFactor);
|
||||||
|
mythrilFactorProp.set(mythrilFactor);
|
||||||
|
palladiumFactorProp.set(palladiumFactor);
|
||||||
|
prometheumFactorProp.set(prometheumFactor);
|
||||||
|
tiberiumFactorProp.set(tiberiumFactor);
|
||||||
|
vibraniumFactorProp.set(vibraniumFactor);
|
||||||
|
rubiumFactorProp.set(rubiumFactor);
|
||||||
|
basaltFactorProp.set(basaltFactor);
|
||||||
|
rottengroundFactorProp.set(rottengroundFactor);
|
||||||
|
ligniteFactorProp.set(ligniteFactor);
|
||||||
|
|
||||||
|
if (config.hasChanged()) {
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ConfigEventHandler {
|
||||||
|
@SubscribeEvent(priority = EventPriority.NORMAL)
|
||||||
|
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||||
|
if (TAIGA.MODID.equals(event.getModID()) && !event.isWorldRunning()) {
|
||||||
|
if (event.getConfigID().equals(CATEGORY_NAME_GENERAL) || event.getConfigID().equals(CATEGORY_NAME_ORE_GEN) || event.getConfigID().equals(CATEGORY_NAME_ORE_VAL)) {
|
||||||
|
syncFromGUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
100
src/main/java/com/sosnitzka/taiga/TAIGAGuiFactory.java
Normal file
100
src/main/java/com/sosnitzka/taiga/TAIGAGuiFactory.java
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
package com.sosnitzka.taiga;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||||
|
import net.minecraftforge.fml.client.config.DummyConfigElement;
|
||||||
|
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||||
|
import net.minecraftforge.fml.client.config.GuiConfigEntries;
|
||||||
|
import net.minecraftforge.fml.client.config.IConfigElement;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class TAIGAGuiFactory implements IModGuiFactory {
|
||||||
|
@Override
|
||||||
|
public void initialize(Minecraft minecraftInstance) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||||
|
return TAIGAConfigGui.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TAIGAConfigGui extends GuiConfig {
|
||||||
|
|
||||||
|
public TAIGAConfigGui(GuiScreen parentScreen) {
|
||||||
|
super(parentScreen, getConfigElements(), TAIGA.MODID, false, false, I18n.format("gui.taiga_configuration.mainTitle"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<IConfigElement> getConfigElements() {
|
||||||
|
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||||
|
list.add(new DummyConfigElement.DummyCategoryElement("Basics configuration", "gui.taiga_configuration.ctgy.general", CategoryEntryGeneral.class));
|
||||||
|
list.add(new DummyConfigElement.DummyCategoryElement("Specific ore generation", "gui.taiga_configuration.ctgy.oregen", CategoryEntryOreGen.class));
|
||||||
|
//list.add(new DummyConfigElement.DummyCategoryElement("Specific ore values", "gui.taiga_configuration.ctgy.oreval", CategoryEntryOreVal.class));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CategoryEntryGeneral extends GuiConfigEntries.CategoryEntry {
|
||||||
|
public CategoryEntryGeneral(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
|
||||||
|
super(owningScreen, owningEntryList, prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GuiScreen buildChildScreen() {
|
||||||
|
Configuration configuration = TAIGAConfiguration.getConfig();
|
||||||
|
ConfigElement cat_general = new ConfigElement(configuration.getCategory(TAIGAConfiguration.CATEGORY_NAME_GENERAL));
|
||||||
|
List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements();
|
||||||
|
String windowTitle = configuration.toString();
|
||||||
|
|
||||||
|
return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, TAIGAConfiguration.CATEGORY_NAME_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CategoryEntryOreGen extends GuiConfigEntries.CategoryEntry {
|
||||||
|
public CategoryEntryOreGen(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
|
||||||
|
super(owningScreen, owningEntryList, prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GuiScreen buildChildScreen() {
|
||||||
|
Configuration configuration = TAIGAConfiguration.getConfig();
|
||||||
|
ConfigElement cat_general = new ConfigElement(configuration.getCategory(TAIGAConfiguration.CATEGORY_NAME_ORE_GEN));
|
||||||
|
List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements();
|
||||||
|
String windowTitle = configuration.toString();
|
||||||
|
|
||||||
|
return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, TAIGAConfiguration.CATEGORY_NAME_ORE_GEN, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CategoryEntryOreVal extends GuiConfigEntries.CategoryEntry {
|
||||||
|
public CategoryEntryOreVal(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
|
||||||
|
super(owningScreen, owningEntryList, prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GuiScreen buildChildScreen() {
|
||||||
|
Configuration configuration = TAIGAConfiguration.getConfig();
|
||||||
|
ConfigElement cat_general = new ConfigElement(configuration.getCategory(TAIGAConfiguration.CATEGORY_NAME_ORE_VAL));
|
||||||
|
List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements();
|
||||||
|
String windowTitle = configuration.toString();
|
||||||
|
|
||||||
|
return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, TAIGAConfiguration.CATEGORY_NAME_ORE_VAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
src/main/java/com/sosnitzka/taiga/blocks/BlockCobble.java
Normal file
33
src/main/java/com/sosnitzka/taiga/blocks/BlockCobble.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package com.sosnitzka.taiga.blocks;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import static slimeknights.tconstruct.TConstruct.random;
|
||||||
|
|
||||||
|
public class BlockCobble extends BasicBlock {
|
||||||
|
|
||||||
|
public BlockCobble(String name, Material material, float hardness, float resistance, int harvestlevel, float light, String oreDictPrefix) {
|
||||||
|
super(name, material, hardness, resistance, harvestlevel, light, oreDictPrefix);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void breakMoonRock(BlockEvent.BreakEvent e) {
|
||||||
|
if (e.getWorld().getBlockState(e.getPos()).getBlock().equals(this)) {
|
||||||
|
if (!e.getWorld().isRemote && random.nextFloat() > .9) {
|
||||||
|
e.setCanceled(true);
|
||||||
|
if (random.nextBoolean()) {
|
||||||
|
e.getWorld().setBlockState(e.getPos(), Blocks.LAVA.getDefaultState());
|
||||||
|
} else {
|
||||||
|
e.getWorld().newExplosion(null, e.getPos().getX(), e.getPos().getY() + 1 / 16f, e.getPos().getZ(), 0.5f + random.nextFloat() * 1.5f, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -3,18 +3,14 @@ package com.sosnitzka.taiga.blocks;
|
|||||||
import com.sosnitzka.taiga.generic.BasicBlock;
|
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Items.lignite;
|
|
||||||
import static com.sosnitzka.taiga.Items.lignite2;
|
|
||||||
import static com.sosnitzka.taiga.Items.lignite3;
|
|
||||||
|
|
||||||
public class BlockLignite extends BasicBlock {
|
public class BlockLignite extends BasicBlock {
|
||||||
|
|
||||||
public BlockLignite() {
|
public BlockLignite() {
|
||||||
@@ -31,18 +27,8 @@ public class BlockLignite extends BasicBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||||
return MathHelper.getRandomIntegerInRange(random, 1, 3 + fortune);
|
return random.nextInt(3) + 1 + fortune;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
|
||||||
int r = RANDOM.nextInt(3);
|
|
||||||
if (r == 0) {
|
|
||||||
return lignite;
|
|
||||||
} else if (r == 1) {
|
|
||||||
return lignite2;
|
|
||||||
} else
|
|
||||||
return lignite3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
70
src/main/java/com/sosnitzka/taiga/blocks/BlockMetal.java
Normal file
70
src/main/java/com/sosnitzka/taiga/blocks/BlockMetal.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package com.sosnitzka.taiga.blocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import slimeknights.mantle.block.EnumBlock;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class BlockMetal extends EnumBlock<BlockMetal.MetalTypes> {
|
||||||
|
|
||||||
|
public static final PropertyEnum<MetalTypes> TYPE = PropertyEnum.create("type", MetalTypes.class);
|
||||||
|
|
||||||
|
public BlockMetal() {
|
||||||
|
super(Material.IRON, TYPE, MetalTypes.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||||
|
for (MetalTypes type : MetalTypes.values()) {
|
||||||
|
list.add(new ItemStack(this, 1, type.getMeta()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum MetalTypes implements IStringSerializable, EnumBlock.IEnumMeta {
|
||||||
|
TIBERIUM,
|
||||||
|
AURODIUM,
|
||||||
|
PROMETHEUM,
|
||||||
|
ARCANITE,
|
||||||
|
TITANITE,
|
||||||
|
MYTHRIL,
|
||||||
|
URU,
|
||||||
|
VIBRANIUM,
|
||||||
|
ETERNITE,
|
||||||
|
FRACTORYTE,
|
||||||
|
PALLADIUM,
|
||||||
|
IGNITITE,
|
||||||
|
BISMUTH,
|
||||||
|
JAUXITE,
|
||||||
|
VIOLIUM,
|
||||||
|
KARMESINE;
|
||||||
|
|
||||||
|
public final int meta;
|
||||||
|
|
||||||
|
MetalTypes() {
|
||||||
|
meta = ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return this.toString().toLowerCase(Locale.US);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMeta() {
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
package com.sosnitzka.taiga.blocks;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import static slimeknights.tconstruct.TConstruct.random;
|
||||||
|
|
||||||
|
public class BlockMeteoriteRock extends BasicBlock {
|
||||||
|
|
||||||
|
private IBlockState cobbblestate;
|
||||||
|
|
||||||
|
public BlockMeteoriteRock(String name, Material material, float hardness, float resistance, int harvestlevel, float light, String oreDictPrefix, IBlockState cobble) {
|
||||||
|
super(name, material, hardness, resistance, harvestlevel, light, oreDictPrefix);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
this.cobbblestate = cobble;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void breakMoonRock(BlockEvent.BreakEvent e) {
|
||||||
|
if (e.getWorld().getBlockState(e.getPos()).getBlock().equals(this)) {
|
||||||
|
if (!e.getWorld().isRemote && random.nextFloat() > .25) {
|
||||||
|
e.setCanceled(true);
|
||||||
|
e.getWorld().setBlockState(e.getPos(), cobbblestate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
68
src/main/java/com/sosnitzka/taiga/blocks/BlockOre.java
Normal file
68
src/main/java/com/sosnitzka/taiga/blocks/BlockOre.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package com.sosnitzka.taiga.blocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import slimeknights.mantle.block.EnumBlock;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class BlockOre extends EnumBlock<BlockOre.OreTypes> {
|
||||||
|
|
||||||
|
public static final PropertyEnum<OreTypes> TYPE = PropertyEnum.create("type", OreTypes.class);
|
||||||
|
|
||||||
|
public BlockOre() {
|
||||||
|
this(Material.ROCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockOre(Material material) {
|
||||||
|
super(material, TYPE, OreTypes.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public BlockRenderLayer getBlockLayer() {
|
||||||
|
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OreTypes implements IStringSerializable, EnumBlock.IEnumMeta {
|
||||||
|
TIBERIUM,
|
||||||
|
AURODIUM,
|
||||||
|
PROMETHEUM,
|
||||||
|
ARCANITE,
|
||||||
|
TITANITE,
|
||||||
|
MYTHRIL,
|
||||||
|
URU,
|
||||||
|
VIBRANIUM,
|
||||||
|
ETERNITE,
|
||||||
|
FRACTORYTE,
|
||||||
|
PALLADIUM,
|
||||||
|
IGNITITE,
|
||||||
|
BISMUTH,
|
||||||
|
JAUXITE,
|
||||||
|
VIOLIUM,
|
||||||
|
KARMESINE;
|
||||||
|
|
||||||
|
public final int meta;
|
||||||
|
|
||||||
|
OreTypes() {
|
||||||
|
meta = ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return this.toString().toLowerCase(Locale.US);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMeta() {
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -4,60 +4,59 @@ import com.sosnitzka.taiga.Items;
|
|||||||
import com.sosnitzka.taiga.generic.BasicBlock;
|
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.util.Utils.PREFIX_ORE;
|
import static com.sosnitzka.taiga.util.Utils.PREFIX_ORE;
|
||||||
import static slimeknights.tconstruct.TConstruct.random;
|
import static slimeknights.tconstruct.TConstruct.random;
|
||||||
import static slimeknights.tconstruct.library.utils.HarvestLevels.OBSIDIAN;
|
import static slimeknights.tconstruct.library.utils.HarvestLevels.STONE;
|
||||||
|
|
||||||
public class BlockTiberium extends BasicBlock {
|
public class BlockTiberium extends BasicBlock {
|
||||||
|
|
||||||
public BlockTiberium() {
|
public BlockTiberium() {
|
||||||
super("tiberium_ore", Material.ROCK, 15.0f, 2.0f, OBSIDIAN, 1.0F, PREFIX_ORE);
|
super("tiberium_ore", Material.ROCK, 15.0f, 2.0f, STONE, 1.0F, PREFIX_ORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
|
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
|
||||||
Random rand = world instanceof World ? ((World) world).rand : new Random();
|
if (random.nextBoolean()) {
|
||||||
int r = RANDOM.nextInt(11);
|
return random.nextInt(10) + fortune;
|
||||||
if (r > 7) {
|
|
||||||
return MathHelper.getRandomIntegerInRange(rand, 0, 10) + fortune;
|
|
||||||
} else return 0;
|
} else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||||
return MathHelper.getRandomIntegerInRange(random, 1, MathHelper.getRandomIntegerInRange(random, 2, 4 + fortune));
|
return (random.nextInt(3 + fortune) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
return Items.tiberiumShardInstable;
|
return Items.tiberiumDust;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
|
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
|
||||||
if (!worldIn.isRemote) {
|
if (!worldIn.isRemote) {
|
||||||
if (MathHelper.getRandomIntegerInRange(random, 1, 15) > 10) {
|
if (random.nextFloat() < 0.5) {
|
||||||
worldIn.newExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 1.6f, true, true);
|
worldIn.newExplosion(null, pos.getX(), pos.getY(), pos.getZ(), random.nextFloat() * 2f + 1.5f, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
|
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
if (MathHelper.getRandomIntegerInRange(random, 1, 30) < 3) {
|
if (random.nextFloat() < 0.1) {
|
||||||
if (!worldIn.isRemote) {
|
if (!worldIn.isRemote) {
|
||||||
worldIn.newExplosion(null, pos.getX(), pos.getY() + 1 / 16f, pos.getZ(), 1.1f, true, true);
|
worldIn.newExplosion(null, pos.getX(), pos.getY() + 1 / 16f, pos.getZ(), 1.5f, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -36,5 +36,4 @@ public class BasicBlock extends Block {
|
|||||||
public String getOreDictPrefix() {
|
public String getOreDictPrefix() {
|
||||||
return this.oreDictPrefix;
|
return this.oreDictPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,9 @@ package com.sosnitzka.taiga.generic;
|
|||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A "wrapper" for Item that makes construction and manipulation easier
|
||||||
|
*/
|
||||||
public class BasicItem extends Item {
|
public class BasicItem extends Item {
|
||||||
private String oreDictPrefix;
|
private String oreDictPrefix;
|
||||||
|
|
||||||
|
@@ -4,20 +4,26 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import slimeknights.tconstruct.library.Util;
|
import slimeknights.tconstruct.library.Util;
|
||||||
import slimeknights.tconstruct.library.fluid.FluidMolten;
|
import slimeknights.tconstruct.library.fluid.FluidMolten;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A "wrapper" for FluidMolten that makes construction and manipulation easier
|
||||||
|
*/
|
||||||
public class BasicTinkerFluid extends FluidMolten {
|
public class BasicTinkerFluid extends FluidMolten {
|
||||||
|
|
||||||
private boolean toolForge;
|
private boolean toolForge;
|
||||||
|
|
||||||
public BasicTinkerFluid(String fluidName, int color, boolean toolForge, int temp, int lumen, int visk) {
|
public BasicTinkerFluid(String fluidName, int color, int temp, int lumen, int visk) {
|
||||||
|
// Constructs the FluidMolten with textures and color
|
||||||
super(fluidName, color, new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
|
super(fluidName, color, new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
|
||||||
|
//Settings
|
||||||
this.setUnlocalizedName(Util.prefix(fluidName));
|
this.setUnlocalizedName(Util.prefix(fluidName));
|
||||||
this.setTemperature(temp);
|
this.setTemperature(temp);
|
||||||
this.setLuminosity(lumen);
|
this.setLuminosity(lumen);
|
||||||
this.setViscosity(visk);
|
this.setViscosity(visk);
|
||||||
this.setDensity(2000);
|
this.setDensity(2000);
|
||||||
this.toolForge = toolForge;
|
this.toolForge = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isToolForge() {
|
public boolean isToolForge() {
|
||||||
return toolForge;
|
return toolForge;
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.items;
|
|
||||||
|
|
||||||
import com.sosnitzka.taiga.generic.BasicItem;
|
|
||||||
|
|
||||||
public class ItemIronNugget extends BasicItem {
|
|
||||||
|
|
||||||
public ItemIronNugget() {
|
|
||||||
super("iron_nugget");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.items;
|
|
||||||
|
|
||||||
import com.sosnitzka.taiga.generic.BasicItem;
|
|
||||||
|
|
||||||
public class ItemLignite extends BasicItem {
|
|
||||||
|
|
||||||
public ItemLignite(String name, String registry) {
|
|
||||||
super(name, null, registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.items;
|
|
||||||
|
|
||||||
import com.sosnitzka.taiga.generic.BasicItem;
|
|
||||||
|
|
||||||
public class ItemSlaggoldIngot extends BasicItem {
|
|
||||||
|
|
||||||
public ItemSlaggoldIngot() {
|
|
||||||
super("slaggold_ingot");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.items;
|
|
||||||
|
|
||||||
import com.sosnitzka.taiga.generic.BasicItem;
|
|
||||||
|
|
||||||
public class ItemSlagironIngot extends BasicItem {
|
|
||||||
|
|
||||||
public ItemSlagironIngot() {
|
|
||||||
super("slagiron_ingot");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -3,6 +3,7 @@ package com.sosnitzka.taiga.proxy;
|
|||||||
import com.sosnitzka.taiga.Blocks;
|
import com.sosnitzka.taiga.Blocks;
|
||||||
import com.sosnitzka.taiga.Items;
|
import com.sosnitzka.taiga.Items;
|
||||||
import com.sosnitzka.taiga.TAIGA;
|
import com.sosnitzka.taiga.TAIGA;
|
||||||
|
import com.sosnitzka.taiga.TAIGAConfiguration;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -22,9 +23,11 @@ import slimeknights.tconstruct.library.materials.Material;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.Fluids.*;
|
||||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||||
|
|
||||||
public class ClientProxy extends ServerProxy {
|
@SuppressWarnings("unused")
|
||||||
|
public class ClientProxy extends CommonProxy {
|
||||||
|
|
||||||
private static void registerBlockModel(Block block) {
|
private static void registerBlockModel(Block block) {
|
||||||
registerItemModel(Item.getItemFromBlock(block));
|
registerItemModel(Item.getItemFromBlock(block));
|
||||||
@@ -35,14 +38,13 @@ public class ClientProxy extends ServerProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerStuff() {
|
public void registerModels() {
|
||||||
Field[] itemFields = Items.class.getDeclaredFields();
|
Field[] itemFields = Items.class.getDeclaredFields();
|
||||||
for (Field field : itemFields) {
|
for (Field field : itemFields) {
|
||||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||||
Class<?> targetType = field.getType();
|
Class<?> targetType = field.getType();
|
||||||
try {
|
try {
|
||||||
Item item = (Item) field.get(targetType);
|
Item item = (Item) field.get(targetType);
|
||||||
|
|
||||||
registerItemModel(item);
|
registerItemModel(item);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -56,7 +58,6 @@ public class ClientProxy extends ServerProxy {
|
|||||||
Class<?> targetType = field.getType();
|
Class<?> targetType = field.getType();
|
||||||
try {
|
try {
|
||||||
Block block = (Block) field.get(targetType);
|
Block block = (Block) field.get(targetType);
|
||||||
|
|
||||||
registerBlockModel(block);
|
registerBlockModel(block);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -66,30 +67,34 @@ public class ClientProxy extends ServerProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setRenderInfo(final Material material) {
|
public void setRenderInfo(final Material material) {
|
||||||
/* if (material != bismuth) {
|
if (material.equals(adamant)) metalRender(material, adamantFluid.getColor(), 1f, 0.8f, 0f);
|
||||||
material.setRenderInfo(new MaterialRenderInfo.Metal(fluid.getColor(), 0.4f, 0.2f, 0f));
|
else if (material.equals(duranite)) metalRender(material, duraniteFluid.getColor(), .4f, .4f, 0);
|
||||||
} else bismuth.setRenderInfo(new MaterialRenderInfo.BlockTexture("taiga:blocks/bismuth_block")); */
|
else if (material.equals(tiberium)) metalRender(material, tiberiumFluid.getColor(), 1f, .3f, 0f);
|
||||||
|
else if (material.equals(palladium)) metalRender(material, palladiumFluid.getColor(), .7f, .6f, 0f);
|
||||||
if (material == adamantite) renderTo(material, 0xd55cdf, 0.5f, 0.8f, 0.2f);
|
else if (material.equals(osram)) metalRender(material, osramFluid.getColor(), .7f, .6f, 0f);
|
||||||
else if (material == solarium) renderTo(material, 0xffff00, 0.6f, 1.8f, 0.0f);
|
else if (material.equals(tritonite)) metalRender(material, tritoniteFluid.getColor(), .3f, .3f, 0f);
|
||||||
else if (material == proxideum) renderTo(material, 0x2d8f8b, 0.4f, 0.3f, 0.1f);
|
else if (material.equals(nucleum)) metalRender(material, nucleumFluid.getColor(), .4f, .6f, .2f);
|
||||||
else if (material == tiberium) renderTo(material, 0x33ff33, 0.5f, 0.2f, 0.1f);
|
else if (material.equals(triberium)) metalRender(material, triberiumFluid.getColor(), 2f, 2f, 0.5f);
|
||||||
else if (material == bismuth) renderTo(material, 0xffffff, 0.4f, 0.2f, 0.0f);
|
else if (material.equals(solarium)) metalRender(material, solariumFluid.getColor(), 1.5f, 1.5f, 0.5f);
|
||||||
else if (material == dyonite) renderTo(material, 0xffe240, 0.6f, 0.8f, 0.2f);
|
else if (material.equals(uru)) metalRender(material, uruFluid.getColor(), 1.0f, 1.0f, 0.3f);
|
||||||
|
else if (material.equals(imperomite)) metalRender(material, imperomiteFluid.getColor(), 0.4f, 1.0f, 0.7f);
|
||||||
|
else if (material.equals(vibranium)) metalRender(material, vibraniumFluid.getColor(), 0.6f, .8f, 1f);
|
||||||
|
else if (material.equals(valyrium)) metalRender(material, valyriumFluid.getColor(), .8f, 1.5f, -0.1f);
|
||||||
else {
|
else {
|
||||||
material.setRenderInfo(new MaterialRenderInfo.BlockTexture("taiga:blocks/" + material.getFluid().getName() + "_block"));
|
material.setRenderInfo(new MaterialRenderInfo.BlockTexture("taiga:blocks/block/" + material.getIdentifier()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderTo(Material material, final int f, final float shine, final float brightness, final float hueshift) {
|
private void metalRender(final Material material, final int f, final float shine, final float brightness, final float hueshift) {
|
||||||
material.setRenderInfo(new MaterialRenderInfo.AbstractMaterialRenderInfo() {
|
material.setRenderInfo(new MaterialRenderInfo.AbstractMaterialRenderInfo() {
|
||||||
@Override
|
@Override
|
||||||
public TextureAtlasSprite getTexture(TextureAtlasSprite baseTexture, String location) {
|
public TextureAtlasSprite getTexture(TextureAtlasSprite baseTexture, String location) {
|
||||||
return new MetalTextureTexture("taiga:blocks/materials/adamantite", baseTexture, location, f, shine, brightness, hueshift);
|
return new MetalTextureTexture("taiga:materials/" + material.getIdentifier(), baseTexture, location, f, shine, brightness, hueshift);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerFluidModels(Fluid fluid) {
|
public void registerFluidModels(Fluid fluid) {
|
||||||
if (fluid == null) {
|
if (fluid == null) {
|
||||||
@@ -111,6 +116,12 @@ public class ClientProxy extends ServerProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initConfig() {
|
||||||
|
super.initConfig();
|
||||||
|
TAIGAConfiguration.clientPreInit();
|
||||||
|
}
|
||||||
|
|
||||||
public static class FluidStateMapper extends StateMapperBase implements ItemMeshDefinition {
|
public static class FluidStateMapper extends StateMapperBase implements ItemMeshDefinition {
|
||||||
|
|
||||||
public final Fluid fluid;
|
public final Fluid fluid;
|
||||||
|
27
src/main/java/com/sosnitzka/taiga/proxy/CommonProxy.java
Normal file
27
src/main/java/com/sosnitzka/taiga/proxy/CommonProxy.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.sosnitzka.taiga.proxy;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.TAIGAConfiguration;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||||
|
import slimeknights.tconstruct.library.materials.Material;
|
||||||
|
|
||||||
|
public class CommonProxy {
|
||||||
|
|
||||||
|
public void registerModels() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRenderInfo(Material material) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerFluidModels(Fluid fluid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initConfig() {
|
||||||
|
TAIGAConfiguration.preInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerServerCommands(FMLServerStartingEvent e) {
|
||||||
|
}
|
||||||
|
}
|
@@ -1,18 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.proxy;
|
|
||||||
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import slimeknights.tconstruct.library.materials.Material;
|
|
||||||
|
|
||||||
public class ServerProxy {
|
|
||||||
|
|
||||||
public void registerStuff() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRenderInfo(Material material) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerFluidModels(Fluid fluid) {
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.recipes;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Items.*;
|
|
||||||
import static slimeknights.tconstruct.shared.TinkerCommons.matNecroticBone;
|
|
||||||
|
|
||||||
public class Crafting {
|
|
||||||
public static void register() {
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(fuel_brick), Items.COAL, Items.COAL, Items.COAL, lignite, lignite, lignite);
|
|
||||||
GameRegistry.addShapedRecipe(new ItemStack((tiberiumShardStable), 3), "STS", "TST", "STS", 'T', new ItemStack(tiberiumShardInstable), 'S', new ItemStack(Item.getItemFromBlock(Blocks.SAND)));
|
|
||||||
GameRegistry.addShapedRecipe(new ItemStack((tiberiumShardStable), 2), "GTG", "TGT", "GTG", 'T', new ItemStack(tiberiumShardInstable), 'G', new ItemStack(Item.getItemFromBlock(Blocks.GRAVEL)));
|
|
||||||
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(luminar_dust), Items.REDSTONE, Items.GLOWSTONE_DUST);
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmerstone_dust), luminar_dust, Items.BLAZE_POWDER);
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmerstone_dust), Items.REDSTONE, Items.GLOWSTONE_DUST, Items.BLAZE_POWDER);
|
|
||||||
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmercoal), Items.COAL, glimmerstone_dust);
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmercoal), lignite, glimmerstone_dust);
|
|
||||||
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(radiant_pearl), Items.ENDER_PEARL, luminar_dust, new ItemStack(Items.DYE, 1, 4));
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmer_pearl), Items.ENDER_PEARL, glimmerstone_dust);
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(energy_pearl), Items.ENDER_PEARL, luminar_dust, Items.GUNPOWDER);
|
|
||||||
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(nitro_brick), fuel_brick, Items.GUNPOWDER, Items.BLAZE_POWDER);
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(anthracite_dust), matNecroticBone, Items.COAL, Items.GUNPOWDER);
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(spectrum_dust), matNecroticBone, glimmerstone_dust);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,7 @@
|
|||||||
|
package com.sosnitzka.taiga.recipes;
|
||||||
|
|
||||||
|
public class CraftingRegistry {
|
||||||
|
public static void register() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,40 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.recipes;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
||||||
import org.apache.commons.lang3.RandomUtils;
|
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Blocks.*;
|
|
||||||
import static com.sosnitzka.taiga.Items.*;
|
|
||||||
|
|
||||||
public class Smelting {
|
|
||||||
public static void register() {
|
|
||||||
GameRegistry.addSmelting(slagironOre, new ItemStack(slagironIngot), 1.0F);
|
|
||||||
GameRegistry.addSmelting(slaggoldOre, new ItemStack(slaggoldIngot), 1.0F);
|
|
||||||
GameRegistry.addSmelting(slagironIngot, new ItemStack(iron_nugget), 0);
|
|
||||||
GameRegistry.addSmelting(slaggoldIngot, new ItemStack(Items.GOLD_NUGGET), 0);
|
|
||||||
GameRegistry.addSmelting(tiberiumShardInstable, new ItemStack(tiberiumShardStable), 0.2F);
|
|
||||||
GameRegistry.addSmelting(tiberiumOre, new ItemStack(tiberiumShardStable, 3), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
|
|
||||||
// Removed until TiC put its own ores back in.
|
|
||||||
/* GameRegistry.addSmelting(titaniteOre, new ItemStack(titaniteIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(arcaniteOre, new ItemStack(arcaniteIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(adamantiteOre, new ItemStack(adamantiteIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(violiumOre, new ItemStack(violiumIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(bismuthOre, new ItemStack(bismuthIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(eterniteOre, new ItemStack(eterniteIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(ignititeOre, new ItemStack(ignititeIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(karmesineOre, new ItemStack(karmesineIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(meteoriteOre, new ItemStack(meteoriteIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(mindoriteOre, new ItemStack(mindoriteIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(mythrilOre, new ItemStack(mythrilIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(palladiumOre, new ItemStack(palladiumIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(prometheumOre, new ItemStack(prometheumIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(vibraniumOre, new ItemStack(vibraniumIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
GameRegistry.addSmelting(rubiumOre, new ItemStack(rubiumIngot), RandomUtils.nextFloat(0F, 2F));
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.sosnitzka.taiga.recipes;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class SmeltingRegistry {
|
||||||
|
public static void register() {
|
||||||
|
ItemStack nugget_iron = OreDictionary.getOres("nuggetIron").get(OreDictionary.getOres("nuggetIron").size() - 1);
|
||||||
|
//GameRegistry.addSmelting(tiberiumOre, new ItemStack(tiberiumShardInstable, 6), (1F));
|
||||||
|
//GameRegistry.addSmelting(tiberiumShardInstable, new ItemStack(tiberiumIngot), (.1F));
|
||||||
|
}
|
||||||
|
}
|
@@ -43,7 +43,7 @@ public class TraitAnalysing extends AbstractTrait {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMobDrops(LivingDropsEvent event) {
|
public void onMobDrops(LivingDropsEvent event) {
|
||||||
World w = event.getEntity().getEntityWorld();
|
World w = event.getEntity().getEntityWorld();
|
||||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
if (random.nextFloat() < .1f && event.getSource().getEntity() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||||
if (!w.isRemote && event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
if (!w.isRemote && event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
@@ -52,15 +52,14 @@ public class TraitAnalysing extends AbstractTrait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getUpdateXP(int xp) {
|
private int getUpdateXP(int xp) {
|
||||||
float exp = (float) random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + 18) * 50;
|
float exp = random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + random.nextInt(xp) * (1 + random.nextFloat()));
|
||||||
return Math.round(exp);
|
return Math.round(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||||
if (random.nextFloat() < 0.85) {
|
if (random.nextFloat() < 0.1) {
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,42 +1,57 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.isNight;
|
||||||
|
|
||||||
public class TraitArcane extends AbstractTrait {
|
public class TraitArcane extends AbstractTrait {
|
||||||
|
|
||||||
public TraitArcane() {
|
public TraitArcane() {
|
||||||
super("arcane", TextFormatting.DARK_PURPLE);
|
super("arcane", TextFormatting.DARK_PURPLE);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||||
int time = (int) world.getWorldTime();
|
int time = (int) world.getWorldTime();
|
||||||
if (random.nextFloat() <= 0.1 && isNight(time)) {
|
if (random.nextFloat() <= 0.05 && isNight(time)) {
|
||||||
ToolHelper.healTool(tool, random.nextInt(15) + 1, null);
|
ToolHelper.healTool(tool, random.nextInt(8) + 1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||||
int time = (int) player.getEntityWorld().getWorldTime();
|
int time = (int) player.getEntityWorld().getWorldTime();
|
||||||
if (random.nextFloat() <= 0.1 && isNight(time)) {
|
if (random.nextFloat() <= 0.05 && isNight(time)) {
|
||||||
ToolHelper.healTool(tool, random.nextInt(15) + 1, null);
|
ToolHelper.healTool(tool, random.nextInt(8) + 1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isNight(int time) {
|
@SubscribeEvent
|
||||||
if (time > 12500) {
|
public void onEntityKill(LivingDeathEvent e) {
|
||||||
return true;
|
World w = e.getEntity().getEntityWorld();
|
||||||
} else {
|
if (!w.isRemote && e.getSource().getEntity() != null) {
|
||||||
return false;
|
if (e.getSource().getEntity() instanceof EntityPlayer && e.getEntity() instanceof EntityCreature) {
|
||||||
|
ItemStack tool = ((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand();
|
||||||
|
if (isNight((int) w.getWorldTime()) && random.nextFloat() < 0.1 && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
ToolHelper.healTool(tool, random.nextInt(16), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,8 @@ import net.minecraft.util.text.TextFormatting;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.isNight;
|
||||||
|
|
||||||
public class TraitBlind extends AbstractTrait {
|
public class TraitBlind extends AbstractTrait {
|
||||||
|
|
||||||
public TraitBlind() {
|
public TraitBlind() {
|
||||||
@@ -19,7 +21,7 @@ public class TraitBlind extends AbstractTrait {
|
|||||||
@Override
|
@Override
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||||
int time = (int) world.getWorldTime();
|
int time = (int) world.getWorldTime();
|
||||||
if (random.nextFloat() <= 0.05 || (random.nextFloat() <= 0.1 && isNight(time))) {
|
if (random.nextFloat() <= 0.01 || (random.nextFloat() <= 0.03 && isNight(time))) {
|
||||||
if (random.nextBoolean())
|
if (random.nextBoolean())
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(200) + 100));
|
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(200) + 100));
|
||||||
else
|
else
|
||||||
@@ -30,19 +32,11 @@ public class TraitBlind extends AbstractTrait {
|
|||||||
@Override
|
@Override
|
||||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||||
int time = (int) player.getEntityWorld().getWorldTime();
|
int time = (int) player.getEntityWorld().getWorldTime();
|
||||||
if (random.nextFloat() <= 0.05 || (random.nextFloat() <= 0.1 && isNight(time))) {
|
if (random.nextFloat() <= 0.01 || (random.nextFloat() <= 0.03 && isNight(time))) {
|
||||||
if (random.nextBoolean())
|
if (random.nextBoolean())
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(400) + 200));
|
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(400) + 200));
|
||||||
else
|
else
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, random.nextInt(400) + 200));
|
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, random.nextInt(400) + 200));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNight(int time) {
|
|
||||||
if (time > 12500) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,20 +1,22 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.MobEffects;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
|
||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
import static com.sosnitzka.taiga.util.Utils.isNight;
|
||||||
|
import static net.minecraft.init.MobEffects.GLOWING;
|
||||||
|
|
||||||
|
|
||||||
public class TraitBright extends AbstractTrait {
|
public class TraitBright extends AbstractTrait {
|
||||||
|
|
||||||
|
private static final float chance = 0.90f;
|
||||||
|
|
||||||
public TraitBright() {
|
public TraitBright() {
|
||||||
super("bright", TextFormatting.DARK_GRAY);
|
super("bright", TextFormatting.DARK_GRAY);
|
||||||
}
|
}
|
||||||
@@ -22,29 +24,17 @@ public class TraitBright extends AbstractTrait {
|
|||||||
@Override
|
@Override
|
||||||
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||||
int time = (int) target.getEntityWorld().getWorldTime();
|
int time = (int) target.getEntityWorld().getWorldTime();
|
||||||
if (isDay(time)) {
|
if (!isNight(time)) {
|
||||||
newDamage += damage / 2f;
|
newDamage = damage * (1 + random.nextFloat() / 2f);
|
||||||
}
|
} else newDamage = damage / (1 + random.nextFloat() / 3f);
|
||||||
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(ItemStack item, World world, Entity entity, int i, boolean b) {
|
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (random.nextFloat() >= chance) {
|
||||||
EntityPlayer e = (EntityPlayer) entity;
|
player.addPotionEffect(new PotionEffect(GLOWING, 200));
|
||||||
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(e.getHeldItemMainhand()), identifier)) {
|
|
||||||
e.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 100));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDay(int time) {
|
|
||||||
if (time < 12500) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,8 @@ public class TraitCascade extends AbstractTrait {
|
|||||||
sx = x = pos.getX();
|
sx = x = pos.getX();
|
||||||
sy = y = pos.getY();
|
sy = y = pos.getY();
|
||||||
sz = z = pos.getZ();
|
sz = z = pos.getZ();
|
||||||
for (int i = random.nextInt((int) Math.max(ToolHelper.getCurrentDurability(tool) * 1.5f, 100) + 10); i > 0; i--) {
|
int i = random.nextInt((int) Math.min(300f * (float) ToolHelper.getCurrentDurability(tool) / ToolHelper.getMaxDurability(tool), 50f));
|
||||||
|
for (int a = i; a > 0; a--) {
|
||||||
int r = random.nextInt(3);
|
int r = random.nextInt(3);
|
||||||
int d = random.nextBoolean() ? 1 : -1;
|
int d = random.nextBoolean() ? 1 : -1;
|
||||||
if (r == 0) x += d;
|
if (r == 0) x += d;
|
||||||
@@ -35,7 +36,7 @@ public class TraitCascade extends AbstractTrait {
|
|||||||
sx = x = nextBlock.getX();
|
sx = x = nextBlock.getX();
|
||||||
sy = y = nextBlock.getY();
|
sy = y = nextBlock.getY();
|
||||||
sz = z = nextBlock.getZ();
|
sz = z = nextBlock.getZ();
|
||||||
ToolHelper.damageTool(tool, random.nextInt(2), player);
|
ToolHelper.damageTool(tool, 1, player);
|
||||||
} else {
|
} else {
|
||||||
x = sx;
|
x = sx;
|
||||||
y = sy;
|
y = sy;
|
||||||
|
113
src/main/java/com/sosnitzka/taiga/traits/TraitCatcher.java
Normal file
113
src/main/java/com/sosnitzka/taiga/traits/TraitCatcher.java
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitCatcher extends AbstractTrait {
|
||||||
|
|
||||||
|
public static int chance = 1;
|
||||||
|
public static float costMulti = 0.25f;
|
||||||
|
|
||||||
|
public TraitCatcher() {
|
||||||
|
super(TraitCatcher.class.getSimpleName().toLowerCase().substring(5), TextFormatting.RED);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
||||||
|
World w = player.worldObj;
|
||||||
|
if (!w.isRemote && random.nextInt((int) target.getMaxHealth()) <= chance && target instanceof EntityLiving) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Data data = Data.read(tag);
|
||||||
|
if (data.mobClass.isEmpty()) {
|
||||||
|
data.mobClass = target.getClass().getName();
|
||||||
|
data.mobName = target.getName();
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setEnchantEffect(tool, true);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
player.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
|
target.setDropItemsWhenDead(false);
|
||||||
|
target.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||||
|
World w = event.getWorld();
|
||||||
|
BlockPos pos = event.getEntityPlayer().getPosition();
|
||||||
|
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||||
|
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Data data = Data.read(tag);
|
||||||
|
if (!data.mobClass.isEmpty()) {
|
||||||
|
Entity ent = null;
|
||||||
|
try {
|
||||||
|
ent = (Entity) Class.forName(data.mobClass).getConstructor(World.class).newInstance(w);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ent != null) {
|
||||||
|
ent.setPosition(pos.getX(), pos.getY(), pos.getZ()); // TODO: set to player view target
|
||||||
|
w.spawnEntityInWorld(ent);
|
||||||
|
event.getEntityPlayer().playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
|
data.mobClass = "";
|
||||||
|
data.mobName = "";
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
TagUtil.setEnchantEffect(tool, false);
|
||||||
|
ToolHelper.damageTool(tool, random.nextInt((int) (ToolHelper.getCurrentDurability(tool) * costMulti)), event.getEntityPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemTooltip(ItemTooltipEvent e) {
|
||||||
|
ItemStack tool = e.getItemStack();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Data data = Data.read(tag);
|
||||||
|
if (!data.mobClass.isEmpty())
|
||||||
|
e.getToolTip().add(TextFormatting.DARK_PURPLE + "Captured: " + TextFormatting.LIGHT_PURPLE + data.mobName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
String mobClass;
|
||||||
|
String mobName;
|
||||||
|
|
||||||
|
public static Data read(NBTTagCompound tag) {
|
||||||
|
Data data = new Data();
|
||||||
|
data.mobName = tag.getString("mobName");
|
||||||
|
data.mobClass = tag.getString("mobClass");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(NBTTagCompound tag) {
|
||||||
|
tag.setString("mobClass", mobClass);
|
||||||
|
tag.setString("mobName", mobName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
78
src/main/java/com/sosnitzka/taiga/traits/TraitCongenial.java
Normal file
78
src/main/java/com/sosnitzka/taiga/traits/TraitCongenial.java
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
|
import net.minecraft.entity.EntityCreature;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitCongenial extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
|
public TraitCongenial() {
|
||||||
|
super(TraitCongenial.class.getSimpleName().toLowerCase().substring(5), TextFormatting.RED);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityKill(LivingDeathEvent e) {
|
||||||
|
if (e.getSource().getEntity() instanceof EntityPlayer && !e.getSource().getEntity().worldObj.isRemote && e.getEntity() instanceof EntityCreature) {
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand()), identifier)) {
|
||||||
|
ItemStack tool = ((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand();
|
||||||
|
String name = e.getEntity().getName();
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (!data.name.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data.name = name;
|
||||||
|
data.write(tag);
|
||||||
|
assert tool != null;
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||||
|
World w = player.getEntityWorld();
|
||||||
|
if (!w.isRemote) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (data.name.isEmpty()) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
if (!data.name.equals(target.getName())) {
|
||||||
|
return damage / (random.nextInt(5) + 5);
|
||||||
|
}
|
||||||
|
float x = (1 + random.nextFloat() * 9);
|
||||||
|
return damage * x;
|
||||||
|
}
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemTooltip(ItemTooltipEvent e) {
|
||||||
|
ItemStack tool = e.getItemStack();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (data.name.isEmpty()) e.getToolTip().add(TextFormatting.LIGHT_PURPLE + "Unbound");
|
||||||
|
else {
|
||||||
|
e.getToolTip().add(TextFormatting.DARK_PURPLE + "Bound to: " + TextFormatting.LIGHT_PURPLE + data.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
58
src/main/java/com/sosnitzka/taiga/traits/TraitCursed.java
Normal file
58
src/main/java/com/sosnitzka/taiga/traits/TraitCursed.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.DamageSource;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitCursed extends AbstractTrait {
|
||||||
|
|
||||||
|
private static int chance = 60 * 1000;
|
||||||
|
|
||||||
|
public TraitCursed() {
|
||||||
|
super(TraitCursed.class.getSimpleName().toLowerCase().substring(5), TextFormatting.RED);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||||
|
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (random.nextInt((chance + data.curse) / (data.curse + 1)) == 1) {
|
||||||
|
if (isSelected) data.curse += 10;
|
||||||
|
else data.curse++;
|
||||||
|
entity.attackEntityFrom(new DamageSource("Curse"), random.nextFloat() * ((EntityPlayer) entity).getHealth() / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemTooltip(ItemTooltipEvent e) {
|
||||||
|
ItemStack tool = e.getItemStack();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (data.curse != 0) {
|
||||||
|
e.getToolTip().add(TextFormatting.DARK_PURPLE + "Curse: " + TextFormatting.WHITE + data.curse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,5 +1,7 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
@@ -10,79 +12,78 @@ import net.minecraft.init.Items;
|
|||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class TraitCurvature extends AbstractTrait {
|
public class TraitCurvature extends AbstractTrait {
|
||||||
|
public static int chance = 5;
|
||||||
|
public static int distance = 10;
|
||||||
private static BlockPos pos = new BlockPos(0, 0, 0);
|
|
||||||
|
|
||||||
public TraitCurvature() {
|
public TraitCurvature() {
|
||||||
super("curvature", TextFormatting.BLACK);
|
super("curvature", TextFormatting.DARK_PURPLE);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||||
if (player.worldObj.isRemote) {
|
if (!event.getWorld().isRemote && random.nextFloat() < 0.05) {
|
||||||
|
List<IBlockState> blockstates = Lists.newArrayList(Blocks.STONE.getDefaultState(), Blocks.NETHERRACK.getDefaultState(), Blocks.END_STONE.getDefaultState(), Blocks.AIR.getDefaultState(), Blocks.DIRT.getDefaultState());
|
||||||
|
IBlockState mainstate = event.getState();
|
||||||
|
if (blockstates.contains(mainstate)) return;
|
||||||
|
for (int i = 0; i < chance; i++) {
|
||||||
|
int x = event.getPos().getX() + Utils.nextInt(random, -distance, distance);
|
||||||
|
int y = event.getPos().getY() + Utils.nextInt(random, -distance, distance);
|
||||||
|
int z = event.getPos().getZ() + Utils.nextInt(random, -distance, distance);
|
||||||
|
BlockPos cPos = new BlockPos(x, y, z);
|
||||||
|
IBlockState state = event.getWorld().getBlockState(cPos);
|
||||||
|
if (blockstates.contains(state)) {
|
||||||
|
event.getDrops().clear();
|
||||||
|
event.getWorld().setBlockState(cPos, mainstate);
|
||||||
|
event.getHarvester().playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
|
event.getHarvester().addChatComponentMessage(new TextComponentString("Teleported to: " + x + " " + y + " " + z));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (random.nextFloat() <= 0.01 && world.provider.getDimension() != -1) {
|
|
||||||
teleport(player, world, 5);
|
|
||||||
player.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||||
World w = player.getEntityWorld();
|
if (random.nextFloat() <= 0.15) {
|
||||||
if (random.nextFloat() <= 0.3) {
|
|
||||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
changepos(player, target);
|
changePos(player, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMobDrops(LivingDropsEvent event) {
|
public void onMobDrops(LivingDropsEvent event) {
|
||||||
World w = event.getEntity().getEntityWorld();
|
World w = event.getEntity().getEntityWorld();
|
||||||
if (!w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
if (!w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||||
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||||
ItemStack i = new ItemStack(Items.ENDER_PEARL, random.nextInt(3));
|
ItemStack i = new ItemStack(Items.ENDER_PEARL, random.nextInt(2));
|
||||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void teleport(EntityLivingBase e, World w, int max) {
|
private void changePos(EntityLivingBase player, EntityLivingBase target) {
|
||||||
int x = e.getPosition().getX() + random.nextInt(250) - 125;
|
|
||||||
int y = e.getPosition().getY();
|
|
||||||
int z = e.getPosition().getZ() + random.nextInt(250) - 125;
|
|
||||||
while (w.getBlockState(new BlockPos(x, y, z)).getBlock() != Blocks.AIR) {
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
while (w.getBlockState(new BlockPos(x, y - 1, z)).getBlock() == Blocks.AIR) {
|
|
||||||
y--;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.setPosition(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void changepos(EntityLivingBase player, EntityLivingBase target) {
|
|
||||||
BlockPos pp = new BlockPos(player.getPosition());
|
BlockPos pp = new BlockPos(player.getPosition());
|
||||||
BlockPos tp = new BlockPos(target.getPosition());
|
BlockPos tp = new BlockPos(target.getPosition());
|
||||||
player.setPosition(tp.getX(), tp.getY(), tp.getZ());
|
player.setPosition(tp.getX(), tp.getY(), tp.getZ());
|
||||||
target.setPosition(pp.getX(), pp.getY(), pp.getZ());
|
target.setPosition(pp.getX(), pp.getY(), pp.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.isNight;
|
||||||
|
|
||||||
|
|
||||||
public class TraitDark extends AbstractTrait {
|
public class TraitDark extends AbstractTrait {
|
||||||
|
|
||||||
@@ -16,17 +18,8 @@ public class TraitDark extends AbstractTrait {
|
|||||||
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||||
int time = (int) target.getEntityWorld().getWorldTime();
|
int time = (int) target.getEntityWorld().getWorldTime();
|
||||||
if (isNight(time)) {
|
if (isNight(time)) {
|
||||||
newDamage += damage / 2f;
|
newDamage = damage * (1 + random.nextFloat() / 2f);
|
||||||
}
|
} else newDamage = damage / (1 + random.nextFloat() / 3f);
|
||||||
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNight(int time) {
|
|
||||||
if (time > 12500) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
115
src/main/java/com/sosnitzka/taiga/traits/TraitDecay.java
Normal file
115
src/main/java/com/sosnitzka/taiga/traits/TraitDecay.java
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
||||||
|
import slimeknights.tconstruct.library.tools.ToolNBT;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the tool bonus stats on crafting.
|
||||||
|
* The bonus stats are distributed over time and are more or less random.
|
||||||
|
* The stats that will be rewarded are already designated on the first time the tool is crafted
|
||||||
|
*/
|
||||||
|
public class TraitDecay extends TraitProgressiveStats {
|
||||||
|
|
||||||
|
protected static int TICK_PER_STAT = 24;
|
||||||
|
protected static int DURABILITY_STEP = 10;
|
||||||
|
protected static float SPEED_STEP = 0.05f;
|
||||||
|
protected static float ATTACK_STEP = 0.05f;
|
||||||
|
|
||||||
|
public TraitDecay() {
|
||||||
|
super("decay", TextFormatting.GREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
|
||||||
|
// check if we have stats already distributed, and if not add them
|
||||||
|
if (!hasPool(rootCompound)) {
|
||||||
|
// ok, we need new stats. Let the fun begin!
|
||||||
|
StatNBT data = new StatNBT();
|
||||||
|
|
||||||
|
int statPoints = 800; // we distribute a whopping X points worth of stats!
|
||||||
|
for (; statPoints > 0; statPoints--) {
|
||||||
|
switch (random.nextInt(3)) {
|
||||||
|
// durability
|
||||||
|
case 0:
|
||||||
|
data.durability += DURABILITY_STEP;
|
||||||
|
break;
|
||||||
|
// speed
|
||||||
|
case 1:
|
||||||
|
data.speed += SPEED_STEP;
|
||||||
|
break;
|
||||||
|
// attack
|
||||||
|
case 2:
|
||||||
|
data.attack += ATTACK_STEP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setPool(rootCompound, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.applyEffect(rootCompound, modifierTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||||
|
if (entity instanceof FakePlayer || entity.worldObj.isRemote) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// every 3.6 seconds we distribute one stat. This means 1h = 1000 applications
|
||||||
|
if (entity.ticksExisted % TICK_PER_STAT > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we don't update if the player is currently breaking a block because that'd reset it
|
||||||
|
if (playerIsBreakingBlock(entity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound root = TagUtil.getTagSafe(tool);
|
||||||
|
StatNBT distributed = getBonus(root);
|
||||||
|
ToolNBT data = TagUtil.getToolStats(tool);
|
||||||
|
|
||||||
|
// attack
|
||||||
|
if (entity.ticksExisted % (TICK_PER_STAT * 3) == 0) {
|
||||||
|
float A = ATTACK_STEP * random.nextFloat();
|
||||||
|
data.attack -= A;
|
||||||
|
distributed.attack -= A;
|
||||||
|
}
|
||||||
|
// speed
|
||||||
|
else if (entity.ticksExisted % (TICK_PER_STAT * 2) == 0) {
|
||||||
|
float S = SPEED_STEP * random.nextFloat();
|
||||||
|
data.speed -= S;
|
||||||
|
distributed.speed -= S;
|
||||||
|
}
|
||||||
|
// durability
|
||||||
|
else {
|
||||||
|
int D = random.nextInt(DURABILITY_STEP) + 1;
|
||||||
|
data.durability -= D;
|
||||||
|
distributed.durability -= D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update tool stats
|
||||||
|
TagUtil.setToolTag(root, data.get());
|
||||||
|
// update statistics on distributed stats
|
||||||
|
setBonus(root, distributed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getExtraInfo(ItemStack tool, NBTTagCompound modifierTag) {
|
||||||
|
StatNBT pool = getBonus(TagUtil.getTagSafe(tool));
|
||||||
|
|
||||||
|
return ImmutableList.of(HeadMaterialStats.formatDurability(pool.durability),
|
||||||
|
HeadMaterialStats.formatMiningSpeed(pool.speed),
|
||||||
|
HeadMaterialStats.formatAttack(pool.attack));
|
||||||
|
}
|
||||||
|
}
|
@@ -1,13 +1,12 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.entity.monster.EntityMob;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
@@ -21,22 +20,12 @@ public class TraitDiffuse extends AbstractTrait {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onXpDrop(LivingExperienceDropEvent event) {
|
|
||||||
EntityPlayer player = event.getAttackingPlayer();
|
|
||||||
if (!event.getEntity().getEntityWorld().isRemote && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
|
||||||
event.setDroppedExperience(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBlockBreak(BlockEvent.BreakEvent event) {
|
public void onBlockBreak(BlockEvent.BreakEvent event) {
|
||||||
EntityPlayer player = event.getPlayer();
|
EntityPlayer player = event.getPlayer();
|
||||||
if (!player.getEntityWorld().isRemote && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
if (!player.getEntityWorld().isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||||
event.setExpToDrop(this.getUpdateXP(event.getExpToDrop()));
|
event.setExpToDrop((int) this.getUpdateXP(event.getExpToDrop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -44,24 +33,23 @@ public class TraitDiffuse extends AbstractTrait {
|
|||||||
World w = event.getEntity().getEntityWorld();
|
World w = event.getEntity().getEntityWorld();
|
||||||
if (!w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
if (!w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||||
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
if (event.getEntity() instanceof EntityCreature && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getUpdateXP(int xp) {
|
private float getUpdateXP(int xp) {
|
||||||
float exp = (float) random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + random.nextInt(10));
|
float exp = random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + random.nextFloat() * xp);
|
||||||
if (random.nextBoolean())
|
if (random.nextFloat() <= 0.25)
|
||||||
return Math.round(exp);
|
return exp;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||||
if (random.nextFloat() < 0.75) {
|
if (random.nextFloat() < 0.35) {
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,17 +18,19 @@ public class TraitDissolving extends AbstractTrait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// high chance to remove XP, low chance to double,triple or quatruple dropped Experience
|
// high chance to remove XP, low chance to double,triple or quatruple dropped Experience
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onXpDrop(LivingExperienceDropEvent event) {
|
public void onXpDrop(LivingExperienceDropEvent event) {
|
||||||
if (!event.getEntity().getEntityWorld().isRemote) {
|
if (!event.getEntity().getEntityWorld().isRemote) {
|
||||||
EntityPlayer player = event.getAttackingPlayer();
|
EntityPlayer player = event.getAttackingPlayer();
|
||||||
float r = random.nextFloat();
|
float r = random.nextFloat();
|
||||||
if (r <= 0.75 && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||||
|
if (r <= 0.80) {
|
||||||
event.setDroppedExperience(0);
|
event.setDroppedExperience(0);
|
||||||
}
|
} else {
|
||||||
if (r > 0.95 && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
|
||||||
event.setDroppedExperience(event.getDroppedExperience() * (random.nextInt(3) + 2));
|
event.setDroppedExperience(event.getDroppedExperience() * (random.nextInt(3) + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -3,6 +3,7 @@ package com.sosnitzka.taiga.traits;
|
|||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
@@ -24,38 +25,42 @@ public class TraitFracture extends AbstractTrait {
|
|||||||
float b = 0.99F * calcBonus(tool);
|
float b = 0.99F * calcBonus(tool);
|
||||||
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
||||||
RayTraceResult mop = ((ToolCore) tool.getItem()).rayTrace(world, (EntityPlayer) player, false);
|
RayTraceResult mop = ((ToolCore) tool.getItem()).rayTrace(world, (EntityPlayer) player, false);
|
||||||
if (mop == null) return;
|
|
||||||
for (int i = random.nextInt(9) + 1; i >= 0; i--) {
|
for (int i = random.nextInt(9) + 1; i >= 0; i--) {
|
||||||
switch (mop.sideHit) {
|
switch (mop.sideHit) {
|
||||||
case UP:
|
case UP:
|
||||||
BlockPos next1 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ());
|
BlockPos next1 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ());
|
||||||
if (tool.canHarvestBlock(world.getBlockState(next1))) world.destroyBlock(next1, true);
|
if (tool.canHarvestBlock(world.getBlockState(next1)) && !world.getBlockState(next1).equals(Blocks.BEDROCK.getDefaultState()))
|
||||||
|
world.destroyBlock(next1, true);
|
||||||
break;
|
break;
|
||||||
case DOWN:
|
case DOWN:
|
||||||
BlockPos next2 = new BlockPos(pos.getX(), pos.getY() + i, pos.getZ());
|
BlockPos next2 = new BlockPos(pos.getX(), pos.getY() + i, pos.getZ());
|
||||||
if (tool.canHarvestBlock(world.getBlockState(next2))) world.destroyBlock(next2, true);
|
if (tool.canHarvestBlock(world.getBlockState(next2)) && !world.getBlockState(next2).equals(Blocks.BEDROCK.getDefaultState()))
|
||||||
|
world.destroyBlock(next2, true);
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
BlockPos next3 = new BlockPos(pos.getX() + i, pos.getY(), pos.getZ());
|
BlockPos next3 = new BlockPos(pos.getX() + i, pos.getY(), pos.getZ());
|
||||||
if (tool.canHarvestBlock(world.getBlockState(next3))) world.destroyBlock(next3, true);
|
if (tool.canHarvestBlock(world.getBlockState(next3)) && !world.getBlockState(next3).equals(Blocks.BEDROCK.getDefaultState()))
|
||||||
|
world.destroyBlock(next3, true);
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
BlockPos next4 = new BlockPos(pos.getX() - i, pos.getY(), pos.getZ());
|
BlockPos next4 = new BlockPos(pos.getX() - i, pos.getY(), pos.getZ());
|
||||||
if (tool.canHarvestBlock(world.getBlockState(next4))) world.destroyBlock(next4, true);
|
if (tool.canHarvestBlock(world.getBlockState(next4)) && !world.getBlockState(next4).equals(Blocks.BEDROCK.getDefaultState()))
|
||||||
|
world.destroyBlock(next4, true);
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
BlockPos next5 = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - i);
|
BlockPos next5 = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - i);
|
||||||
if (tool.canHarvestBlock(world.getBlockState(next5))) world.destroyBlock(next5, true);
|
if (tool.canHarvestBlock(world.getBlockState(next5)) && !world.getBlockState(next5).equals(Blocks.BEDROCK.getDefaultState()))
|
||||||
|
world.destroyBlock(next5, true);
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
BlockPos next6 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ() + i);
|
BlockPos next6 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ() + i);
|
||||||
if (tool.canHarvestBlock(world.getBlockState(next6))) world.destroyBlock(next6, true);
|
if (tool.canHarvestBlock(world.getBlockState(next6)) && !world.getBlockState(next6).equals(Blocks.BEDROCK.getDefaultState()))
|
||||||
|
world.destroyBlock(next6, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(5), player);
|
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(5), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private float calcBonus(ItemStack tool) {
|
private float calcBonus(ItemStack tool) {
|
||||||
|
@@ -24,6 +24,7 @@ public class TraitFragile extends AbstractTrait {
|
|||||||
float b = 0.99F * calcBonus(tool);
|
float b = 0.99F * calcBonus(tool);
|
||||||
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
||||||
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(3), player);
|
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(3), player);
|
||||||
|
else ToolHelper.healTool(tool, random.nextInt(3), player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float f = random.nextFloat();
|
float f = random.nextFloat();
|
||||||
@@ -40,22 +41,19 @@ public class TraitFragile extends AbstractTrait {
|
|||||||
if (r == 1) y += d;
|
if (r == 1) y += d;
|
||||||
if (r == 2) z += d;
|
if (r == 2) z += d;
|
||||||
BlockPos nextBlock = new BlockPos(x, y, z);
|
BlockPos nextBlock = new BlockPos(x, y, z);
|
||||||
int tn = (int) world.getWorldTime() + 5;
|
|
||||||
if (world.getBlockState(nextBlock) == world.getBlockState(pos)) {
|
if (world.getBlockState(nextBlock) == world.getBlockState(pos)) {
|
||||||
Block block = Blocks.STONE;
|
Block block = null;
|
||||||
int ib = random.nextInt(3);
|
int ib = random.nextInt(2);
|
||||||
switch (ib) {
|
switch (ib) {
|
||||||
case 0:
|
case 0:
|
||||||
block = Blocks.COBBLESTONE;
|
block = Blocks.COBBLESTONE;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
block = Blocks.MOSSY_COBBLESTONE;
|
if (random.nextFloat() <= 0.9) block = Blocks.GRAVEL;
|
||||||
break;
|
else block = Blocks.MOSSY_COBBLESTONE;
|
||||||
case 2:
|
|
||||||
block = Blocks.GRAVEL;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
f = random.nextFloat();
|
f = random.nextFloat();
|
||||||
|
assert block != null;
|
||||||
if (f < 0.85) {
|
if (f < 0.85) {
|
||||||
world.setBlockState(nextBlock, block.getDefaultState());
|
world.setBlockState(nextBlock, block.getDefaultState());
|
||||||
} else if (f > 95) {
|
} else if (f > 95) {
|
||||||
@@ -78,7 +76,6 @@ public class TraitFragile extends AbstractTrait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private float calcBonus(ItemStack tool) {
|
private float calcBonus(ItemStack tool) {
|
||||||
int durability = ToolHelper.getCurrentDurability(tool);
|
int durability = ToolHelper.getCurrentDurability(tool);
|
||||||
int maxDurability = ToolHelper.getMaxDurability(tool);
|
int maxDurability = ToolHelper.getMaxDurability(tool);
|
||||||
|
@@ -18,8 +18,6 @@ import slimeknights.tconstruct.library.utils.TagUtil;
|
|||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Items.*;
|
|
||||||
|
|
||||||
public class TraitGarishly extends AbstractTrait {
|
public class TraitGarishly extends AbstractTrait {
|
||||||
|
|
||||||
public TraitGarishly() {
|
public TraitGarishly() {
|
||||||
@@ -34,7 +32,7 @@ public class TraitGarishly extends AbstractTrait {
|
|||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||||
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||||
|
|
||||||
int r = random.nextInt(5);
|
int r = random.nextInt(2);
|
||||||
ItemStack i = null;
|
ItemStack i = null;
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -44,19 +42,10 @@ public class TraitGarishly extends AbstractTrait {
|
|||||||
i = new ItemStack(Items.BLAZE_ROD, random.nextInt(3));
|
i = new ItemStack(Items.BLAZE_ROD, random.nextInt(3));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
i = new ItemStack(glimmerstone_dust, random.nextInt(3));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
i = new ItemStack(luminar_dust, random.nextInt(3));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
i = new ItemStack(Items.COAL, random.nextInt(3));
|
i = new ItemStack(Items.COAL, random.nextInt(3));
|
||||||
break;
|
break;
|
||||||
case 5:
|
|
||||||
i = new ItemStack(lignite, random.nextInt(3));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
assert i != null;
|
||||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,9 +54,9 @@ public class TraitGarishly extends AbstractTrait {
|
|||||||
@Override
|
@Override
|
||||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||||
float r = random.nextFloat();
|
float r = random.nextFloat();
|
||||||
if (r > 0.5f) event.getDrops().clear();
|
if (random.nextBoolean()) event.getDrops().clear();
|
||||||
else if (r < 0.1 && event.getWorld().getBlockState(event.getPos()).getMaterial() == Material.ROCK) {
|
else if (r < 0.25 && event.getWorld().getBlockState(event.getPos()).getMaterial() == Material.ROCK) {
|
||||||
ItemStack stack = new ItemStack(Item.getItemFromBlock(event.getWorld().getBlockState(event.getPos()).getBlock()), random.nextInt(5));
|
@SuppressWarnings("ConstantConditions") ItemStack stack = new ItemStack(Item.getItemFromBlock(event.getWorld().getBlockState(event.getPos()).getBlock()), random.nextInt(3));
|
||||||
event.getDrops().add(0, stack);
|
event.getDrops().add(0, stack);
|
||||||
ToolHelper.damageTool(tool, random.nextInt(6) + 1, event.getHarvester());
|
ToolHelper.damageTool(tool, random.nextInt(6) + 1, event.getHarvester());
|
||||||
}
|
}
|
||||||
|
@@ -34,14 +34,14 @@ public class TraitGlimmer extends AbstractTrait {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||||
if (random.nextFloat() <= 0.08) {
|
if (random.nextFloat() <= 0.05) {
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||||
if (random.nextFloat() <= 0.08) {
|
if (random.nextFloat() <= 0.05) {
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,44 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
|
||||||
|
|
||||||
import com.sosnitzka.taiga.util.EntityAIPermanentPanic;
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.monster.*;
|
|
||||||
import net.minecraft.entity.passive.*;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
|
||||||
|
|
||||||
public class TraitHaunted extends AbstractTrait {
|
|
||||||
|
|
||||||
public TraitHaunted() {
|
|
||||||
super("haunted", TextFormatting.DARK_GRAY);
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Just several tested Vanilla-Mobs, e.g. no ghasts, bats or skeletons
|
|
||||||
@Override
|
|
||||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
|
||||||
int time = (int) player.getEntityWorld().getWorldTime();
|
|
||||||
if (random.nextFloat() <= 0.1 || (random.nextFloat() <= 0.3 && isNight(time)))
|
|
||||||
if (target instanceof EntityCow || target instanceof EntityZombie || target instanceof EntityWolf || target instanceof EntityPig || target instanceof EntitySpider ||
|
|
||||||
target instanceof EntityVillager || target instanceof EntitySheep || target instanceof EntityEnderman || target instanceof EntityEndermite ||
|
|
||||||
target instanceof EntityBlaze || target instanceof EntityWitch || target instanceof EntityHorse) {
|
|
||||||
((EntityLiving) target).tasks.taskEntries.clear();
|
|
||||||
((EntityLiving) target).targetTasks.taskEntries.clear();
|
|
||||||
((EntityLiving) target).tasks.addTask(0, new EntityAIPermanentPanic((EntityCreature) target, target.getAIMoveSpeed() + 3.5D));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNight(int time) {
|
|
||||||
if (time > 12500) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -16,9 +16,9 @@ public class TraitHeroic extends AbstractTrait {
|
|||||||
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||||
int durability = ToolHelper.getCurrentDurability(tool);
|
int durability = ToolHelper.getCurrentDurability(tool);
|
||||||
int durabilitymax = ToolHelper.getMaxDurability(tool);
|
int durabilitymax = ToolHelper.getMaxDurability(tool);
|
||||||
float calc = (float) (newDamage + (newDamage / 2) / (durability * durabilitymax / (durabilitymax - durability - 1)));
|
float calc = newDamage + (newDamage / 2) / (durability * durabilitymax / (durabilitymax - durability - 1));
|
||||||
if ((float) durability < (float) (0.10 * durabilitymax) || player.getHealth() < player.getMaxHealth() / 8 || (target.getHealth() == target.getMaxHealth() && random.nextFloat() > 0.8)) {
|
if ((float) durability < (float) (0.10 * durabilitymax) || player.getHealth() < player.getMaxHealth() / 8 || (target.getHealth() == target.getMaxHealth() && random.nextFloat() > 0.8)) {
|
||||||
return super.damage(tool, player, target, damage, calc, isCritical);
|
return super.damage(tool, player, target, damage, calc, isCritical);
|
||||||
} else return super.damage(tool, player, target, damage, newDamage, isCritical);
|
} else return super.damage(tool, player, target, damage, newDamage * 0.9f, isCritical);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,8 @@ import slimeknights.tconstruct.library.traits.AbstractTrait;
|
|||||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.isNight;
|
||||||
|
|
||||||
public class TraitHollow extends AbstractTrait {
|
public class TraitHollow extends AbstractTrait {
|
||||||
|
|
||||||
public TraitHollow() {
|
public TraitHollow() {
|
||||||
@@ -26,10 +28,10 @@ public class TraitHollow extends AbstractTrait {
|
|||||||
@Override
|
@Override
|
||||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
||||||
int time = (int) player.getEntityWorld().getWorldTime();
|
int time = (int) player.getEntityWorld().getWorldTime();
|
||||||
if (random.nextFloat() <= 0.2 || (random.nextFloat() <= 0.2 && isNight(time))) {
|
if (random.nextFloat() <= 0.01 || (random.nextFloat() <= 0.03 && isNight(time))) {
|
||||||
((EntityLiving) target).setNoAI(true);
|
((EntityLiving) target).setNoAI(true);
|
||||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
if (target.getMaxHealth() < 200) {
|
if (target.getMaxHealth() < 250) {
|
||||||
target.setHealth(target.getMaxHealth() * (1.8f - random.nextFloat() * 0.4f));
|
target.setHealth(target.getMaxHealth() * (1.8f - random.nextFloat() * 0.4f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,12 +47,4 @@ public class TraitHollow extends AbstractTrait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNight(int time) {
|
|
||||||
if (time > 12500) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ public class TraitInstable extends AbstractTrait {
|
|||||||
explode(world, player, pos.getX(), pos.getY(), pos.getZ());
|
explode(world, player, pos.getX(), pos.getY(), pos.getZ());
|
||||||
} else explode(world, null, pos.getX(), pos.getY(), pos.getZ());
|
} else explode(world, null, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
ToolHelper.damageTool(tool, 11 + random.nextInt(10), null);
|
ToolHelper.damageTool(tool, random.nextInt(10) + 2, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,23 +49,23 @@ public class TraitInstable extends AbstractTrait {
|
|||||||
explode(player.getEntityWorld(), player, pos.getX(), pos.getY(), pos.getZ());
|
explode(player.getEntityWorld(), player, pos.getX(), pos.getY(), pos.getZ());
|
||||||
} else explode(player.getEntityWorld(), target, pos.getX(), pos.getY(), pos.getZ());
|
} else explode(player.getEntityWorld(), target, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
ToolHelper.damageTool(tool, 3 + random.nextInt(18), null);
|
ToolHelper.damageTool(tool, 2 + random.nextInt(10), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMobDrops(LivingDropsEvent event) {
|
public void onMobDrops(LivingDropsEvent event) {
|
||||||
World w = event.getEntity().getEntityWorld();
|
World w = event.getEntity().getEntityWorld();
|
||||||
if (!w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
if (random.nextFloat() < 0.05 && !w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||||
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||||
ItemStack i = new ItemStack(Items.GUNPOWDER, random.nextInt(4));
|
ItemStack i = new ItemStack(Items.GUNPOWDER, random.nextInt(2));
|
||||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void explode(World w, Entity e, double x, double y, double z) {
|
private void explode(World w, Entity e, double x, double y, double z) {
|
||||||
w.newExplosion(e, x, y, z, 1.2f + random.nextFloat() * 35, random.nextBoolean(), true);
|
w.newExplosion(e, x, y, z, 1.2f + random.nextFloat() * 5, random.nextBoolean(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,31 +2,34 @@ package com.sosnitzka.taiga.traits;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Robert on 03.06.2016.
|
|
||||||
*/
|
|
||||||
public class TraitMelting extends AbstractTrait {
|
public class TraitMelting extends AbstractTrait {
|
||||||
|
|
||||||
public TraitMelting() {
|
public TraitMelting() {
|
||||||
super("melting", TextFormatting.YELLOW);
|
super("melting", TextFormatting.YELLOW);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
@SubscribeEvent
|
||||||
float r = random.nextFloat();
|
public void blockbreak(BlockEvent.BreakEvent e) {
|
||||||
Block b = event.getWorld().getBlockState(event.getPos()).getBlock();
|
Block b = e.getWorld().getBlockState(e.getPos()).getBlock();
|
||||||
if (r <= 0.01 && (b == Blocks.STONE || b == Blocks.COBBLESTONE || b == Blocks.NETHERRACK)) {
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(e.getPlayer().getHeldItemMainhand()), identifier)) {
|
||||||
event.getWorld().setBlockState(event.getPos(), Blocks.LAVA.getDefaultState());
|
if (!e.getWorld().isRemote && random.nextFloat() <= 0.025 && (b == Blocks.STONE || b == Blocks.COBBLESTONE || b == Blocks.NETHERRACK || b == Blocks.OBSIDIAN)) {
|
||||||
|
e.setCanceled(true);
|
||||||
|
e.getWorld().setBlockState(e.getPos(), Blocks.LAVA.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,26 +1,17 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.SoundEvents;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.DamageSource;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
|
||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
|
|
||||||
public class TraitNatureBound extends AbstractTrait {
|
public class TraitNatureBound extends AbstractTrait {
|
||||||
public static DamageSource splinter = new DamageSource("splinter").setDamageBypassesArmor();
|
|
||||||
private static int chance = 20;
|
|
||||||
|
|
||||||
public TraitNatureBound() {
|
public TraitNatureBound() {
|
||||||
super("naturebound", TextFormatting.GREEN);
|
super("naturebound", TextFormatting.GREEN);
|
||||||
@@ -29,30 +20,19 @@ public class TraitNatureBound extends AbstractTrait {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onToolHeal(ItemStack tool, int amount, int newAmount, EntityLivingBase entity) {
|
public int onToolHeal(ItemStack tool, int amount, int newAmount, EntityLivingBase entity) {
|
||||||
// 5% less durability repaired!
|
// 10% less durability repaired!
|
||||||
return newAmount - amount * 5 / 100;
|
return newAmount - amount * 10 / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
|
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||||
// * 20 because 20 ticks in a second
|
// * 20 because 20 ticks in a second
|
||||||
if (!world.isRemote && entity instanceof EntityLivingBase && random.nextInt(30 * chance) == 0) {
|
int chance = 20 * 20;
|
||||||
ToolHelper.healTool(tool, random.nextInt(9) + 1, (EntityLivingBase) entity);
|
Material m = world.getBlockState(entity.getPosition().down()).getMaterial();
|
||||||
}
|
if (!world.isRemote && entity instanceof EntityLivingBase && random.nextInt(chance) == 0) {
|
||||||
|
if (m.equals(Material.GRASS) || m.equals(Material.LEAVES)) {
|
||||||
}
|
ToolHelper.healTool(tool, random.nextInt(2) + 1, (EntityLivingBase) entity);
|
||||||
|
} else ToolHelper.damageTool(tool, 1, (EntityLivingBase) entity);
|
||||||
@SubscribeEvent
|
|
||||||
public void onBlockBreak(BlockEvent.BreakEvent e) {
|
|
||||||
Block b = e.getWorld().getBlockState(e.getPos()).getBlock();
|
|
||||||
if (!e.getWorld().isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(e.getPlayer().getHeldItemMainhand()), identifier) && random.nextFloat() <= .07 && (b == Blocks.DIRT || b == Blocks.GRASS || b == Blocks.LOG || b == Blocks.LOG2 || b == Blocks.STONE)) {
|
|
||||||
e.setCanceled(true);
|
|
||||||
e.getPlayer().playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
|
||||||
|
|
||||||
public class TraitOrganizing extends AbstractTrait {
|
|
||||||
|
|
||||||
private static final float chance = 0.02f;
|
|
||||||
|
|
||||||
public TraitOrganizing() {
|
|
||||||
super("organizing", TextFormatting.GREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
|
||||||
if (!world.isRemote && (state.getMaterial() == Material.ROCK) && random.nextFloat() < chance) {
|
|
||||||
world.setBlockState(pos, Blocks.LOG.getDefaultState());
|
|
||||||
ToolHelper.healTool(tool, random.nextInt(5), player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
67
src/main/java/com/sosnitzka/taiga/traits/TraitPorted.java
Normal file
67
src/main/java/com/sosnitzka/taiga/traits/TraitPorted.java
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitPorted extends AbstractTrait {
|
||||||
|
public static int distance = 10;
|
||||||
|
|
||||||
|
public TraitPorted() {
|
||||||
|
super("ported", TextFormatting.DARK_PURPLE);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemRightClick(PlayerInteractEvent.RightClickItem e) {
|
||||||
|
ItemStack tool = e.getEntityPlayer().getHeldItemMainhand();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier))
|
||||||
|
teleport(e.getEntityPlayer(), e.getWorld());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||||
|
if (random.nextFloat() <= 0.005) {
|
||||||
|
player.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
|
teleport(player, world);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||||
|
if (random.nextFloat() <= 0.005) {
|
||||||
|
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||||
|
teleport(player, player.getEntityWorld());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void teleport(EntityLivingBase e, World w) {
|
||||||
|
BlockPos tPos = new BlockPos(e.getPosition().up(distance));
|
||||||
|
if (e.getPosition().getY() >= 128) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!w.getBlockState(tPos).equals(Blocks.AIR.getDefaultState()) && tPos.getY() <= 128) {
|
||||||
|
tPos = tPos.up();
|
||||||
|
}
|
||||||
|
if (!w.getBlockState(tPos).equals(Blocks.AIR.getDefaultState())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.setPosition(tPos.getX(), tPos.getY(), tPos.getZ());
|
||||||
|
ToolHelper.damageTool(e.getHeldItemMainhand(), ToolHelper.getCurrentDurability(e.getHeldItemMainhand()) / 2 + 1, e);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,115 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import slimeknights.tconstruct.library.modifiers.ModifierNBT;
|
||||||
|
import slimeknights.tconstruct.library.tools.ToolNBT;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for tools that progressively gain/award stats.
|
||||||
|
* The modifier persists 2 different stat-data on the tool:
|
||||||
|
* - A 'pool' of stats to award
|
||||||
|
* - A 'bonus' of already awarded stats
|
||||||
|
* <p>
|
||||||
|
* The modifier reapplies the 'bonus' stats on application.
|
||||||
|
* The pool is not touched inheritly but only provided for the logic of the deriving trait.
|
||||||
|
*/
|
||||||
|
public abstract class TraitProgressiveStats extends AbstractTrait {
|
||||||
|
|
||||||
|
protected final String pool_key; // Key to the tag that contains the free unassigned
|
||||||
|
protected final String applied_key; // Key to the tag that contains the already applied bonus stats
|
||||||
|
|
||||||
|
public TraitProgressiveStats(String identifier, TextFormatting color) {
|
||||||
|
super(identifier, color);
|
||||||
|
|
||||||
|
pool_key = identifier + "StatPool";
|
||||||
|
applied_key = identifier + "StatBonus";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TraitProgressiveStats(String identifier, int color) {
|
||||||
|
super(identifier, color);
|
||||||
|
|
||||||
|
pool_key = identifier + "StatPool";
|
||||||
|
applied_key = identifier + "StatBonus";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modifier management */
|
||||||
|
|
||||||
|
protected static StatNBT getStats(NBTTagCompound root, String key) {
|
||||||
|
return ModifierNBT.readTag(TagUtil.getTagSafe(TagUtil.getExtraTag(root), key), StatNBT.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void setStats(NBTTagCompound root, StatNBT data, String key) {
|
||||||
|
NBTTagCompound extra = TagUtil.getExtraTag(root);
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
data.write(tag);
|
||||||
|
extra.setTag(key, tag);
|
||||||
|
TagUtil.setExtraTag(root, extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
|
||||||
|
super.applyEffect(rootCompound, modifierTag);
|
||||||
|
// called on tool loading only
|
||||||
|
// we just apply the saved bonus stats
|
||||||
|
ToolNBT data = TagUtil.getToolStats(rootCompound);
|
||||||
|
StatNBT bonus = getBonus(rootCompound);
|
||||||
|
|
||||||
|
data.durability += bonus.durability;
|
||||||
|
data.speed += bonus.speed;
|
||||||
|
data.attack += bonus.attack;
|
||||||
|
|
||||||
|
TagUtil.setToolTag(rootCompound, data.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean hasPool(NBTTagCompound root) {
|
||||||
|
return TagUtil.getExtraTag(root).hasKey(pool_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected StatNBT getPool(NBTTagCompound root) {
|
||||||
|
return getStats(root, pool_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setPool(NBTTagCompound root, StatNBT data) {
|
||||||
|
setStats(root, data, pool_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected StatNBT getBonus(NBTTagCompound root) {
|
||||||
|
return getStats(root, applied_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setBonus(NBTTagCompound root, StatNBT data) {
|
||||||
|
setStats(root, data, applied_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean playerIsBreakingBlock(Entity entity) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class StatNBT extends ModifierNBT {
|
||||||
|
|
||||||
|
// statpool
|
||||||
|
public int durability;
|
||||||
|
public float attack;
|
||||||
|
public float speed;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(NBTTagCompound tag) {
|
||||||
|
super.read(tag);
|
||||||
|
durability = tag.getInteger("durability");
|
||||||
|
attack = tag.getFloat("attack");
|
||||||
|
speed = tag.getFloat("speed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(NBTTagCompound tag) {
|
||||||
|
super.write(tag);
|
||||||
|
tag.setInteger("durability", durability);
|
||||||
|
tag.setFloat("attack", attack);
|
||||||
|
tag.setFloat("speed", speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -16,24 +16,21 @@ public class TraitPulverizing extends AbstractTrait {
|
|||||||
@Override
|
@Override
|
||||||
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
|
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
|
||||||
if (ToolHelper.isToolEffective2(tool, event.getState())) {
|
if (ToolHelper.isToolEffective2(tool, event.getState())) {
|
||||||
event.setNewSpeed((float) (event.getNewSpeed() + calcBonus(tool)));
|
event.setNewSpeed((float) (event.getNewSpeed() * calcBonus(tool)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double calcBonus(ItemStack tool) {
|
private double calcBonus(ItemStack tool) {
|
||||||
int durability = ToolHelper.getCurrentDurability(tool);
|
int durability = ToolHelper.getCurrentDurability(tool);
|
||||||
int maxDurability = ToolHelper.getMaxDurability(tool);
|
int maxDurability = ToolHelper.getMaxDurability(tool);
|
||||||
float speed = ToolHelper.getMiningSpeedStat(tool);
|
return (1 + .9f * (maxDurability - durability) / maxDurability);
|
||||||
tool.setItemDamage(tool.getItemDamage() + 1);
|
// Min 1.0; Max 1.9
|
||||||
return speed * (maxDurability - maxDurability / 10) / (durability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||||
if (random.nextFloat() < 0.9) {
|
if (random.nextFloat() < 0.9) {
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,175 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
|
||||||
import net.minecraft.entity.monster.*;
|
|
||||||
import net.minecraft.entity.passive.*;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.SoundEvents;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
|
||||||
import slimeknights.tconstruct.world.entity.EntityBlueSlime;
|
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Blocks.*;
|
|
||||||
import static slimeknights.tconstruct.shared.TinkerCommons.oreArdite;
|
|
||||||
import static slimeknights.tconstruct.shared.TinkerCommons.oreCobalt;
|
|
||||||
|
|
||||||
public class TraitRandomize extends AbstractTrait {
|
|
||||||
|
|
||||||
public TraitRandomize() {
|
|
||||||
super("randomize", TextFormatting.DARK_RED);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
|
|
||||||
if (ToolHelper.isToolEffective2(tool, event.getState())) {
|
|
||||||
event.setNewSpeed((float) (event.getNewSpeed() + random.nextFloat() * 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
|
||||||
if (random.nextFloat() <= .15 && target instanceof EntityLiving) {
|
|
||||||
World w = player.getEntityWorld();
|
|
||||||
Entity e = new EntityCow(w);
|
|
||||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
|
||||||
if (!w.isRemote) {
|
|
||||||
int i = random.nextInt(22);
|
|
||||||
switch (i) {
|
|
||||||
case 0:
|
|
||||||
e = new EntityCow(w);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
e = new EntityPig(w);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
e = new EntityHorse(w);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
e = new EntityChicken(w);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
e = new EntityVillager(w);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
e = new EntityEnderman(w);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
e = new EntityPolarBear(w);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
e = new EntityIronGolem(w);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
e = new EntitySilverfish(w);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
e = new EntityCaveSpider(w);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
e = new EntityWolf(w);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
e = new EntityWitch(w);
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
e = new EntityTNTPrimed(w);
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
e = new EntityGhast(w);
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
e = new EntitySpider(w);
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
e = new EntitySkeleton(w);
|
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
e = new EntityMagmaCube(w);
|
|
||||||
break;
|
|
||||||
case 17:
|
|
||||||
e = new EntitySlime(w);
|
|
||||||
break;
|
|
||||||
case 18:
|
|
||||||
e = new EntityBlueSlime(w);
|
|
||||||
break;
|
|
||||||
case 19:
|
|
||||||
e = new EntityBat(w);
|
|
||||||
break;
|
|
||||||
case 20:
|
|
||||||
e = new EntityPigZombie(w);
|
|
||||||
break;
|
|
||||||
case 21:
|
|
||||||
e = new EntityBlaze(w);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
e.setPosition(target.getPosition().getX(), target.getPosition().getY() + 0.1f, target.getPosition().getZ());
|
|
||||||
e.setCustomNameTag("Missingno");
|
|
||||||
((EntityLiving) e).setHealth(((EntityLiving) e).getHealth() * (random.nextInt(5) + 1));
|
|
||||||
w.spawnEntityInWorld(e);
|
|
||||||
target.setDead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
|
||||||
float r = random.nextFloat();
|
|
||||||
if (r > 0.95f) event.getDrops().clear();
|
|
||||||
if (event.getDrops() != null) {
|
|
||||||
if (r < 0.4f && (event.getDrops().get(0).getItem() == Item.getItemFromBlock(Blocks.IRON_ORE) || event.getDrops().get(0).getItem() == Item.getItemFromBlock(Blocks.GOLD_ORE))) {
|
|
||||||
ItemStack change = new ItemStack(Item.getItemFromBlock(Blocks.IRON_ORE));
|
|
||||||
int i = random.nextInt(12);
|
|
||||||
switch (i) {
|
|
||||||
case 0:
|
|
||||||
change = new ItemStack(Item.getItemFromBlock(Blocks.GOLD_ORE));
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
change = new ItemStack(Item.getItemFromBlock(Blocks.REDSTONE_ORE));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
change = new ItemStack(Item.getItemFromBlock(Blocks.LAPIS_ORE));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
change = new ItemStack(Item.getItemFromBlock(Blocks.DIAMOND_ORE));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
change = new ItemStack(Item.getItemFromBlock(Blocks.QUARTZ_ORE));
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
change = new ItemStack(oreCobalt.getItem());
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
change = new ItemStack(oreArdite.getItem());
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
change = new ItemStack(titaniteOre);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
change = new ItemStack(bismuthOre);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
change = new ItemStack(tiberiumOre);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
change = new ItemStack(eterniteOre);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
change = new ItemStack(Item.getItemFromBlock(Blocks.IRON_ORE));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
event.getDrops().set(0, change);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -8,19 +8,19 @@ import slimeknights.tconstruct.library.traits.AbstractTrait;
|
|||||||
public class TraitResonance extends AbstractTrait {
|
public class TraitResonance extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
|
public static float chance = 0.33f;
|
||||||
|
|
||||||
public TraitResonance() {
|
public TraitResonance() {
|
||||||
super("resonance", TextFormatting.AQUA);
|
super("resonance", TextFormatting.AQUA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||||
if (random.nextFloat() <= .33) {
|
if (random.nextFloat() <= chance) {
|
||||||
target.knockBack(target, random.nextFloat() * random.nextFloat() * 12, player.posX - target.posX, player.posZ - target.posZ);
|
target.knockBack(target, random.nextFloat() * random.nextFloat() * 10, player.posX - target.posX, player.posZ - target.posZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.monster.EntitySkeleton;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -16,14 +15,13 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Robert on 03.06.2016.
|
|
||||||
*/
|
|
||||||
public class TraitReviving extends AbstractTrait {
|
public class TraitReviving extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
|
public final float chance = 0.15f;
|
||||||
|
|
||||||
public TraitReviving() {
|
public TraitReviving() {
|
||||||
super("reviving", TextFormatting.DARK_PURPLE);
|
super("reviving", TextFormatting.DARK_PURPLE);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
@@ -35,38 +33,19 @@ public class TraitReviving extends AbstractTrait {
|
|||||||
World w = e.getEntity().getEntityWorld();
|
World w = e.getEntity().getEntityWorld();
|
||||||
if (!w.isRemote && e.getSource().getEntity() != null) {
|
if (!w.isRemote && e.getSource().getEntity() != null) {
|
||||||
if (e.getSource().getEntity() instanceof EntityPlayer && e.getEntity() instanceof EntityCreature) {
|
if (e.getSource().getEntity() instanceof EntityPlayer && e.getEntity() instanceof EntityCreature) {
|
||||||
if (isNight((int) w.getWorldTime()) && random.nextFloat() > 0.85 && TinkerUtil.hasTrait(TagUtil.getTagSafe(((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand()), identifier)) {
|
if (random.nextFloat() <= chance && TinkerUtil.hasTrait(TagUtil.getTagSafe(((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand()), identifier)) {
|
||||||
String name = EntityList.getEntityString(e.getEntity());
|
String name = EntityList.getEntityString(e.getEntity());
|
||||||
Entity ent = EntityList.createEntityByName(name, w);
|
Entity ent = EntityList.createEntityByName(name, w);
|
||||||
|
if (ent != null) {
|
||||||
|
if (ent instanceof EntitySkeleton && e.getEntity() instanceof EntitySkeleton) {
|
||||||
|
((EntitySkeleton) ent).setSkeletonType(((EntitySkeleton) e.getEntity()).getSkeletonType());
|
||||||
|
}
|
||||||
ent.setPosition(pos.getX(), pos.getY(), pos.getZ());
|
ent.setPosition(pos.getX(), pos.getY(), pos.getZ());
|
||||||
w.spawnEntityInWorld(ent);
|
w.spawnEntityInWorld(ent);
|
||||||
|
e.getSource().getEntity().playSound(SoundEvents.AMBIENT_CAVE, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
|
||||||
int time = (int) world.getWorldTime();
|
|
||||||
if (random.nextFloat() <= 0.1 && isNight(time)) {
|
|
||||||
ToolHelper.healTool(tool, random.nextInt(15) + 1, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
|
||||||
int time = (int) player.getEntityWorld().getWorldTime();
|
|
||||||
if (random.nextFloat() <= 0.1 && isNight(time)) {
|
|
||||||
ToolHelper.healTool(tool, random.nextInt(15) + 1, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isNight(int time) {
|
|
||||||
if (time > 12500) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,11 +29,8 @@ public class TraitSlaughtering extends AbstractTrait {
|
|||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||||
if (!w.isRemote && event.getEntity() instanceof EntityLiving && !(event.getEntity() instanceof EntityPlayer) && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
if (!w.isRemote && event.getEntity() instanceof EntityLiving && !(event.getEntity() instanceof EntityPlayer) && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||||
Item i = event.getDrops().get(random.nextInt(event.getDrops().size())).getEntityItem().getItem();
|
Item i = event.getDrops().get(random.nextInt(event.getDrops().size())).getEntityItem().getItem();
|
||||||
if (i != null) {
|
|
||||||
event.getDrops().add(new EntityItem(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(i, random.nextInt(4) + 1)));
|
event.getDrops().add(new EntityItem(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(i, random.nextInt(4) + 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@@ -1,33 +1,52 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
public class TraitSofty extends AbstractTrait {
|
public class TraitSofty extends AbstractTrait {
|
||||||
private static final float chance = 0.2f;
|
|
||||||
|
private static final float chance = 0.1f;
|
||||||
|
private static final float speedmulti = 1.3f;
|
||||||
|
|
||||||
public TraitSofty() {
|
public TraitSofty() {
|
||||||
super("softy", TextFormatting.AQUA);
|
super("softy", TextFormatting.GRAY);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void blockbreak(BlockEvent.BreakEvent e) {
|
||||||
|
float r = random.nextFloat();
|
||||||
|
float hardness = e.getWorld().getBlockState(e.getPos()).getBlockHardness(e.getWorld(), e.getPos());
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(e.getPlayer().getHeldItemMainhand()), identifier)) {
|
||||||
|
if (!e.getWorld().isRemote && r <= chance && hardness >= 1.0f) {
|
||||||
|
e.setCanceled(true);
|
||||||
|
ToolHelper.damageTool(e.getPlayer().getHeldItemMainhand(), random.nextInt(3) + 1, e.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
|
||||||
if (!world.isRemote && state.getMaterial().equals(Material.GROUND) && random.nextFloat() < chance) {
|
World w = event.getEntity().getEntityWorld();
|
||||||
ToolHelper.healTool(tool, random.nextInt(10), player);
|
IBlockState state = w.getBlockState(event.getPos());
|
||||||
|
float speed = event.getOriginalSpeed();
|
||||||
|
if (!w.isRemote) {
|
||||||
|
if (state.getBlockHardness(w, event.getPos()) <= 1.0f) {
|
||||||
|
event.setNewSpeed(speed * speedmulti);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
70
src/main/java/com/sosnitzka/taiga/traits/TraitSoulEater.java
Normal file
70
src/main/java/com/sosnitzka/taiga/traits/TraitSoulEater.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitSoulEater extends AbstractTrait {
|
||||||
|
|
||||||
|
private static float divisor = 20000f;
|
||||||
|
|
||||||
|
public TraitSoulEater() {
|
||||||
|
super(TraitSoulEater.class.getSimpleName().toLowerCase().substring(5), TextFormatting.RED);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onTargetKilled(LivingDeathEvent event) {
|
||||||
|
if (event.getSource().getEntity() instanceof EntityPlayer && event.getEntity() instanceof EntityLiving) {
|
||||||
|
World w = event.getSource().getEntity().worldObj;
|
||||||
|
ItemStack tool = ((EntityPlayer) event.getSource().getEntity()).getHeldItemMainhand();
|
||||||
|
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
float health = ((EntityLiving) event.getEntity()).getMaxHealth();
|
||||||
|
data.killcount += 1;
|
||||||
|
data.health = health;
|
||||||
|
float bonus = Math.round(random.nextFloat() * health * 100) / divisor;
|
||||||
|
data.bonus += bonus;
|
||||||
|
data.bonus = (float) Math.round(data.bonus * 100f) / 100f;
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
float bonus = data.bonus;
|
||||||
|
return newDamage + bonus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemTooltip(ItemTooltipEvent e) {
|
||||||
|
ItemStack tool = e.getItemStack();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (data.killcount != 0) {
|
||||||
|
e.getToolTip().add(TextFormatting.WHITE + "Killed: " + TextFormatting.WHITE + data.killcount);
|
||||||
|
e.getToolTip().add(TextFormatting.WHITE + "Bonus: " + TextFormatting.WHITE + data.bonus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
105
src/main/java/com/sosnitzka/taiga/traits/TraitTantrum.java
Normal file
105
src/main/java/com/sosnitzka/taiga/traits/TraitTantrum.java
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.common.Sounds;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.Blocks.tiberiumOre;
|
||||||
|
|
||||||
|
public class TraitTantrum extends AbstractTrait {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Collects tiberium, to release it for an explosion
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static float max_charges = 12f;
|
||||||
|
public static float max_power = 5;
|
||||||
|
|
||||||
|
public TraitTantrum() {
|
||||||
|
super("tantrum", TextFormatting.RED);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||||
|
World w = event.getWorld();
|
||||||
|
if (!w.isRemote) {
|
||||||
|
if (event.getState().getBlock().equals(tiberiumOre)) {
|
||||||
|
event.getDrops().clear();
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Data data = Data.read(tag);
|
||||||
|
if (data.amount >= max_charges) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data.amount += (0.25f + Utils.round2(random.nextDouble() / 4));
|
||||||
|
if (data.amount >= max_charges) {
|
||||||
|
TagUtil.setEnchantEffect(tool, true);
|
||||||
|
if (event.getHarvester() instanceof EntityPlayerMP) {
|
||||||
|
Sounds.PlaySoundForPlayer(event.getHarvester(), Sounds.shocking_discharge, 1f, 0.8f + .2f * random.nextFloat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void RightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||||
|
World w = event.getWorld();
|
||||||
|
BlockPos pos = event.getPos();
|
||||||
|
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||||
|
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Data data = Data.read(tag);
|
||||||
|
if (data.amount > 1f) {
|
||||||
|
double d = Math.min(Utils.round2(random.nextDouble() * data.amount), max_power);
|
||||||
|
w.newExplosion(event.getEntityPlayer(), pos.getX(), pos.getY(), pos.getZ(), (float) Math.pow((double) 1.2f, d), false, true);
|
||||||
|
data.amount -= d;
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
TagUtil.setEnchantEffect(tool, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemTooltip(ItemTooltipEvent e) {
|
||||||
|
ItemStack tool = e.getItemStack();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Data data = Data.read(tag);
|
||||||
|
e.getToolTip().add(TextFormatting.RED + "Charge: " + data.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
|
||||||
|
float amount;
|
||||||
|
|
||||||
|
public static Data read(NBTTagCompound tag) {
|
||||||
|
Data data = new Data();
|
||||||
|
data.amount = tag.getFloat("amount");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(NBTTagCompound tag) {
|
||||||
|
tag.setFloat("amount", amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
17
src/main/java/com/sosnitzka/taiga/traits/TraitTemplate.java
Normal file
17
src/main/java/com/sosnitzka/taiga/traits/TraitTemplate.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitTemplate extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
|
public TraitTemplate() {
|
||||||
|
super(TraitTemplate.class.getSimpleName().toLowerCase().substring(5), TextFormatting.RED);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,16 +1,49 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.entity.EntityCreature;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
|
||||||
|
|
||||||
public class TraitTraditional extends AbstractTrait {
|
public class TraitTraditional extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
public TraitTraditional() {
|
public TraitTraditional() {
|
||||||
super("traditional", TextFormatting.GREEN);
|
super("traditional", 0xff33ff);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityKill(LivingDeathEvent e) {
|
||||||
|
World w = e.getEntity().getEntityWorld();
|
||||||
|
if (!w.isRemote && e.getSource().getEntity() instanceof EntityPlayer && e.getEntity() instanceof EntityCreature) {
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand()), identifier)) {
|
||||||
|
String name = EntityList.getEntityString(e.getEntity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
|
||||||
|
String mobname;
|
||||||
|
|
||||||
|
public static Data read(NBTTagCompound tag) {
|
||||||
|
Data data = new Data();
|
||||||
|
data.mobname = tag.getString("mob");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(NBTTagCompound tag) {
|
||||||
|
tag.setString("amount", mobname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,78 +1,15 @@
|
|||||||
package com.sosnitzka.taiga.traits;
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.monster.EntityMob;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
|
||||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
|
||||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Items.glimmerstone_dust;
|
|
||||||
import static com.sosnitzka.taiga.Items.tiberiumShardStable;
|
|
||||||
|
|
||||||
|
|
||||||
public class TraitUncertain extends AbstractTrait {
|
public class TraitUncertain extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
public TraitUncertain() {
|
public TraitUncertain() {
|
||||||
super("uncertain", TextFormatting.RED);
|
super(TraitUncertain.class.getName().toLowerCase().substring(4), TextFormatting.RED);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
|
||||||
if (random.nextFloat() <= 0.05) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
if (random.nextFloat() > 0.1f) {
|
|
||||||
explode(world, player, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
} else explode(world, null, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
ToolHelper.damageTool(tool, random.nextInt(5) + 1, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onMobDrops(LivingDropsEvent event) {
|
|
||||||
World w = event.getEntity().getEntityWorld();
|
|
||||||
if (!w.isRemote && event.getSource().getEntity() instanceof EntityPlayer) {
|
|
||||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
|
||||||
if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
|
||||||
ItemStack i = new ItemStack(Items.COAL, random.nextInt(4));
|
|
||||||
if (random.nextBoolean()) {
|
|
||||||
int r = random.nextInt(4);
|
|
||||||
switch (r) {
|
|
||||||
case 0:
|
|
||||||
i = new ItemStack(Items.GUNPOWDER, random.nextInt(4));
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
i = new ItemStack(tiberiumShardStable, random.nextInt(4));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
i = new ItemStack(tiberiumShardStable, random.nextInt(4));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
i = new ItemStack(glimmerstone_dust, random.nextInt(4));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void explode(World w, Entity e, double x, double y, double z) {
|
|
||||||
w.newExplosion(e, x, y, z, 1.2f + random.nextFloat() * 5, random.nextBoolean(), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
17
src/main/java/com/sosnitzka/taiga/traits/TraitVortex.java
Normal file
17
src/main/java/com/sosnitzka/taiga/traits/TraitVortex.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitVortex extends AbstractTrait {
|
||||||
|
|
||||||
|
|
||||||
|
public TraitVortex() {
|
||||||
|
super(TraitVortex.class.getSimpleName().toLowerCase().substring(5), TextFormatting.DARK_PURPLE);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
98
src/main/java/com/sosnitzka/taiga/traits/TraitWhirl.java
Normal file
98
src/main/java/com/sosnitzka/taiga/traits/TraitWhirl.java
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
package com.sosnitzka.taiga.traits;
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.util.Utils;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||||
|
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||||
|
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraitWhirl extends AbstractTrait {
|
||||||
|
|
||||||
|
protected static int TICK_PER_STAT = 36;
|
||||||
|
|
||||||
|
public TraitWhirl() {
|
||||||
|
super(TraitWhirl.class.getSimpleName().toLowerCase().substring(5), TextFormatting.DARK_BLUE);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||||
|
|
||||||
|
if (entity instanceof FakePlayer || entity.worldObj.isRemote) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.ticksExisted % TICK_PER_STAT > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
data.radius += random.nextFloat() * 0.5f;
|
||||||
|
if (data.radius >= 1) {
|
||||||
|
TagUtil.setEnchantEffect(tool, true);
|
||||||
|
}
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||||
|
World w = event.getWorld();
|
||||||
|
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||||
|
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if ((int) data.radius >= 1) {
|
||||||
|
int r = Math.min((int) data.radius, 8);
|
||||||
|
for (int x = -r; x <= r; x++) {
|
||||||
|
for (int y = -r; y <= r; y++) {
|
||||||
|
for (int z = -r; z <= r; z++) {
|
||||||
|
if (MathHelper.sqrt_double(x * x + y * y + z * z) > r) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BlockPos nPos = new BlockPos(event.getPos().getX() + x, event.getPos().getY() + y, event.getPos().getZ() + z);
|
||||||
|
if (!(event.getWorld().getBlockState(nPos).equals(Blocks.WATER.getDefaultState()) || event.getWorld().getBlockState(nPos).equals(Blocks.FLOWING_WATER.getDefaultState())))
|
||||||
|
continue;
|
||||||
|
event.getWorld().destroyBlock(nPos, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.radius -= r;
|
||||||
|
data.write(tag);
|
||||||
|
TagUtil.setExtraTag(tool, tag);
|
||||||
|
TagUtil.setEnchantEffect(tool, false);
|
||||||
|
ToolHelper.damageTool(tool, 2 * r, event.getEntityPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemTooltip(ItemTooltipEvent e) {
|
||||||
|
ItemStack tool = e.getItemStack();
|
||||||
|
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||||
|
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||||
|
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||||
|
if (data.radius > 0) {
|
||||||
|
e.getToolTip().add(TextFormatting.BLUE + "Actual Radius: " + TextFormatting.WHITE + Math.round(data.radius * 100) / 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -13,7 +13,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public class EntityAIPermanentPanic extends EntityAIBase {
|
public class EntityAIPermanentPanic extends EntityAIBase {
|
||||||
private EntityCreature theEntityCreature;
|
private EntityCreature theEntityCreature;
|
||||||
protected double speed;
|
private double speed;
|
||||||
private double randPosX;
|
private double randPosX;
|
||||||
private double randPosY;
|
private double randPosY;
|
||||||
private double randPosZ;
|
private double randPosZ;
|
||||||
|
@@ -1,31 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.util;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fml.common.IFuelHandler;
|
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Items.*;
|
|
||||||
import static slimeknights.tconstruct.TConstruct.random;
|
|
||||||
|
|
||||||
public class FuelHandler implements IFuelHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBurnTime(ItemStack fuel) {
|
|
||||||
if (fuel.getItem().equals(lignite)) {
|
|
||||||
return 200 * 6;
|
|
||||||
}
|
|
||||||
if (fuel.getItem().equals(lignite2)) {
|
|
||||||
return 200 * 4;
|
|
||||||
}
|
|
||||||
if (fuel.getItem().equals(lignite3)) {
|
|
||||||
return 200 * 8;
|
|
||||||
}
|
|
||||||
if (fuel.getItem().equals(fuel_brick)) {
|
|
||||||
return 200 * 16;
|
|
||||||
}
|
|
||||||
if (fuel.getItem().equals(glimmercoal)) {
|
|
||||||
return (random.nextInt(32) + 32) * 200;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,41 +1,214 @@
|
|||||||
package com.sosnitzka.taiga.util;
|
package com.sosnitzka.taiga.util;
|
||||||
|
|
||||||
import com.sosnitzka.taiga.world.ZWorldGenMinable;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.sosnitzka.taiga.world.MeteorWorldSaveData;
|
||||||
|
import com.sosnitzka.taiga.world.WorldGenMinable;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.util.Utils.nextInt;
|
||||||
|
|
||||||
public class Generator {
|
public class Generator {
|
||||||
|
|
||||||
public static void generateOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
public static void generateOre(boolean center, IBlockState state, IBlockState replace, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||||
generateOre(state, Blocks.STONE.getDefaultState(), null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
if (center) {
|
||||||
|
generateOreDense(state, replace, random, x, z, world, chance, minY, maxY, minSize, maxSize, null);
|
||||||
|
} else {
|
||||||
|
generateOre(state, replace, null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateNetherOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
|
||||||
generateOre(state, Blocks.NETHERRACK.getDefaultState(), null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void generateEndOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
public static void generateOre(IBlockState state, IBlockState replace, IProperty property, Comparable comparable, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize, List<Biome> biome) {
|
||||||
generateOre(state, Blocks.END_STONE.getDefaultState(), null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void generateOre(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
|
||||||
generateOre(state, replace, null, null, random, chunkX, chunkZ, world, chance, minY, maxY, minSize, maxSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void generateOre(IBlockState state, IBlockState replace, IProperty property, Comparable comparable, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
|
||||||
int size = minSize + random.nextInt(maxSize - minSize);
|
int size = minSize + random.nextInt(maxSize - minSize);
|
||||||
int height = maxY - minY;
|
int height = maxY - minY;
|
||||||
|
|
||||||
for (int i = 0; i < chance; i++) {
|
for (int i = 0; i < chance; i++) {
|
||||||
int posX = chunkX + random.nextInt(16);
|
int posX = chunkX + random.nextInt(16);
|
||||||
int posY = random.nextInt(height) + minY;
|
int posY = random.nextInt(height) + minY;
|
||||||
int posZ = chunkZ + random.nextInt(16);
|
int posZ = chunkZ + random.nextInt(16);
|
||||||
new ZWorldGenMinable(state, size, StateMatcher.forState(replace, property, comparable)).generate(world, random, new BlockPos(posX, posY, posZ));
|
BlockPos cPos = new BlockPos(posX, posY, posZ);
|
||||||
|
if (biome == null || biome.contains(world.getBiome(cPos))) {
|
||||||
|
new WorldGenMinable(state, size, StateMatcher.forState(replace, property, comparable)).generate(world, random, new BlockPos(posX, posY, posZ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateOreDescending(List<IBlockState> replaceBlockList, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int count, int minY, int maxY, int chance) {
|
||||||
|
if (random.nextFloat() < (float) (0.01 * chance))
|
||||||
|
generateOreDescending(replaceBlockList, replacementBlock, random, chunkX, chunkZ, world, count, minY, maxY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void generateOreDescending(List<IBlockState> replaceBlockList, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int count, int minY, int maxY) {
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
int posX = chunkX + random.nextInt(16);
|
||||||
|
int posZ = chunkZ + random.nextInt(16);
|
||||||
|
BlockPos cPos = new BlockPos(posX, maxY, posZ);
|
||||||
|
if (replaceBlockList.contains(world.getBlockState(cPos)) && replaceBlockList.contains(world.getBlockState(cPos.up()))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (replaceBlockList.contains(world.getBlockState(cPos)) && !replaceBlockList.contains(world.getBlockState(cPos.up())))
|
||||||
|
world.setBlockState(cPos, replacementBlock);
|
||||||
|
while (!replaceBlockList.contains(world.getBlockState(cPos.down())) && cPos.getY() > minY) {
|
||||||
|
cPos = cPos.down();
|
||||||
|
}
|
||||||
|
if (replaceBlockList.contains(world.getBlockState(cPos.down())))
|
||||||
|
world.setBlockState(cPos.down(), replacementBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateOreBottom(IBlockState replacedBlock, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int chance, int spread, int maxY) {
|
||||||
|
for (int i = 0; i < chance; i++) {
|
||||||
|
int posX = chunkX + random.nextInt(16);
|
||||||
|
int posY = 0;
|
||||||
|
int posZ = chunkZ + random.nextInt(16);
|
||||||
|
BlockPos cPos = new BlockPos(posX, posY, posZ);
|
||||||
|
if (Blocks.AIR.getDefaultState().equals(world.getBlockState(cPos))) {
|
||||||
|
while (world.getBlockState(cPos).equals(Blocks.AIR.getDefaultState()) && cPos.getY() < maxY) {
|
||||||
|
cPos = cPos.up();
|
||||||
|
}
|
||||||
|
if (world.getBlockState(cPos).equals(replacedBlock)) {
|
||||||
|
world.setBlockState(cPos.up(random.nextInt(spread)), replacementBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateCube(boolean fly, IBlockState centerBlock, IBlockState hullBlock, Random random, int chunkX, int chunkZ, World world, int count, int chance, int minY, int maxY, int maxS) {
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
if (random.nextFloat() < 0.01 * chance) {
|
||||||
|
int outer = nextInt(random, 1, maxS);
|
||||||
|
int inner = random.nextInt(2);
|
||||||
|
int posX = chunkX + random.nextInt(16);
|
||||||
|
int posY = nextInt(random, minY, maxY);
|
||||||
|
int posZ = chunkZ + random.nextInt(16);
|
||||||
|
BlockPos cPos = new BlockPos(posX, posY, posZ);
|
||||||
|
if (!fly) {
|
||||||
|
if (world.getBlockState(cPos).equals(Blocks.AIR.getDefaultState()) && world.getBlockState(cPos.down()).equals(Blocks.AIR.getDefaultState())) {
|
||||||
|
// we are in mid air, go down
|
||||||
|
while (world.getBlockState(cPos.down()).equals(Blocks.AIR.getDefaultState())) {
|
||||||
|
cPos = cPos.down();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cPos.down((random.nextInt(4) + 2) * outer);
|
||||||
|
for (int x = -inner; x <= inner; x++) {
|
||||||
|
for (int y = -inner; y <= inner; y++) {
|
||||||
|
for (int z = -inner; z <= inner; z++) {
|
||||||
|
if (!world.getBlockState(cPos).equals(Blocks.AIR.getDefaultState()))
|
||||||
|
continue;
|
||||||
|
world.setBlockState(new BlockPos(cPos.getX() + x, cPos.getY() + y, cPos.getZ() + z), centerBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int x = -outer; x <= outer; x++) {
|
||||||
|
for (int y = -outer; y <= outer; y++) {
|
||||||
|
for (int z = -outer; z <= outer; z++) {
|
||||||
|
BlockPos nPos = new BlockPos(cPos.getX() + x, cPos.getY() + y, cPos.getZ() + z);
|
||||||
|
if (world.getBlockState(nPos).equals(centerBlock) || !world.getBlockState(nPos).equals(Blocks.AIR.getDefaultState()))
|
||||||
|
continue;
|
||||||
|
world.setBlockState(nPos, hullBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void generateMeteor(IBlockState centerBlock, IBlockState hullBlock, Random random, int chunkX, int chunkZ, World world, int count, int chance, int minY, int maxY) {
|
||||||
|
Set<Item> validSurface = new HashSet<Item>();
|
||||||
|
List<String> oredictentries = Lists.newArrayList("dirt", "grass", "stone", "sand", "gravel", "cobblestone", "sandstone");
|
||||||
|
for (String e : oredictentries) {
|
||||||
|
for (ItemStack stack : OreDictionary.getOres(e)) {
|
||||||
|
validSurface.add(stack.getItem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
if (random.nextFloat() < 0.01 * chance) {
|
||||||
|
int r = nextInt(random, 1, 5);
|
||||||
|
int posX = chunkX + random.nextInt(16);
|
||||||
|
int posY = nextInt(random, minY, maxY);
|
||||||
|
int posZ = chunkZ + random.nextInt(16);
|
||||||
|
BlockPos cPos = new BlockPos(posX, posY, posZ);
|
||||||
|
if (world.getBlockState(cPos).equals(Blocks.AIR.getDefaultState()) && world.getBlockState(cPos.down()).equals(Blocks.AIR.getDefaultState())) {
|
||||||
|
// we are in mid air, go down
|
||||||
|
while (world.getBlockState(cPos.down()).equals(Blocks.AIR.getDefaultState())) {
|
||||||
|
cPos = cPos.down();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!validSurface.contains(Item.getItemFromBlock(world.getBlockState(cPos.down()).getBlock())))
|
||||||
|
continue;
|
||||||
|
cPos.down((random.nextInt(3) + 1) * r);
|
||||||
|
|
||||||
|
MeteorWorldSaveData saveData = MeteorWorldSaveData.getForWorld(world);
|
||||||
|
saveData.addPos(cPos);
|
||||||
|
saveData.markDirty();
|
||||||
|
|
||||||
|
int t = 1;
|
||||||
|
if (r > 3) t = random.nextInt(r - 1);
|
||||||
|
for (int x = -t; x <= t; x++) {
|
||||||
|
for (int y = -t; y <= t; y++) {
|
||||||
|
for (int z = -t; z <= t; z++) {
|
||||||
|
if (MathHelper.sqrt_double(x * x + y * y + z * z) > t) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
world.setBlockState(new BlockPos(cPos.getX() + x, cPos.getY() + y, cPos.getZ() + z), centerBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int x = -r; x <= r; x++) {
|
||||||
|
for (int y = -r; y <= r; y++) {
|
||||||
|
for (int z = -r; z <= r; z++) {
|
||||||
|
if (MathHelper.sqrt_double(x * x + y * y + z * z) > r) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BlockPos nPos = new BlockPos(cPos.getX() + x, cPos.getY() + y, cPos.getZ() + z);
|
||||||
|
if (world.getBlockState(nPos).equals(centerBlock))
|
||||||
|
continue;
|
||||||
|
world.setBlockState(nPos, hullBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void generateOreDense(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize, List<Biome> biome) {
|
||||||
|
int size = minSize + random.nextInt(maxSize - minSize);
|
||||||
|
int height = maxY - minY;
|
||||||
|
BlockPos cPos;
|
||||||
|
for (int i = 0; i < chance; i += 5) {
|
||||||
|
for (int j = 0; j <= 2; j++) {
|
||||||
|
cPos = new BlockPos(chunkX + random.nextInt(16), minY + height * j / 5 + random.nextInt(height * 3 / 5), chunkZ + random.nextInt(16));
|
||||||
|
if (biome == null || biome.contains(world.getBiome(cPos))) {
|
||||||
|
new WorldGenMinable(state, size, StateMatcher.forState(replace, null, null)).generate(world, random, cPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int j = 0; j <= 1; j++) {
|
||||||
|
int x = chunkX + random.nextInt(16);
|
||||||
|
int y = chunkZ + random.nextInt(16);
|
||||||
|
cPos = new BlockPos(x, minY + height * 4 / 9 + random.nextInt(height / 9), y);
|
||||||
|
if (biome == null || biome.contains(world.getBiome(cPos))) {
|
||||||
|
new WorldGenMinable(state, size, StateMatcher.forState(replace, null, null)).generate(world, random, cPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ public class StateMatcher implements Predicate<IBlockState> {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StateMatcher forState(IBlockState state, IProperty property, Comparable value) {
|
static StateMatcher forState(IBlockState state, IProperty property, Comparable value) {
|
||||||
return new StateMatcher(state, property, value);
|
return new StateMatcher(state, property, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +64,6 @@ public class StateMatcher implements Predicate<IBlockState> {
|
|||||||
|
|
||||||
IBlockState bState = world.getBlockState(blockPos);
|
IBlockState bState = world.getBlockState(blockPos);
|
||||||
if (bState.getBlock() == this.state.getBlock() && bState.getValue(property) == value) {
|
if (bState.getBlock() == this.state.getBlock() && bState.getValue(property) == value) {
|
||||||
// Check if a replacable block is near origin block - show pos in console
|
|
||||||
// System.out.println(String.format("Found block with desired state! (%s), Block: %s, try #%s, y=%s", i, Y));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,73 +1,149 @@
|
|||||||
package com.sosnitzka.taiga.util;
|
package com.sosnitzka.taiga.util;
|
||||||
|
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.Items;
|
||||||
|
import com.sosnitzka.taiga.TAIGA;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import slimeknights.tconstruct.library.MaterialIntegration;
|
||||||
|
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||||
|
import slimeknights.tconstruct.library.materials.*;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.TAIGA.proxy;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
public static String PREFIX_INGOT = "ingot";
|
public static String PREFIX_INGOT = "ingot";
|
||||||
public static String PREFIX_NUGGET = "nugget";
|
public static String PREFIX_NUGGET = "nugget";
|
||||||
public static String PREFIX_ORE = "ore";
|
public static String PREFIX_ORE = "ore";
|
||||||
public static String PREFIX_BLOCK = "block";
|
public static String PREFIX_BLOCK = "block";
|
||||||
|
public static String PREFIX_DUST = "dust";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the block and its corresponding item (block as item in inventory)
|
||||||
|
*
|
||||||
|
* @param block the associated block
|
||||||
|
*/
|
||||||
public static void registerBlockWithItem(Block block) {
|
public static void registerBlockWithItem(Block block) {
|
||||||
GameRegistry.register(block);
|
GameRegistry.register(block);
|
||||||
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the fluid and its bucket item
|
||||||
|
*
|
||||||
|
* @param fluid the fluid
|
||||||
|
*/
|
||||||
public static void registerFluid(Fluid fluid) {
|
public static void registerFluid(Fluid fluid) {
|
||||||
FluidRegistry.registerFluid(fluid);
|
FluidRegistry.registerFluid(fluid);
|
||||||
FluidRegistry.addBucketForFluid(fluid);
|
FluidRegistry.addBucketForFluid(fluid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerTinkerAlloys(Fluid alloy, int out, Fluid first, int inOne, Fluid second, int inTwo) {
|
|
||||||
NBTTagList tagList = new NBTTagList();
|
|
||||||
NBTTagCompound fluid = new NBTTagCompound();
|
|
||||||
fluid.setString("FluidName", alloy.getName());
|
|
||||||
fluid.setInteger("Amount", out);
|
|
||||||
tagList.appendTag(fluid);
|
|
||||||
fluid = new NBTTagCompound();
|
|
||||||
fluid.setString("FluidName", first.getName());
|
|
||||||
fluid.setInteger("Amount", inOne);
|
|
||||||
tagList.appendTag(fluid);
|
|
||||||
fluid = new NBTTagCompound();
|
|
||||||
fluid.setString("FluidName", second.getName());
|
|
||||||
fluid.setInteger("Amount", inTwo);
|
|
||||||
tagList.appendTag(fluid);
|
|
||||||
|
|
||||||
NBTTagCompound message = new NBTTagCompound();
|
public static void registerTinkerAlloy(FluidStack output, FluidStack... inputs) {
|
||||||
message.setTag("alloy", tagList);
|
if (inputs.length >= 2 && output != null) {
|
||||||
FMLInterModComms.sendMessage("tconstruct", "alloy", message);
|
TinkerRegistry.registerAlloy(output, inputs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void registerTinkerAlloys(Fluid alloy, int out, Fluid first, int inOne, Fluid second, int inTwo, Fluid third, int inThree) {
|
|
||||||
NBTTagList tagList = new NBTTagList();
|
public static boolean isNight(int time) {
|
||||||
NBTTagCompound fluid = new NBTTagCompound();
|
return time > 12500;
|
||||||
fluid.setString("FluidName", alloy.getName());
|
}
|
||||||
fluid.setInteger("Amount", out);
|
|
||||||
tagList.appendTag(fluid);
|
public static double round2(double d) {
|
||||||
fluid = new NBTTagCompound();
|
return (Math.round(d * 100.0) / 100.0);
|
||||||
fluid.setString("FluidName", first.getName());
|
}
|
||||||
fluid.setInteger("Amount", inOne);
|
|
||||||
tagList.appendTag(fluid);
|
public static void integrateMaterial(String oreSuffix, @Nullable Material material, Fluid fluid, int headDura, float headSpeed, float headAttack, float handleMod, int handleDura, int extra, int headLevel, float draw, float range, int bdamage) {
|
||||||
fluid = new NBTTagCompound();
|
integrateMaterial(oreSuffix, material, fluid, headDura, headSpeed, headAttack, handleMod, handleDura, extra, headLevel, new BowMaterialStats(draw, range, bdamage), false, true);
|
||||||
fluid.setString("FluidName", second.getName());
|
}
|
||||||
fluid.setInteger("Amount", inTwo);
|
|
||||||
tagList.appendTag(fluid);
|
public static void integrateMaterial(String oreSuffix, @Nullable Material material, Fluid fluid, int headDura, float headSpeed, float headAttack, float handleMod, int handleDura, int extra, int headLevel, BowMaterialStats bowstats) {
|
||||||
fluid = new NBTTagCompound();
|
integrateMaterial(oreSuffix, material, fluid, headDura, headSpeed, headAttack, handleMod, handleDura, extra, headLevel, bowstats, false, true);
|
||||||
fluid.setString("FluidName", third.getName());
|
}
|
||||||
fluid.setInteger("Amount", inThree);
|
|
||||||
tagList.appendTag(fluid);
|
public static void integrateMaterial(String oreSuffix, @Nullable Material material, Fluid fluid, int headDura, float headSpeed, float headAttack, float handleMod, int handleDura, int extra, int headLevel, BowMaterialStats bowstats, boolean craft, boolean cast) {
|
||||||
|
if (material != null) {
|
||||||
NBTTagCompound message = new NBTTagCompound();
|
if (TinkerRegistry.getMaterial(material.identifier) != Material.UNKNOWN)
|
||||||
message.setTag("alloy", tagList);
|
return;
|
||||||
FMLInterModComms.sendMessage("tconstruct", "alloy", message);
|
|
||||||
|
TinkerRegistry.addMaterialStats(material, new HeadMaterialStats(headDura, headSpeed, headAttack, headLevel));
|
||||||
|
TinkerRegistry.addMaterialStats(material, new HandleMaterialStats(handleMod, handleDura));
|
||||||
|
TinkerRegistry.addMaterialStats(material, new ExtraMaterialStats(extra));
|
||||||
|
TinkerRegistry.addMaterialStats(material, bowstats);
|
||||||
|
|
||||||
|
Item item = null;
|
||||||
|
Field[] items = Items.class.getDeclaredFields();
|
||||||
|
for (Field i : items) {
|
||||||
|
if (i.getName().equals(StringUtils.uncapitalize(oreSuffix) + "Ingot")) {
|
||||||
|
Item r = null;
|
||||||
|
try {
|
||||||
|
r = (Item) i.get(i.getType());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
item = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
material.setFluid(fluid).setCraftable(craft).setCastable(cast).addItem(item, 1, Material.VALUE_Ingot);
|
||||||
|
material.setRepresentativeItem(item);
|
||||||
|
proxy.setRenderInfo(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIntegration integration = new MaterialIntegration(material, fluid, oreSuffix);
|
||||||
|
integration.integrate();
|
||||||
|
TAIGA.integrateList.add(integration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void integrateOre(String oreSuffix, Fluid fluid) {
|
||||||
|
integrateMaterial(oreSuffix, null, fluid, -1, -1, -1, -1, -1, -1, -1, new BowMaterialStats(0.1f, 0.1f, -1f), true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int nextInt(Random random, int min, int max) {
|
||||||
|
return random.nextInt((max - min) + 1) + min;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GeneralNBTData {
|
||||||
|
|
||||||
|
public int killcount;
|
||||||
|
public float health;
|
||||||
|
public int brokenblocks;
|
||||||
|
public float bonus;
|
||||||
|
public int curse;
|
||||||
|
public String name;
|
||||||
|
public float radius;
|
||||||
|
|
||||||
|
public static GeneralNBTData read(NBTTagCompound tag) {
|
||||||
|
GeneralNBTData data = new GeneralNBTData();
|
||||||
|
data.killcount = tag.getInteger("killcount");
|
||||||
|
data.brokenblocks = tag.getInteger("brokenblocks");
|
||||||
|
data.health = tag.getFloat("health");
|
||||||
|
data.bonus = tag.getFloat("bonus");
|
||||||
|
data.curse = tag.getInteger("curse");
|
||||||
|
data.name = tag.getString("name");
|
||||||
|
data.radius = tag.getFloat("radius");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(NBTTagCompound tag) {
|
||||||
|
tag.setInteger("killcount", killcount);
|
||||||
|
tag.setInteger("brokenblocks", brokenblocks);
|
||||||
|
tag.setFloat("health", health);
|
||||||
|
tag.setFloat("bonus", bonus);
|
||||||
|
tag.setInteger("curse", curse);
|
||||||
|
tag.setString("name", name);
|
||||||
|
tag.setFloat("radius", radius);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,64 @@
|
|||||||
|
package com.sosnitzka.taiga.world;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldSavedData;
|
||||||
|
import net.minecraft.world.storage.MapStorage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.sosnitzka.taiga.TAIGA.MODID;
|
||||||
|
|
||||||
|
public class MeteorWorldSaveData extends WorldSavedData {
|
||||||
|
private static final String DATA_NAME = MODID + "_meteors";
|
||||||
|
private List<BlockPos> posList;
|
||||||
|
|
||||||
|
public MeteorWorldSaveData() {
|
||||||
|
super(DATA_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MeteorWorldSaveData getForWorld(World world) {
|
||||||
|
MapStorage storage = world.getPerWorldStorage();
|
||||||
|
MeteorWorldSaveData instance = (MeteorWorldSaveData) storage.getOrLoadData(MeteorWorldSaveData.class, DATA_NAME);
|
||||||
|
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new MeteorWorldSaveData();
|
||||||
|
storage.setData(DATA_NAME, instance);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockPos> getPosList() {
|
||||||
|
return posList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPos(BlockPos pos) {
|
||||||
|
if (posList == null)
|
||||||
|
posList = new ArrayList<BlockPos>();
|
||||||
|
|
||||||
|
posList.add(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removePos(BlockPos pos) {
|
||||||
|
return posList != null && posList.remove(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
if (nbt.hasKey("posData")) {
|
||||||
|
posList = new Gson().fromJson(nbt.getString("posData"), posList.getClass());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||||
|
if (posList == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
compound.setString("posData", new Gson().toJson(posList));
|
||||||
|
return compound;
|
||||||
|
}
|
||||||
|
}
|
71
src/main/java/com/sosnitzka/taiga/world/WorldGen.java
Normal file
71
src/main/java/com/sosnitzka/taiga/world/WorldGen.java
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
package com.sosnitzka.taiga.world;
|
||||||
|
|
||||||
|
|
||||||
|
import com.sosnitzka.taiga.util.Generator;
|
||||||
|
import net.minecraft.block.BlockStone;
|
||||||
|
import net.minecraft.init.Biomes;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.IChunkGenerator;
|
||||||
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static com.google.common.collect.Lists.newArrayList;
|
||||||
|
import static com.sosnitzka.taiga.Blocks.*;
|
||||||
|
import static com.sosnitzka.taiga.TAIGAConfiguration.ironGen;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public class WorldGen implements IWorldGenerator {
|
||||||
|
private void nether(Random random, int x, int z, World world) {
|
||||||
|
|
||||||
|
Generator.generateOre(false, Blocks.NETHERRACK.getDefaultState(), tiberiumOre.getDefaultState(), random, x, z, world, 15, 0, 128, 10, 35);
|
||||||
|
Generator.generateOre(true, Blocks.NETHERRACK.getDefaultState(), prometheumOre.getDefaultState(), random, x, z, world, 25, 0, 128, 2, 4);
|
||||||
|
Generator.generateOre(true, Blocks.NETHERRACK.getDefaultState(), valyriumOre.getDefaultState(), random, x, z, world, 10, 0, 32, 2, 4);
|
||||||
|
Generator.generateOreDescending(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), osramOre.getDefaultState(), random, x, z, world, 1, 0, 64, 5);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void world(Random random, int x, int z, World world) {
|
||||||
|
// Optional
|
||||||
|
if (!ironGen) {
|
||||||
|
Generator.generateOre(false, Blocks.STONE.getDefaultState(), Blocks.IRON_ORE.getDefaultState(), random, x, z, world, 20, 0, 128, 1, 8);
|
||||||
|
}
|
||||||
|
Generator.generateMeteor(duraniteOre.getDefaultState(), blockMeteorite.getDefaultState(), random, x, z, world, 1, 4, 16, 112);
|
||||||
|
Generator.generateOreDescending(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), basaltBlock.getDefaultState(), random, x, z, world, 10, 0, 64);
|
||||||
|
Generator.generateOreDescending(newArrayList(Blocks.BEDROCK.getDefaultState()), eezoOre.getDefaultState(), random, x, z, world, 3, 0, 10);
|
||||||
|
Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, 15, 0, 96, 3, 4, null);
|
||||||
|
Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, 15, 0, 96, 3, 4, null);
|
||||||
|
Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, 15, 0, 96, 3, 4, null);
|
||||||
|
Generator.generateOreDense(vibraniumOre.getDefaultState(), Blocks.STONE.getDefaultState(), random, x, z, world, 10, 0, 64, 2, 12, newArrayList(Biomes.DESERT_HILLS, Biomes.EXTREME_HILLS, Biomes.EXTREME_HILLS_EDGE, Biomes.EXTREME_HILLS_WITH_TREES, Biomes.DESERT));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void end(Random random, int x, int z, World world) {
|
||||||
|
Generator.generateCube(true, uruOre.getDefaultState(), blockObsidiorite.getDefaultState(), random, x, z, world, 1, 2, 0, 96, 3);
|
||||||
|
Generator.generateOre(Blocks.END_STONE.getDefaultState(), Blocks.AIR.getDefaultState(), null, null, random, x, z, world, 1, 3, 64, 3, 8, null);
|
||||||
|
Generator.generateOre(false, Blocks.END_STONE.getDefaultState(), auroriumOre.getDefaultState(), random, x, z, world, 10, 32, 48, 2, 4);
|
||||||
|
Generator.generateOre(true, Blocks.END_STONE.getDefaultState(), palladiumOre.getDefaultState(), random, x, z, world, 10, 48, 64, 2, 4);
|
||||||
|
Generator.generateOreBottom(Blocks.END_STONE.getDefaultState(), abyssumOre.getDefaultState(), random, x, z, world, 12, 4, 64);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
|
||||||
|
int x = chunkX * 16;
|
||||||
|
int z = chunkZ * 16;
|
||||||
|
switch (world.provider.getDimension()) {
|
||||||
|
case -1:
|
||||||
|
nether(random, x, z, world);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
world(random, x, z, world);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
end(random, x, z, world);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
world(random, x, z, world);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -8,11 +8,11 @@ import net.minecraft.init.Blocks;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ZWorldGenMinable extends WorldGenMinable {
|
public class WorldGenMinable extends net.minecraft.world.gen.feature.WorldGenMinable {
|
||||||
private final IBlockState oreBlock;
|
private final IBlockState oreBlock;
|
||||||
/**
|
/**
|
||||||
* The number of com.sosnitzka.taiga.blocks to generate.
|
* The number of com.sosnitzka.taiga.blocks to generate.
|
||||||
@@ -20,11 +20,11 @@ public class ZWorldGenMinable extends WorldGenMinable {
|
|||||||
private final int numberOfBlocks;
|
private final int numberOfBlocks;
|
||||||
private final Predicate<IBlockState> predicate;
|
private final Predicate<IBlockState> predicate;
|
||||||
|
|
||||||
public ZWorldGenMinable(IBlockState state, int blockCount) {
|
public WorldGenMinable(IBlockState state, int blockCount) {
|
||||||
this(state, blockCount, BlockMatcher.forBlock(Blocks.STONE));
|
this(state, blockCount, BlockMatcher.forBlock(Blocks.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZWorldGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> predicate) {
|
public WorldGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> predicate) {
|
||||||
super(state, blockCount, predicate);
|
super(state, blockCount, predicate);
|
||||||
this.oreBlock = state;
|
this.oreBlock = state;
|
||||||
this.numberOfBlocks = blockCount;
|
this.numberOfBlocks = blockCount;
|
||||||
@@ -32,6 +32,7 @@ public class ZWorldGenMinable extends WorldGenMinable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public boolean generate(World worldIn, Random rand, BlockPos position) {
|
public boolean generate(World worldIn, Random rand, BlockPos position) {
|
||||||
float f = rand.nextFloat() * (float) Math.PI;
|
float f = rand.nextFloat() * (float) Math.PI;
|
||||||
double d0 = (double) ((float) (position.getX() + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
|
double d0 = (double) ((float) (position.getX() + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
|
@@ -1,67 +0,0 @@
|
|||||||
package com.sosnitzka.taiga.world;
|
|
||||||
|
|
||||||
import com.sosnitzka.taiga.util.Generator;
|
|
||||||
import net.minecraft.block.BlockStone;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.chunk.IChunkGenerator;
|
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
|
||||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import static com.sosnitzka.taiga.Blocks.*;
|
|
||||||
|
|
||||||
public class ZWorldGen implements IWorldGenerator {
|
|
||||||
private void nether(Random random, int x, int z, World world) {
|
|
||||||
Generator.generateNetherOre(adamantiteOre.getDefaultState(), random, x, z, world, 30, 1, 32, 2, 8);
|
|
||||||
Generator.generateNetherOre(tiberiumOre.getDefaultState(), random, x, z, world, 20, 1, 128, 7, 15);
|
|
||||||
Generator.generateNetherOre(palladiumOre.getDefaultState(), random, x, z, world, 30, 32, 64, 2, 7);
|
|
||||||
Generator.generateNetherOre(prometheumOre.getDefaultState(), random, x, z, world, 30, 32, 64, 2, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void world(Random random, int x, int z, World world) {
|
|
||||||
Generator.generateOre(slagironOre.getDefaultState(), random, x, z, world, 45, 8, 96, 5, 12);
|
|
||||||
Generator.generateOre(slaggoldOre.getDefaultState(), random, x, z, world, 30, 8, 48, 4, 8);
|
|
||||||
Generator.generateOre(ligniteOre.getDefaultState(), random, x, z, world, 30, 8, 96, 5, 12);
|
|
||||||
Generator.generateOre(Blocks.IRON_ORE.getDefaultState(), random, x, z, world, 40, 8, 96, 2, 8);
|
|
||||||
Generator.generateOre(basalt.getDefaultState(), Blocks.LAVA.getDefaultState(), random, x, z, world, 100, 8, 24, 2, 5);
|
|
||||||
Generator.generateOre(rottenGround.getDefaultState(), Blocks.DIRT.getDefaultState(), random, x, z, world, 25, 50, 70, 2, 15);
|
|
||||||
|
|
||||||
Generator.generateOre(vibraniumOre.getDefaultState(), random, x, z, world, 30, 48, 64, 2, 8);
|
|
||||||
Generator.generateOre(karmesineOre.getDefaultState(), random, x, z, world, 35, 16, 48, 2, 7);
|
|
||||||
Generator.generateOre(bismuthOre.getDefaultState(), random, x, z, world, 60, 50, 130, 2, 4);
|
|
||||||
Generator.generateOre(mythrilOre.getDefaultState(), random, x, z, world, 33, 16, 32, 2, 8);
|
|
||||||
Generator.generateOre(meteoriteOre.getDefaultState(), random, x, z, world, 10, 0, 32, 2, 25);
|
|
||||||
Generator.generateOre(mindoriteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, 150, 16, 96, 2, 8);
|
|
||||||
Generator.generateOre(arcaniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, 150, 16, 96, 2, 8);
|
|
||||||
Generator.generateOre(eterniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, 150, 16, 96, 2, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void end(Random random, int x, int z, World world) {
|
|
||||||
|
|
||||||
Generator.generateEndOre(rubiumOre.getDefaultState(), random, x, z, world, 18, 10, 35, 2, 8);
|
|
||||||
Generator.generateEndOre(ignititeOre.getDefaultState(), random, x, z, world, 18, 20, 45, 2, 8);
|
|
||||||
Generator.generateEndOre(violiumOre.getDefaultState(), random, x, z, world, 18, 30, 55, 2, 8);
|
|
||||||
Generator.generateEndOre(titaniteOre.getDefaultState(), random, x, z, world, 18, 40, 65, 2, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
|
|
||||||
IChunkProvider chunkProvider) {
|
|
||||||
int x = chunkX * 16;
|
|
||||||
int z = chunkZ * 16;
|
|
||||||
switch (world.provider.getDimension()) {
|
|
||||||
case -1:
|
|
||||||
nether(random, x, z, world);
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
world(random, x, z, world);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
end(random, x, z, world);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/abyssum"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
18
src/main/resources/assets/taiga/blockstates/abyssum_ore.json
Normal file
18
src/main/resources/assets/taiga/blockstates/abyssum_ore.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/ore/abyssum"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/adamant"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:adamantite_block"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:adamantite_ore"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:aegisalt_block"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:arcanite_block"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:arcanite_ore"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +1,18 @@
|
|||||||
{
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/astrium"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"normal": {
|
"normal": [
|
||||||
"model": "taiga:astrium_block"
|
{}
|
||||||
}
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/aurorium"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/ore/aurorium"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:basalt"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/basalt"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:bismuth_block"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:bismuth_ore"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:bysmuid_block"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"normal": {
|
|
||||||
"model": "taiga:cryptogen_block"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/duranite"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/ore/duranite"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,18 @@
|
|||||||
{
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "taiga:blocks/block/dyonite"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"normal": {
|
"normal": [
|
||||||
"model": "taiga:dyonite_block"
|
{}
|
||||||
}
|
],
|
||||||
|
"inventory": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user