mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-25 06:24:54 +00:00
Compare commits
261
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c39529c6f | ||
|
|
774defd118 | ||
|
|
6b5b6b0efe | ||
|
|
41a0528d2a | ||
|
|
eb05b5c1eb | ||
|
|
2f1bd92b33 | ||
|
|
3be904d27d | ||
|
|
08b1b9b456 | ||
|
|
6467ba4612 | ||
|
|
09dc0657ef | ||
|
|
dcfa448af3 | ||
|
|
786cb01b94 | ||
|
|
f6f4a988af | ||
|
|
5a823658ea | ||
|
|
8770492524 | ||
|
|
322203ac6a | ||
|
|
1e5c8db826 | ||
|
|
ef47b1863a | ||
|
|
c3dac80d44 | ||
|
|
f2beaae45c | ||
|
|
3a4e4dce04 | ||
|
|
99c3cb68eb | ||
|
|
38bc8a151c | ||
|
|
a64bd5f437 | ||
|
|
fb43f46bb8 | ||
|
|
9d2c667c35 | ||
|
|
67dfeb7daa | ||
|
|
e2080bc542 | ||
|
|
b0116884f1 | ||
|
|
a9948fcf26 | ||
|
|
828231c3c4 | ||
|
|
aed51fbd9a | ||
|
|
9bae32761c | ||
|
|
25c04cedcb | ||
|
|
cfe1cad9e8 | ||
|
|
766a440429 | ||
|
|
428bfb04f8 | ||
|
|
9fb5e3d8fb | ||
|
|
3da4083bba | ||
|
|
9d36165259 | ||
|
|
573c089b96 | ||
|
|
b82ce5e15f | ||
|
|
4f5358bea6 | ||
|
|
df0761c9af | ||
|
|
b5165b3e58 | ||
|
|
12f8ed9435 | ||
|
|
edf3ff7423 | ||
|
|
06571c1eb4 | ||
|
|
4823e44793 | ||
|
|
f55a9f7643 | ||
|
|
65b698face | ||
|
|
123ff12302 | ||
|
|
6e6cbbab48 | ||
|
|
b965d50bbc | ||
|
|
fb98d686fb | ||
|
|
ff20b5f600 | ||
|
|
2ade3e5705 | ||
|
|
b7a928bb06 | ||
|
|
ec4491994c | ||
|
|
89acb72f0b | ||
|
|
fc9ebd66d9 | ||
|
|
4c64395e21 | ||
|
|
121fe1c0a9 | ||
|
|
906b97064e | ||
|
|
ae736770fb | ||
|
|
27ea81cd09 | ||
|
|
aa25a5086d | ||
|
|
ac68e40b9f | ||
|
|
2935df3409 | ||
|
|
98c0810820 | ||
|
|
af2d06aa7b | ||
|
|
e88eb1756c | ||
|
|
b19979e88b | ||
|
|
974e459311 | ||
|
|
f366dcdfc6 | ||
|
|
e7e5292526 | ||
|
|
c79503d669 | ||
|
|
6529e7245d | ||
|
|
29e72ed7fc | ||
|
|
02c7fc7613 | ||
|
|
7416d21f6f | ||
|
|
d3ad57a622 | ||
|
|
0578441707 | ||
|
|
07a987151e | ||
|
|
c23401e45c | ||
|
|
e03d4da989 | ||
|
|
4c47f77214 | ||
|
|
bdd76306bb | ||
|
|
ae246d87eb | ||
|
|
c8aaeba7cb | ||
|
|
7345669405 | ||
|
|
5e912b69bd | ||
|
|
481c22a19d | ||
|
|
4103ce72e5 | ||
|
|
116e3610e6 | ||
|
|
702a02e943 | ||
|
|
b200f3006a | ||
|
|
322b8d0944 | ||
|
|
b5e1046904 | ||
|
|
f0f51be20e | ||
|
|
c3b0378096 | ||
|
|
baf9f915e5 | ||
|
|
0d97d836a3 | ||
|
|
f777cf976d | ||
|
|
bd6887c598 | ||
|
|
acf2525801 | ||
|
|
054bf8f329 | ||
|
|
418a322378 | ||
|
|
dcf47bb393 | ||
|
|
5ca5c11fc9 | ||
|
|
991c4fff5e | ||
|
|
137784f76d | ||
|
|
bde910d708 | ||
|
|
befd485d39 | ||
|
|
e56e056c5d | ||
|
|
ce4f1880ca | ||
|
|
520d2e09e1 | ||
|
|
870eafbbe4 | ||
|
|
d9ef30fe32 | ||
|
|
0112a7f104 | ||
|
|
9724d519e8 | ||
|
|
3d562d0052 | ||
|
|
9f17d8ceff | ||
|
|
614acf5114 | ||
|
|
b338d97517 | ||
|
|
2870e06387 | ||
|
|
96514b1aff | ||
|
|
f85900d9a8 | ||
|
|
66b1f3e075 | ||
|
|
e053b019af | ||
|
|
5dfa179c87 | ||
|
|
966e4ba2f2 | ||
|
|
1cbe881ae3 | ||
|
|
b0b38a472a | ||
|
|
5f56b46e00 | ||
|
|
83b0bfc504 | ||
|
|
fe56288c72 | ||
|
|
ff25ec619c | ||
|
|
c4ef06b027 | ||
|
|
0b6c1cc345 | ||
|
|
0efc169ef7 | ||
|
|
d83a0cc775 | ||
|
|
02afe5dbc8 | ||
|
|
951f5a1ad5 | ||
|
|
1cbc997be3 | ||
|
|
f3d3a0a2df | ||
|
|
fa10e888dc | ||
|
|
fdc1301b43 | ||
|
|
756b186db4 | ||
|
|
639c53a01d | ||
|
|
309a9c0818 | ||
|
|
2c547e3851 | ||
|
|
79d0283901 | ||
|
|
918ec20739 | ||
|
|
2ea0a44429 | ||
|
|
8f919fc688 | ||
|
|
c47b50b617 | ||
|
|
764fda0985 | ||
|
|
8412246e3e | ||
|
|
1391dd3ed6 | ||
|
|
cf6536c17f | ||
|
|
fddc31a8f5 | ||
|
|
840771f5f4 | ||
|
|
b76b77d4a3 | ||
|
|
5e5a80fb5c | ||
|
|
66c5bdf2ca | ||
|
|
a64ae86853 | ||
|
|
d612f8c520 | ||
|
|
806c326b62 | ||
|
|
c31726001b | ||
|
|
c209ef59fb | ||
|
|
98fd7c1e19 | ||
|
|
5b4aaf50f4 | ||
|
|
17768a1300 | ||
|
|
9f1642fd5b | ||
|
|
c3fcb6fc28 | ||
|
|
bc963b0d7e | ||
|
|
80c1c4d5da | ||
|
|
3afee4f553 | ||
|
|
1e0c7d3c5e | ||
|
|
9b21be0eb5 | ||
|
|
3a0d9352b1 | ||
|
|
108a11c119 | ||
|
|
e90b40159c | ||
|
|
61398d3139 | ||
|
|
e1d289bc48 | ||
|
|
75db1329ea | ||
|
|
32ffe03aa3 | ||
|
|
138e8d9c40 | ||
|
|
6c6b690d57 | ||
|
|
726831399d | ||
|
|
87ec6c63eb | ||
|
|
ef4359835a | ||
|
|
b9292af3d9 | ||
|
|
77936b6dab | ||
|
|
e24a94f0ba | ||
|
|
1d4a52c3af | ||
|
|
c7c47b9a1b | ||
|
|
e12eda73fc | ||
|
|
2b1e179eeb | ||
|
|
dbc4b23821 | ||
|
|
f5dc54e1fb | ||
|
|
500adb0357 | ||
|
|
7df6221e0b | ||
|
|
2d78a84df1 | ||
|
|
729908b1b0 | ||
|
|
e5cea4e3dd | ||
|
|
c17c2f3746 | ||
|
|
951df8a632 | ||
|
|
bdb7a53b96 | ||
|
|
e5f0fc2368 | ||
|
|
702cffe458 | ||
|
|
72b71021de | ||
|
|
0149c34d1d | ||
|
|
caca6a6329 | ||
|
|
6bd5cc24d3 | ||
|
|
4bef945c4e | ||
|
|
6fe4436226 | ||
|
|
0f7363c756 | ||
|
|
afa16af645 | ||
|
|
4ce1caa37e | ||
|
|
e565d86ed9 | ||
|
|
f1069a91f1 | ||
|
|
32411450d3 | ||
|
|
49ef624bd4 | ||
|
|
189d305a31 | ||
|
|
97a45e8e0a | ||
|
|
8c72b75e0e | ||
|
|
2cca9de690 | ||
|
|
6523fb0a1d | ||
|
|
8833aab1f1 | ||
|
|
7e9a54ced2 | ||
|
|
14a712260b | ||
|
|
d993c90c3e | ||
|
|
e73f5a841e | ||
|
|
9fcf50b61a | ||
|
|
337d8692c6 | ||
|
|
8cf54bb10f | ||
|
|
854ae94be6 | ||
|
|
aea52904d4 | ||
|
|
4704d4c18c | ||
|
|
2abb28bd8e | ||
|
|
011a5767a7 | ||
|
|
9fa67a8426 | ||
|
|
fb65570ce9 | ||
|
|
0901392f11 | ||
|
|
1359133050 | ||
|
|
b12577b506 | ||
|
|
b787d693b9 | ||
|
|
1f19dc2f5e | ||
|
|
4e638db2a7 | ||
|
|
db7d6ab7a2 | ||
|
|
1db58409ec | ||
|
|
ff9e54760a | ||
|
|
a15b899913 | ||
|
|
68a2880877 | ||
|
|
913c4e5d00 | ||
|
|
51f161c2e8 | ||
|
|
a49128337b | ||
|
|
4903f97de6 | ||
|
|
f87a689045 |
No files matched your search
@@ -0,0 +1,19 @@
|
||||
# This is the universal Text Editor Configuration
|
||||
# for all GTNewHorizons projects
|
||||
# See: https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{bat,ini}]
|
||||
end_of_line = crlf
|
||||
|
||||
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
|
||||
indent_size = 2
|
||||
@@ -0,0 +1,2 @@
|
||||
# Ignore spotlessApply reformat
|
||||
f1069a91f1b2ea9469775696c097dd6fb484e6e8
|
||||
@@ -0,0 +1,44 @@
|
||||
* text eol=lf
|
||||
|
||||
*.[jJ][aA][rR] binary
|
||||
|
||||
*.[pP][nN][gG] binary
|
||||
*.[jJ][pP][gG] binary
|
||||
*.[jJ][pP][eE][gG] binary
|
||||
*.[gG][iI][fF] binary
|
||||
*.[tT][iI][fF] binary
|
||||
*.[tT][iI][fF][fF] binary
|
||||
*.[iI][cC][oO] binary
|
||||
*.[sS][vV][gG] text
|
||||
*.[eE][pP][sS] binary
|
||||
*.[xX][cC][fF] binary
|
||||
|
||||
*.[kK][aA][rR] binary
|
||||
*.[mM]4[aA] binary
|
||||
*.[mM][iI][dD] binary
|
||||
*.[mM][iI][dD][iI] binary
|
||||
*.[mM][pP]3 binary
|
||||
*.[oO][gG][gG] binary
|
||||
*.[rR][aA] binary
|
||||
|
||||
*.7[zZ] binary
|
||||
*.[gG][zZ] binary
|
||||
*.[tT][aA][rR] binary
|
||||
*.[tT][gG][zZ] binary
|
||||
*.[zZ][iI][pP] binary
|
||||
|
||||
*.[tT][cC][nN] binary
|
||||
*.[sS][oO] binary
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
*.[pP][aA][tT][cC][hH] -text
|
||||
|
||||
*.[bB][aA][tT] text eol=crlf
|
||||
*.[cC][mM][dD] text eol=crlf
|
||||
*.[pP][sS]1 text eol=crlf
|
||||
|
||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||
@@ -1,27 +0,0 @@
|
||||
if [[ -d "run/crash-reports" ]]; then
|
||||
echo "Crash reports detected:"
|
||||
cat $directory/*
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "Fatal errors were detected" server.log; then
|
||||
echo "Fatal errors detected:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
|
||||
echo "Server force stopped:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
|
||||
echo "Server didn't finish startup:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "No crash reports detected"
|
||||
exit 0
|
||||
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# bashsupport disable=BP5006 # Global environment variables
|
||||
RUNDIR="run" \
|
||||
CRASH="crash-reports" \
|
||||
SERVERLOG="server.log"
|
||||
|
||||
# enable nullglob to get 0 results when no match rather than the pattern
|
||||
shopt -s nullglob
|
||||
|
||||
# store matches in array
|
||||
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
|
||||
|
||||
# if array not empty there are crash_reports
|
||||
if [ "${#crash_reports[@]}" -gt 0 ]; then
|
||||
# get the latest crash_report from array
|
||||
latest_crash_report="${crash_reports[-1]}"
|
||||
{
|
||||
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
|
||||
cat "$latest_crash_report"
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
|
||||
{
|
||||
printf 'Fatal errors detected:\n'
|
||||
cat server.log
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
|
||||
"$SERVERLOG"; then
|
||||
{
|
||||
printf 'Server force stopped:'
|
||||
cat server.log
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
|
||||
{
|
||||
printf 'Server did not finish startup:'
|
||||
cat server.log
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'No crash reports detected'
|
||||
exit 0
|
||||
@@ -1,5 +1,3 @@
|
||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Build and test
|
||||
|
||||
@@ -11,35 +9,5 @@ on:
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Setup the workspace
|
||||
run: ./gradlew setupCIWorkspace
|
||||
|
||||
- name: Build the mod
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Run server for 1.5 minutes
|
||||
run: |
|
||||
mkdir run
|
||||
echo "eula=true" > run/eula.txt
|
||||
timeout 90 ./gradlew runServer | tee --append server.log || true
|
||||
|
||||
- name: Test no errors reported during server run
|
||||
run: |
|
||||
chmod +x .github/scripts/test-no-error-reports.sh
|
||||
.github/scripts/test-no-error-reports.sh
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,61 +1,14 @@
|
||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Release tagged build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
tags: [ '*' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Setup the workspace
|
||||
run: ./gradlew setupCIWorkspace
|
||||
|
||||
- name: Build the mod
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Release under current tag
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
|
||||
prerelease: false
|
||||
title: "${{ env.RELEASE_VERSION }}"
|
||||
files: build/libs/*.jar
|
||||
|
||||
- name: Set repository owner and name
|
||||
run: |
|
||||
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
|
||||
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Publish package
|
||||
run: ./gradlew publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ARTIFACT_GROUP_ID: com.github.${{ env.REPOSITORY_OWNER }}
|
||||
ARTIFACT_ID: "${{ env.REPOSITORY_NAME }}"
|
||||
ARTIFACT_VERSION: "${{ env.RELEASE_VERSION }}"
|
||||
REPOSITORY_NAME: "${{ env.REPOSITORY_NAME }}"
|
||||
REPOSITORY_OWNER: "${{ env.REPOSITORY_OWNER }}"
|
||||
|
||||
release-tags:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,3 @@
|
||||
# Any Github changes require admin approval
|
||||
/.github/** @GTNewHorizons/admin
|
||||
|
||||
+1624
-588
File diff suppressed because it is too large.
Load diff
+9
-11
@@ -1,16 +1,14 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile("com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:dev")
|
||||
compile('com.github.GTNewHorizons:ForestryMC:4.8.2:dev')
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Baubles:master-SNAPSHOT:dev") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:Botania:master-SNAPSHOT:api") {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly('com.github.GTNewHorizons:BloodMagic:1.5.1:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicHorizons:1.5.1:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.10.6-GTNH:api') {transitive = false}
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.59:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.2-GTNH:dev')
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,78 +17,111 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+15
-23
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,10 +25,14 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -51,7 +55,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -61,38 +65,26 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "ic2"
|
||||
url = "https://maven.ic2.player.to/"
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package magicbees.api;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectController;
|
||||
|
||||
public class MagicBeesAPI
|
||||
{
|
||||
// Use this object during or after the Mod.Init phase to add your logic to the Transmutation bee effect.
|
||||
public static ITransmutationEffectController transmutationEffectController;
|
||||
|
||||
// This is a reference to the Tempus aspect. Initialized after MagicBees's post init phase.
|
||||
// Ensure it is not null, and cast it to thaumcraft.api.aspects.Aspect.
|
||||
public static Object thaumcraftAspectTempus;
|
||||
public class MagicBeesAPI {
|
||||
|
||||
// Use this object during or after the Mod.Init phase to add your logic to the Transmutation bee effect.
|
||||
public static ITransmutationEffectController transmutationEffectController;
|
||||
|
||||
// This is a reference to the Tempus aspect. Initialized after MagicBees's post init phase.
|
||||
// Ensure it is not null, and cast it to thaumcraft.api.aspects.Aspect.
|
||||
public static Object thaumcraftAspectTempus;
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
public enum AuraChargeType {
|
||||
MUTATION,
|
||||
DEATH,
|
||||
PRODUCTION,
|
||||
;
|
||||
}
|
||||
package magicbees.api.bees;
|
||||
|
||||
public enum AuraChargeType {
|
||||
MUTATION,
|
||||
DEATH,
|
||||
PRODUCTION,;
|
||||
}
|
||||
@@ -1,46 +1,42 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
/**
|
||||
* Allows a tile entity to provide a Magic Apiary with 'aura' to boost bee production, mutation rate,
|
||||
* or decrease bee lifespan.
|
||||
*
|
||||
* Allows a tile entity to provide a Magic Apiary with 'aura' to boost bee production, mutation rate, or decrease bee
|
||||
* lifespan.
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*/
|
||||
public interface IMagicApiaryAuraProvider {
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getMutationCharge();
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the aura provider should decrement its
|
||||
* internal charge by one. If there are no charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getMutationCharge();
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getDeathRateCharge();
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the aura provider should decrement its
|
||||
* internal charge by one. If there are no charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getDeathRateCharge();
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getProductionCharge();
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the aura provider should decrement its
|
||||
* internal charge by one. If there are no charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getProductionCharge();
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getCharge(AuraChargeType auraChargeType);
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the aura provider should decrement its
|
||||
* internal charge by one. If there are no charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getCharge(AuraChargeType auraChargeType);
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
/**
|
||||
* Manages adding custom ITransmutationEffectLogic instances into the bee effect
|
||||
* system.
|
||||
*
|
||||
* Manages adding custom ITransmutationEffectLogic instances into the bee effect system.
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public interface ITransmutationEffectController
|
||||
{
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic);
|
||||
|
||||
public interface ITransmutationEffectController {
|
||||
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic);
|
||||
}
|
||||
@@ -5,29 +5,27 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
/**
|
||||
* Class to control plugin logic for the Transmutation bee effect. Turns blocks
|
||||
* into other blocks based on biome, time of day, or whatever is deemed
|
||||
* appropriate at the time.
|
||||
*
|
||||
* Class to control plugin logic for the Transmutation bee effect. Turns blocks into other blocks based on biome, time
|
||||
* of day, or whatever is deemed appropriate at the time.
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public interface ITransmutationEffectLogic
|
||||
{
|
||||
/**
|
||||
* Allows an external mod to add transmutation logic to the Transmuting bee effect.
|
||||
* Called from a list of ITransmutationEffectLogic until one returns true. You can
|
||||
* implement more than one transmutation effect in a single implementation of the
|
||||
* interface. Function checks for a series of conditions based on block ID/meta, or
|
||||
* biome information, or world information.
|
||||
*
|
||||
* @param world World object
|
||||
* @param biome Biome information for current coordinates
|
||||
* @param sourceBlock ItemStack representing the block at current coordinates
|
||||
* @param x Current X coordinate to attempt a transmute
|
||||
* @param y Current Y coordinate to attempt a transmute
|
||||
* @param z Current Z coordinate to attempt a transmute
|
||||
* @return true if a block was changed.
|
||||
*/
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z);
|
||||
public interface ITransmutationEffectLogic {
|
||||
|
||||
/**
|
||||
* Allows an external mod to add transmutation logic to the Transmuting bee effect. Called from a list of
|
||||
* ITransmutationEffectLogic until one returns true. You can implement more than one transmutation effect in a
|
||||
* single implementation of the interface. Function checks for a series of conditions based on block ID/meta, or
|
||||
* biome information, or world information.
|
||||
*
|
||||
* @param world World object
|
||||
* @param biome Biome information for current coordinates
|
||||
* @param sourceBlock ItemStack representing the block at current coordinates
|
||||
* @param x Current X coordinate to attempt a transmute
|
||||
* @param y Current Y coordinate to attempt a transmute
|
||||
* @param z Current Z coordinate to attempt a transmute
|
||||
* @return true if a block was changed.
|
||||
*/
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z);
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IAlleleRegistry;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import magicbees.api.MagicBeesAPI;
|
||||
import magicbees.bees.allele.effect.AlleleEffectCrumbling;
|
||||
import magicbees.bees.allele.effect.AlleleEffectCure;
|
||||
@@ -27,290 +39,285 @@ import magicbees.main.utils.compat.ArsMagicaHelper;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.main.utils.compat.ThermalModsHelper;
|
||||
import net.minecraft.potion.Potion;
|
||||
import thaumcraft.api.nodes.NodeType;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IAlleleRegistry;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
|
||||
public class Allele implements IAllele {
|
||||
|
||||
private static final String FLOWER_ARS_MAGICA_PLANT = "flowerArsMagicaPlant";
|
||||
private static final String FLOWER_BOTANIA = "flowerBotania";
|
||||
private static final String EFFECT_TE_BLIZZY = "TEBlizzy";
|
||||
private static final String EFFECT_TE_BLITZ = "TEBlitz";
|
||||
private static final String EFFECT_TE_BASALZ = "TEBasalz";
|
||||
private static final String EFFECT_AM_WISP = "AMWisp";
|
||||
private static final String EFFECT_MANA_DRAIN = "ManaDrain";
|
||||
private static final String EFFECT_DREAMING = "Dreaming";
|
||||
private static final String EFFECT_WISPY = "Wispy";
|
||||
private static final String EFFECT_BATTY = "Batty";
|
||||
private static final String EFFECT_BRAINY = "Brainy";
|
||||
private static final String EFFECT_NODE_RAVENING = "NodeRavening";
|
||||
private static final String EFFECT_NODE_PURIFYING = "NodePurifying";
|
||||
private static final String EFFECT_NODE_TAINTING = "NodeTainting";
|
||||
private static final String EFFECT_NODE_REPAIR = "NodeRepair";
|
||||
private static final String EFFECT_NODE_EMPOWER = "NodeEmpower";
|
||||
private static final String EFFECT_VIS_RECHARGE = "VisRecharge";
|
||||
private static final String FLOWERS_AURA_NODE = "AuraNode";
|
||||
private static final String FLOWERS_THAUMCRAFT_PLANT = "ThaumcraftPlant";
|
||||
|
||||
public static AlleleFloat speedBlinding;
|
||||
private static final String FLOWER_ARS_MAGICA_PLANT = "flowerArsMagicaPlant";
|
||||
private static final String FLOWER_BOTANIA = "flowerBotania";
|
||||
private static final String EFFECT_TE_BLIZZY = "TEBlizzy";
|
||||
private static final String EFFECT_TE_BLITZ = "TEBlitz";
|
||||
private static final String EFFECT_TE_BASALZ = "TEBasalz";
|
||||
private static final String EFFECT_AM_WISP = "AMWisp";
|
||||
private static final String EFFECT_MANA_DRAIN = "ManaDrain";
|
||||
private static final String EFFECT_DREAMING = "Dreaming";
|
||||
private static final String EFFECT_WISPY = "Wispy";
|
||||
private static final String EFFECT_BATTY = "Batty";
|
||||
private static final String EFFECT_BRAINY = "Brainy";
|
||||
private static final String EFFECT_NODE_RAVENING = "NodeRavening";
|
||||
private static final String EFFECT_NODE_PURIFYING = "NodePurifying";
|
||||
private static final String EFFECT_NODE_TAINTING = "NodeTainting";
|
||||
private static final String EFFECT_NODE_REPAIR = "NodeRepair";
|
||||
private static final String EFFECT_NODE_EMPOWER = "NodeEmpower";
|
||||
private static final String EFFECT_VIS_RECHARGE = "VisRecharge";
|
||||
private static final String FLOWERS_AURA_NODE = "AuraNode";
|
||||
private static final String FLOWERS_THAUMCRAFT_PLANT = "ThaumcraftPlant";
|
||||
|
||||
public static IAlleleBeeEffect forestryBaseEffect;
|
||||
public static AlleleFloat speedBlinding;
|
||||
|
||||
public static IAlleleFlowers flowerBookshelf;
|
||||
public static IAlleleFlowers flowerThaumcraft;
|
||||
public static IAlleleFlowers flowerArsMagica;
|
||||
public static IAlleleFlowers flowerAuraNode;
|
||||
public static IAlleleFlowers flowerBotania;
|
||||
public static IAlleleBeeEffect forestryBaseEffect;
|
||||
|
||||
public static IAlleleEffect effectCleansing;
|
||||
public static IAlleleEffect effectDigSpeed;
|
||||
public static IAlleleEffect effectMoveSpeed;
|
||||
public static IAlleleEffect effectSlowSpeed;
|
||||
public static IAlleleEffect effectWithering;
|
||||
public static IAlleleEffect effectVisRecharge;
|
||||
public static IAlleleEffect effectNodeEmpower;
|
||||
public static IAlleleEffect effectNodeRepair;
|
||||
public static IAlleleEffect effectNodeConversionTaint;
|
||||
public static IAlleleEffect effectNodeConversionPure;
|
||||
public static IAlleleEffect effectNodeConversionHungry;
|
||||
public static IAlleleEffect effectTransmuting;
|
||||
public static IAlleleEffect effectCrumbling;
|
||||
public static IAlleleEffect effectInvisibility;
|
||||
public static IAlleleEffect effectDreaming;
|
||||
public static IAlleleFlowers flowerBookshelf;
|
||||
public static IAlleleFlowers flowerThaumcraft;
|
||||
public static IAlleleFlowers flowerArsMagica;
|
||||
public static IAlleleFlowers flowerAuraNode;
|
||||
public static IAlleleFlowers flowerBotania;
|
||||
|
||||
public static IAlleleEffect spawnWolf;
|
||||
public static IAlleleEffect spawnBats;
|
||||
public static IAlleleEffect spawnCow;
|
||||
public static IAlleleEffect spawnChicken;
|
||||
public static IAlleleEffect spawnPig;
|
||||
public static IAlleleEffect spawnSheep;
|
||||
public static IAlleleEffect spawnCat;
|
||||
public static IAlleleEffect spawnHorse;
|
||||
public static IAlleleEffect spawnGhast;
|
||||
public static IAlleleEffect spawnSpider;
|
||||
public static IAlleleEffect spawnBlaze;
|
||||
public static IAlleleEffect spawnBrainyZombie;
|
||||
public static IAlleleEffect spawnWisp;
|
||||
public static IAlleleEffect spawnBlizz;
|
||||
public static IAlleleEffect spawnBlitz;
|
||||
public static IAlleleEffect spawnBasalz;
|
||||
public static IAlleleEffect spawnManaDrainer;
|
||||
public static IAlleleEffect spawnWispOrHecate;
|
||||
public static IAlleleEffect effectCleansing;
|
||||
public static IAlleleEffect effectDigSpeed;
|
||||
public static IAlleleEffect effectMoveSpeed;
|
||||
public static IAlleleEffect effectSlowSpeed;
|
||||
public static IAlleleEffect effectWithering;
|
||||
public static IAlleleEffect effectVisRecharge;
|
||||
public static IAlleleEffect effectNodeEmpower;
|
||||
public static IAlleleEffect effectNodeRepair;
|
||||
public static IAlleleEffect effectNodeConversionTaint;
|
||||
public static IAlleleEffect effectNodeConversionPure;
|
||||
public static IAlleleEffect effectNodeConversionHungry;
|
||||
public static IAlleleEffect effectTransmuting;
|
||||
public static IAlleleEffect effectCrumbling;
|
||||
public static IAlleleEffect effectInvisibility;
|
||||
public static IAlleleEffect effectDreaming;
|
||||
|
||||
public static void setupAdditionalAlleles() {
|
||||
forestryBaseEffect = (IAlleleBeeEffect) getBaseAllele("effectNone");
|
||||
IFlowerProvider vanillaFlowers = ((IAlleleFlowers)getBaseAllele("flowersVanilla")).getProvider();
|
||||
public static IAlleleEffect spawnWolf;
|
||||
public static IAlleleEffect spawnBats;
|
||||
public static IAlleleEffect spawnCow;
|
||||
public static IAlleleEffect spawnChicken;
|
||||
public static IAlleleEffect spawnPig;
|
||||
public static IAlleleEffect spawnSheep;
|
||||
public static IAlleleEffect spawnCat;
|
||||
public static IAlleleEffect spawnHorse;
|
||||
public static IAlleleEffect spawnGhast;
|
||||
public static IAlleleEffect spawnSpider;
|
||||
public static IAlleleEffect spawnBlaze;
|
||||
public static IAlleleEffect spawnBrainyZombie;
|
||||
public static IAlleleEffect spawnWisp;
|
||||
public static IAlleleEffect spawnBlizz;
|
||||
public static IAlleleEffect spawnBlitz;
|
||||
public static IAlleleEffect spawnBasalz;
|
||||
public static IAlleleEffect spawnManaDrainer;
|
||||
public static IAlleleEffect spawnWispOrHecate;
|
||||
|
||||
speedBlinding = new AlleleFloat("speedBlinding", 2f, false, EnumBeeChromosome.SPEED);
|
||||
flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true);
|
||||
public static void setupAdditionalAlleles() {
|
||||
forestryBaseEffect = (IAlleleBeeEffect) getBaseAllele("effectNone");
|
||||
IFlowerProvider vanillaFlowers = ((IAlleleFlowers) getBaseAllele("flowersVanilla")).getProvider();
|
||||
|
||||
effectCleansing = new AlleleEffectCure("Curative", false);
|
||||
effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false);
|
||||
effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false);
|
||||
effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious();
|
||||
effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious();
|
||||
speedBlinding = new AlleleFloat("speedBlinding", 2f, false, EnumBeeChromosome.SPEED);
|
||||
flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true);
|
||||
|
||||
TransmutationEffectController controller = new TransmutationEffectController(
|
||||
new TransmutationEffectRailcraft(),
|
||||
new TransmutationEffectVanilla()
|
||||
);
|
||||
MagicBeesAPI.transmutationEffectController = controller;
|
||||
effectTransmuting = new AlleleEffectTransmuting("Transmuting", true, controller, 200);
|
||||
effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
|
||||
effectCleansing = new AlleleEffectCure("Curative", false);
|
||||
effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false);
|
||||
effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false);
|
||||
effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious();
|
||||
effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious();
|
||||
|
||||
effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false);
|
||||
TransmutationEffectController controller = new TransmutationEffectController(
|
||||
new TransmutationEffectRailcraft(),
|
||||
new TransmutationEffectVanilla());
|
||||
MagicBeesAPI.transmutationEffectController = controller;
|
||||
effectTransmuting = new AlleleEffectTransmuting("Transmuting", true, controller, 200);
|
||||
effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
|
||||
|
||||
spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan")
|
||||
.setThrottle(2060)
|
||||
.setChanceToSpawn(10)
|
||||
.setMaxMobsInSpawnZone(1);
|
||||
spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step")
|
||||
.setThrottle(400)
|
||||
.setChanceToSpawn(70)
|
||||
.setMaxMobsInSpawnZone(4);
|
||||
spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe")
|
||||
.setThrottle(800)
|
||||
.setChanceToSpawn(60)
|
||||
.setMaxMobsInSpawnZone(2);
|
||||
spawnWolf = new AlleleEffectSpawnMob("Canine", false , "Wolf", "mob.wolf.panting")
|
||||
.setThrottle(650)
|
||||
.setChanceToSpawn(40)
|
||||
.setMaxMobsInSpawnZone(2);
|
||||
spawnPig = new AlleleEffectSpawnMob("Porcine", true, "Pig", "mob.pig.say")
|
||||
.setThrottle(350)
|
||||
.setMaxMobsInSpawnZone(4);
|
||||
spawnCow = new AlleleEffectSpawnMob("Bovine", true, "Cow", "mob.cow.say")
|
||||
.setThrottle(640)
|
||||
.setMaxMobsInSpawnZone(3);
|
||||
spawnChicken = new AlleleEffectSpawnMob("Chicken", true, "Chicken", "mob.chicken.hurt")
|
||||
.setThrottle(20)
|
||||
.setMaxMobsInSpawnZone(20);
|
||||
spawnSheep = new AlleleEffectSpawnMob("Sheep", false, "Sheep", "mob.sheep.say")
|
||||
.setThrottle(450)
|
||||
.setMaxMobsInSpawnZone(5);
|
||||
spawnCat = new AlleleEffectSpawnMob("Catty", false, "Ozelot", "mob.cat.meow")
|
||||
.setThrottle(702)
|
||||
.setChanceToSpawn(60)
|
||||
.setMaxMobsInSpawnZone(2);
|
||||
spawnHorse = new AlleleEffectSpawnMob("Horse", false, "EntityHorse", "mob.horse.idle")
|
||||
.setThrottle(450)
|
||||
.setChanceToSpawn(59)
|
||||
.setMaxMobsInSpawnZone(2);
|
||||
effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false);
|
||||
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, new FlowerProviderThaumcraftFlower(), false);
|
||||
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, new FlowerProviderAuraNode(), true);
|
||||
|
||||
effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
|
||||
effectNodeEmpower = new AlleleEffectEmpowering(EFFECT_NODE_EMPOWER, false);
|
||||
effectNodeRepair = new AlleleEffectNodeRepair(EFFECT_NODE_REPAIR, false);
|
||||
effectNodeConversionTaint = new AlleleEffectNodeConversion(EFFECT_NODE_TAINTING, NodeType.TAINTED, false, 250);
|
||||
effectNodeConversionPure = new AlleleEffectNodeConversion(EFFECT_NODE_PURIFYING, NodeType.PURE, false, 250);
|
||||
effectNodeConversionHungry = new AlleleEffectNodeConversion(EFFECT_NODE_RAVENING, NodeType.HUNGRY, false, 2);
|
||||
spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan").setThrottle(2060)
|
||||
.setChanceToSpawn(10).setMaxMobsInSpawnZone(1);
|
||||
spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step").setThrottle(400)
|
||||
.setChanceToSpawn(70).setMaxMobsInSpawnZone(4);
|
||||
spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe").setThrottle(800)
|
||||
.setChanceToSpawn(60).setMaxMobsInSpawnZone(2);
|
||||
spawnWolf = new AlleleEffectSpawnMob("Canine", false, "Wolf", "mob.wolf.panting").setThrottle(650)
|
||||
.setChanceToSpawn(40).setMaxMobsInSpawnZone(2);
|
||||
spawnPig = new AlleleEffectSpawnMob("Porcine", true, "Pig", "mob.pig.say").setThrottle(350)
|
||||
.setMaxMobsInSpawnZone(4);
|
||||
spawnCow = new AlleleEffectSpawnMob("Bovine", true, "Cow", "mob.cow.say").setThrottle(640)
|
||||
.setMaxMobsInSpawnZone(3);
|
||||
spawnChicken = new AlleleEffectSpawnMob("Chicken", true, "Chicken", "mob.chicken.hurt").setThrottle(20)
|
||||
.setMaxMobsInSpawnZone(20);
|
||||
spawnSheep = new AlleleEffectSpawnMob("Sheep", false, "Sheep", "mob.sheep.say").setThrottle(450)
|
||||
.setMaxMobsInSpawnZone(5);
|
||||
spawnCat = new AlleleEffectSpawnMob("Catty", false, "Ozelot", "mob.cat.meow").setThrottle(702)
|
||||
.setChanceToSpawn(60).setMaxMobsInSpawnZone(2);
|
||||
spawnHorse = new AlleleEffectSpawnMob("Horse", false, "EntityHorse", "mob.horse.idle").setThrottle(450)
|
||||
.setChanceToSpawn(59).setMaxMobsInSpawnZone(2);
|
||||
|
||||
spawnBrainyZombie = new AlleleEffectSpawnMob(EFFECT_BRAINY, false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID)
|
||||
.setAggrosPlayerOnSpawn()
|
||||
.setThrottle(800)
|
||||
.setSpawnsOnPlayerNear(null)
|
||||
.setMaxMobsInSpawnZone(2);
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, new FlowerProviderThaumcraftFlower(), false);
|
||||
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, new FlowerProviderAuraNode(), true);
|
||||
|
||||
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, ThaumcraftHelper.Entity.FIREBAT.entityID)
|
||||
.setThrottle(300)
|
||||
.setSpawnsOnPlayerNear("Bat");
|
||||
effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
|
||||
effectNodeEmpower = new AlleleEffectEmpowering(EFFECT_NODE_EMPOWER, false);
|
||||
effectNodeRepair = new AlleleEffectNodeRepair(EFFECT_NODE_REPAIR, false);
|
||||
effectNodeConversionTaint = new AlleleEffectNodeConversion(
|
||||
EFFECT_NODE_TAINTING,
|
||||
NodeType.TAINTED,
|
||||
false,
|
||||
250);
|
||||
effectNodeConversionPure = new AlleleEffectNodeConversion(EFFECT_NODE_PURIFYING, NodeType.PURE, false, 250);
|
||||
effectNodeConversionHungry = new AlleleEffectNodeConversion(
|
||||
EFFECT_NODE_RAVENING,
|
||||
NodeType.HUNGRY,
|
||||
false,
|
||||
2);
|
||||
|
||||
spawnWisp = new AlleleEffectSpawnWisp(EFFECT_WISPY, false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive")
|
||||
.setThrottle(1800)
|
||||
.setChanceToSpawn(79);
|
||||
}
|
||||
else {
|
||||
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, "Bat")
|
||||
.setThrottle(150);
|
||||
|
||||
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, vanillaFlowers, false);
|
||||
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, vanillaFlowers, true);Allele.effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
|
||||
effectNodeEmpower = new AlleleEffectPlaceholder(EFFECT_NODE_EMPOWER, false);
|
||||
effectNodeRepair = new AlleleEffectPlaceholder(EFFECT_NODE_REPAIR, false);
|
||||
effectNodeConversionTaint = new AlleleEffectPlaceholder(EFFECT_NODE_TAINTING, false);
|
||||
effectNodeConversionPure = new AlleleEffectPlaceholder(EFFECT_NODE_PURIFYING, false);
|
||||
effectNodeConversionHungry = new AlleleEffectPlaceholder(EFFECT_NODE_RAVENING, false);
|
||||
spawnBrainyZombie = new AlleleEffectPlaceholder(EFFECT_BRAINY, false);
|
||||
spawnWisp = new AlleleEffectPlaceholder(EFFECT_WISPY, false);
|
||||
}
|
||||
spawnBrainyZombie = new AlleleEffectSpawnMob(
|
||||
EFFECT_BRAINY,
|
||||
false,
|
||||
ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID).setAggrosPlayerOnSpawn().setThrottle(800)
|
||||
.setSpawnsOnPlayerNear(null).setMaxMobsInSpawnZone(2);
|
||||
|
||||
if (BotaniaHelper.isActive()) {
|
||||
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, new FlowerProviderBotania(), true);
|
||||
effectDreaming = new AlleleEffectTransmuting(EFFECT_DREAMING, false,
|
||||
new TransmutationEffectController(new TransmutationEffectLBotaniaLiving()), 100);
|
||||
}
|
||||
else {
|
||||
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, vanillaFlowers, true);
|
||||
effectDreaming = new AlleleEffectPlaceholder(EFFECT_DREAMING, false);
|
||||
}
|
||||
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, ThaumcraftHelper.Entity.FIREBAT.entityID)
|
||||
.setThrottle(300).setSpawnsOnPlayerNear("Bat");
|
||||
|
||||
if (ArsMagicaHelper.isActive()) {
|
||||
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, new FlowerProviderArsMagicaFlower(), false);
|
||||
spawnManaDrainer = new AlleleEffectSpawnMobWeighted(EFFECT_MANA_DRAIN, true, 20,
|
||||
new String[] { ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex" },
|
||||
new int[] { 60, 2 }
|
||||
);
|
||||
spawnWisp = new AlleleEffectSpawnWisp(
|
||||
EFFECT_WISPY,
|
||||
false,
|
||||
ThaumcraftHelper.Entity.WISP.entityID,
|
||||
"thaumcraft.wisplive").setThrottle(1800).setChanceToSpawn(79);
|
||||
} else {
|
||||
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, "Bat").setThrottle(150);
|
||||
|
||||
spawnWispOrHecate = new AlleleEffectSpawnMobWeighted(EFFECT_AM_WISP, true, 20,
|
||||
new String[] { ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate" },
|
||||
new int[] { 40, 3 }
|
||||
);
|
||||
}
|
||||
else {
|
||||
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, vanillaFlowers, false);
|
||||
spawnManaDrainer = new AlleleEffectPlaceholder(EFFECT_MANA_DRAIN, true);
|
||||
spawnWispOrHecate = new AlleleEffectPlaceholder(EFFECT_AM_WISP, true);
|
||||
}
|
||||
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, vanillaFlowers, false);
|
||||
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, vanillaFlowers, true);
|
||||
Allele.effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
|
||||
effectNodeEmpower = new AlleleEffectPlaceholder(EFFECT_NODE_EMPOWER, false);
|
||||
effectNodeRepair = new AlleleEffectPlaceholder(EFFECT_NODE_REPAIR, false);
|
||||
effectNodeConversionTaint = new AlleleEffectPlaceholder(EFFECT_NODE_TAINTING, false);
|
||||
effectNodeConversionPure = new AlleleEffectPlaceholder(EFFECT_NODE_PURIFYING, false);
|
||||
effectNodeConversionHungry = new AlleleEffectPlaceholder(EFFECT_NODE_RAVENING, false);
|
||||
spawnBrainyZombie = new AlleleEffectPlaceholder(EFFECT_BRAINY, false);
|
||||
spawnWisp = new AlleleEffectPlaceholder(EFFECT_WISPY, false);
|
||||
}
|
||||
|
||||
//TODO TE spawning
|
||||
if (ThermalModsHelper.isActive()) {
|
||||
spawnBlizz = new AlleleEffectSpawnMob(EFFECT_TE_BLIZZY, true, ThermalModsHelper.Entity.BLIZZ.entityID, ThermalModsHelper.Entity.BLIZZ.soundName)
|
||||
.setThrottle(100)
|
||||
.setChanceToSpawn(80);
|
||||
spawnBlitz = new AlleleEffectSpawnMob(EFFECT_TE_BLITZ, true, ThermalModsHelper.Entity.BLITZ.entityID, ThermalModsHelper.Entity.BLITZ.soundName)
|
||||
.setThrottle(100)
|
||||
.setChanceToSpawn(80);
|
||||
spawnBasalz = new AlleleEffectSpawnMob(EFFECT_TE_BASALZ, true, ThermalModsHelper.Entity.BASALZ.entityID, ThermalModsHelper.Entity.BASALZ.soundName)
|
||||
.setThrottle(100)
|
||||
.setChanceToSpawn(80);
|
||||
}
|
||||
else {
|
||||
spawnBlizz = new AlleleEffectPlaceholder(EFFECT_TE_BLIZZY, true);
|
||||
spawnBlitz = new AlleleEffectPlaceholder(EFFECT_TE_BLITZ, true);
|
||||
spawnBasalz = new AlleleEffectPlaceholder(EFFECT_TE_BASALZ, true);
|
||||
}
|
||||
}
|
||||
if (BotaniaHelper.isActive()) {
|
||||
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, new FlowerProviderBotania(), true);
|
||||
effectDreaming = new AlleleEffectTransmuting(
|
||||
EFFECT_DREAMING,
|
||||
false,
|
||||
new TransmutationEffectController(new TransmutationEffectLBotaniaLiving()),
|
||||
100);
|
||||
} else {
|
||||
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, vanillaFlowers, true);
|
||||
effectDreaming = new AlleleEffectPlaceholder(EFFECT_DREAMING, false);
|
||||
}
|
||||
|
||||
public static void registerDeprecatedAlleleReplacements() {
|
||||
IAlleleRegistry registry = AlleleManager.alleleRegistry;
|
||||
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", effectNodeEmpower);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", effectNodeConversionPure);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", effectNodeConversionTaint);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", effectNodeEmpower);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.speciesTCAttractive", BeeSpecies.TC_EMPOWERING.getSpecies());
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.speciesBMBloodyBMBloody", BeeSpecies.EARTHY.getSpecies());
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.speciesBMBloodyBMBound", BeeSpecies.ARCANE.getSpecies());
|
||||
}
|
||||
if (ArsMagicaHelper.isActive()) {
|
||||
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, new FlowerProviderArsMagicaFlower(), false);
|
||||
spawnManaDrainer = new AlleleEffectSpawnMobWeighted(
|
||||
EFFECT_MANA_DRAIN,
|
||||
true,
|
||||
20,
|
||||
new String[] { ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex" },
|
||||
new int[] { 60, 2 });
|
||||
|
||||
public static IAlleleBeeSpecies getBaseSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("forestry.species").append(name).toString());
|
||||
}
|
||||
spawnWispOrHecate = new AlleleEffectSpawnMobWeighted(
|
||||
EFFECT_AM_WISP,
|
||||
true,
|
||||
20,
|
||||
new String[] { ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate" },
|
||||
new int[] { 40, 3 });
|
||||
} else {
|
||||
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, vanillaFlowers, false);
|
||||
spawnManaDrainer = new AlleleEffectPlaceholder(EFFECT_MANA_DRAIN, true);
|
||||
spawnWispOrHecate = new AlleleEffectPlaceholder(EFFECT_AM_WISP, true);
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getExtraSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("extrabees.species.").append(name.toLowerCase())
|
||||
.toString());
|
||||
}
|
||||
// TODO TE spawning
|
||||
if (ThermalModsHelper.isActive()) {
|
||||
spawnBlizz = new AlleleEffectSpawnMob(
|
||||
EFFECT_TE_BLIZZY,
|
||||
true,
|
||||
ThermalModsHelper.Entity.BLIZZ.entityID,
|
||||
ThermalModsHelper.Entity.BLIZZ.soundName).setThrottle(100).setChanceToSpawn(80);
|
||||
spawnBlitz = new AlleleEffectSpawnMob(
|
||||
EFFECT_TE_BLITZ,
|
||||
true,
|
||||
ThermalModsHelper.Entity.BLITZ.entityID,
|
||||
ThermalModsHelper.Entity.BLITZ.soundName).setThrottle(100).setChanceToSpawn(80);
|
||||
spawnBasalz = new AlleleEffectSpawnMob(
|
||||
EFFECT_TE_BASALZ,
|
||||
true,
|
||||
ThermalModsHelper.Entity.BASALZ.entityID,
|
||||
ThermalModsHelper.Entity.BASALZ.soundName).setThrottle(100).setChanceToSpawn(80);
|
||||
} else {
|
||||
spawnBlizz = new AlleleEffectPlaceholder(EFFECT_TE_BLIZZY, true);
|
||||
spawnBlitz = new AlleleEffectPlaceholder(EFFECT_TE_BLITZ, true);
|
||||
spawnBasalz = new AlleleEffectPlaceholder(EFFECT_TE_BASALZ, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static IAllele getBaseAllele(String name) {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry." + name);
|
||||
}
|
||||
public static void registerDeprecatedAlleleReplacements() {
|
||||
IAlleleRegistry registry = AlleleManager.alleleRegistry;
|
||||
|
||||
public static IAllele getAllele(String name) {
|
||||
return AlleleManager.alleleRegistry.getAllele(name);
|
||||
}
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", effectNodeEmpower);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", effectNodeConversionPure);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", effectNodeConversionTaint);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", effectNodeEmpower);
|
||||
registry.registerDeprecatedAlleleReplacement(
|
||||
"magicbees.speciesTCAttractive",
|
||||
BeeSpecies.TC_EMPOWERING.getSpecies());
|
||||
registry.registerDeprecatedAlleleReplacement(
|
||||
"magicbees.speciesBMBloodyBMBloody",
|
||||
BeeSpecies.EARTHY.getSpecies());
|
||||
registry.registerDeprecatedAlleleReplacement(
|
||||
"magicbees.speciesBMBloodyBMBound",
|
||||
BeeSpecies.ARCANE.getSpecies());
|
||||
}
|
||||
|
||||
private String uid;
|
||||
private boolean dominant;
|
||||
public static IAlleleBeeSpecies getBaseSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry
|
||||
.getAllele((new StringBuilder()).append("forestry.species").append(name).toString());
|
||||
}
|
||||
|
||||
public Allele(String id, boolean isDominant, IChromosomeType... chromosomeTypes) {
|
||||
this.uid = "magicbees." + id;
|
||||
this.dominant = isDominant;
|
||||
AlleleManager.alleleRegistry.registerAllele(this, chromosomeTypes);
|
||||
}
|
||||
public static IAlleleBeeSpecies getExtraSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry
|
||||
.getAllele((new StringBuilder()).append("extrabees.species.").append(name.toLowerCase()).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
public static IAllele getBaseAllele(String name) {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry." + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return this.dominant;
|
||||
}
|
||||
public static IAllele getAllele(String name) {
|
||||
return AlleleManager.alleleRegistry.getAllele(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return LocalizationManager.getLocalizedString(getUID());
|
||||
}
|
||||
private String uid;
|
||||
private boolean dominant;
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.uid;
|
||||
}
|
||||
public Allele(String id, boolean isDominant, IChromosomeType... chromosomeTypes) {
|
||||
this.uid = "magicbees." + id;
|
||||
this.dominant = isDominant;
|
||||
AlleleManager.alleleRegistry.registerAllele(this, chromosomeTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return this.dominant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return LocalizationManager.getLocalizedString(getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.uid;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package magicbees.bees;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
@@ -14,82 +12,74 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect
|
||||
{
|
||||
protected int throttle;
|
||||
protected boolean combinable;
|
||||
public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect {
|
||||
|
||||
public AlleleEffect(String id, boolean isDominant, int timeout)
|
||||
{
|
||||
super("effect" + id, isDominant, EnumBeeChromosome.EFFECT);
|
||||
this.throttle = timeout;
|
||||
combinable = false;
|
||||
}
|
||||
protected int throttle;
|
||||
protected boolean combinable;
|
||||
|
||||
@Override
|
||||
public boolean isCombinable()
|
||||
{
|
||||
return combinable;
|
||||
}
|
||||
|
||||
public AlleleEffect setIsCombinable(boolean canCombine) {
|
||||
combinable = canCombine;
|
||||
return this;
|
||||
}
|
||||
public AlleleEffect(String id, boolean isDominant, int timeout) {
|
||||
super("effect" + id, isDominant, EnumBeeChromosome.EFFECT);
|
||||
this.throttle = timeout;
|
||||
combinable = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract IEffectData validateStorage(IEffectData storedData);
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return combinable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
int count = storedData.getInteger(0);
|
||||
if (count >= this.throttle)
|
||||
{
|
||||
storedData = this.doEffectThrottled(genome, storedData, housing);
|
||||
}
|
||||
else
|
||||
{
|
||||
storedData.setInteger(0, count + 1);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param genome
|
||||
* @param storedData
|
||||
* @param housing
|
||||
* @return
|
||||
*/
|
||||
protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
|
||||
public AlleleEffect setIsCombinable(boolean canCombine) {
|
||||
combinable = canCombine;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
return Allele.forestryBaseEffect.doFX(genome, storedData, housing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T extends Entity> List<T> getEntitiesWithinRange(IBeeGenome genome, IBeeHousing housing, Class<T> entityClass)
|
||||
{
|
||||
// Get the size of the affected area
|
||||
int[] area = genome.getTerritory();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
|
||||
// Calculate offset
|
||||
int[] min = new int[3];
|
||||
int[] max = new int[3];
|
||||
min[0] = coords.posX - area[0] / 2;
|
||||
max[0] = coords.posX + area[0] / 2;
|
||||
|
||||
min[1] = coords.posY - area[1] / 2;
|
||||
max[1] = coords.posY + area[1] / 2;
|
||||
|
||||
min[2] = coords.posZ - area[2] / 2;
|
||||
max[2] = coords.posZ + area[2] / 2;
|
||||
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
|
||||
return (List<T>)housing.getWorld().getEntitiesWithinAABB(entityClass, bounds);
|
||||
}
|
||||
@Override
|
||||
public abstract IEffectData validateStorage(IEffectData storedData);
|
||||
|
||||
@Override
|
||||
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
int count = storedData.getInteger(0);
|
||||
if (count >= this.throttle) {
|
||||
storedData = this.doEffectThrottled(genome, storedData, housing);
|
||||
} else {
|
||||
storedData.setInteger(0, count + 1);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param genome
|
||||
* @param storedData
|
||||
* @param housing
|
||||
* @return
|
||||
*/
|
||||
protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
return Allele.forestryBaseEffect.doFX(genome, storedData, housing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T extends Entity> List<T> getEntitiesWithinRange(IBeeGenome genome, IBeeHousing housing,
|
||||
Class<T> entityClass) {
|
||||
// Get the size of the affected area
|
||||
int[] area = genome.getTerritory();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
|
||||
// Calculate offset
|
||||
int[] min = new int[3];
|
||||
int[] max = new int[3];
|
||||
min[0] = coords.posX - area[0] / 2;
|
||||
max[0] = coords.posX + area[0] / 2;
|
||||
|
||||
min[1] = coords.posY - area[1] / 2;
|
||||
max[1] = coords.posY + area[1] / 2;
|
||||
|
||||
min[2] = coords.posZ - area[2] / 2;
|
||||
max[2] = coords.posZ + area[2] / 2;
|
||||
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
|
||||
return (List<T>) housing.getWorld().getEntitiesWithinAABB(entityClass, bounds);
|
||||
}
|
||||
}
|
||||
@@ -3,20 +3,17 @@ package magicbees.bees;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
public class AlleleFloat extends Allele implements IAlleleFloat
|
||||
{
|
||||
private float value;
|
||||
|
||||
public AlleleFloat(String id, float val, boolean isDominant, IChromosomeType... chromosomeTypes)
|
||||
{
|
||||
super(id, isDominant, chromosomeTypes);
|
||||
this.value = val;
|
||||
}
|
||||
public class AlleleFloat extends Allele implements IAlleleFloat {
|
||||
|
||||
@Override
|
||||
public float getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
private float value;
|
||||
|
||||
public AlleleFloat(String id, float val, boolean isDominant, IChromosomeType... chromosomeTypes) {
|
||||
super(id, isDominant, chromosomeTypes);
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,25 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
|
||||
public class AlleleFlower extends Allele implements IAlleleFlowers
|
||||
{
|
||||
private IFlowerProvider provider;
|
||||
|
||||
public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant)
|
||||
{
|
||||
super("flower" + uid, isDominant, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
this.provider = flowerProvider;
|
||||
}
|
||||
public class AlleleFlower extends Allele implements IAlleleFlowers {
|
||||
|
||||
@Override
|
||||
public IFlowerProvider getProvider()
|
||||
{
|
||||
return this.provider;
|
||||
}
|
||||
private IFlowerProvider provider;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.provider.getDescription();
|
||||
}
|
||||
public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant) {
|
||||
super("flower" + uid, isDominant, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
this.provider = flowerProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerProvider getProvider() {
|
||||
return this.provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.provider.getDescription();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,34 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.api.bees.AuraChargeType;
|
||||
|
||||
public enum AuraCharge {
|
||||
MUTATION(AuraChargeType.MUTATION, 850, 11),
|
||||
DEATH(AuraChargeType.DEATH, 400, 5),
|
||||
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
|
||||
;
|
||||
|
||||
public final AuraChargeType type;
|
||||
public final int duration;
|
||||
/** The number of ticks to count between draining vis from the environment **/
|
||||
public final int tickRate;
|
||||
public final int flag;
|
||||
|
||||
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
|
||||
this.type = chargeType;
|
||||
this.duration = duration;
|
||||
this.tickRate = tickRate;
|
||||
flag = 1 << ordinal();
|
||||
}
|
||||
|
||||
public static AuraCharge fromChargeType(AuraChargeType type) {
|
||||
for (AuraCharge charge : values()) {
|
||||
if (type == charge.type) {
|
||||
return charge;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.api.bees.AuraChargeType;
|
||||
|
||||
public enum AuraCharge {
|
||||
|
||||
MUTATION(AuraChargeType.MUTATION, 850, 11),
|
||||
DEATH(AuraChargeType.DEATH, 400, 5),
|
||||
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),;
|
||||
|
||||
public final AuraChargeType type;
|
||||
public final int duration;
|
||||
/** The number of ticks to count between draining vis from the environment **/
|
||||
public final int tickRate;
|
||||
|
||||
public final int flag;
|
||||
|
||||
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
|
||||
this.type = chargeType;
|
||||
this.duration = duration;
|
||||
this.tickRate = tickRate;
|
||||
flag = 1 << ordinal();
|
||||
}
|
||||
|
||||
public static AuraCharge fromChargeType(AuraChargeType type) {
|
||||
for (AuraCharge charge : values()) {
|
||||
if (type == charge.type) {
|
||||
return charge;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,127 +2,110 @@ package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
|
||||
public enum BeeClassification implements IClassification
|
||||
{
|
||||
VEILED("Veiled", "Velatapis"),
|
||||
ARCANE("Arcane", "Arcanapis"),
|
||||
SUPERNATURAL("Supernatural", "Occultapis"),
|
||||
SCHOLARLY("Scholarly", "Doctapis"),
|
||||
SKULKING("Skulking", "Malevolenapis"),
|
||||
MAGICAL("Magic", "Magicapis"),
|
||||
TIME("Time", "Tempestivapis"),
|
||||
SOUL("Soul", "Animapis"),
|
||||
|
||||
ABOMINABLE("Abominable", "Detestabilapis"),
|
||||
EXTRINSIC("Extrinsic", "Extrarapis"),
|
||||
|
||||
METALLIC("Metallic", "Metalliapis"),
|
||||
GEM("Gem", "Lapidapis"),
|
||||
TRANSMUTING("Transmuting", "Transmutapis"),
|
||||
|
||||
THAUMIC("Thaumic", "Thaumiapis"),
|
||||
FLESHY("Fleshy", "Carnosapis"),
|
||||
|
||||
ALCHEMICAL("Alchemical", "Alchimiapis"),
|
||||
|
||||
ESSENTIAL("Essential", "Essentiapis"),
|
||||
|
||||
THERMAL("Thermal", "Thermametallic"),
|
||||
ADORABLE("Adorable", "Amabilis"),
|
||||
public enum BeeClassification implements IClassification {
|
||||
|
||||
BLOODY("Bloody", "Sanguis"),
|
||||
|
||||
BOTANICAL("Botanical", "Botanica"),
|
||||
;
|
||||
|
||||
private String uID;
|
||||
private String latin;
|
||||
private ArrayList<IAlleleSpecies> species;
|
||||
private IClassification parent;
|
||||
private EnumClassLevel level;
|
||||
|
||||
private BeeClassification(String name, String scientific)
|
||||
{
|
||||
this.uID = "classification." + name.toLowerCase();
|
||||
this.latin = scientific;
|
||||
this.level = EnumClassLevel.GENUS;
|
||||
this.species = new ArrayList<IAlleleSpecies>();
|
||||
this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
|
||||
AlleleManager.alleleRegistry.registerClassification(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClassLevel getLevel()
|
||||
{
|
||||
return this.level;
|
||||
}
|
||||
VEILED("Veiled", "Velatapis"),
|
||||
ARCANE("Arcane", "Arcanapis"),
|
||||
SUPERNATURAL("Supernatural", "Occultapis"),
|
||||
SCHOLARLY("Scholarly", "Doctapis"),
|
||||
SKULKING("Skulking", "Malevolenapis"),
|
||||
MAGICAL("Magic", "Magicapis"),
|
||||
TIME("Time", "Tempestivapis"),
|
||||
SOUL("Soul", "Animapis"),
|
||||
|
||||
@Override
|
||||
public String getUID()
|
||||
{
|
||||
return this.uID;
|
||||
}
|
||||
ABOMINABLE("Abominable", "Detestabilapis"),
|
||||
EXTRINSIC("Extrinsic", "Extrarapis"),
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString(getUID());
|
||||
}
|
||||
METALLIC("Metallic", "Metalliapis"),
|
||||
GEM("Gem", "Lapidapis"),
|
||||
TRANSMUTING("Transmuting", "Transmutapis"),
|
||||
|
||||
@Override
|
||||
public String getScientific()
|
||||
{
|
||||
return this.latin;
|
||||
}
|
||||
THAUMIC("Thaumic", "Thaumiapis"),
|
||||
FLESHY("Fleshy", "Carnosapis"),
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString(getUID() + ".description");
|
||||
}
|
||||
ALCHEMICAL("Alchemical", "Alchimiapis"),
|
||||
|
||||
@Override
|
||||
public IClassification[] getMemberGroups()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ESSENTIAL("Essential", "Essentiapis"),
|
||||
|
||||
@Override
|
||||
public void addMemberGroup(IClassification group)
|
||||
{
|
||||
|
||||
}
|
||||
THERMAL("Thermal", "Thermametallic"),
|
||||
ADORABLE("Adorable", "Amabilis"),
|
||||
|
||||
@Override
|
||||
public IAlleleSpecies[] getMemberSpecies()
|
||||
{
|
||||
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
|
||||
}
|
||||
BLOODY("Bloody", "Sanguis"),
|
||||
|
||||
@Override
|
||||
public void addMemberSpecies(IAlleleSpecies species)
|
||||
{
|
||||
if (!this.species.contains(species))
|
||||
{
|
||||
this.species.add(species);
|
||||
}
|
||||
}
|
||||
BOTANICAL("Botanical", "Botanica"),;
|
||||
|
||||
@Override
|
||||
public IClassification getParent()
|
||||
{
|
||||
return this.parent;
|
||||
}
|
||||
private String uID;
|
||||
private String latin;
|
||||
private ArrayList<IAlleleSpecies> species;
|
||||
private IClassification parent;
|
||||
private EnumClassLevel level;
|
||||
|
||||
@Override
|
||||
public void setParent(IClassification parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
private BeeClassification(String name, String scientific) {
|
||||
this.uID = "classification." + name.toLowerCase();
|
||||
this.latin = scientific;
|
||||
this.level = EnumClassLevel.GENUS;
|
||||
this.species = new ArrayList<IAlleleSpecies>();
|
||||
this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
|
||||
AlleleManager.alleleRegistry.registerClassification(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClassLevel getLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return LocalizationManager.getLocalizedString(getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScientific() {
|
||||
return this.latin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString(getUID() + ".description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification[] getMemberGroups() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberGroup(IClassification group) {}
|
||||
|
||||
@Override
|
||||
public IAlleleSpecies[] getMemberSpecies() {
|
||||
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberSpecies(IAlleleSpecies species) {
|
||||
if (!this.species.contains(species)) {
|
||||
this.species.add(species);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(IClassification parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,23 +1,24 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import forestry.api.apiculture.IBeeIconColourProvider;
|
||||
|
||||
public enum BeeIconColourProvider implements IBeeIconColourProvider {
|
||||
RAINBOW {
|
||||
@Override
|
||||
public int getIconColour(int renderPass) {
|
||||
if (renderPass == 0) {
|
||||
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
|
||||
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
|
||||
} else if (renderPass == 1) {
|
||||
int hue = (int) (System.currentTimeMillis() >> 3) % 360;
|
||||
hue += 60;
|
||||
hue = hue % 360;
|
||||
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
package magicbees.bees;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import forestry.api.apiculture.IBeeIconColourProvider;
|
||||
|
||||
public enum BeeIconColourProvider implements IBeeIconColourProvider {
|
||||
RAINBOW {
|
||||
|
||||
@Override
|
||||
public int getIconColour(int renderPass) {
|
||||
if (renderPass == 0) {
|
||||
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
|
||||
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
|
||||
} else if (renderPass == 1) {
|
||||
int hue = (int) (System.currentTimeMillis() >> 3) % 360;
|
||||
hue += 60;
|
||||
hue = hue % 360;
|
||||
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,50 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBeeIconProvider;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
|
||||
public enum BeeIconProvider implements IBeeIconProvider {
|
||||
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
|
||||
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[][] icons;
|
||||
private final String iconPath;
|
||||
|
||||
BeeIconProvider(String iconPath) {
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister itemMap) {
|
||||
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
|
||||
|
||||
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.VALUES[i];
|
||||
if (beeType == EnumBeeType.NONE)
|
||||
continue;
|
||||
|
||||
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
|
||||
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
|
||||
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return icons[type.ordinal()][Math.min(renderPass, 2)];
|
||||
}
|
||||
}
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBeeIconProvider;
|
||||
import magicbees.main.CommonProxy;
|
||||
|
||||
public enum BeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
|
||||
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[][] icons;
|
||||
|
||||
private final String iconPath;
|
||||
|
||||
BeeIconProvider(String iconPath) {
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister itemMap) {
|
||||
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
|
||||
|
||||
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.VALUES[i];
|
||||
if (beeType == EnumBeeType.NONE) continue;
|
||||
|
||||
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
|
||||
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
|
||||
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return icons[type.ordinal()][Math.min(renderPass, 2)];
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.Tuple;
|
||||
import magicbees.main.utils.compat.ExtraBeesHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -18,95 +14,99 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.Tuple;
|
||||
import magicbees.main.utils.compat.ExtraBeesHelper;
|
||||
|
||||
public class BeeManager
|
||||
{
|
||||
public static IBeeRoot beeRoot;
|
||||
public class BeeManager {
|
||||
|
||||
private static List<Tuple<IAlleleBeeSpecies, Double>> worldgenSpeciesWeights = new ArrayList<Tuple<IAlleleBeeSpecies, Double>>();
|
||||
private static double worldgenSpeciesWeightsTotal = 0;
|
||||
|
||||
public static void getBeeRoot() {
|
||||
beeRoot = (IBeeRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
|
||||
}
|
||||
|
||||
public static void setupAlleles() {
|
||||
Allele.setupAdditionalAlleles();
|
||||
BeeSpecies.setupBeeSpecies();
|
||||
Allele.registerDeprecatedAlleleReplacements();
|
||||
}
|
||||
|
||||
public static void lateBeeInit()
|
||||
{
|
||||
BeeMutation.setupMutations();
|
||||
BeeProductHelper.initBaseProducts();
|
||||
BeeProductHelper.initOreDictSProducts();
|
||||
|
||||
HiveType.initHiveData();
|
||||
|
||||
beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f);
|
||||
}
|
||||
|
||||
public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies beeSpecies, EnumBeeType type) {
|
||||
IBee bee = getBeeFromSpecies(beeSpecies, false);
|
||||
return BeeManager.beeRoot.getMemberStack(bee, type.ordinal());
|
||||
}
|
||||
|
||||
public static IBee getBeeFromSpecies(IAlleleBeeSpecies beeSpecies, boolean applyRainResist) {
|
||||
IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(beeSpecies.getUID());
|
||||
|
||||
if (applyRainResist) {
|
||||
speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate);
|
||||
}
|
||||
|
||||
IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate);
|
||||
return BeeManager.beeRoot.getBee(null, genome);
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) {
|
||||
Collections.shuffle(worldgenSpeciesWeights);
|
||||
double value = r.nextDouble() * worldgenSpeciesWeightsTotal;
|
||||
IAlleleBeeSpecies species = Allele.getBaseSpecies("Forest");
|
||||
|
||||
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
|
||||
value -= t.right.doubleValue();
|
||||
if (value <= 0.0) {
|
||||
species = t.left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return species;
|
||||
}
|
||||
|
||||
public static void addWorldgenSpeciesWeight(IAlleleBeeSpecies species, double d) {
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(species, d));
|
||||
worldgenSpeciesWeightsTotal += d;
|
||||
}
|
||||
|
||||
public static void populateSpeciesListRarity() {
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Forest"), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Meadows"), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Tropical"), 10.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Modest"), 16.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Wintry"), 10.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Ended"), 0.5));
|
||||
|
||||
if (ExtraBeesHelper.isActive()) {
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Water"), 12.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Rock"), 16.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Basalt"), 10.0));
|
||||
}
|
||||
public static IBeeRoot beeRoot;
|
||||
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.MYSTICAL.getSpecies(), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.UNUSUAL.getSpecies(), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.SORCEROUS.getSpecies(), 13.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.ATTUNED.getSpecies(), 6.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.INFERNAL.getSpecies(), 10.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.OBLIVION.getSpecies(), 1.0));
|
||||
|
||||
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
|
||||
worldgenSpeciesWeightsTotal += t.right.doubleValue();
|
||||
}
|
||||
}
|
||||
private static List<Tuple<IAlleleBeeSpecies, Double>> worldgenSpeciesWeights = new ArrayList<Tuple<IAlleleBeeSpecies, Double>>();
|
||||
private static double worldgenSpeciesWeightsTotal = 0;
|
||||
|
||||
public static void getBeeRoot() {
|
||||
beeRoot = (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
|
||||
}
|
||||
|
||||
public static void setupAlleles() {
|
||||
Allele.setupAdditionalAlleles();
|
||||
BeeSpecies.setupBeeSpecies();
|
||||
Allele.registerDeprecatedAlleleReplacements();
|
||||
}
|
||||
|
||||
public static void lateBeeInit() {
|
||||
BeeMutation.setupMutations();
|
||||
BeeProductHelper.initBaseProducts();
|
||||
BeeProductHelper.initOreDictSProducts();
|
||||
|
||||
HiveType.initHiveData();
|
||||
|
||||
beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f);
|
||||
}
|
||||
|
||||
public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies beeSpecies, EnumBeeType type) {
|
||||
IBee bee = getBeeFromSpecies(beeSpecies, false);
|
||||
return BeeManager.beeRoot.getMemberStack(bee, type.ordinal());
|
||||
}
|
||||
|
||||
public static IBee getBeeFromSpecies(IAlleleBeeSpecies beeSpecies, boolean applyRainResist) {
|
||||
IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(beeSpecies.getUID());
|
||||
|
||||
if (applyRainResist) {
|
||||
speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate);
|
||||
}
|
||||
|
||||
IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate);
|
||||
return BeeManager.beeRoot.getBee(null, genome);
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) {
|
||||
Collections.shuffle(worldgenSpeciesWeights);
|
||||
double value = r.nextDouble() * worldgenSpeciesWeightsTotal;
|
||||
IAlleleBeeSpecies species = Allele.getBaseSpecies("Forest");
|
||||
|
||||
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
|
||||
value -= t.right.doubleValue();
|
||||
if (value <= 0.0) {
|
||||
species = t.left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return species;
|
||||
}
|
||||
|
||||
public static void addWorldgenSpeciesWeight(IAlleleBeeSpecies species, double d) {
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(species, d));
|
||||
worldgenSpeciesWeightsTotal += d;
|
||||
}
|
||||
|
||||
public static void populateSpeciesListRarity() {
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Forest"), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Meadows"), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Tropical"), 10.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Modest"), 16.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Wintry"), 10.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Ended"), 0.5));
|
||||
|
||||
if (ExtraBeesHelper.isActive()) {
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Water"), 12.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Rock"), 16.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Basalt"), 10.0));
|
||||
}
|
||||
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.MYSTICAL.getSpecies(), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.UNUSUAL.getSpecies(), 20.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.SORCEROUS.getSpecies(), 13.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.ATTUNED.getSpecies(), 6.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.INFERNAL.getSpecies(), 10.0));
|
||||
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.OBLIVION.getSpecies(), 1.0));
|
||||
|
||||
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
|
||||
worldgenSpeciesWeightsTotal += t.right.doubleValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,191 +1,187 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHiveDescription;
|
||||
import forestry.api.apiculture.hives.IHiveGen;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.world.feature.FeatureOreVein;
|
||||
import magicbees.world.feature.HiveGenNether;
|
||||
import magicbees.world.feature.HiveGenOblivion;
|
||||
import magicbees.world.feature.HiveGenUnderground;
|
||||
|
||||
public enum HiveDescription implements IHiveDescription {
|
||||
CURIOUS(HiveType.CURIOUS, 3.0f, HiveManager.genHelper.tree(), false,
|
||||
BiomeDictionary.Type.FOREST, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.HILLS),
|
||||
UNUSUAL(HiveType.UNUSUAL, 1.0f, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass), false,
|
||||
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.RIVER),
|
||||
RESONANT(HiveType.RESONANT, 0.9f, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone), false,
|
||||
BiomeDictionary.Type.SANDY, BiomeDictionary.Type.MESA, BiomeDictionary.Type.HOT, BiomeDictionary.Type.MAGICAL),
|
||||
DEEP(HiveType.DEEP, 5.0f, new HiveGenUnderground(10, 15, 5), true,
|
||||
BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.MAGICAL) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
|
||||
}
|
||||
},
|
||||
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true,
|
||||
BiomeDictionary.Type.NETHER) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
|
||||
}
|
||||
},
|
||||
INFERNAL_OVERWORLD(HiveType.INFERNAL, 0.95f, new HiveGenUnderground(5, 13, 6), true,
|
||||
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.HOT) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
|
||||
|
||||
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
|
||||
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
|
||||
}
|
||||
|
||||
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
|
||||
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
|
||||
}
|
||||
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
|
||||
}
|
||||
},
|
||||
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true,
|
||||
BiomeDictionary.Type.END) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
|
||||
|
||||
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
|
||||
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
|
||||
}
|
||||
}
|
||||
},
|
||||
OBLIVION_OVERWORLD(HiveType.OBLIVION, 0.87f, new HiveGenUnderground(5, 5, 5), true,
|
||||
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.COLD) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
|
||||
}
|
||||
};
|
||||
|
||||
private static boolean logSpawns = Config.logHiveSpawns;
|
||||
|
||||
private final HiveType hiveType;
|
||||
private final float genChance;
|
||||
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
|
||||
private final IHiveGen hiveGen;
|
||||
private final boolean spawnsIgnoreClimate;
|
||||
|
||||
private HiveDescription(HiveType type, float chance, IHiveGen genType, boolean ignoreClimate, BiomeDictionary.Type ... goodBiomeTypes) {
|
||||
hiveType = type;
|
||||
genChance = chance;
|
||||
hiveGen = genType;
|
||||
spawnsIgnoreClimate = ignoreClimate;
|
||||
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
|
||||
biomes.add(biomeType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHiveGen getHiveGen()
|
||||
{
|
||||
return hiveGen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock()
|
||||
{
|
||||
return Config.hive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta()
|
||||
{
|
||||
return hiveType.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodBiome(BiomeGenBase biome)
|
||||
{
|
||||
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
|
||||
for (BiomeDictionary.Type type : types)
|
||||
{
|
||||
if (biomes.contains(type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodHumidity(EnumHumidity humidity)
|
||||
{
|
||||
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature)
|
||||
{
|
||||
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGenChance()
|
||||
{
|
||||
return genChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z)
|
||||
{
|
||||
if (logSpawns)
|
||||
{
|
||||
LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y + ", Z: " + z);
|
||||
}
|
||||
}
|
||||
}
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHiveDescription;
|
||||
import forestry.api.apiculture.hives.IHiveGen;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.world.feature.FeatureOreVein;
|
||||
import magicbees.world.feature.HiveGenNether;
|
||||
import magicbees.world.feature.HiveGenOblivion;
|
||||
import magicbees.world.feature.HiveGenUnderground;
|
||||
|
||||
public enum HiveDescription implements IHiveDescription {
|
||||
|
||||
CURIOUS(HiveType.CURIOUS, 3.0f, HiveManager.genHelper.tree(), false, BiomeDictionary.Type.FOREST,
|
||||
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.HILLS),
|
||||
UNUSUAL(HiveType.UNUSUAL, 1.0f, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass), false,
|
||||
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.HILLS,
|
||||
BiomeDictionary.Type.RIVER),
|
||||
RESONANT(HiveType.RESONANT, 0.9f, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone), false,
|
||||
BiomeDictionary.Type.SANDY, BiomeDictionary.Type.MESA, BiomeDictionary.Type.HOT,
|
||||
BiomeDictionary.Type.MAGICAL),
|
||||
DEEP(HiveType.DEEP, 5.0f, new HiveGenUnderground(10, 15, 5), true, BiomeDictionary.Type.HILLS,
|
||||
BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.MAGICAL) {
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
|
||||
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
|
||||
}
|
||||
},
|
||||
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true, BiomeDictionary.Type.NETHER) {
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
|
||||
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
|
||||
}
|
||||
},
|
||||
INFERNAL_OVERWORLD(HiveType.INFERNAL, 0.95f, new HiveGenUnderground(5, 13, 6), true, BiomeDictionary.Type.MAGICAL,
|
||||
BiomeDictionary.Type.HOT) {
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
|
||||
|
||||
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
|
||||
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
|
||||
}
|
||||
|
||||
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
|
||||
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
|
||||
}
|
||||
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
|
||||
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
|
||||
}
|
||||
},
|
||||
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true, BiomeDictionary.Type.END) {
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
|
||||
|
||||
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
|
||||
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
|
||||
}
|
||||
}
|
||||
},
|
||||
OBLIVION_OVERWORLD(HiveType.OBLIVION, 0.87f, new HiveGenUnderground(5, 5, 5), true, BiomeDictionary.Type.MAGICAL,
|
||||
BiomeDictionary.Type.COLD) {
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
super.postGen(world, x, y, z);
|
||||
Random random = world.rand;
|
||||
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
|
||||
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
|
||||
}
|
||||
};
|
||||
|
||||
private static boolean logSpawns = Config.logHiveSpawns;
|
||||
|
||||
private final HiveType hiveType;
|
||||
private final float genChance;
|
||||
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
|
||||
private final IHiveGen hiveGen;
|
||||
private final boolean spawnsIgnoreClimate;
|
||||
|
||||
private HiveDescription(HiveType type, float chance, IHiveGen genType, boolean ignoreClimate,
|
||||
BiomeDictionary.Type... goodBiomeTypes) {
|
||||
hiveType = type;
|
||||
genChance = chance;
|
||||
hiveGen = genType;
|
||||
spawnsIgnoreClimate = ignoreClimate;
|
||||
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
|
||||
biomes.add(biomeType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHiveGen getHiveGen() {
|
||||
return hiveGen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return Config.hive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return hiveType.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodBiome(BiomeGenBase biome) {
|
||||
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
|
||||
for (BiomeDictionary.Type type : types) {
|
||||
if (biomes.contains(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodHumidity(EnumHumidity humidity) {
|
||||
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGenChance() {
|
||||
return genChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
if (logSpawns) {
|
||||
LogHelper.info(
|
||||
"Spawned " + this.toString()
|
||||
.toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y + ", Z: " + z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,73 +5,65 @@ import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class HiveDrop implements IHiveDrop
|
||||
{
|
||||
private IAllele[] template;
|
||||
private int chance;
|
||||
private ItemStack[] bonus;
|
||||
private float ignoblePercent = 0f;
|
||||
|
||||
public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance)
|
||||
{
|
||||
this.template = beeTemplate;
|
||||
this.bonus = bonusDrops;
|
||||
this.chance = dropChance;
|
||||
}
|
||||
|
||||
public HiveDrop setIgnoblePercentage(float f)
|
||||
{
|
||||
this.ignoblePercent = f;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private IBee getBee(World w)
|
||||
{
|
||||
IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template));
|
||||
if (w.rand.nextFloat() < this.ignoblePercent)
|
||||
{
|
||||
bee.setIsNatural(false);
|
||||
}
|
||||
|
||||
return bee;
|
||||
}
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
@Override
|
||||
public ItemStack getPrincess(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal());
|
||||
}
|
||||
private IAllele[] template;
|
||||
private int chance;
|
||||
private ItemStack[] bonus;
|
||||
private float ignoblePercent = 0f;
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> value = new ArrayList<ItemStack>(1);
|
||||
value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal()));
|
||||
return value;
|
||||
}
|
||||
public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance) {
|
||||
this.template = beeTemplate;
|
||||
this.bonus = bonusDrops;
|
||||
this.chance = dropChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
|
||||
|
||||
for (int i = 0; i < bonus.length; ++i)
|
||||
{
|
||||
value.add(bonus[i].copy());
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
public HiveDrop setIgnoblePercentage(float f) {
|
||||
this.ignoblePercent = f;
|
||||
|
||||
@Override
|
||||
public int getChance(World world, int x, int y, int z)
|
||||
{
|
||||
return this.chance;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private IBee getBee(World w) {
|
||||
IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template));
|
||||
if (w.rand.nextFloat() < this.ignoblePercent) {
|
||||
bee.setIsNatural(false);
|
||||
}
|
||||
|
||||
return bee;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPrincess(World world, int x, int y, int z, int fortune) {
|
||||
return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> value = new ArrayList<ItemStack>(1);
|
||||
value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal()));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
|
||||
|
||||
for (int i = 0; i < bonus.length; ++i) {
|
||||
value.add(bonus[i].copy());
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance(World world, int x, int y, int z) {
|
||||
return this.chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import magicbees.main.utils.ItemStackUtils;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
|
||||
public class MagicApiaryInventory implements IApiaryInventory {
|
||||
|
||||
public static final int SLOT_QUEEN = 0;
|
||||
public static final int SLOT_DRONE = 1;
|
||||
public static final int SLOT_FRAME_START = 2;
|
||||
public static final int SLOT_FRAME_COUNT = 3;
|
||||
public static final int SLOT_PRODUCTS_START = 5;
|
||||
public static final int SLOT_PRODUCTS_COUNT = 7;
|
||||
|
||||
private final TileEntityMagicApiary magicApiary;
|
||||
private final ItemStack[] items;
|
||||
|
||||
public MagicApiaryInventory(TileEntityMagicApiary magicApiary) {
|
||||
this.magicApiary = magicApiary;
|
||||
this.items = new ItemStack[12];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getQueen() {
|
||||
return magicApiary.getStackInSlot(SLOT_QUEEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDrone() {
|
||||
return magicApiary.getStackInSlot(SLOT_DRONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueen(ItemStack itemstack) {
|
||||
magicApiary.setInventorySlotContents(SLOT_QUEEN, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrone(ItemStack itemstack) {
|
||||
magicApiary.setInventorySlotContents(SLOT_DRONE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
int countAdded = ItemStackUtils
|
||||
.addItemToInventory(magicApiary, product, SLOT_PRODUCTS_START, SLOT_PRODUCTS_COUNT);
|
||||
|
||||
if (all) {
|
||||
return countAdded == product.stackSize;
|
||||
}
|
||||
return countAdded > 0;
|
||||
}
|
||||
|
||||
public int getSizeInventory() {
|
||||
return items.length;
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return items[i];
|
||||
}
|
||||
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
items[i] = itemStack;
|
||||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
if (side == 0 || side == 1) {
|
||||
return new int[] { SLOT_QUEEN, SLOT_DRONE };
|
||||
}
|
||||
int[] slots = new int[SLOT_PRODUCTS_COUNT];
|
||||
for (int i = 0, slot = SLOT_PRODUCTS_START; i < SLOT_PRODUCTS_COUNT; ++i, ++slot) {
|
||||
slots[i] = slot;
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
if (slot == SLOT_QUEEN && BeeManager.beeRoot.isMember(itemStack) && !BeeManager.beeRoot.isDrone(itemStack)) {
|
||||
return true;
|
||||
} else if (slot == SLOT_DRONE && BeeManager.beeRoot.isDrone(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
return slot == SLOT_DRONE && BeeManager.beeRoot.isDrone(itemStack);
|
||||
}
|
||||
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return slot >= SLOT_FRAME_START && slot <= SLOT_FRAME_START + 2;
|
||||
}
|
||||
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public Collection<IHiveFrame> getFrames() {
|
||||
Collection<IHiveFrame> hiveFrames = new ArrayList<IHiveFrame>(SLOT_FRAME_COUNT);
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++) {
|
||||
ItemStack stackInSlot = magicApiary.getStackInSlot(i);
|
||||
if (stackInSlot == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Item itemInSlot = stackInSlot.getItem();
|
||||
if (itemInSlot instanceof IHiveFrame) {
|
||||
hiveFrames.add((IHiveFrame) itemInSlot);
|
||||
}
|
||||
}
|
||||
return hiveFrames;
|
||||
}
|
||||
|
||||
public void wearOutFrames(IBeeHousing beeHousing, int amount) {
|
||||
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(magicApiary.getWorldObj());
|
||||
int wear = Math.round(amount * beekeepingMode.getWearModifier());
|
||||
for (int i = MagicApiaryInventory.SLOT_FRAME_START; i
|
||||
< MagicApiaryInventory.SLOT_FRAME_START + MagicApiaryInventory.SLOT_FRAME_COUNT; i++) {
|
||||
ItemStack hiveFrameStack = magicApiary.getStackInSlot(i);
|
||||
if (hiveFrameStack == null) {
|
||||
continue;
|
||||
}
|
||||
Item hiveFrameItem = hiveFrameStack.getItem();
|
||||
if (!(hiveFrameItem instanceof IHiveFrame)) {
|
||||
continue;
|
||||
}
|
||||
IHiveFrame hiveFrame = (IHiveFrame) hiveFrameItem;
|
||||
ItemStack queenStack = magicApiary.getBeeInventory().getQueen();
|
||||
IBee queen = BeeManager.beeRoot.getMember(queenStack);
|
||||
ItemStack usedFrame = hiveFrame.frameUsed(magicApiary, hiveFrameStack, queen, wear);
|
||||
magicApiary.setInventorySlotContents(i, usedFrame);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
NBTTagList itemsNBT = new NBTTagList();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
ItemStack itemStack = items[i];
|
||||
if (itemStack != null) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
item.setByte("Slot", (byte) i);
|
||||
itemStack.writeToNBT(item);
|
||||
itemsNBT.appendTag(item);
|
||||
}
|
||||
}
|
||||
compound.setTag("Items", itemsNBT);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
NBTTagList items = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
for (int i = 0; i < items.tagCount(); i++) {
|
||||
NBTTagCompound item = items.getCompoundTagAt(i);
|
||||
int slot = item.getByte("Slot");
|
||||
if (slot >= 0 && slot < getSizeInventory()) {
|
||||
setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,53 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
|
||||
// There is a bonus to this mutation during moon phases...
|
||||
public class MoonPhaseMutationBonus implements IMutationCondition {
|
||||
private final MoonPhase moonPhaseStart;
|
||||
private final MoonPhase moonPhaseEnd;
|
||||
private final float mutationBonus;
|
||||
|
||||
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
|
||||
this.moonPhaseStart = phase;
|
||||
this.moonPhaseEnd = phase;
|
||||
this.mutationBonus = bonus;
|
||||
}
|
||||
|
||||
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
|
||||
this.moonPhaseStart = start;
|
||||
this.moonPhaseEnd = end;
|
||||
this.mutationBonus = bonus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
|
||||
return this.mutationBonus;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (this.moonPhaseStart != this.moonPhaseEnd) {
|
||||
return String.format(LocalizationManager.getLocalizedString("research.bonusPhase"),
|
||||
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
|
||||
} else {
|
||||
return String.format(LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
|
||||
moonPhaseStart.getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
|
||||
// There is a bonus to this mutation during moon phases...
|
||||
public class MoonPhaseMutationBonus implements IMutationCondition {
|
||||
|
||||
private final MoonPhase moonPhaseStart;
|
||||
private final MoonPhase moonPhaseEnd;
|
||||
private final float mutationBonus;
|
||||
|
||||
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
|
||||
this.moonPhaseStart = phase;
|
||||
this.moonPhaseEnd = phase;
|
||||
this.mutationBonus = bonus;
|
||||
}
|
||||
|
||||
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
|
||||
this.moonPhaseStart = start;
|
||||
this.moonPhaseEnd = end;
|
||||
this.mutationBonus = bonus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,
|
||||
IGenome genome1, IClimateProvider climate) {
|
||||
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
|
||||
return this.mutationBonus;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (this.moonPhaseStart != this.moonPhaseEnd) {
|
||||
return String.format(
|
||||
LocalizationManager.getLocalizedString("research.bonusPhase"),
|
||||
moonPhaseStart.getLocalizedNameAlt(),
|
||||
moonPhaseEnd.getLocalizedNameAlt());
|
||||
} else {
|
||||
return String.format(
|
||||
LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
|
||||
moonPhaseStart.getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,49 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
|
||||
public class MoonPhaseMutationRestriction implements IMutationCondition {
|
||||
private final MoonPhase moonPhaseStart;
|
||||
private final MoonPhase moonPhaseEnd;
|
||||
|
||||
public MoonPhaseMutationRestriction(MoonPhase phase) {
|
||||
this.moonPhaseStart = phase;
|
||||
this.moonPhaseEnd = phase;
|
||||
}
|
||||
|
||||
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
|
||||
this.moonPhaseStart = start;
|
||||
this.moonPhaseEnd = end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (moonPhaseStart != moonPhaseEnd) {
|
||||
return String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
|
||||
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
|
||||
}
|
||||
else {
|
||||
return String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
|
||||
moonPhaseStart.getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
|
||||
public class MoonPhaseMutationRestriction implements IMutationCondition {
|
||||
|
||||
private final MoonPhase moonPhaseStart;
|
||||
private final MoonPhase moonPhaseEnd;
|
||||
|
||||
public MoonPhaseMutationRestriction(MoonPhase phase) {
|
||||
this.moonPhaseStart = phase;
|
||||
this.moonPhaseEnd = phase;
|
||||
}
|
||||
|
||||
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
|
||||
this.moonPhaseStart = start;
|
||||
this.moonPhaseEnd = end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,
|
||||
IGenome genome1, IClimateProvider climate) {
|
||||
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (moonPhaseStart != moonPhaseEnd) {
|
||||
return String.format(
|
||||
LocalizationManager.getLocalizedString("research.requiresPhase"),
|
||||
moonPhaseStart.getLocalizedNameAlt(),
|
||||
moonPhaseEnd.getLocalizedNameAlt());
|
||||
} else {
|
||||
return String.format(
|
||||
LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
|
||||
moonPhaseStart.getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,86 +2,92 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
public class AlleleEffectCrumbling extends AlleleEffect {
|
||||
private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>();
|
||||
|
||||
public static void addPairToMap(ItemStack source, ItemStack target) {
|
||||
boolean add = true;
|
||||
for (ItemStack i : crumbleMap.keySet()) {
|
||||
if (OreDictionary.itemMatches(i, source, false)) {
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
crumbleMap.put(source, target);
|
||||
}
|
||||
}
|
||||
private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>();
|
||||
|
||||
public AlleleEffectCrumbling(String id, boolean isDominant) {
|
||||
super(id, isDominant, 600);
|
||||
public static void addPairToMap(ItemStack source, ItemStack target) {
|
||||
boolean add = true;
|
||||
for (ItemStack i : crumbleMap.keySet()) {
|
||||
if (OreDictionary.itemMatches(i, source, false)) {
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
crumbleMap.put(source, target);
|
||||
}
|
||||
}
|
||||
|
||||
addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
|
||||
addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
|
||||
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2));
|
||||
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1));
|
||||
addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1));
|
||||
addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand));
|
||||
}
|
||||
public AlleleEffectCrumbling(String id, boolean isDominant) {
|
||||
super(id, isDominant, 600);
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
|
||||
addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
|
||||
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2));
|
||||
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1));
|
||||
addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1));
|
||||
addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
// Get random coords within territory
|
||||
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
|
||||
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
|
||||
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
|
||||
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
|
||||
// Get random coords within territory
|
||||
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
|
||||
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
|
||||
|
||||
Block block = world.getBlock(xCoord, yCoord, zCoord);
|
||||
if (block != null) {
|
||||
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
for (ItemStack key : crumbleMap.keySet()) {
|
||||
if (OreDictionary.itemMatches(source, key, false)) {
|
||||
ItemStack target = crumbleMap.get(key);
|
||||
world.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromItem(target.getItem()), target.getItemDamage(), 2);
|
||||
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
|
||||
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
|
||||
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Block block = world.getBlock(xCoord, yCoord, zCoord);
|
||||
if (block != null) {
|
||||
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
for (ItemStack key : crumbleMap.keySet()) {
|
||||
if (OreDictionary.itemMatches(source, key, false)) {
|
||||
ItemStack target = crumbleMap.get(key);
|
||||
world.setBlock(
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
Block.getBlockFromItem(target.getItem()),
|
||||
target.getItemDamage(),
|
||||
2);
|
||||
|
||||
storedData.setInteger(0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -2,40 +2,38 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
|
||||
public class AlleleEffectCure extends AlleleEffect {
|
||||
|
||||
public AlleleEffectCure(String id, boolean isDominant) {
|
||||
super(id, isDominant, 200);
|
||||
}
|
||||
public AlleleEffectCure(String id, boolean isDominant) {
|
||||
super(id, isDominant, 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null) {
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null) {
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class);
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class);
|
||||
|
||||
for (EntityPlayer player : entityList) {
|
||||
player.curePotionEffects(new ItemStack(Items.milk_bucket));
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
for (EntityPlayer player : entityList) {
|
||||
player.curePotionEffects(new ItemStack(Items.milk_bucket));
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,118 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.List;
|
||||
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.getWeightedRandomAspect;
|
||||
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.updateNode;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeAcceleratableEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.nodes.INode;
|
||||
|
||||
public class AlleleEffectEmpowering extends AlleleEffect {
|
||||
public class AlleleEffectEmpowering extends AlleleEffect implements IAlleleBeeAcceleratableEffect {
|
||||
|
||||
public AlleleEffectEmpowering(String id, boolean isDominant) {
|
||||
super(id, isDominant, 200);
|
||||
combinable = true;
|
||||
}
|
||||
public AlleleEffectEmpowering(String id, boolean isDominant) {
|
||||
super(id, isDominant, 200);
|
||||
combinable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (!(storedData instanceof EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = Math
|
||||
.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = Math.max((int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
if (NodeHelper.growNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectAccelerated(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, float did) {
|
||||
storedData.setInteger(0, 0);
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = Math
|
||||
.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
int idid = (int) did;
|
||||
|
||||
List<INode> nodes = new ArrayList<>(idid);
|
||||
Collections.shuffle(chunks);
|
||||
for (Chunk chunk : chunks) {
|
||||
List<INode> l = NodeHelper.findNodesInChunkWithinRange(chunk, coords.posX, coords.posY, coords.posZ, range);
|
||||
nodes.addAll(l);
|
||||
idid -= l.size();
|
||||
if (idid <= 0) {
|
||||
while (idid < 0) {
|
||||
nodes.remove(0);
|
||||
idid++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nodes.isEmpty()) return storedData;
|
||||
|
||||
did /= (float) nodes.size();
|
||||
if (did < 1f) did = 1f;
|
||||
|
||||
for (INode node : nodes) {
|
||||
AspectList aspectsBase = node.getAspectsBase();
|
||||
int randBase = Math.max(aspectsBase.visSize(), 1);
|
||||
if (world.rand.nextInt(randBase) < 120) {
|
||||
Aspect aspectToAdd;
|
||||
int rollAttempts = 0;
|
||||
short amount = (short) Math
|
||||
.min((int) did + world.rand.nextInt((int) (2f * did)), Config.thaumcraftNodeMaxSize);
|
||||
do {
|
||||
aspectToAdd = getWeightedRandomAspect(world.rand);
|
||||
++rollAttempts;
|
||||
} while (aspectsBase.getAmount(aspectToAdd) > (Config.thaumcraftNodeMaxSize - 1) && rollAttempts < 20);
|
||||
|
||||
if (20 <= rollAttempts) {
|
||||
continue;
|
||||
}
|
||||
|
||||
amount = (short) Math.min(Config.thaumcraftNodeMaxSize - aspectsBase.getAmount(aspectToAdd), amount);
|
||||
|
||||
aspectsBase.add(aspectToAdd, amount);
|
||||
node.getAspects().add(aspectToAdd, amount);
|
||||
updateNode(node, world);
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -2,49 +2,50 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import thaumcraft.api.nodes.NodeType;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
import thaumcraft.api.nodes.NodeType;
|
||||
|
||||
public class AlleleEffectNodeConversion extends AlleleEffect {
|
||||
|
||||
private NodeType targetType;
|
||||
|
||||
public AlleleEffectNodeConversion(String id, NodeType targetNodeType, boolean isDominant, int timeout) {
|
||||
super(id, isDominant, timeout);
|
||||
targetType = targetNodeType;
|
||||
}
|
||||
private NodeType targetType;
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
public AlleleEffectNodeConversion(String id, NodeType targetNodeType, boolean isDominant, int timeout) {
|
||||
super(id, isDominant, timeout);
|
||||
targetType = targetNodeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
if (NodeHelper.convertNodeInRangeToType(chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) {
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
if (NodeHelper
|
||||
.convertNodeInRangeToType(chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) {
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -16,31 +17,30 @@ import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
|
||||
public class AlleleEffectNodeRepair extends AlleleEffect {
|
||||
|
||||
public AlleleEffectNodeRepair(String id, boolean isDominant) {
|
||||
super(id, isDominant, 2);
|
||||
}
|
||||
public AlleleEffectNodeRepair(String id, boolean isDominant) {
|
||||
super(id, isDominant, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -7,18 +7,17 @@ import magicbees.bees.AlleleEffect;
|
||||
|
||||
public class AlleleEffectPlaceholder extends AlleleEffect {
|
||||
|
||||
public AlleleEffectPlaceholder(String id, boolean isDominant) {
|
||||
super(id, isDominant, 100000);
|
||||
}
|
||||
public AlleleEffectPlaceholder(String id, boolean isDominant) {
|
||||
super(id, isDominant, 100000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome,IEffectData storedData, IBeeHousing housing) {
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -13,52 +11,54 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
|
||||
public class AlleleEffectPotion extends AlleleEffect {
|
||||
private int potionId;
|
||||
private int duration;
|
||||
private boolean isMalicious;
|
||||
|
||||
public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant) {
|
||||
super(name, isDominant, 200);
|
||||
this.potionId = potionApplied.id;
|
||||
this.duration = 20 * effectDuration;
|
||||
this.isMalicious = false;
|
||||
}
|
||||
private int potionId;
|
||||
private int duration;
|
||||
private boolean isMalicious;
|
||||
|
||||
public AlleleEffectPotion setMalicious() {
|
||||
this.isMalicious = true;
|
||||
public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant) {
|
||||
super(name, isDominant, 200);
|
||||
this.potionId = potionApplied.id;
|
||||
this.duration = 20 * effectDuration;
|
||||
this.isMalicious = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
public AlleleEffectPotion setMalicious() {
|
||||
this.isMalicious = true;
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null) {
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class);
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null) {
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
for (EntityLivingBase e : entityList) {
|
||||
if (this.isMalicious) {
|
||||
int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true);
|
||||
int finalDuration = this.duration / 4 * (4 - armorPieces);
|
||||
if (finalDuration > 0) {
|
||||
e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
|
||||
}
|
||||
} else {
|
||||
if (e instanceof EntityPlayer) {
|
||||
e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
for (EntityLivingBase e : entityList) {
|
||||
if (this.isMalicious) {
|
||||
int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true);
|
||||
int finalDuration = this.duration / 4 * (4 - armorPieces);
|
||||
if (finalDuration > 0) {
|
||||
e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
|
||||
}
|
||||
} else {
|
||||
if (e instanceof EntityPlayer) {
|
||||
e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,118 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.List;
|
||||
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.updateNode;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeAcceleratableEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.BlockUtil;
|
||||
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.nodes.INode;
|
||||
|
||||
public class AlleleEffectRecharge extends AlleleEffect {
|
||||
|
||||
public AlleleEffectRecharge(String id, boolean isDominant) {
|
||||
super(id, isDominant, 20);
|
||||
combinable = true;
|
||||
}
|
||||
public class AlleleEffectRecharge extends AlleleEffect implements IAlleleBeeAcceleratableEffect {
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
public AlleleEffectRecharge(String id, boolean isDominant) {
|
||||
super(id, isDominant, 20);
|
||||
combinable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (!(storedData instanceof EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
if (NodeHelper.rechargeNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectAccelerated(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, float did) {
|
||||
storedData.setInteger(0, 0);
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
int range = Math
|
||||
.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
|
||||
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
|
||||
|
||||
int idid = (int) did;
|
||||
|
||||
List<INode> nodes = new ArrayList<>(idid);
|
||||
Collections.shuffle(chunks);
|
||||
for (Chunk chunk : chunks) {
|
||||
List<INode> l = NodeHelper.findNodesInChunkWithinRange(chunk, coords.posX, coords.posY, coords.posZ, range);
|
||||
nodes.addAll(l);
|
||||
idid -= l.size();
|
||||
if (idid <= 0) {
|
||||
while (idid < 0) {
|
||||
nodes.remove(0);
|
||||
idid++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nodes.isEmpty()) return storedData;
|
||||
|
||||
did /= (float) nodes.size();
|
||||
if (did < 1f) did = 1f;
|
||||
|
||||
for (INode node : nodes) {
|
||||
AspectList baseAspects = node.getAspectsBase();
|
||||
AspectList currentAspects = node.getAspects();
|
||||
|
||||
HashMap<Aspect, Integer> toAdd = new HashMap<>();
|
||||
int total = 0;
|
||||
|
||||
for (Map.Entry<Aspect, Integer> aspect : baseAspects.aspects.entrySet()) {
|
||||
int diff = aspect.getValue() - currentAspects.getAmount(aspect.getKey());
|
||||
if (diff <= 0) continue;
|
||||
toAdd.put(aspect.getKey(), diff);
|
||||
total += diff;
|
||||
}
|
||||
|
||||
if (total == 0) continue;
|
||||
|
||||
int amount = Math.min(total + world.rand.nextInt(total), (int) did);
|
||||
if (amount <= 0) amount = 1;
|
||||
|
||||
for (Map.Entry<Aspect, Integer> aspect : toAdd.entrySet()) {
|
||||
currentAspects.add(aspect.getKey(), Math.min(aspect.getValue(), amount));
|
||||
}
|
||||
|
||||
updateNode(node, world);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,6 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -12,175 +9,191 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
public class AlleleEffectSpawnMob extends AlleleEffect {
|
||||
protected boolean aggosOnPlayer;
|
||||
protected boolean spawnsWhilePlayerNear;
|
||||
protected String alternateMob;
|
||||
protected String mobName;
|
||||
protected String mobSound;
|
||||
protected int chanceToSpawn;
|
||||
protected int maxMobsInArea;
|
||||
|
||||
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn) {
|
||||
this(id, isDominant, mobToSpawn, null);
|
||||
}
|
||||
protected boolean aggosOnPlayer;
|
||||
protected boolean spawnsWhilePlayerNear;
|
||||
protected String alternateMob;
|
||||
protected String mobName;
|
||||
protected String mobSound;
|
||||
protected int chanceToSpawn;
|
||||
protected int maxMobsInArea;
|
||||
|
||||
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx) {
|
||||
super(id, isDominant, 200);
|
||||
this.aggosOnPlayer = false;
|
||||
this.mobName = mobToSpawn;
|
||||
this.chanceToSpawn = 100;
|
||||
this.maxMobsInArea = 6;
|
||||
this.mobSound = mobSoundFx;
|
||||
}
|
||||
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn) {
|
||||
this(id, isDominant, mobToSpawn, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
// Throttle; Ready to spawn
|
||||
storedData = new EffectData(1, 1, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx) {
|
||||
super(id, isDominant, 200);
|
||||
this.aggosOnPlayer = false;
|
||||
this.mobName = mobToSpawn;
|
||||
this.chanceToSpawn = 100;
|
||||
this.maxMobsInArea = 6;
|
||||
this.mobSound = mobSoundFx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
// Check if we're ready to spawn the mob.
|
||||
boolean didSpawn = false;
|
||||
if (storedData.getBoolean(0)) {
|
||||
World w = housing.getWorld();
|
||||
|
||||
int roll = w.rand.nextInt(100);
|
||||
|
||||
if (roll <= chanceToSpawn) {
|
||||
if (spawnsWhilePlayerNear) {
|
||||
EntityPlayer target = findPlayerTarget(genome, housing);
|
||||
|
||||
// Let's spawn a mob. =D
|
||||
if (target != null) {
|
||||
didSpawn = spawnMob(genome, target, w, housing, false);
|
||||
} else if (alternateMob != null) {
|
||||
didSpawn = spawnMob(genome, null, w, housing, true);
|
||||
}
|
||||
} else {
|
||||
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
|
||||
}
|
||||
} else {
|
||||
playMobLiveSound(genome, housing, w);
|
||||
didSpawn = true;
|
||||
}
|
||||
|
||||
if (didSpawn) {
|
||||
storedData.setBoolean(0, !didSpawn);
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
}
|
||||
else {
|
||||
storedData.setBoolean(0, true);
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
// Throttle; Ready to spawn
|
||||
storedData = new EffectData(1, 1, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
// Check if we're ready to spawn the mob.
|
||||
boolean didSpawn = false;
|
||||
if (storedData.getBoolean(0)) {
|
||||
World w = housing.getWorld();
|
||||
|
||||
private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) {
|
||||
if (mobSound != null && w.rand.nextInt(100) < 35) {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
int roll = w.rand.nextInt(100);
|
||||
|
||||
int range = genome.getTerritory()[0];
|
||||
double x = coords.posX + w.rand.nextDouble() * (range * 2) - range;
|
||||
range = genome.getTerritory()[1];
|
||||
double y = coords.posY + w.rand.nextDouble() * (range * 2) - range;
|
||||
range = genome.getTerritory()[2];
|
||||
double z = coords.posZ + w.rand.nextDouble() * (range * 2) - range;
|
||||
w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f);
|
||||
}
|
||||
}
|
||||
if (roll <= chanceToSpawn) {
|
||||
if (spawnsWhilePlayerNear) {
|
||||
EntityPlayer target = findPlayerTarget(genome, housing);
|
||||
|
||||
private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) {
|
||||
List<EntityPlayer> entities = getEntitiesWithinRange(genome, housing, EntityPlayer.class);
|
||||
for (EntityPlayer e : entities) {
|
||||
// Check for wearing armor & cancel
|
||||
// Full armor suit is treated as "invisible."
|
||||
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) e, getUID(), true) < 4) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// Let's spawn a mob. =D
|
||||
if (target != null) {
|
||||
didSpawn = spawnMob(genome, target, w, housing, false);
|
||||
} else if (alternateMob != null) {
|
||||
didSpawn = spawnMob(genome, null, w, housing, true);
|
||||
}
|
||||
} else {
|
||||
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
|
||||
}
|
||||
} else {
|
||||
playMobLiveSound(genome, housing, w);
|
||||
didSpawn = true;
|
||||
}
|
||||
|
||||
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
|
||||
boolean spawnedFlag = false;
|
||||
if (didSpawn) {
|
||||
storedData.setBoolean(0, !didSpawn);
|
||||
storedData.setInteger(0, storedData.getInteger(0) - throttle);
|
||||
}
|
||||
} else {
|
||||
storedData.setBoolean(0, true);
|
||||
}
|
||||
|
||||
EntityLiving mob;
|
||||
if (spawnAlternate && alternateMob != null) {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world);
|
||||
} else {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(mobName, world);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
if (mob != null) {
|
||||
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
|
||||
private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) {
|
||||
if (mobSound != null && w.rand.nextInt(100) < 35) {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
|
||||
int entitiesCount = world.getEntitiesWithinAABB(mob.getClass(),
|
||||
AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2],
|
||||
(int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1)
|
||||
.expand(8.0D,4.0D, 8.0D)).size();
|
||||
int range = genome.getTerritory()[0];
|
||||
double x = coords.posX + w.rand.nextDouble() * (range * 2) - range;
|
||||
range = genome.getTerritory()[1];
|
||||
double y = coords.posY + w.rand.nextDouble() * (range * 2) - range;
|
||||
range = genome.getTerritory()[2];
|
||||
double z = coords.posZ + w.rand.nextDouble() * (range * 2) - range;
|
||||
w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
|
||||
private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) {
|
||||
List<EntityPlayer> entities = getEntitiesWithinRange(genome, housing, EntityPlayer.class);
|
||||
for (EntityPlayer e : entities) {
|
||||
// Check for wearing armor & cancel
|
||||
// Full armor suit is treated as "invisible."
|
||||
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) e, getUID(), true)
|
||||
< 4) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) {
|
||||
spawnedFlag = world.spawnEntityInWorld(mob);
|
||||
if (aggosOnPlayer && player != null) {
|
||||
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
|
||||
// Protect fully suited player from initial murder intent.
|
||||
mob.setAttackTarget(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing,
|
||||
boolean spawnAlternate) {
|
||||
boolean spawnedFlag = false;
|
||||
|
||||
return spawnedFlag;
|
||||
}
|
||||
EntityLiving mob;
|
||||
if (spawnAlternate && alternateMob != null) {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world);
|
||||
} else {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(mobName, world);
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) {
|
||||
spawnsWhilePlayerNear = true;
|
||||
alternateMob = alternateMobToSpawn;
|
||||
return this;
|
||||
}
|
||||
if (mob != null) {
|
||||
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
|
||||
|
||||
public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() {
|
||||
aggosOnPlayer = true;
|
||||
return this;
|
||||
}
|
||||
int entitiesCount = world.getEntitiesWithinAABB(
|
||||
mob.getClass(),
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(int) pos[0],
|
||||
(int) pos[1],
|
||||
(int) pos[2],
|
||||
(int) pos[0] + 1,
|
||||
(int) pos[1] + 1,
|
||||
(int) pos[2] + 1).expand(8.0D, 4.0D, 8.0D))
|
||||
.size();
|
||||
|
||||
public AlleleEffectSpawnMob setThrottle(int val) {
|
||||
throttle = val;
|
||||
return this;
|
||||
}
|
||||
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
|
||||
|
||||
public AlleleEffectSpawnMob setChanceToSpawn(int value) {
|
||||
chanceToSpawn = value;
|
||||
return this;
|
||||
}
|
||||
if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) {
|
||||
spawnedFlag = world.spawnEntityInWorld(mob);
|
||||
if (aggosOnPlayer && player != null) {
|
||||
if (forestry.api.apiculture.BeeManager.armorApiaristHelper
|
||||
.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
|
||||
// Protect fully suited player from initial murder intent.
|
||||
mob.setAttackTarget(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) {
|
||||
maxMobsInArea = value;
|
||||
return this;
|
||||
}
|
||||
return spawnedFlag;
|
||||
}
|
||||
|
||||
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) {
|
||||
spawnsWhilePlayerNear = true;
|
||||
alternateMob = alternateMobToSpawn;
|
||||
return this;
|
||||
}
|
||||
|
||||
double pos[] = new double[3];
|
||||
pos[0] = coords.posX + (world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2);
|
||||
pos[1] = coords.posY + world.rand.nextInt(3) - 1;
|
||||
pos[2] = coords.posZ + (world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2);
|
||||
return pos;
|
||||
}
|
||||
public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() {
|
||||
aggosOnPlayer = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setThrottle(int val) {
|
||||
throttle = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setChanceToSpawn(int value) {
|
||||
chanceToSpawn = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) {
|
||||
maxMobsInArea = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
double pos[] = new double[3];
|
||||
pos[0] = coords.posX
|
||||
+ (world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f))
|
||||
- bee.getTerritory()[0] / 2);
|
||||
pos[1] = coords.posY + world.rand.nextInt(3) - 1;
|
||||
pos[2] = coords.posZ
|
||||
+ (world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f))
|
||||
- bee.getTerritory()[2] / 2);
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -13,75 +10,83 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
public class AlleleEffectSpawnMobWeighted extends AlleleEffect {
|
||||
private String[] entityNames;
|
||||
private int[] spawnChance;
|
||||
|
||||
public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance) {
|
||||
super(id, isDominant, throttle);
|
||||
if (mobs.length != chance.length) {
|
||||
throw new IllegalArgumentException("Array lengths must be equal!");
|
||||
}
|
||||
this.entityNames = mobs;
|
||||
this.spawnChance = chance;
|
||||
}
|
||||
private String[] entityNames;
|
||||
private int[] spawnChance;
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance) {
|
||||
super(id, isDominant, throttle);
|
||||
if (mobs.length != chance.length) {
|
||||
throw new IllegalArgumentException("Array lengths must be equal!");
|
||||
}
|
||||
this.entityNames = mobs;
|
||||
this.spawnChance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
if (this.spawnMob(genome, housing)) {
|
||||
storedData.setInteger(0, 0);
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
if (this.spawnMob(genome, housing)) {
|
||||
storedData.setInteger(0, 0);
|
||||
}
|
||||
|
||||
protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing) {
|
||||
boolean flag = false;
|
||||
return storedData;
|
||||
}
|
||||
|
||||
World w = housing.getWorld();
|
||||
int roll = 0;
|
||||
protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing) {
|
||||
boolean flag = false;
|
||||
|
||||
for (int i = 0; i < this.spawnChance.length && !flag; ++i) {
|
||||
roll = 100 - w.rand.nextInt(100) + 1;
|
||||
if (roll < this.spawnChance[i]) {
|
||||
Entity mob = EntityList.createEntityByName(this.entityNames[i], w);
|
||||
if (mob != null) {
|
||||
flag = true;
|
||||
double[] coords = this.randomMobSpawnCoords(w, genome, housing);
|
||||
|
||||
mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f);
|
||||
if (mob instanceof EntityLiving) {
|
||||
if (((EntityLiving) mob).getCanSpawnHere()) {
|
||||
w.spawnEntityInWorld(mob);
|
||||
}
|
||||
} else {
|
||||
w.spawnEntityInWorld(mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
World w = housing.getWorld();
|
||||
int roll = 0;
|
||||
|
||||
return flag;
|
||||
}
|
||||
for (int i = 0; i < this.spawnChance.length && !flag; ++i) {
|
||||
roll = 100 - w.rand.nextInt(100) + 1;
|
||||
if (roll < this.spawnChance[i]) {
|
||||
Entity mob = EntityList.createEntityByName(this.entityNames[i], w);
|
||||
if (mob != null) {
|
||||
flag = true;
|
||||
double[] coords = this.randomMobSpawnCoords(w, genome, housing);
|
||||
|
||||
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f);
|
||||
if (mob instanceof EntityLiving) {
|
||||
if (((EntityLiving) mob).getCanSpawnHere()) {
|
||||
w.spawnEntityInWorld(mob);
|
||||
}
|
||||
} else {
|
||||
w.spawnEntityInWorld(mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double pos[] = new double[3];
|
||||
pos[0] = coords.posX + world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2;
|
||||
pos[1] = coords.posY + world.rand.nextDouble() * (bee.getTerritory()[1] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[1] / 2;
|
||||
pos[2] = coords.posZ + world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2;
|
||||
return pos;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
double pos[] = new double[3];
|
||||
pos[0] = coords.posX
|
||||
+ world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f))
|
||||
- bee.getTerritory()[0] / 2;
|
||||
pos[1] = coords.posY
|
||||
+ world.rand.nextDouble() * (bee.getTerritory()[1] * beeModifier.getTerritoryModifier(bee, 1f))
|
||||
- bee.getTerritory()[1] / 2;
|
||||
pos[2] = coords.posZ
|
||||
+ world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f))
|
||||
- bee.getTerritory()[2] / 2;
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -13,65 +12,68 @@ import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
|
||||
public class AlleleEffectSpawnWisp extends AlleleEffectSpawnMob {
|
||||
|
||||
private byte[] wispTypes = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47
|
||||
};
|
||||
private byte[] wispTypes = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25,
|
||||
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 };
|
||||
|
||||
public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay) {
|
||||
super(id, isDominant, mobToSpawn, soundToPlay);
|
||||
}
|
||||
public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay) {
|
||||
super(id, isDominant, mobToSpawn, soundToPlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
|
||||
boolean spawnedFlag = false;
|
||||
@Override
|
||||
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing,
|
||||
boolean spawnAlternate) {
|
||||
boolean spawnedFlag = false;
|
||||
|
||||
EntityLiving mob;
|
||||
if (spawnAlternate && this.alternateMob != null) {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
|
||||
} else {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
|
||||
}
|
||||
EntityLiving mob;
|
||||
if (spawnAlternate && this.alternateMob != null) {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
|
||||
} else {
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
|
||||
}
|
||||
|
||||
if (mob != null) {
|
||||
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
|
||||
if (mob != null) {
|
||||
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
|
||||
|
||||
int entitiesCount = world.getEntitiesWithinAABB(
|
||||
mob.getClass(),
|
||||
AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2], (int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1).expand(8.0D,
|
||||
4.0D, 8.0D)).size();
|
||||
int entitiesCount = world.getEntitiesWithinAABB(
|
||||
mob.getClass(),
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(int) pos[0],
|
||||
(int) pos[1],
|
||||
(int) pos[2],
|
||||
(int) pos[0] + 1,
|
||||
(int) pos[1] + 1,
|
||||
(int) pos[2] + 1).expand(8.0D, 4.0D, 8.0D))
|
||||
.size();
|
||||
|
||||
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
|
||||
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
|
||||
|
||||
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) {
|
||||
// Try some Reflection on TC code. This could be dangerous.
|
||||
try {
|
||||
Class<?> wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName());
|
||||
Field type = wispEntity.getDeclaredField("type");
|
||||
type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]);
|
||||
} catch (Exception e) { /*
|
||||
* Last time I had a request to post
|
||||
* error messages, I regretted it.
|
||||
*/
|
||||
}
|
||||
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) {
|
||||
// Try some Reflection on TC code. This could be dangerous.
|
||||
try {
|
||||
Class<?> wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName());
|
||||
Field type = wispEntity.getDeclaredField("type");
|
||||
type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]);
|
||||
} catch (Exception e) {
|
||||
/*
|
||||
* Last time I had a request to post error messages, I regretted it.
|
||||
*/
|
||||
}
|
||||
|
||||
spawnedFlag = world.spawnEntityInWorld(mob);
|
||||
if (this.aggosOnPlayer && player != null) {
|
||||
if (BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
|
||||
// Protect fully suited player from initial murder
|
||||
// intent.
|
||||
mob.setAttackTarget(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
spawnedFlag = world.spawnEntityInWorld(mob);
|
||||
if (this.aggosOnPlayer && player != null) {
|
||||
if (BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
|
||||
// Protect fully suited player from initial murder
|
||||
// intent.
|
||||
mob.setAttackTarget(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawnedFlag;
|
||||
}
|
||||
return spawnedFlag;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,64 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import magicbees.bees.AlleleEffect;
|
||||
import magicbees.bees.BeeManager;
|
||||
|
||||
public class AlleleEffectTransmuting extends AlleleEffect {
|
||||
|
||||
private TransmutationEffectController transmutationController;
|
||||
|
||||
public AlleleEffectTransmuting(String id, boolean isDominant, TransmutationEffectController effectController, int timeoutBeeTicks) {
|
||||
super(id, isDominant, timeoutBeeTicks);
|
||||
this.transmutationController = effectController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
private TransmutationEffectController transmutationController;
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
public AlleleEffectTransmuting(String id, boolean isDominant, TransmutationEffectController effectController,
|
||||
int timeoutBeeTicks) {
|
||||
super(id, isDominant, timeoutBeeTicks);
|
||||
this.transmutationController = effectController;
|
||||
}
|
||||
|
||||
// Get random coords within territory
|
||||
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
|
||||
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
|
||||
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
|
||||
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
|
||||
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
|
||||
transmutationController.attemptTransmutations(world, biome,
|
||||
new ItemStack(world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)), xCoord, yCoord, zCoord);
|
||||
// Get random coords within territory
|
||||
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
|
||||
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
|
||||
|
||||
storedData.setInteger(0, 0);
|
||||
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
|
||||
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
|
||||
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
|
||||
|
||||
return storedData;
|
||||
}
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
|
||||
transmutationController.attemptTransmutations(
|
||||
world,
|
||||
biome,
|
||||
new ItemStack(
|
||||
world.getBlock(xCoord, yCoord, zCoord),
|
||||
1,
|
||||
world.getBlockMetadata(xCoord, yCoord, zCoord)),
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord);
|
||||
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -1,89 +1,72 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class EffectData implements IEffectData
|
||||
{
|
||||
private int[] intData;
|
||||
private boolean[] boolData;
|
||||
private float[] floatData;
|
||||
|
||||
public EffectData(int intCount, int boolCount, int floatCount)
|
||||
{
|
||||
this.intData = new int[intCount];
|
||||
this.boolData = new boolean[boolCount];
|
||||
this.floatData = new float[floatCount];
|
||||
}
|
||||
public class EffectData implements IEffectData {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
}
|
||||
private int[] intData;
|
||||
private boolean[] boolData;
|
||||
private float[] floatData;
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
}
|
||||
public EffectData(int intCount, int boolCount, int floatCount) {
|
||||
this.intData = new int[intCount];
|
||||
this.boolData = new boolean[boolCount];
|
||||
this.floatData = new float[floatCount];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInteger(int index, int val)
|
||||
{
|
||||
if (index >= 0 && index < this.intData.length)
|
||||
{
|
||||
this.intData[index] = val;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
@Override
|
||||
public void setFloat(int index, float val)
|
||||
{
|
||||
if (index >= 0 && index < this.floatData.length)
|
||||
{
|
||||
this.floatData[index] = val;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
@Override
|
||||
public void setBoolean(int index, boolean val)
|
||||
{
|
||||
if (index >= 0 && index < this.boolData.length)
|
||||
{
|
||||
this.boolData[index] = val;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setInteger(int index, int val) {
|
||||
if (index >= 0 && index < this.intData.length) {
|
||||
this.intData[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInteger(int index)
|
||||
{
|
||||
int val = 0;
|
||||
if (index >= 0 && index < this.intData.length)
|
||||
{
|
||||
val = this.intData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@Override
|
||||
public void setFloat(int index, float val) {
|
||||
if (index >= 0 && index < this.floatData.length) {
|
||||
this.floatData[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(int index)
|
||||
{
|
||||
float val = 0f;
|
||||
if (index >= 0 && index < this.floatData.length)
|
||||
{
|
||||
val = this.floatData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@Override
|
||||
public void setBoolean(int index, boolean val) {
|
||||
if (index >= 0 && index < this.boolData.length) {
|
||||
this.boolData[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(int index)
|
||||
{
|
||||
boolean val = false;
|
||||
if (index >= 0 && index < this.boolData.length)
|
||||
{
|
||||
val = this.boolData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@Override
|
||||
public int getInteger(int index) {
|
||||
int val = 0;
|
||||
if (index >= 0 && index < this.intData.length) {
|
||||
val = this.intData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(int index) {
|
||||
float val = 0f;
|
||||
if (index >= 0 && index < this.floatData.length) {
|
||||
val = this.floatData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(int index) {
|
||||
boolean val = false;
|
||||
if (index >= 0 && index < this.boolData.length) {
|
||||
val = this.boolData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
@@ -4,43 +4,46 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectController;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectController;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
|
||||
public class TransmutationEffectController implements ITransmutationEffectController {
|
||||
private List<ITransmutationEffectLogic> logicObjects;
|
||||
|
||||
public TransmutationEffectController(ITransmutationEffectLogic... effectLogic) {
|
||||
logicObjects = new ArrayList<ITransmutationEffectLogic>();
|
||||
for (ITransmutationEffectLogic logic : effectLogic) {
|
||||
logicObjects.add(logic);
|
||||
}
|
||||
}
|
||||
private List<ITransmutationEffectLogic> logicObjects;
|
||||
|
||||
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
Collections.shuffle(logicObjects);
|
||||
for (ITransmutationEffectLogic logic : logicObjects) {
|
||||
try {
|
||||
if (logic.tryTransmutation(world, biome, sourceBlock, x, y, z)) {
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogHelper.warn(String.format("Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.",
|
||||
logic.getClass().getName()));
|
||||
LogHelper.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
public TransmutationEffectController(ITransmutationEffectLogic... effectLogic) {
|
||||
logicObjects = new ArrayList<ITransmutationEffectLogic>();
|
||||
for (ITransmutationEffectLogic logic : effectLogic) {
|
||||
logicObjects.add(logic);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic) {
|
||||
if (logic != null && !logicObjects.contains(logic)) {
|
||||
logicObjects.add(logic);
|
||||
}
|
||||
}
|
||||
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
Collections.shuffle(logicObjects);
|
||||
for (ITransmutationEffectLogic logic : logicObjects) {
|
||||
try {
|
||||
if (logic.tryTransmutation(world, biome, sourceBlock, x, y, z)) {
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogHelper.warn(
|
||||
String.format(
|
||||
"Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.",
|
||||
logic.getClass().getName()));
|
||||
LogHelper.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic) {
|
||||
if (logic != null && !logicObjects.contains(logic)) {
|
||||
logicObjects.add(logic);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,30 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
|
||||
public class TransmutationEffectLBotaniaLiving implements ITransmutationEffectLogic {
|
||||
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
int[] oreIDs = OreDictionary.getOreIDs(sourceBlock);
|
||||
for (int oreId : oreIDs) {
|
||||
if (oreId == OreDictionary.getOreID("logWood")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockLivingWood);
|
||||
return true;
|
||||
}
|
||||
else if (oreId == OreDictionary.getOreID("stone")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockLivingRock);
|
||||
return true;
|
||||
}
|
||||
else if (oreId == OreDictionary.getOreID("livingwood")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockDreamWood);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
int[] oreIDs = OreDictionary.getOreIDs(sourceBlock);
|
||||
for (int oreId : oreIDs) {
|
||||
if (oreId == OreDictionary.getOreID("logWood")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockLivingWood);
|
||||
return true;
|
||||
} else if (oreId == OreDictionary.getOreID("stone")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockLivingRock);
|
||||
return true;
|
||||
} else if (oreId == OreDictionary.getOreID("livingwood")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockDreamWood);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@ package magicbees.bees.allele.effect;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,38 +10,45 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
|
||||
public class TransmutationEffectRailcraft implements ITransmutationEffectLogic {
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false)
|
||||
|| OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) {
|
||||
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z) || trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST) && !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
|
||||
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
|
||||
if (item != null) {
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false)
|
||||
|| OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) {
|
||||
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z)
|
||||
|| trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER) && !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) {
|
||||
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
|
||||
if (item != null) {
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)
|
||||
&& !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
|
||||
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
|
||||
if (item != null) {
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER)
|
||||
&& !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) {
|
||||
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
|
||||
if (item != null) {
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -8,18 +7,22 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TransmutationEffectVanilla implements ITransmutationEffectLogic {
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
return trySpawnSandstone(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
|
||||
private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY) && OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false)) {
|
||||
world.setBlock(x, y, z, Blocks.sandstone);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
public class TransmutationEffectVanilla implements ITransmutationEffectLogic {
|
||||
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
return trySpawnSandstone(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
|
||||
private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)
|
||||
&& OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false)) {
|
||||
world.setBlock(x, y, z, Blocks.sandstone);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -11,21 +11,21 @@ import forestry.api.genetics.IFlowerProvider;
|
||||
|
||||
public abstract class FlowerProvider implements IFlowerProvider {
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public Set<IFlower> getFlowers() {
|
||||
return FlowerManager.flowerRegistry.getAcceptableFlowers(getFlowerType());
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public Set<IFlower> getFlowers() {
|
||||
return FlowerManager.flowerRegistry.getAcceptableFlowers(getFlowerType());
|
||||
}
|
||||
|
||||
protected void registerPlantableFlower(Block block, int meta, int weight) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(block, meta, weight, getFlowerType());
|
||||
}
|
||||
protected void registerPlantableFlower(Block block, int meta, int weight) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(block, meta, weight, getFlowerType());
|
||||
}
|
||||
|
||||
protected void registerAcceptableFlower(Block block, int meta) {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(block, meta, getFlowerType());
|
||||
}
|
||||
protected void registerAcceptableFlower(Block block, int meta) {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(block, meta, getFlowerType());
|
||||
}
|
||||
|
||||
protected void registerGrowthRule(IFlowerGrowthRule growthRule) {
|
||||
FlowerManager.flowerRegistry.registerGrowthRule(growthRule, getFlowerType());
|
||||
}
|
||||
protected void registerGrowthRule(IFlowerGrowthRule growthRule) {
|
||||
FlowerManager.flowerRegistry.registerGrowthRule(growthRule, getFlowerType());
|
||||
}
|
||||
}
|
||||
+70
-69
@@ -1,7 +1,5 @@
|
||||
package magicbees.bees.allele.flowerProvider;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ArsMagicaHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,82 +10,85 @@ import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ArsMagicaHelper;
|
||||
|
||||
public class FlowerProviderArsMagicaFlower extends FlowerProvider implements IFlowerGrowthRule {
|
||||
|
||||
public FlowerProviderArsMagicaFlower() {
|
||||
registerPlantableFlower(ArsMagicaHelper.blackOrchid, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.desertNova, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.aum, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.wakebloom, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.tarmaRoot, 0, 1);
|
||||
registerGrowthRule(this);
|
||||
}
|
||||
public FlowerProviderArsMagicaFlower() {
|
||||
registerPlantableFlower(ArsMagicaHelper.blackOrchid, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.desertNova, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.aum, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.wakebloom, 0, 1);
|
||||
registerPlantableFlower(ArsMagicaHelper.tarmaRoot, 0, 1);
|
||||
registerGrowthRule(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersArsMagica";
|
||||
}
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersArsMagica";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.arsmagica");
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.arsmagica");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 1;
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y,
|
||||
int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
Block blockDown = world.getBlock(x, y - 1, z);
|
||||
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
|
||||
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
|
||||
int dart = world.rand.nextInt(100);
|
||||
Block block;
|
||||
if (dart > 60) {
|
||||
block = ArsMagicaHelper.blackOrchid;
|
||||
} else if (dart > 30) {
|
||||
block = ArsMagicaHelper.aum;
|
||||
} else {
|
||||
block = ArsMagicaHelper.tarmaRoot;
|
||||
}
|
||||
world.setBlock(x, y, z, block);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.sand) {
|
||||
world.setBlock(x, y, z, ArsMagicaHelper.desertNova);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.stone) {
|
||||
world.setBlock(x, y, z, ArsMagicaHelper.tarmaRoot);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.water || blockDown == Blocks.water) {
|
||||
world.setBlock(x, y, z, ArsMagicaHelper.wakebloom);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
Block blockDown = world.getBlock(x, y - 1, z);
|
||||
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
|
||||
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
|
||||
int dart = world.rand.nextInt(100);
|
||||
Block block;
|
||||
if (dart > 60) {
|
||||
block = ArsMagicaHelper.blackOrchid;
|
||||
} else if (dart > 30) {
|
||||
block = ArsMagicaHelper.aum;
|
||||
} else {
|
||||
block = ArsMagicaHelper.tarmaRoot;
|
||||
}
|
||||
world.setBlock(x, y, z, block);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.sand) {
|
||||
world.setBlock(x, y, z, ArsMagicaHelper.desertNova);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.stone) {
|
||||
world.setBlock(x, y, z, ArsMagicaHelper.tarmaRoot);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.water || blockDown == Blocks.water) {
|
||||
world.setBlock(x, y, z, ArsMagicaHelper.wakebloom);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +1,65 @@
|
||||
package magicbees.bees.allele.flowerProvider;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
|
||||
public class FlowerProviderAuraNode extends FlowerProvider {
|
||||
|
||||
public FlowerProviderAuraNode() {
|
||||
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal());
|
||||
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 0;
|
||||
}
|
||||
public FlowerProviderAuraNode() {
|
||||
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal());
|
||||
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersThaumcraftAuraNode";
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.node");
|
||||
}
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersThaumcraftAuraNode";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.node");
|
||||
}
|
||||
|
||||
protected ItemStack[] addItemToProducts(ItemStack[] products, ItemStack itemStack) {
|
||||
for (ItemStack stack : products) {
|
||||
if (stack.getItem() == itemStack.getItem() && stack.getItemDamage() == itemStack.getItemDamage()) {
|
||||
if (stack.stackSize < stack.getItem().getItemStackLimit(stack)) {
|
||||
stack.stackSize += itemStack.stackSize;
|
||||
itemStack.stackSize = Math.max(stack.stackSize - stack.getItem().getItemStackLimit(stack), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
|
||||
if (itemStack.stackSize > 0) {
|
||||
ItemStack[] newProducts = new ItemStack[products.length + 1];
|
||||
for (int i = 0; i < products.length; ++i) {
|
||||
newProducts[i] = products[i];
|
||||
}
|
||||
newProducts[products.length] = itemStack;
|
||||
products = newProducts;
|
||||
}
|
||||
protected ItemStack[] addItemToProducts(ItemStack[] products, ItemStack itemStack) {
|
||||
for (ItemStack stack : products) {
|
||||
if (stack.getItem() == itemStack.getItem() && stack.getItemDamage() == itemStack.getItemDamage()) {
|
||||
if (stack.stackSize < stack.getItem().getItemStackLimit(stack)) {
|
||||
stack.stackSize += itemStack.stackSize;
|
||||
itemStack.stackSize = Math.max(stack.stackSize - stack.getItem().getItemStackLimit(stack), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
if (itemStack.stackSize > 0) {
|
||||
ItemStack[] newProducts = new ItemStack[products.length + 1];
|
||||
for (int i = 0; i < products.length; ++i) {
|
||||
newProducts[i] = products[i];
|
||||
}
|
||||
newProducts[products.length] = itemStack;
|
||||
products = newProducts;
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
}
|
||||
@@ -2,45 +2,46 @@ package magicbees.bees.allele.flowerProvider;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
|
||||
public class FlowerProviderBookshelf extends FlowerProvider {
|
||||
|
||||
public FlowerProviderBookshelf() {
|
||||
registerAcceptableFlower(Blocks.bookshelf, OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int i, int j) {
|
||||
return true;
|
||||
}
|
||||
public FlowerProviderBookshelf() {
|
||||
registerAcceptableFlower(Blocks.bookshelf, OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersBookshelf";
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int i, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[]) {
|
||||
return products;
|
||||
}
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersBookshelf";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
|
||||
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water);
|
||||
}
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[]) {
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.book");
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
|
||||
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.book");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package magicbees.bees.allele.flowerProvider;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -11,56 +9,59 @@ import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
|
||||
public class FlowerProviderBotania extends FlowerProvider implements IFlowerGrowthRule {
|
||||
|
||||
public FlowerProviderBotania() {
|
||||
registerPlantableFlower(BotaniaHelper.blockMysticalFlower, OreDictionary.WILDCARD_VALUE, 1);
|
||||
registerGrowthRule(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
public FlowerProviderBotania() {
|
||||
registerPlantableFlower(BotaniaHelper.blockMysticalFlower, OreDictionary.WILDCARD_VALUE, 1);
|
||||
registerGrowthRule(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
if (world.isAirBlock(x, y, z) && BotaniaHelper.blockMysticalFlower.canPlaceBlockAt(world, x, y, z)) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockMysticalFlower);
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.rand.nextInt(16), 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y,
|
||||
int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
if (world.isAirBlock(x, y, z) && BotaniaHelper.blockMysticalFlower.canPlaceBlockAt(world, x, y, z)) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockMysticalFlower);
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.rand.nextInt(16), 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.botania");
|
||||
}
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersBotania";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.botania");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 0;
|
||||
}
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersBotania";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 0;
|
||||
}
|
||||
}
|
||||
+53
-52
@@ -1,7 +1,5 @@
|
||||
package magicbees.bees.allele.flowerProvider;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,64 +10,67 @@ import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
|
||||
public class FlowerProviderThaumcraftFlower extends FlowerProvider implements IFlowerGrowthRule {
|
||||
|
||||
public FlowerProviderThaumcraftFlower() {
|
||||
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1);
|
||||
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1);
|
||||
registerGrowthRule(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersThaumcraft";
|
||||
}
|
||||
public FlowerProviderThaumcraftFlower() {
|
||||
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1);
|
||||
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1);
|
||||
registerGrowthRule(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.magic");
|
||||
}
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return "flowersThaumcraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.magic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return 0 < pollinatable.getPlantType().size();
|
||||
}
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return 0 < pollinatable.getPlantType().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
Block blockDown = world.getBlock(x, y - 1, z);
|
||||
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
|
||||
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
|
||||
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.sand) {
|
||||
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y,
|
||||
int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
boolean flag = false;
|
||||
Block blockDown = world.getBlock(x, y - 1, z);
|
||||
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
|
||||
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
|
||||
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
|
||||
flag = true;
|
||||
} else if (blockDown == Blocks.sand) {
|
||||
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package magicbees.block;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityApimancersDrainerCommon;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
|
||||
public class BlockApimancersDrainer extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public static Class<? extends TileEntity> drainer = TileEntityApimancersDrainerCommon.class;
|
||||
|
||||
public BlockApimancersDrainer() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("apimancersDrainer");
|
||||
this.setHardness(1f);
|
||||
this.setResistance(1.5f);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
try {
|
||||
return drainer.newInstance();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7,
|
||||
float par8, float par9) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
} else {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityApimancersDrainerCommon && side != 1) {
|
||||
ItemStack tItemStack = player.getHeldItem();
|
||||
if (tItemStack != null) {
|
||||
Item tItem = tItemStack.getItem();
|
||||
if (tItem instanceof IEssentiaContainerItem
|
||||
&& ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem()) != null
|
||||
&& ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem()).size() > 0) {
|
||||
Aspect tLocked = ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem())
|
||||
.getAspects()[0];
|
||||
((TileEntityApimancersDrainerCommon) tile).setAspect(tLocked);
|
||||
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation("Producing " + tLocked.getLocalizedDescription()));
|
||||
}
|
||||
} else {
|
||||
((TileEntityApimancersDrainerCommon) tile).setAspect(null);
|
||||
player.addChatMessage(new ChatComponentTranslation("Cleared production specifier"));
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[side <= 1 ? side : 2];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[4];
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = register.registerIcon(CommonProxy.DOMAIN + ":apimancersdrainer." + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,5 @@
|
||||
package magicbees.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.client.gui.UIScreens;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -18,96 +11,93 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockEffectJar extends BlockContainer
|
||||
{
|
||||
public BlockEffectJar()
|
||||
{
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("effectJar");
|
||||
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
|
||||
this.setHardness(0.1f);
|
||||
this.setResistance(1.5f);
|
||||
}
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.client.gui.UIScreens;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
boolean activate = false;
|
||||
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
|
||||
activate = true;
|
||||
}
|
||||
|
||||
return activate;
|
||||
}
|
||||
public class BlockEffectJar extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World w, int metadata)
|
||||
{
|
||||
return new TileEntityEffectJar();
|
||||
}
|
||||
public BlockEffectJar() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("effectJar");
|
||||
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
|
||||
this.setHardness(0.1f);
|
||||
this.setResistance(1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
boolean activate = false;
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
|
||||
activate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.RenderIdEffectJar;
|
||||
}
|
||||
return activate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World w, int metadata) {
|
||||
return new TileEntityEffectJar();
|
||||
}
|
||||
|
||||
private void dropInventory(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity e = world.getTileEntity(x, y, z);
|
||||
|
||||
if (e != null && e instanceof TileEntityEffectJar)
|
||||
{
|
||||
TileEntityEffectJar jar = (TileEntityEffectJar)e;
|
||||
|
||||
// 0 is the only droppable stack.
|
||||
ItemStack stack = jar.getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.stackSize > 0)
|
||||
{
|
||||
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
|
||||
|
||||
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
|
||||
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = Blocks.glass.getIcon(0, 0);
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return CommonProxy.RenderIdEffectJar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
private void dropInventory(World world, int x, int y, int z) {
|
||||
TileEntity e = world.getTileEntity(x, y, z);
|
||||
|
||||
if (e != null && e instanceof TileEntityEffectJar) {
|
||||
TileEntityEffectJar jar = (TileEntityEffectJar) e;
|
||||
|
||||
// 0 is the only droppable stack.
|
||||
ItemStack stack = jar.getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
|
||||
|
||||
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
|
||||
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
this.blockIcon = Blocks.glass.getIcon(0, 0);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@ package magicbees.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -12,64 +10,67 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
|
||||
public class BlockEnchantedEarth extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
|
||||
public BlockEnchantedEarth() {
|
||||
super(Material.ground);
|
||||
setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
setBlockName("enchantedEarth");
|
||||
setBlockTextureName(CommonProxy.DOMAIN + ":enchantedEarth");
|
||||
setTickRandomly(true);
|
||||
setStepSound(soundTypeGravel);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
for (int height = y + 1; height <= 256; ++height) {
|
||||
Block b = world.getBlock(x, height, z);
|
||||
if (b == this) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (b.getTickRandomly()) {
|
||||
world.scheduleBlockUpdate(x, height, z, b, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (y < 256 && random.nextInt(2) == 0) {
|
||||
int newX = x + (random.nextInt(3) - 1);
|
||||
int newZ = z + (random.nextInt(3) - 1);
|
||||
int newY = y + 1;
|
||||
Block b = world.getBlock(newX, newY, newZ);
|
||||
if (b.getTickRandomly()) {
|
||||
world.scheduleBlockUpdate(newX, newY, newZ, b, random.nextInt(5) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
public BlockEnchantedEarth() {
|
||||
super(Material.ground);
|
||||
setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
setBlockName("enchantedEarth");
|
||||
setBlockTextureName(CommonProxy.DOMAIN + ":enchantedEarth");
|
||||
setTickRandomly(true);
|
||||
setStepSound(soundTypeGravel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
for (int height = y + 1; height <= 256; ++height) {
|
||||
Block b = world.getBlock(x, height, z);
|
||||
if (b == this) {
|
||||
continue;
|
||||
} else {
|
||||
if (b.getTickRandomly()) {
|
||||
world.scheduleBlockUpdate(x, height, z, b, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (y < 256 && random.nextInt(2) == 0) {
|
||||
int newX = x + (random.nextInt(3) - 1);
|
||||
int newZ = z + (random.nextInt(3) - 1);
|
||||
int newY = y + 1;
|
||||
Block b = world.getBlock(newX, newY, newZ);
|
||||
if (b.getTickRandomly()) {
|
||||
world.scheduleBlockUpdate(newX, newY, newZ, b, random.nextInt(5) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 1) {
|
||||
return top;
|
||||
}
|
||||
return super.getIcon(side, meta);
|
||||
}
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction,
|
||||
IPlantable plantable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
top = iconRegister.registerIcon(textureName + "_top");
|
||||
super.registerBlockIcons(iconRegister);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 1) {
|
||||
return top;
|
||||
}
|
||||
return super.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
top = iconRegister.registerIcon(textureName + "_top");
|
||||
super.registerBlockIcons(iconRegister);
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,6 @@ package magicbees.block;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.main.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -17,97 +13,87 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.main.Config;
|
||||
|
||||
public class BlockHive extends Block
|
||||
{
|
||||
public BlockHive()
|
||||
{
|
||||
super(new MaterialHive());
|
||||
this.setLightLevel(0.8f);
|
||||
setHardness(1f);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setBlockName("hive");
|
||||
}
|
||||
public class BlockHive extends Block {
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public BlockHive() {
|
||||
super(new MaterialHive());
|
||||
this.setLightLevel(0.8f);
|
||||
setHardness(1f);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setBlockName("hive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta < 0 || meta > HiveType.values().length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
return HiveType.getHiveFromMeta(meta).getLightValue();
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList)
|
||||
{
|
||||
// Java bitches about raw types & types not being checked. Sorry, but the API sucks.
|
||||
for (HiveType type : HiveType.values())
|
||||
{
|
||||
if (type.show || Config.forestryDebugEnabled)
|
||||
{
|
||||
itemsList.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta < 0 || meta > HiveType.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return HiveType.getHiveFromMeta(meta).getLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
HiveType.registerIcons(register);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if (meta < 0 || meta > HiveType.values().length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
return HiveType.getHiveFromMeta(meta).getIconForSide(side);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList) {
|
||||
// Java bitches about raw types & types not being checked. Sorry, but the API sucks.
|
||||
for (HiveType type : HiveType.values()) {
|
||||
if (type.show || Config.forestryDebugEnabled) {
|
||||
itemsList.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune);
|
||||
}
|
||||
|
||||
if (block.isAir(world, x, y, z))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
HiveType.registerIcons(register);
|
||||
}
|
||||
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta < 0 || meta > HiveType.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return HiveType.getHiveFromMeta(meta).getIconForSide(side);
|
||||
}
|
||||
|
||||
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if (block.isAir(world, x, y, z)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
package magicbees.block;
|
||||
|
||||
import magicbees.client.gui.UIScreens;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -16,16 +11,21 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.client.gui.UIScreens;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
|
||||
public class BlockMagicApiary extends BlockContainer {
|
||||
|
||||
public class BlockMagicApiary extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public BlockMagicApiary()
|
||||
{
|
||||
public BlockMagicApiary() {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("magicApiary");
|
||||
@@ -35,12 +35,11 @@ public class BlockMagicApiary extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9 )
|
||||
{
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
boolean activate = false;
|
||||
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(MagicBees.object, UIScreens.THAUMIC_APIARY.ordinal(), world, x, y, z);
|
||||
activate = true;
|
||||
}
|
||||
@@ -50,23 +49,22 @@ public class BlockMagicApiary extends BlockContainer
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
if (side == 0){
|
||||
if (side == 0) {
|
||||
return icons[0];
|
||||
}else if (side == 1){
|
||||
} else if (side == 1) {
|
||||
return icons[1];
|
||||
}else if (side == 2 || side == 3){
|
||||
} else if (side == 2 || side == 3) {
|
||||
return icons[2];
|
||||
}else{
|
||||
} else {
|
||||
return icons[3];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[4];
|
||||
|
||||
icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":thaumicapiary.0");
|
||||
@@ -81,15 +79,15 @@ public class BlockMagicApiary extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta){
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory){
|
||||
IInventory inventory = (IInventory)te;
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++){
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack itemStack = inventory.getStackInSlotOnClosing(i);
|
||||
|
||||
if (itemStack != null){
|
||||
if (itemStack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package magicbees.block;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityManaAuraProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -10,39 +7,41 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityManaAuraProvider;
|
||||
|
||||
public class BlockManaAuraProvider extends Block implements ITileEntityProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockManaAuraProvider() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("manaAuraProvider");
|
||||
this.setHardness(2f);
|
||||
this.setResistance(3f);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityManaAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
|
||||
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockManaAuraProvider() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("manaAuraProvider");
|
||||
this.setHardness(2f);
|
||||
this.setResistance(3f);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityManaAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
|
||||
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,47 @@
|
||||
package magicbees.block;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
|
||||
public class BlockVisAuraProvider extends BlockContainer {
|
||||
|
||||
public BlockVisAuraProvider() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("visAuraProvider");
|
||||
this.setHardness(0.5f);
|
||||
this.setResistance(1.5f);
|
||||
this.setLightLevel(8);
|
||||
}
|
||||
public BlockVisAuraProvider() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("visAuraProvider");
|
||||
this.setHardness(0.5f);
|
||||
this.setResistance(1.5f);
|
||||
this.setLightLevel(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileEntityVisAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.RenderIdVisAuraProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 5);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileEntityVisAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return CommonProxy.RenderIdVisAuraProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 5);
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,11 @@ package magicbees.block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class MaterialHive extends Material
|
||||
{
|
||||
|
||||
public MaterialHive()
|
||||
{
|
||||
super(MapColor.stoneColor);
|
||||
this.setImmovableMobility();
|
||||
this.setRequiresTool();
|
||||
}
|
||||
public class MaterialHive extends Material {
|
||||
|
||||
public MaterialHive() {
|
||||
super(MapColor.stoneColor);
|
||||
this.setImmovableMobility();
|
||||
this.setRequiresTool();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,15 @@ package magicbees.block.types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import magicbees.bees.BeeGenomeManager;
|
||||
import magicbees.bees.BeeSpecies;
|
||||
import magicbees.bees.HiveDrop;
|
||||
@@ -10,182 +19,158 @@ import magicbees.item.types.CombType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
|
||||
public enum HiveType
|
||||
{
|
||||
CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true),
|
||||
UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true),
|
||||
RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true),
|
||||
DEEP("deep", BeeSpecies.ATTUNED, 4, false),
|
||||
INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false),
|
||||
OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false),
|
||||
;
|
||||
|
||||
private static String[] nameList;
|
||||
|
||||
private String name;
|
||||
private BeeSpecies occupant;
|
||||
public boolean show;
|
||||
private int lightLevel;
|
||||
private ArrayList<IHiveDrop> drops;
|
||||
public enum HiveType {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public static HiveType getHiveFromMeta(int meta)
|
||||
{
|
||||
HiveType type = CURIOUS;
|
||||
|
||||
if (meta > 0 && meta < HiveType.values().length)
|
||||
{
|
||||
type = HiveType.values()[meta];
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static void initHiveData()
|
||||
{
|
||||
ItemStack[] combs = new ItemStack[] { Config.combs.getStackForType(CombType.MUNDANE) };
|
||||
HiveDrop valiantDrop = new HiveDrop(BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")), combs, 5);
|
||||
CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true),
|
||||
UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true),
|
||||
RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true),
|
||||
DEEP("deep", BeeSpecies.ATTUNED, 4, false),
|
||||
INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false),
|
||||
OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false),;
|
||||
|
||||
CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15));
|
||||
CURIOUS.drops.add(valiantDrop);
|
||||
private static String[] nameList;
|
||||
|
||||
UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15));
|
||||
UNUSUAL.drops.add(valiantDrop);
|
||||
private String name;
|
||||
private BeeSpecies occupant;
|
||||
public boolean show;
|
||||
private int lightLevel;
|
||||
private ArrayList<IHiveDrop> drops;
|
||||
|
||||
RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20));
|
||||
RESONANT.drops.add(valiantDrop);
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f));
|
||||
DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20));
|
||||
DEEP.drops.add(valiantDrop);
|
||||
public static HiveType getHiveFromMeta(int meta) {
|
||||
HiveType type = CURIOUS;
|
||||
|
||||
combs = new ItemStack[] { Config.combs.getStackForType(CombType.MOLTEN), new ItemStack(Items.glowstone_dust, 6) };
|
||||
if (meta > 0 && meta < HiveType.values().length) {
|
||||
type = HiveType.values()[meta];
|
||||
}
|
||||
|
||||
INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f));
|
||||
INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3));
|
||||
return type;
|
||||
}
|
||||
|
||||
combs = new ItemStack[] { Config.combs.getStackForType(CombType.FORGOTTEN), new ItemStack(Items.ender_pearl, 1) };
|
||||
public static void initHiveData() {
|
||||
ItemStack[] combs = new ItemStack[] { Config.combs.getStackForType(CombType.MUNDANE) };
|
||||
HiveDrop valiantDrop = new HiveDrop(
|
||||
BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")),
|
||||
combs,
|
||||
5);
|
||||
|
||||
OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80));
|
||||
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
|
||||
}
|
||||
|
||||
private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible)
|
||||
{
|
||||
this.name = hiveName;
|
||||
this.occupant = occupant;
|
||||
this.lightLevel = light;
|
||||
this.show = visible;
|
||||
this.drops = new ArrayList<IHiveDrop>();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register)
|
||||
{
|
||||
for (HiveType type : HiveType.values())
|
||||
{
|
||||
type.icons = new IIcon[2];
|
||||
CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15));
|
||||
CURIOUS.drops.add(valiantDrop);
|
||||
|
||||
type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top");
|
||||
type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side");
|
||||
}
|
||||
}
|
||||
UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15));
|
||||
UNUSUAL.drops.add(valiantDrop);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconForSide(int side)
|
||||
{
|
||||
IIcon i = this.icons[0];
|
||||
|
||||
if (side != 0 && side != 1)
|
||||
{
|
||||
i = this.icons[1];
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getLightValue()
|
||||
{
|
||||
return this.lightLevel;
|
||||
}
|
||||
RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20));
|
||||
RESONANT.drops.add(valiantDrop);
|
||||
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>();
|
||||
int dart;
|
||||
|
||||
Collections.shuffle(this.drops);
|
||||
DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f));
|
||||
DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20));
|
||||
DEEP.drops.add(valiantDrop);
|
||||
|
||||
// Get a princess.
|
||||
int throttle = 0;
|
||||
while (hiveDrops.size() <= 0 && throttle < 10)
|
||||
{
|
||||
++throttle;
|
||||
for (IHiveDrop drop : drops)
|
||||
{
|
||||
dart = world.rand.nextInt(100);
|
||||
if (dart <= drop.getChance(world, x, y, z))
|
||||
{
|
||||
hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get a drone, maybe.
|
||||
for (IHiveDrop drop : drops)
|
||||
{
|
||||
dart = world.rand.nextInt(100);
|
||||
if (dart <= drop.getChance(world, x, y, z))
|
||||
{
|
||||
hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get additional drops.
|
||||
for (IHiveDrop drop : drops)
|
||||
{
|
||||
dart = world.rand.nextInt(100);
|
||||
if (dart <= drop.getChance(world, x, y, z))
|
||||
{
|
||||
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune));
|
||||
}
|
||||
}
|
||||
|
||||
return hiveDrops;
|
||||
}
|
||||
|
||||
public static String[] getAllNames()
|
||||
{
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
public BeeSpecies getOccupant() {
|
||||
return this.occupant;
|
||||
}
|
||||
|
||||
private static String[] generateNames()
|
||||
{
|
||||
String[] names = new String[values().length];
|
||||
for (int i = 0; i < names.length; ++i)
|
||||
{
|
||||
names[i] = values()[i].name;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
combs = new ItemStack[] { Config.combs.getStackForType(CombType.MOLTEN),
|
||||
new ItemStack(Items.glowstone_dust, 6) };
|
||||
|
||||
INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f));
|
||||
INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3));
|
||||
|
||||
combs = new ItemStack[] { Config.combs.getStackForType(CombType.FORGOTTEN),
|
||||
new ItemStack(Items.ender_pearl, 1) };
|
||||
|
||||
OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80));
|
||||
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
|
||||
}
|
||||
|
||||
private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible) {
|
||||
this.name = hiveName;
|
||||
this.occupant = occupant;
|
||||
this.lightLevel = light;
|
||||
this.show = visible;
|
||||
this.drops = new ArrayList<IHiveDrop>();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
for (HiveType type : HiveType.values()) {
|
||||
type.icons = new IIcon[2];
|
||||
|
||||
type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top");
|
||||
type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side");
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconForSide(int side) {
|
||||
IIcon i = this.icons[0];
|
||||
|
||||
if (side != 0 && side != 1) {
|
||||
i = this.icons[1];
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getLightValue() {
|
||||
return this.lightLevel;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>();
|
||||
int dart;
|
||||
|
||||
Collections.shuffle(this.drops);
|
||||
|
||||
// Get a princess.
|
||||
int throttle = 0;
|
||||
while (hiveDrops.size() <= 0 && throttle < 10) {
|
||||
++throttle;
|
||||
for (IHiveDrop drop : drops) {
|
||||
dart = world.rand.nextInt(100);
|
||||
if (dart <= drop.getChance(world, x, y, z)) {
|
||||
hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get a drone, maybe.
|
||||
for (IHiveDrop drop : drops) {
|
||||
dart = world.rand.nextInt(100);
|
||||
if (dart <= drop.getChance(world, x, y, z)) {
|
||||
hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get additional drops.
|
||||
for (IHiveDrop drop : drops) {
|
||||
dart = world.rand.nextInt(100);
|
||||
if (dart <= drop.getChance(world, x, y, z)) {
|
||||
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune));
|
||||
}
|
||||
}
|
||||
|
||||
return hiveDrops;
|
||||
}
|
||||
|
||||
public static String[] getAllNames() {
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
public BeeSpecies getOccupant() {
|
||||
return this.occupant;
|
||||
}
|
||||
|
||||
private static String[] generateNames() {
|
||||
String[] names = new String[values().length];
|
||||
for (int i = 0; i < names.length; ++i) {
|
||||
names[i] = values()[i].name;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,38 @@
|
||||
package magicbees.block.types;
|
||||
|
||||
public enum PlankType
|
||||
{
|
||||
GREATWOOD("greatwood", 48),
|
||||
SILVERWOOD("silverwood", 49),
|
||||
;
|
||||
|
||||
public String name;
|
||||
public int textureIdx;
|
||||
private static String[] nameList;
|
||||
|
||||
private PlankType(String n, int idx)
|
||||
{
|
||||
this.name = n;
|
||||
this.textureIdx = idx;
|
||||
}
|
||||
|
||||
public static PlankType getType(int meta)
|
||||
{
|
||||
PlankType type = null;
|
||||
|
||||
if (meta >= 0 && meta <= values().length)
|
||||
{
|
||||
type = values()[meta];
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static String[] getAllNames()
|
||||
{
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
private static String[] generateNames()
|
||||
{
|
||||
String[] names = new String[values().length];
|
||||
for (int i = 0; i < names.length; ++i)
|
||||
{
|
||||
names[i] = values()[i].name;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
public enum PlankType {
|
||||
|
||||
GREATWOOD("greatwood", 48),
|
||||
SILVERWOOD("silverwood", 49),;
|
||||
|
||||
public String name;
|
||||
public int textureIdx;
|
||||
private static String[] nameList;
|
||||
|
||||
private PlankType(String n, int idx) {
|
||||
this.name = n;
|
||||
this.textureIdx = idx;
|
||||
}
|
||||
|
||||
public static PlankType getType(int meta) {
|
||||
PlankType type = null;
|
||||
|
||||
if (meta >= 0 && meta <= values().length) {
|
||||
type = values()[meta];
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static String[] getAllNames() {
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
private static String[] generateNames() {
|
||||
String[] names = new String[values().length];
|
||||
for (int i = 0; i < names.length; ++i) {
|
||||
names[i] = values()[i].name;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
@@ -1,122 +1,102 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerEffectJar extends Container
|
||||
{
|
||||
public TileEntityEffectJar jar;
|
||||
|
||||
public int lastBeeHealth = 0;
|
||||
public int speciesColour = 0xffffff;
|
||||
|
||||
public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player)
|
||||
{
|
||||
this.jar = tileEntityEffectJar;
|
||||
this.addSlotToContainer(new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1)));
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18));
|
||||
}
|
||||
}
|
||||
public class ContainerEffectJar extends Container {
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(crafting);
|
||||
|
||||
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
|
||||
}
|
||||
public TileEntityEffectJar jar;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting)this.crafters.get(i);
|
||||
|
||||
if (this.lastBeeHealth != this.jar.currentBeeHealth)
|
||||
{
|
||||
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
|
||||
this.lastBeeHealth = this.jar.currentBeeHealth;
|
||||
}
|
||||
if (this.speciesColour != this.jar.currentBeeColour)
|
||||
{
|
||||
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
|
||||
this.speciesColour = this.jar.currentBeeColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
public int lastBeeHealth = 0;
|
||||
public int speciesColour = 0xffffff;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int craftingId, int value)
|
||||
{
|
||||
if (craftingId == 0)
|
||||
{
|
||||
this.jar.currentBeeHealth = value;
|
||||
}
|
||||
else if (craftingId == 1)
|
||||
{
|
||||
this.jar.currentBeeColour = value;
|
||||
}
|
||||
}
|
||||
public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player) {
|
||||
this.jar = tileEntityEffectJar;
|
||||
this.addSlotToContainer(
|
||||
new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1)));
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return this.jar.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
|
||||
{
|
||||
Slot itemSlot = this.getSlot(slot);
|
||||
boolean clearSlot = false;
|
||||
|
||||
if (itemSlot != null && itemSlot.getHasStack())
|
||||
{
|
||||
ItemStack srcStack = itemSlot.getStack();
|
||||
if (slot == 0 && srcStack != null)
|
||||
{
|
||||
clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.getSlot(0).isItemValid(srcStack))
|
||||
{
|
||||
clearSlot = this.mergeItemStack(srcStack, 0, 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearSlot)
|
||||
{
|
||||
itemSlot.putStack(null);
|
||||
}
|
||||
itemSlot.onSlotChanged();
|
||||
player.inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
|
||||
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (int i = 0; i < this.crafters.size(); ++i) {
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastBeeHealth != this.jar.currentBeeHealth) {
|
||||
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
|
||||
this.lastBeeHealth = this.jar.currentBeeHealth;
|
||||
}
|
||||
if (this.speciesColour != this.jar.currentBeeColour) {
|
||||
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
|
||||
this.speciesColour = this.jar.currentBeeColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int craftingId, int value) {
|
||||
if (craftingId == 0) {
|
||||
this.jar.currentBeeHealth = value;
|
||||
} else if (craftingId == 1) {
|
||||
this.jar.currentBeeColour = value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return this.jar.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
Slot itemSlot = this.getSlot(slot);
|
||||
boolean clearSlot = false;
|
||||
|
||||
if (itemSlot != null && itemSlot.getHasStack()) {
|
||||
ItemStack srcStack = itemSlot.getStack();
|
||||
if (slot == 0 && srcStack != null) {
|
||||
clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false);
|
||||
} else {
|
||||
if (this.getSlot(0).isItemValid(srcStack)) {
|
||||
clearSlot = this.mergeItemStack(srcStack, 0, 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearSlot) {
|
||||
itemSlot.putStack(null);
|
||||
}
|
||||
itemSlot.onSlotChanged();
|
||||
player.inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import magicbees.main.utils.compat.baubles.InventoryBeeRing;
|
||||
|
||||
public class ContainerEffectRing extends ContainerItemInventory<InventoryBeeRing> {
|
||||
|
||||
public ContainerEffectRing(InventoryBeeRing inventory, InventoryPlayer playerInventory) {
|
||||
super(inventory, playerInventory, 8, 74);
|
||||
addSlotToContainer(
|
||||
new SlotCustomItems(inventory, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1)));
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,19 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerMB extends Container
|
||||
{
|
||||
public class ContainerMB extends Container {
|
||||
|
||||
protected final int PLAYER_INVENTORY_ROWS = 3;
|
||||
protected final int PLAYER_INVENTORY_COLUMNS = 9;
|
||||
|
||||
public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart)
|
||||
{
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
|
||||
public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart) {
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++) {
|
||||
addSlotToContainer(
|
||||
new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
|
||||
}
|
||||
|
||||
for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++){
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){
|
||||
for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++) {
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, xStart + 8 + 18 * x, yStart + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.ItemInterface;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.ItemInterface;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
|
||||
public class ContainerMagicApiary extends ContainerMB {
|
||||
|
||||
public TileEntityMagicApiary apiary;
|
||||
@@ -19,39 +20,47 @@ public class ContainerMagicApiary extends ContainerMB {
|
||||
private static final int SLOT_QUEEN = 0;
|
||||
private static final int SLOT_DRONE = 1;
|
||||
private static final int SLOT_FRAME_START = 2;
|
||||
private static final int SLOT_INVENTORY_START = 5;
|
||||
private static final int SLOT_INVENTORY_START = 5;
|
||||
private static final int SLOT_FRAME_COUNT = 3;
|
||||
private static final int SLOT_INVENTORY_COUNT = 7;
|
||||
|
||||
public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary){
|
||||
public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary) {
|
||||
this.apiary = thaumicApiary;
|
||||
|
||||
// Queen/Princess slot
|
||||
addSlotToContainer(new SlotCustomItems(this.apiary, 0, 29, 39, ItemInterface.getItemStack("Forestry", "beeQueenGE", 1), ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
|
||||
addSlotToContainer(
|
||||
new SlotCustomItems(
|
||||
this.apiary,
|
||||
0,
|
||||
29,
|
||||
39,
|
||||
ItemInterface.getItemStack("Forestry", "beeQueenGE", 1),
|
||||
ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
|
||||
// Drone slot
|
||||
addSlotToContainer(new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
|
||||
addSlotToContainer(
|
||||
new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
|
||||
|
||||
int currentSlot = 1;
|
||||
|
||||
// Frame slots
|
||||
for (int x = 0; x < 3; x++){
|
||||
for (int x = 0; x < 3; x++) {
|
||||
currentSlot++;
|
||||
addSlotToContainer(new SlotFrame(thaumicApiary, currentSlot, 66, 23 + x * 29));
|
||||
//LogHelper.info("[1] CURRENTSLOT: " + currentSlot);
|
||||
// LogHelper.info("[1] CURRENTSLOT: " + currentSlot);
|
||||
}
|
||||
|
||||
for (int x = 0; x < 3; x++){
|
||||
for (int x = 0; x < 3; x++) {
|
||||
currentSlot++;
|
||||
addSlotToContainer(new Slot(thaumicApiary, currentSlot, 116, 26 + x * 26));
|
||||
//LogHelper.info("[2] CURRENTSLOT: " + currentSlot);
|
||||
// LogHelper.info("[2] CURRENTSLOT: " + currentSlot);
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
for (int y = 0; y < 2; y++){
|
||||
for (int x = 0; x < 2; x++){
|
||||
for (int y = 0; y < 2; y++) {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
currentSlot++;
|
||||
addSlotToContainer(new Slot(thaumicApiary, currentSlot, 95 + x * 42, 39 + j * 26));
|
||||
//LogHelper.info("[3] CURRENTSLOT: " + currentSlot);
|
||||
// LogHelper.info("[3] CURRENTSLOT: " + currentSlot);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
@@ -59,41 +68,39 @@ public class ContainerMagicApiary extends ContainerMB {
|
||||
addPlayerInventory(inventoryPlayer, 0, 110);
|
||||
|
||||
maxSlot = currentSlot;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex){
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
Slot itemSlot = this.getSlot(slotIndex);
|
||||
boolean clearSlot = false;
|
||||
|
||||
if (itemSlot != null && itemSlot.getHasStack()) {
|
||||
ItemStack srcStack = itemSlot.getStack();
|
||||
|
||||
if (slotIndex <= maxSlot && srcStack != null){
|
||||
if (slotIndex <= maxSlot && srcStack != null) {
|
||||
clearSlot = this.mergeItemStack(srcStack, maxSlot + 1, maxSlot + 36, false);
|
||||
}else{
|
||||
if (slotIndex > maxSlot && srcStack != null){
|
||||
if (BeeManager.beeRoot.isMember(srcStack)){
|
||||
if (!BeeManager.beeRoot.isDrone(srcStack)){
|
||||
if (this.getSlot(SLOT_QUEEN).getHasStack() == false) {
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_QUEEN, SLOT_QUEEN + 1, false);
|
||||
}
|
||||
}else{
|
||||
if (this.getSlot(SLOT_DRONE).isItemValid(srcStack)){
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_DRONE, SLOT_DRONE + 1, false);
|
||||
}
|
||||
} else {
|
||||
if (slotIndex > maxSlot && srcStack != null) {
|
||||
if (BeeManager.beeRoot.isMember(srcStack)) {
|
||||
if (!BeeManager.beeRoot.isDrone(srcStack)) {
|
||||
if (this.getSlot(SLOT_QUEEN).getHasStack() == false) {
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_QUEEN, SLOT_QUEEN + 1, false);
|
||||
}
|
||||
}else if(srcStack.getItem() instanceof IHiveFrame){
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_FRAME_START, SLOT_FRAME_START + SLOT_FRAME_COUNT, false);
|
||||
} else {
|
||||
if (this.getSlot(SLOT_DRONE).isItemValid(srcStack)) {
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_DRONE, SLOT_DRONE + 1, false);
|
||||
}
|
||||
}
|
||||
} else if (srcStack.getItem() instanceof IHiveFrame) {
|
||||
clearSlot = this
|
||||
.mergeItemStack(srcStack, SLOT_FRAME_START, SLOT_FRAME_START + SLOT_FRAME_COUNT, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (clearSlot){
|
||||
if (clearSlot) {
|
||||
itemSlot.putStack(null);
|
||||
}
|
||||
|
||||
@@ -108,7 +115,6 @@ public class ContainerMagicApiary extends ContainerMB {
|
||||
return apiary.isUseableByPlayer(entityPlayer);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
apiary.getGUINetworkData(i, j);
|
||||
|
||||
@@ -1,65 +1,66 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
|
||||
public class GUIEffectJar extends GuiContainer
|
||||
{
|
||||
public static final String BACKGROUND_FILE = "jarScreen.png";
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "jarScreen.png");
|
||||
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 156;
|
||||
|
||||
private static final int SLOT_JAR_X = 80;
|
||||
private static final int SLOT_JAR_Y = 22;
|
||||
private static final int SLOT_INVENTORY_X = 8;
|
||||
private static final int SLOT_INVENTORY_Y = 74;
|
||||
private static final int BAR_DEST_X = 117;
|
||||
private static final int BAR_DEST_Y = 10;
|
||||
|
||||
private static final int BAR_SRC_X = 176;
|
||||
private static final int BAR_SRC_Y = 0;
|
||||
|
||||
private static final int BAR_WIDTH = 10;
|
||||
private static final int BAR_HEIGHT = 40;
|
||||
|
||||
public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player)
|
||||
{
|
||||
super(new ContainerEffectJar(jar, player));
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
}
|
||||
public class GUIEffectJar extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString("Inventory", 9, 63, 0);
|
||||
}
|
||||
public static final String BACKGROUND_FILE = "jarScreen.png";
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.GUI_TEXTURE + "jarScreen.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileEntityEffectJar jar = ((ContainerEffectJar)this.inventorySlots).jar;
|
||||
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
|
||||
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
|
||||
float b = (jar.currentBeeColour & 255) / 255f;
|
||||
|
||||
GL11.glColor3f(r, g, b);
|
||||
|
||||
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
|
||||
this.drawTexturedModalRect(this.guiLeft + BAR_DEST_X, this.guiTop + value + BAR_DEST_Y, BAR_SRC_X, BAR_SRC_Y, BAR_WIDTH, BAR_HEIGHT - value);
|
||||
}
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 156;
|
||||
|
||||
private static final int BAR_DEST_X = 117;
|
||||
private static final int BAR_DEST_Y = 10;
|
||||
|
||||
private static final int BAR_SRC_X = 176;
|
||||
private static final int BAR_SRC_Y = 0;
|
||||
|
||||
private static final int BAR_WIDTH = 10;
|
||||
private static final int BAR_HEIGHT = 40;
|
||||
|
||||
public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player) {
|
||||
super(new ContainerEffectJar(jar, player));
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString("Inventory", 9, 63, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileEntityEffectJar jar = ((ContainerEffectJar) this.inventorySlots).jar;
|
||||
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
|
||||
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
|
||||
float b = (jar.currentBeeColour & 255) / 255f;
|
||||
|
||||
GL11.glColor3f(r, g, b);
|
||||
|
||||
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + BAR_DEST_X,
|
||||
this.guiTop + value + BAR_DEST_Y,
|
||||
BAR_SRC_X,
|
||||
BAR_SRC_Y,
|
||||
BAR_WIDTH,
|
||||
BAR_HEIGHT - value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.compat.baubles.InventoryBeeRing;
|
||||
|
||||
public class GUIEffectRing extends GuiForestry<ContainerEffectRing, IInventory> {
|
||||
|
||||
public static final String BACKGROUND_FILE = "ringScreen.png";
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.GUI_TEXTURE + BACKGROUND_FILE);
|
||||
|
||||
private static final int BAR_DEST_X = 117;
|
||||
private static final int BAR_DEST_Y = 10;
|
||||
|
||||
private static final int BAR_SRC_X = 176;
|
||||
private static final int BAR_SRC_Y = 0;
|
||||
|
||||
private static final int BAR_WIDTH = 10;
|
||||
private static final int BAR_HEIGHT = 40;
|
||||
|
||||
private final InventoryBeeRing inventoryBeeRing;
|
||||
|
||||
protected GUIEffectRing(InventoryBeeRing inventory, InventoryPlayer playerInventory) {
|
||||
super(BACKGROUND_LOCATION, new ContainerEffectRing(inventory, playerInventory), inventory);
|
||||
this.inventoryBeeRing = inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int currentBeeColour = this.inventoryBeeRing.getCurrentBeeColour();
|
||||
float r = ((currentBeeColour >> 16) & 255) / 255f;
|
||||
float g = ((currentBeeColour >> 8) & 255) / 255f;
|
||||
float b = (currentBeeColour & 255) / 255f;
|
||||
|
||||
GL11.glColor3f(r, g, b);
|
||||
|
||||
int value = BAR_HEIGHT - (this.inventoryBeeRing.getCurrentBeeHealth() * BAR_HEIGHT) / 100;
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + BAR_DEST_X,
|
||||
this.guiTop + value + BAR_DEST_Y,
|
||||
BAR_SRC_X,
|
||||
BAR_SRC_Y,
|
||||
BAR_WIDTH,
|
||||
BAR_HEIGHT - value);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,41 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import magicbees.main.utils.compat.baubles.InventoryBeeRing;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GUIHandler implements IGuiHandler
|
||||
{
|
||||
public class GUIHandler implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
Object value = null;
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
Object value = null;
|
||||
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal())
|
||||
{
|
||||
value = new ContainerEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
|
||||
}
|
||||
else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
|
||||
{
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal()) {
|
||||
value = new ContainerEffectJar((TileEntityEffectJar) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
|
||||
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
|
||||
value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
} else if (ID == UIScreens.EFFECT_RING.ordinal()) {
|
||||
value = new ContainerEffectRing(new InventoryBeeRing(player.getHeldItem(), player), player.inventory);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
Object value = null;
|
||||
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal())
|
||||
{
|
||||
value = new GUIEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
|
||||
}else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal()) {
|
||||
return new GUIEffectJar((TileEntityEffectJar) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
|
||||
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
|
||||
value = new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
return new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
} else if (ID == UIScreens.EFFECT_RING.ordinal()) {
|
||||
return new GUIEffectRing(new InventoryBeeRing(player.getHeldItem(), player), player.inventory);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,34 +2,28 @@ package magicbees.client.gui;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory
|
||||
{
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance)
|
||||
{
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return ModGuiConfig.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return ModGuiConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -11,49 +9,53 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMagicApiary extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png");
|
||||
public class GuiMagicApiary extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.GUI_TEXTURE + "apiary.png");
|
||||
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 190;
|
||||
|
||||
|
||||
private static final int LIFEBAR_WIDTH = 2;
|
||||
private static final int LIFEBAR_HEIGHT = 46;
|
||||
|
||||
|
||||
private static final int LIFEBAR_DEST_X = 21;
|
||||
private static final int LIFEBAR_DEST_Y = 37;
|
||||
|
||||
|
||||
private static final int LIFEBAR_SRC_Y = 0;
|
||||
private static final int LIFEBAR_SRC_STAGE1_X = 184;
|
||||
private static final int LIFEBAR_SRC_STAGE2_X = 182;
|
||||
private static final int LIFEBAR_SRC_STAGE3_X = 180;
|
||||
private static final int LIFEBAR_SRC_STAGE4_X = 178;
|
||||
private static final int LIFEBAR_SRC_STAGE5_X = 176;
|
||||
|
||||
|
||||
private static final int WORKBOOST_WIDTH = 16;
|
||||
private static final int WORKBOOST_HEIGHT = 12;
|
||||
private static final int WORKBOOST_DEST_X = 37;
|
||||
private static final int WORKBOOST_DEST_Y = 18;
|
||||
private static final int WORKBOOST_SRC_X = 176;
|
||||
private static final int WORKBOOST_SRC_Y = 46;
|
||||
|
||||
|
||||
private static final int DEATHBOOST_WIDTH = 11;
|
||||
private static final int DEATHBOOST_HEIGHT = 13;
|
||||
private static final int DEATHBOOST_DEST_X = 25;
|
||||
private static final int DEATHBOOST_DEST_Y = 17;
|
||||
private static final int DEATHBOOST_SRC_X = 176;
|
||||
private static final int DEATHBOOST_SRC_Y = 58;
|
||||
|
||||
|
||||
private static final int MUTATIONBOOST_WIDTH = 9;
|
||||
private static final int MUTATIONBOOST_HEIGHT = 13;
|
||||
private static final int MUTATIONBOOST_DEST_X = 15;
|
||||
private static final int MUTATIONBOOST_DEST_Y = 17;
|
||||
private static final int MUTATIONBOOST_SRC_X = 176;
|
||||
private static final int MUTATIONBOOST_SRC_Y = 71;
|
||||
|
||||
|
||||
private GuiButton mutationButton;
|
||||
|
||||
public GuiMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary) {
|
||||
@@ -61,14 +63,12 @@ public class GuiMagicApiary extends GuiContainer
|
||||
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString("Inventory", 9, 99, 0);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString("Inventory", 9, 99, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||
@@ -76,9 +76,9 @@ public class GuiMagicApiary extends GuiContainer
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileEntityMagicApiary apiary = ((ContainerMagicApiary)this.inventorySlots).apiary;
|
||||
|
||||
|
||||
TileEntityMagicApiary apiary = ((ContainerMagicApiary) this.inventorySlots).apiary;
|
||||
|
||||
drawLifebar(apiary);
|
||||
|
||||
drawWorkBoostIcon(apiary);
|
||||
@@ -86,56 +86,72 @@ public class GuiMagicApiary extends GuiContainer
|
||||
drawMutationIcon(apiary);
|
||||
}
|
||||
|
||||
private void drawMutationIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isMutationBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + MUTATIONBOOST_DEST_X, this.guiTop + MUTATIONBOOST_DEST_Y,
|
||||
MUTATIONBOOST_SRC_X, MUTATIONBOOST_SRC_Y, MUTATIONBOOST_WIDTH, MUTATIONBOOST_HEIGHT);
|
||||
private void drawMutationIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isMutationBoosted()) {
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + MUTATIONBOOST_DEST_X,
|
||||
this.guiTop + MUTATIONBOOST_DEST_Y,
|
||||
MUTATIONBOOST_SRC_X,
|
||||
MUTATIONBOOST_SRC_Y,
|
||||
MUTATIONBOOST_WIDTH,
|
||||
MUTATIONBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isDeathRateBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + DEATHBOOST_DEST_X, this.guiTop + DEATHBOOST_DEST_Y,
|
||||
DEATHBOOST_SRC_X, DEATHBOOST_SRC_Y, DEATHBOOST_WIDTH, DEATHBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isProductionBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + WORKBOOST_DEST_X, this.guiTop + WORKBOOST_DEST_Y,
|
||||
WORKBOOST_SRC_X, WORKBOOST_SRC_Y, WORKBOOST_WIDTH, WORKBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawLifebar(TileEntityMagicApiary apiary) {
|
||||
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
|
||||
int lifebarSrc = getLifebarSrc(apiary);
|
||||
this.drawTexturedModalRect(this.guiLeft + LIFEBAR_DEST_X, this.guiTop + value + LIFEBAR_DEST_Y,
|
||||
lifebarSrc, LIFEBAR_SRC_Y, LIFEBAR_WIDTH, LIFEBAR_HEIGHT - value);
|
||||
}
|
||||
|
||||
private int getLifebarSrc(TileEntityMagicApiary apiary) {
|
||||
int value = apiary.getHealthScaled(5);
|
||||
if (value >= 5) {
|
||||
return LIFEBAR_SRC_STAGE1_X;
|
||||
}
|
||||
else if (value >= 4) {
|
||||
return LIFEBAR_SRC_STAGE2_X;
|
||||
}
|
||||
else if (value >= 3) {
|
||||
return LIFEBAR_SRC_STAGE3_X;
|
||||
}
|
||||
else if (value >= 2) {
|
||||
return LIFEBAR_SRC_STAGE4_X;
|
||||
}
|
||||
else {
|
||||
return LIFEBAR_SRC_STAGE5_X;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
|
||||
}
|
||||
private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isDeathRateBoosted()) {
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + DEATHBOOST_DEST_X,
|
||||
this.guiTop + DEATHBOOST_DEST_Y,
|
||||
DEATHBOOST_SRC_X,
|
||||
DEATHBOOST_SRC_Y,
|
||||
DEATHBOOST_WIDTH,
|
||||
DEATHBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isProductionBoosted()) {
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + WORKBOOST_DEST_X,
|
||||
this.guiTop + WORKBOOST_DEST_Y,
|
||||
WORKBOOST_SRC_X,
|
||||
WORKBOOST_SRC_Y,
|
||||
WORKBOOST_WIDTH,
|
||||
WORKBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawLifebar(TileEntityMagicApiary apiary) {
|
||||
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
|
||||
int lifebarSrc = getLifebarSrc(apiary);
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + LIFEBAR_DEST_X,
|
||||
this.guiTop + value + LIFEBAR_DEST_Y,
|
||||
lifebarSrc,
|
||||
LIFEBAR_SRC_Y,
|
||||
LIFEBAR_WIDTH,
|
||||
LIFEBAR_HEIGHT - value);
|
||||
}
|
||||
|
||||
private int getLifebarSrc(TileEntityMagicApiary apiary) {
|
||||
int value = apiary.getHealthScaled(5);
|
||||
if (value >= 5) {
|
||||
return LIFEBAR_SRC_STAGE1_X;
|
||||
} else if (value >= 4) {
|
||||
return LIFEBAR_SRC_STAGE2_X;
|
||||
} else if (value >= 3) {
|
||||
return LIFEBAR_SRC_STAGE3_X;
|
||||
} else if (value >= 2) {
|
||||
return LIFEBAR_SRC_STAGE4_X;
|
||||
} else {
|
||||
return LIFEBAR_SRC_STAGE5_X;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
|
||||
}
|
||||
}
|
||||
@@ -3,36 +3,42 @@ package magicbees.client.gui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import cpw.mods.fml.client.config.DummyConfigElement;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
|
||||
public class ModGuiConfig extends GuiConfig
|
||||
{
|
||||
public ModGuiConfig(GuiScreen guiScreen)
|
||||
{
|
||||
super(guiScreen, configElements(), VersionInfo.ModName, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Config.configuration.toString()));
|
||||
}
|
||||
|
||||
private static List<IConfigElement> configElements() {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
public class ModGuiConfig extends GuiConfig {
|
||||
|
||||
list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general"));
|
||||
list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug"));
|
||||
list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules"));
|
||||
list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
|
||||
return new DummyConfigElement.DummyCategoryElement(name, tooltip_key,
|
||||
new ConfigElement(Config.configuration.getCategory(category)).getChildElements());
|
||||
}
|
||||
public ModGuiConfig(GuiScreen guiScreen) {
|
||||
super(
|
||||
guiScreen,
|
||||
configElements(),
|
||||
VersionInfo.ModName,
|
||||
false,
|
||||
false,
|
||||
GuiConfig.getAbridgedConfigPath(Config.configuration.toString()));
|
||||
}
|
||||
|
||||
private static List<IConfigElement> configElements() {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general"));
|
||||
list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug"));
|
||||
list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules"));
|
||||
list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
|
||||
return new DummyConfigElement.DummyCategoryElement(
|
||||
name,
|
||||
tooltip_key,
|
||||
new ConfigElement(Config.configuration.getCategory(category)).getChildElements());
|
||||
}
|
||||
}
|
||||
@@ -12,90 +12,71 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
/**
|
||||
* @author MysteriousAges
|
||||
*/
|
||||
public class SlotCustomItems extends Slot
|
||||
{
|
||||
private List<ItemStack> items;
|
||||
public class SlotCustomItems extends Slot {
|
||||
|
||||
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items)
|
||||
{
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
this.items = new ArrayList<ItemStack>(items.length);
|
||||
private List<ItemStack> items;
|
||||
|
||||
Collections.addAll(this.items, items);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of valid ItemStacks
|
||||
*/
|
||||
public List<ItemStack> getValidItems()
|
||||
{
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void addValidItem(ItemStack newItem)
|
||||
{
|
||||
boolean contains = false;
|
||||
for (int i = 0; i < this.items.size(); ++i)
|
||||
{
|
||||
ItemStack s = this.items.get(i);
|
||||
if (s.getItem() == newItem.getItem())
|
||||
{
|
||||
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
else if (s.getItemDamage() == newItem.getItemDamage())
|
||||
{
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!contains)
|
||||
{
|
||||
this.items.add(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param removeItem ItemStack to remove.
|
||||
*/
|
||||
public void removeValidItem(ItemStack removeItem)
|
||||
{
|
||||
for (int i = 0; i < this.items.size(); ++i)
|
||||
{
|
||||
ItemStack s = this.items.get(i);
|
||||
if (s.getItem() == removeItem.getItem())
|
||||
{
|
||||
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
this.items.remove(i);
|
||||
break;
|
||||
}
|
||||
else if (s.getItemDamage() == removeItem.getItemDamage())
|
||||
{
|
||||
this.items.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items) {
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
this.items = new ArrayList<ItemStack>(items.length);
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
for (ItemStack item : this.items)
|
||||
{
|
||||
if (item != null && item.getItem() == itemStack.getItem())
|
||||
{
|
||||
if (item.getItemDamage() == itemStack.getItemDamage() || item.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Collections.addAll(this.items, items);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of valid ItemStacks
|
||||
*/
|
||||
public List<ItemStack> getValidItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void addValidItem(ItemStack newItem) {
|
||||
boolean contains = false;
|
||||
for (int i = 0; i < this.items.size(); ++i) {
|
||||
ItemStack s = this.items.get(i);
|
||||
if (s.getItem() == newItem.getItem()) {
|
||||
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
contains = true;
|
||||
break;
|
||||
} else if (s.getItemDamage() == newItem.getItemDamage()) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!contains) {
|
||||
this.items.add(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param removeItem ItemStack to remove.
|
||||
*/
|
||||
public void removeValidItem(ItemStack removeItem) {
|
||||
for (int i = 0; i < this.items.size(); ++i) {
|
||||
ItemStack s = this.items.get(i);
|
||||
if (s.getItem() == removeItem.getItem()) {
|
||||
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
this.items.remove(i);
|
||||
break;
|
||||
} else if (s.getItemDamage() == removeItem.getItemDamage()) {
|
||||
this.items.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
for (ItemStack item : this.items) {
|
||||
if (item != null && item.getItem() == itemStack.getItem()) {
|
||||
if (item.getItemDamage() == itemStack.getItemDamage()
|
||||
|| item.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,28 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
|
||||
public class SlotFrame extends SlotCustomItems {
|
||||
|
||||
public SlotFrame(IInventory inventory, int slotIndex, int xPos, int yPos) {
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack){
|
||||
if (itemStack == null){
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
if (!inventory.isItemValidForSlot(getSlotIndex(), itemStack)){
|
||||
if (!inventory.isItemValidForSlot(getSlotIndex(), itemStack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if(itemStack.getItem() instanceof IHiveFrame){
|
||||
if (itemStack.getItem() instanceof IHiveFrame) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
public enum UIScreens
|
||||
{
|
||||
EFFECT_JAR,
|
||||
THAUMIC_APIARY,;
|
||||
public enum UIScreens {
|
||||
EFFECT_JAR,
|
||||
THAUMIC_APIARY,
|
||||
EFFECT_RING
|
||||
}
|
||||
@@ -1,39 +1,42 @@
|
||||
package magicbees.client.model;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelEffectJar
|
||||
{
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "effectJar.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png");
|
||||
|
||||
public static final ModelEffectJar model = new ModelEffectJar();
|
||||
|
||||
private IModelCustom effectJarObj;
|
||||
|
||||
public ModelEffectJar()
|
||||
{
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render()
|
||||
{
|
||||
this.effectJarObj.renderPart("jarLid");
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.effectJarObj.renderPart("jarBase");
|
||||
GL11.glPopAttrib();
|
||||
|
||||
}
|
||||
public class ModelEffectJar {
|
||||
|
||||
public static final ResourceLocation objFile = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.MODEL + "effectJar.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.MODEL + "jarTexture.png");
|
||||
|
||||
public static final ModelEffectJar model = new ModelEffectJar();
|
||||
|
||||
private IModelCustom effectJarObj;
|
||||
|
||||
public ModelEffectJar() {
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
this.effectJarObj.renderPart("jarLid");
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.effectJarObj.renderPart("jarBase");
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,49 @@
|
||||
package magicbees.client.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelVisAuraProvider {
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png");
|
||||
|
||||
public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
|
||||
|
||||
private IModelCustom visAuraProviderObj;
|
||||
|
||||
public ModelVisAuraProvider() {
|
||||
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render(long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
|
||||
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
|
||||
GL11.glTranslated(Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
|
||||
float red = (float)(Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
|
||||
float green = (float)(Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
|
||||
float blue = (float)(Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
this.visAuraProviderObj.renderPart("centre");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
this.visAuraProviderObj.renderPart("frame");
|
||||
}
|
||||
public static final ResourceLocation objFile = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.MODEL + "visAuraConverter.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.MODEL + "visAuraProvider.png");
|
||||
|
||||
public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
|
||||
|
||||
private IModelCustom visAuraProviderObj;
|
||||
|
||||
public ModelVisAuraProvider() {
|
||||
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render(long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
|
||||
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
|
||||
GL11.glTranslated(
|
||||
Math.sin(tick * Math.PI * 2 / 1000) * 0.025,
|
||||
0,
|
||||
Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
|
||||
float red = (float) (Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
|
||||
float green = (float) (Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
|
||||
float blue = (float) (Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
this.visAuraProviderObj.renderPart("centre");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
this.visAuraProviderObj.renderPart("frame");
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,71 @@
|
||||
package magicbees.client.render;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import magicbees.client.model.ModelEffectJar;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
{
|
||||
public static RendererEffectJar instance = new RendererEffectJar();
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import magicbees.client.model.ModelEffectJar;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
||||
{
|
||||
if (tileEntity instanceof TileEntityEffectJar)
|
||||
{
|
||||
this.doRender(x, y, z, 1f);
|
||||
}
|
||||
}
|
||||
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public static RendererEffectJar instance = new RendererEffectJar();
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||
if (tileEntity instanceof TileEntityEffectJar) {
|
||||
this.doRender(x, y, z, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case ENTITY:
|
||||
doRender(0, 0, 0, 1.8f);
|
||||
break;
|
||||
|
||||
case EQUIPPED:
|
||||
doRender(0, 0, 0, 1.5f);
|
||||
break;
|
||||
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
doRender(-.5, .5, 0.25, 1f);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
doRender(0.3, 0.25, 0.3, 1.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureLocation);
|
||||
|
||||
ModelEffectJar.model.render();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
default:
|
||||
case ENTITY:
|
||||
doRender(0, 0, 0, 1.8f);
|
||||
break;
|
||||
|
||||
case EQUIPPED:
|
||||
doRender(0, 0, 0, 1.5f);
|
||||
break;
|
||||
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
doRender(-.5, .5, 0.25, 1f);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
doRender(0.3, 0.25, 0.3, 1.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureLocation);
|
||||
|
||||
ModelEffectJar.model.render();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package magicbees.client.render;
|
||||
|
||||
import magicbees.client.model.ModelVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -10,41 +8,43 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import magicbees.client.model.ModelVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
|
||||
public class RendererVisAuraProvider extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
|
||||
if (entity instanceof TileEntityVisAuraProvider) {
|
||||
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
|
||||
if (entity instanceof TileEntityVisAuraProvider) {
|
||||
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
doRender(0, 0, 0, 1f, 0);
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale, long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
|
||||
ModelVisAuraProvider.model.render(tick);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
doRender(0, 0, 0, 1f, 0);
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale, long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
|
||||
ModelVisAuraProvider.model.render(tick);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -2,100 +2,91 @@ package magicbees.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.item.types.CapsuleType;
|
||||
import magicbees.item.types.FluidType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.CapsuleType;
|
||||
import magicbees.item.types.FluidType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
|
||||
public class ItemCapsule extends Item
|
||||
{
|
||||
private CapsuleType capsuleType;
|
||||
|
||||
public ItemCapsule(CapsuleType type, int maxStackSize)
|
||||
{
|
||||
super();
|
||||
this.capsuleType = type;
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(maxStackSize);
|
||||
this.setUnlocalizedName("capsule." + type.toString().toLowerCase());
|
||||
GameRegistry.registerItem(this, "capsule." + type.toString().toLowerCase());
|
||||
}
|
||||
|
||||
public CapsuleType getType()
|
||||
{
|
||||
return this.capsuleType;
|
||||
}
|
||||
public class ItemCapsule extends Item {
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemStack)
|
||||
{
|
||||
return String.format(this.capsuleType.getLocalizedName(), FluidType.values()[itemStack.getItemDamage()].getDisplayName());
|
||||
}
|
||||
private CapsuleType capsuleType;
|
||||
|
||||
public ItemStack getCapsuleForLiquid(FluidType l)
|
||||
{
|
||||
return new ItemStack(this, 1, l.ordinal());
|
||||
}
|
||||
public ItemCapsule(CapsuleType type, int maxStackSize) {
|
||||
super();
|
||||
this.capsuleType = type;
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(maxStackSize);
|
||||
this.setUnlocalizedName("capsule." + type.toString().toLowerCase());
|
||||
GameRegistry.registerItem(this, "capsule." + type.toString().toLowerCase());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List itemList)
|
||||
{
|
||||
for (FluidType l : FluidType.values())
|
||||
{
|
||||
if (l.available)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, l.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
public CapsuleType getType() {
|
||||
return this.capsuleType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":capsule" + this.capsuleType.getName().substring(0, 1).toUpperCase()
|
||||
+ this.capsuleType.getName().substring(1));
|
||||
for (FluidType t : FluidType.values())
|
||||
{
|
||||
if (t != FluidType.EMPTY)
|
||||
{
|
||||
t.liquidIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":liquids/" + t.liquidID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||
return String.format(
|
||||
this.capsuleType.getLocalizedName(),
|
||||
FluidType.values()[itemStack.getItemDamage()].getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int metadata, int pass)
|
||||
{
|
||||
IIcon i = this.itemIcon;
|
||||
if (metadata != 0 && pass == 0)
|
||||
{
|
||||
i = FluidType.values()[metadata % FluidType.values().length].liquidIcon;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
public ItemStack getCapsuleForLiquid(FluidType l) {
|
||||
return new ItemStack(this, 1, l.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata)
|
||||
{
|
||||
return (metadata == 0) ? 1 : 2;
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
|
||||
for (FluidType l : FluidType.values()) {
|
||||
if (l.available) {
|
||||
itemList.add(new ItemStack(this, 1, l.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(
|
||||
CommonProxy.DOMAIN + ":capsule"
|
||||
+ this.capsuleType.getName().substring(0, 1).toUpperCase()
|
||||
+ this.capsuleType.getName().substring(1));
|
||||
for (FluidType t : FluidType.values()) {
|
||||
if (t != FluidType.EMPTY) {
|
||||
t.liquidIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":liquids/" + t.liquidID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int metadata, int pass) {
|
||||
IIcon i = this.itemIcon;
|
||||
if (metadata != 0 && pass == 0) {
|
||||
i = FluidType.values()[metadata % FluidType.values().length].liquidIcon;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return (metadata == 0) ? 1 : 2;
|
||||
}
|
||||
}
|
||||
@@ -2,111 +2,97 @@ package magicbees.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.item.types.CombType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.CombType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
|
||||
public class ItemComb extends Item
|
||||
{
|
||||
public ItemComb()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("comb");
|
||||
GameRegistry.registerItem(this, "comb");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(CombType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(CombType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (CombType type : CombType.values())
|
||||
{
|
||||
if (type.showInList || Config.forestryDebugEnabled)
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public class ItemComb extends Item {
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int meta)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.0");
|
||||
this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.1");
|
||||
}
|
||||
public ItemComb() {
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("comb");
|
||||
GameRegistry.registerItem(this, "comb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
return (pass == 0) ? itemIcon : secondIcon;
|
||||
}
|
||||
public ItemStack getStackForType(CombType type) {
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = CombType.values()[meta].getColours()[0];
|
||||
|
||||
if (pass >= 1)
|
||||
{
|
||||
colour = CombType.values()[meta].getColours()[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
public ItemStack getStackForType(CombType type, int count) {
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return CombType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
for (CombType type : CombType.values()) {
|
||||
if (type.showInList || Config.forestryDebugEnabled) {
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage(ItemStack stack) {
|
||||
if (CombType.values().length < super.getDamage(stack)) {
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
return super.getDamage(stack);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int meta) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.0");
|
||||
this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return (pass == 0) ? itemIcon : secondIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = CombType.values()[meta].getColours()[0];
|
||||
|
||||
if (pass >= 1) {
|
||||
colour = CombType.values()[meta].getColours()[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return CombType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage(ItemStack stack) {
|
||||
if (CombType.values().length < super.getDamage(stack)) {
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
return super.getDamage(stack);
|
||||
}
|
||||
}
|
||||
@@ -2,98 +2,86 @@ package magicbees.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
|
||||
public class ItemDrop extends Item
|
||||
{
|
||||
public ItemDrop()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("drop");
|
||||
GameRegistry.registerItem(this, "drop");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(DropType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(DropType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (DropType type : DropType.values())
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public class ItemDrop extends Item {
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.0");
|
||||
this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.1");
|
||||
}
|
||||
public ItemDrop() {
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("drop");
|
||||
GameRegistry.registerItem(this, "drop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
return (pass == 0) ? this.itemIcon : this.secondIcon;
|
||||
}
|
||||
public ItemStack getStackForType(DropType type) {
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int meta = Math.max(0, Math.min(DropType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = DropType.values()[meta].combColour[0];
|
||||
|
||||
if (pass >= 1)
|
||||
{
|
||||
colour = DropType.values()[meta].combColour[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
public ItemStack getStackForType(DropType type, int count) {
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return DropType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
for (DropType type : DropType.values()) {
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.0");
|
||||
this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return (pass == 0) ? this.itemIcon : this.secondIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
int meta = Math.max(0, Math.min(DropType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = DropType.values()[meta].combColour[0];
|
||||
|
||||
if (pass >= 1) {
|
||||
colour = DropType.values()[meta].combColour[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return DropType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package magicbees.item;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -9,53 +7,53 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.IToolGrafter;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
|
||||
public class ItemGrafter extends Item implements IToolGrafter {
|
||||
|
||||
public ItemGrafter() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
|
||||
this.setHarvestLevel("grafter", 3);
|
||||
}
|
||||
public ItemGrafter() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
|
||||
this.setHarvestLevel("grafter", 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) {
|
||||
return 100f;
|
||||
}
|
||||
@Override
|
||||
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) {
|
||||
return 100f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) {
|
||||
int damage = 1;
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
if (block == ThaumcraftHelper.leaf)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z) & 1;
|
||||
if (meta == 0 || meta == 1)
|
||||
{
|
||||
double chance = Math.random();
|
||||
if (chance <= Config.thaumcraftSaplingDroprate)
|
||||
{
|
||||
this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemstack.damageItem(damage, entityLiving);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z,
|
||||
EntityLivingBase entityLiving) {
|
||||
int damage = 1;
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
if (block == ThaumcraftHelper.leaf) {
|
||||
int meta = world.getBlockMetadata(x, y, z) & 1;
|
||||
if (meta == 0 || meta == 1) {
|
||||
double chance = Math.random();
|
||||
if (chance <= Config.thaumcraftSaplingDroprate) {
|
||||
this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemstack.damageItem(damage, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void dropItem(World world, int x, int y, int z, ItemStack item) {
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, item);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
protected void dropItem(World world, int x, int y, int z, ItemStack item) {
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, item);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +1,43 @@
|
||||
package magicbees.item;
|
||||
|
||||
import magicbees.block.types.HiveType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.block.types.HiveType;
|
||||
|
||||
/**
|
||||
* Created by Allen on 7/29/2014.
|
||||
*/
|
||||
public class ItemMagicHive extends ItemBlock
|
||||
{
|
||||
public ItemMagicHive(Block block)
|
||||
{
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
public class ItemMagicHive extends ItemBlock {
|
||||
|
||||
@Override
|
||||
public int getMetadata(int i) {
|
||||
return i;
|
||||
}
|
||||
public ItemMagicHive(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
protected Block getBlock() {
|
||||
return field_150939_a;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.getBlock().getIcon(1, meta);
|
||||
}
|
||||
protected Block getBlock() {
|
||||
return field_150939_a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
return getBlock().getUnlocalizedName() + "." + HiveType.getHiveFromMeta(itemstack.getItemDamage()).name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.getBlock().getIcon(1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
return getBlock().getUnlocalizedName() + "."
|
||||
+ HiveType.getHiveFromMeta(itemstack.getItemDamage()).name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -1,64 +1,60 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.HiveFrameType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import magicbees.item.types.HiveFrameType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
|
||||
public class ItemMagicHiveFrame extends Item implements IHiveFrame
|
||||
{
|
||||
private HiveFrameType type;
|
||||
public class ItemMagicHiveFrame extends Item implements IHiveFrame {
|
||||
|
||||
public ItemMagicHiveFrame(HiveFrameType frameType)
|
||||
{
|
||||
super();
|
||||
this.type = frameType;
|
||||
this.setMaxDamage(this.type.maxDamage);
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setUnlocalizedName("frame" + frameType.getName());
|
||||
GameRegistry.registerItem(this, "frame" + frameType.getName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":frame" + type.getName());
|
||||
}
|
||||
|
||||
// --------- IHiveFrame functions -----------------------------------------
|
||||
|
||||
@Override
|
||||
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) {
|
||||
frame.setItemDamage(frame.getItemDamage() + wear);
|
||||
private HiveFrameType type;
|
||||
|
||||
if (frame.getItemDamage() >= frame.getMaxDamage()) {
|
||||
// Break the frame.
|
||||
frame = null;
|
||||
}
|
||||
public ItemMagicHiveFrame(HiveFrameType frameType) {
|
||||
super();
|
||||
this.type = frameType;
|
||||
this.setMaxDamage(this.type.maxDamage);
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setUnlocalizedName("frame" + frameType.getName());
|
||||
GameRegistry.registerItem(this, "frame" + frameType.getName());
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":frame" + type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// --------- IHiveFrame functions -----------------------------------------
|
||||
|
||||
@Override
|
||||
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) {
|
||||
frame.setItemDamage(frame.getItemDamage() + wear);
|
||||
|
||||
if (frame.getItemDamage() >= frame.getMaxDamage()) {
|
||||
// Break the frame.
|
||||
frame = null;
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,59 @@
|
||||
package magicbees.item;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaUsingItem", modid = BotaniaHelper.Name, striprefs = true)
|
||||
})
|
||||
@Optional.InterfaceList({ @Optional.Interface(
|
||||
iface = "vazkii.botania.api.mana.IManaUsingItem",
|
||||
modid = BotaniaHelper.Name,
|
||||
striprefs = true) })
|
||||
public class ItemManasteelGrafter extends ItemGrafter implements IManaUsingItem {
|
||||
|
||||
public static final int MANA_PER_DAMAGE = 90;
|
||||
|
||||
public ItemManasteelGrafter() {
|
||||
super();
|
||||
this.setMaxDamage(15);
|
||||
this.setUnlocalizedName("manasteelGrafter");
|
||||
}
|
||||
public static final int MANA_PER_DAMAGE = 90;
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public boolean getIsRepairable(ItemStack toolStack, ItemStack material) {
|
||||
return (material.getItem() == BotaniaHelper.itemManaResource && material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal()) || super.getIsRepairable(toolStack, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelGrafter");
|
||||
}
|
||||
public ItemManasteelGrafter() {
|
||||
super();
|
||||
this.setMaxDamage(15);
|
||||
this.setUnlocalizedName("manasteelGrafter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
|
||||
// Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in.
|
||||
if (/*!world.isRemote && */stack.getItemDamage() > 0 && player instanceof EntityPlayer) {
|
||||
if (BotaniaHelper.requestMana(stack, (EntityPlayer)player, MANA_PER_DAMAGE, 1)) {
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public boolean getIsRepairable(ItemStack toolStack, ItemStack material) {
|
||||
return (material.getItem() == BotaniaHelper.itemManaResource
|
||||
&& material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal())
|
||||
|| super.getIsRepairable(toolStack, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMana(ItemStack arg0) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelGrafter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
|
||||
// Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in.
|
||||
if (
|
||||
/* !world.isRemote && */ stack.getItemDamage() > 0 && player instanceof EntityPlayer) {
|
||||
if (BotaniaHelper.requestMana(stack, (EntityPlayer) player, MANA_PER_DAMAGE, 1)) {
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMana(ItemStack arg0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package magicbees.item;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -10,58 +8,66 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IToolScoop;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaUsingItem", modid = BotaniaHelper.Name, striprefs = true)
|
||||
})
|
||||
@Optional.InterfaceList({ @Optional.Interface(
|
||||
iface = "vazkii.botania.api.mana.IManaUsingItem",
|
||||
modid = BotaniaHelper.Name,
|
||||
striprefs = true) })
|
||||
public class ItemManasteelScoop extends Item implements IManaUsingItem, IToolScoop {
|
||||
|
||||
public static final int MANA_PER_DAMAGE = 30;
|
||||
|
||||
public ItemManasteelScoop() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(20);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabApiculture);
|
||||
this.setUnlocalizedName("manasteelScoop");
|
||||
this.setHarvestLevel("scoop", 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
|
||||
stack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMana(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public boolean getIsRepairable(ItemStack toolStack, ItemStack material) {
|
||||
return (material.getItem() == BotaniaHelper.itemManaResource && material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal()) || super.getIsRepairable(toolStack, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelScoop");
|
||||
}
|
||||
public static final int MANA_PER_DAMAGE = 30;
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
|
||||
// Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in.
|
||||
if (/*!world.isRemote && */stack.getItemDamage() > 0 && player instanceof EntityPlayer) {
|
||||
if (BotaniaHelper.requestMana(stack, (EntityPlayer)player, MANA_PER_DAMAGE, 1)) {
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
public ItemManasteelScoop() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(20);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabApiculture);
|
||||
this.setUnlocalizedName("manasteelScoop");
|
||||
this.setHarvestLevel("scoop", 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z,
|
||||
EntityLivingBase player) {
|
||||
stack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMana(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public boolean getIsRepairable(ItemStack toolStack, ItemStack material) {
|
||||
return (material.getItem() == BotaniaHelper.itemManaResource
|
||||
&& material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal())
|
||||
|| super.getIsRepairable(toolStack, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelScoop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
|
||||
// Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in.
|
||||
if (
|
||||
/* !world.isRemote && */ stack.getItemDamage() > 0 && player instanceof EntityPlayer) {
|
||||
if (BotaniaHelper.requestMana(stack, (EntityPlayer) player, MANA_PER_DAMAGE, 1)) {
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,75 +2,66 @@ package magicbees.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.ResourceType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemMiscResources extends Item
|
||||
{
|
||||
private IIcon[] icons = new IIcon[ResourceType.values().length];
|
||||
|
||||
public ItemMiscResources()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("miscResources");
|
||||
GameRegistry.registerItem(this, "miscResources");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(ResourceType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(ResourceType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (ResourceType type : ResourceType.values())
|
||||
{
|
||||
if (type.showInList)
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
for (int i = 0; i < ResourceType.values().length; i++)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":" + ResourceType.values()[i].getName());
|
||||
}
|
||||
}
|
||||
public class ItemMiscResources extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
private IIcon[] icons = new IIcon[ResourceType.values().length];
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return ResourceType.values()[stack.getItemDamage()].getLocalizedName();
|
||||
}
|
||||
public ItemMiscResources() {
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("miscResources");
|
||||
GameRegistry.registerItem(this, "miscResources");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(ResourceType type) {
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(ResourceType type, int count) {
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
for (ResourceType type : ResourceType.values()) {
|
||||
if (type.showInList) {
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < ResourceType.values().length; i++) {
|
||||
this.icons[i] = par1IconRegister
|
||||
.registerIcon(CommonProxy.DOMAIN + ":" + ResourceType.values()[i].getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return ResourceType.values()[stack.getItemDamage()].getLocalizedName();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,12 @@ package magicbees.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -9,53 +15,43 @@ import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemMoonDial extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public ItemMoonDial()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setUnlocalizedName("moonDial");
|
||||
GameRegistry.registerItem(this, "moonDial");
|
||||
}
|
||||
public class ItemMoonDial extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new IIcon[MoonPhase.values().length];
|
||||
for (int i = 0; i < MoonPhase.values().length; ++i)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":moonDial." + i);
|
||||
}
|
||||
this.itemIcon = this.icons[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
return this.icons[MoonPhase.getMoonPhaseFromTime(player.worldObj.getWorldTime()).ordinal()];
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List infoList, boolean par4)
|
||||
{
|
||||
if (Config.moonDialShowsPhaseInText &&
|
||||
entityPlayer.getCurrentEquippedItem() != null &&
|
||||
entityPlayer.getCurrentEquippedItem().getItem() == this)
|
||||
{
|
||||
infoList.add("\u00A77" + MoonPhase.getMoonPhaseFromTime(entityPlayer.worldObj.getWorldTime()).getLocalizedName());
|
||||
}
|
||||
}
|
||||
public ItemMoonDial() {
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setUnlocalizedName("moonDial");
|
||||
GameRegistry.registerItem(this, "moonDial");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.icons = new IIcon[MoonPhase.values().length];
|
||||
for (int i = 0; i < MoonPhase.values().length; ++i) {
|
||||
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":moonDial." + i);
|
||||
}
|
||||
this.itemIcon = this.icons[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
return this.icons[MoonPhase.getMoonPhaseFromTime(player.worldObj.getWorldTime()).ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List infoList, boolean par4) {
|
||||
if (Config.moonDialShowsPhaseInText && entityPlayer.getCurrentEquippedItem() != null
|
||||
&& entityPlayer.getCurrentEquippedItem().getItem() == this) {
|
||||
infoList.add(
|
||||
"\u00A77"
|
||||
+ MoonPhase.getMoonPhaseFromTime(entityPlayer.worldObj.getWorldTime()).getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,6 @@ package magicbees.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -24,194 +15,206 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
|
||||
@Optional.Interface(modid="Baubles", iface="baubles.api.IBauble")
|
||||
@Optional.Interface(modid = "Baubles", iface = "baubles.api.IBauble")
|
||||
public class ItemMysteriousMagnet extends Item implements IBauble {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
|
||||
private final float FUDGE_FACTOR = 0.2f;
|
||||
|
||||
public ItemMysteriousMagnet() {
|
||||
super();
|
||||
this.setNoRepair();
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName(CommonProxy.DOMAIN + ":mysteriousMagnet");
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
|
||||
String s = LocalizationManager.getLocalizedString("misc.level", getMagnetLevel(itemStack));
|
||||
if (isMagnetActive(itemStack)) {
|
||||
list.add(LocalizationManager.getLocalizedString("misc.magnetActive", s));
|
||||
}
|
||||
else {
|
||||
list.add(LocalizationManager.getLocalizedString("misc.magnetInactive", s));
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
onWornTick(itemStack, (EntityLivingBase) entity);
|
||||
}
|
||||
}
|
||||
private final float FUDGE_FACTOR = 0.2f;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
for (int i = 0; i <= getMaximumLevel(); i++) {
|
||||
list.add(new ItemStack(this, 1, i * 2));
|
||||
}
|
||||
}
|
||||
public ItemMysteriousMagnet() {
|
||||
super();
|
||||
this.setNoRepair();
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName(CommonProxy.DOMAIN + ":mysteriousMagnet");
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":magnetInactive");
|
||||
this.activeIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":magnetActive");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
|
||||
String s = LocalizationManager.getLocalizedString("misc.level", getMagnetLevel(itemStack));
|
||||
if (isMagnetActive(itemStack)) {
|
||||
list.add(LocalizationManager.getLocalizedString("misc.magnetActive", s));
|
||||
} else {
|
||||
list.add(LocalizationManager.getLocalizedString("misc.magnetInactive", s));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return isMagnetActive(meta) ? this.activeIcon : this.itemIcon;
|
||||
}
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
onWornTick(itemStack, (EntityLivingBase) entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack itemStack, int pass) {
|
||||
return isMagnetActive(itemStack);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
for (int i = 0; i <= getMaximumLevel(); i++) {
|
||||
list.add(new ItemStack(this, 1, i * 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
toggleActive(itemStack);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":magnetInactive");
|
||||
this.activeIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":magnetActive");
|
||||
}
|
||||
|
||||
public void toggleActive(ItemStack itemStack) {
|
||||
itemStack.setItemDamage(itemStack.getItemDamage() ^ 1);
|
||||
}
|
||||
|
||||
public boolean isMagnetActive(ItemStack itemStack) {
|
||||
return isMagnetActive(itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
private boolean isMagnetActive(int damage) {
|
||||
return (damage & 0x01) == 1;
|
||||
}
|
||||
|
||||
public int getMaximumLevel() {
|
||||
return Config.magnetMaxLevel;
|
||||
}
|
||||
|
||||
public int getMagnetLevel(ItemStack itemStack) {
|
||||
return itemStack.getItemDamage() >> 1;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return isMagnetActive(meta) ? this.activeIcon : this.itemIcon;
|
||||
}
|
||||
|
||||
private float getRadius(ItemStack itemStack) {
|
||||
return Config.magnetBaseRange + (Config.magnetLevelMultiplier * getMagnetLevel(itemStack));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack itemStack, int pass) {
|
||||
return isMagnetActive(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
toggleActive(itemStack);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
|
||||
return true;
|
||||
}
|
||||
public void toggleActive(ItemStack itemStack) {
|
||||
itemStack.setItemDamage(itemStack.getItemDamage() ^ 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="Baubles")
|
||||
public BaubleType getBaubleType(ItemStack arg0) {
|
||||
return BaubleType.AMULET;
|
||||
}
|
||||
public boolean isMagnetActive(ItemStack itemStack) {
|
||||
return isMagnetActive(itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if (!isMagnetActive(itemStack)) {
|
||||
toggleActive(itemStack);
|
||||
}
|
||||
}
|
||||
private boolean isMagnetActive(int damage) {
|
||||
return (damage & 0x01) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if (isMagnetActive(itemStack)) {
|
||||
toggleActive(itemStack);
|
||||
}
|
||||
}
|
||||
public int getMaximumLevel() {
|
||||
return Config.magnetMaxLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if (isMagnetActive(itemStack) && entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
World world = entity.worldObj;
|
||||
float radius = getRadius(itemStack) - FUDGE_FACTOR;
|
||||
AxisAlignedBB bounds = player.boundingBox.expand(radius, radius, radius);
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||
bounds.expand(FUDGE_FACTOR, FUDGE_FACTOR, FUDGE_FACTOR);
|
||||
|
||||
if (7 <= getMagnetLevel(itemStack)) {
|
||||
List<EntityArrow> arrows = world.getEntitiesWithinAABB(EntityArrow.class, bounds);
|
||||
|
||||
for (EntityArrow arrow : arrows) {
|
||||
if ((arrow.canBePickedUp == 1 || world.rand.nextFloat() < 0.3f)
|
||||
&& arrow.shootingEntity != entity) {
|
||||
EntityItem replacement = new EntityItem(world, arrow.posX, arrow.posY, arrow.posZ,
|
||||
new ItemStack(Items.arrow));
|
||||
world.spawnEntityInWorld(replacement);
|
||||
}
|
||||
world.removeEntity(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityItem> list = world.getEntitiesWithinAABB(EntityItem.class, bounds);
|
||||
|
||||
for (EntityItem e : list) {
|
||||
if (e.age >= 10) {
|
||||
double x = player.posX - e.posX;
|
||||
double y = player.posY - e.posY - 1.f;
|
||||
double z = player.posZ - e.posZ;
|
||||
|
||||
double length = Math.sqrt(x * x + y * y + z * z) * 2;
|
||||
public int getMagnetLevel(ItemStack itemStack) {
|
||||
return itemStack.getItemDamage() >> 1;
|
||||
}
|
||||
|
||||
if (length < 1.2f)
|
||||
continue;
|
||||
|
||||
x = x / length + player.motionX / 2;
|
||||
y = y / length + player.motionY / 2;
|
||||
z = z / length + player.motionZ / 2;
|
||||
|
||||
e.motionX = x;
|
||||
e.motionY = y;
|
||||
e.motionZ = z;
|
||||
e.isAirBorne = true;
|
||||
|
||||
if (e.isCollidedHorizontally) {
|
||||
e.motionY += 1;
|
||||
}
|
||||
|
||||
if (world.rand.nextFloat() < 0.2f) {
|
||||
float pitch = 0.85f - world.rand.nextFloat() * 3f / 10f;
|
||||
if(!Config.disableMagnetSound)
|
||||
world.playSoundEffect(e.posX, e.posY, e.posZ, "mob.endermen.portal", 0.6f, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private float getRadius(ItemStack itemStack) {
|
||||
return Config.magnetBaseRange + (Config.magnetLevelMultiplier * getMagnetLevel(itemStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public BaubleType getBaubleType(ItemStack arg0) {
|
||||
return BaubleType.AMULET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if (!isMagnetActive(itemStack)) {
|
||||
toggleActive(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if (isMagnetActive(itemStack)) {
|
||||
toggleActive(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if (isMagnetActive(itemStack) && entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
World world = entity.worldObj;
|
||||
float radius = getRadius(itemStack) - FUDGE_FACTOR;
|
||||
AxisAlignedBB bounds = player.boundingBox.expand(radius, radius, radius);
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||
bounds.expand(FUDGE_FACTOR, FUDGE_FACTOR, FUDGE_FACTOR);
|
||||
|
||||
if (7 <= getMagnetLevel(itemStack)) {
|
||||
List<EntityArrow> arrows = world.getEntitiesWithinAABB(EntityArrow.class, bounds);
|
||||
|
||||
for (EntityArrow arrow : arrows) {
|
||||
if ((arrow.canBePickedUp == 1 || world.rand.nextFloat() < 0.3f)
|
||||
&& arrow.shootingEntity != entity) {
|
||||
EntityItem replacement = new EntityItem(
|
||||
world,
|
||||
arrow.posX,
|
||||
arrow.posY,
|
||||
arrow.posZ,
|
||||
new ItemStack(Items.arrow));
|
||||
world.spawnEntityInWorld(replacement);
|
||||
}
|
||||
world.removeEntity(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityItem> list = world.getEntitiesWithinAABB(EntityItem.class, bounds);
|
||||
|
||||
for (EntityItem e : list) {
|
||||
if (e.age >= 10) {
|
||||
double x = player.posX - e.posX;
|
||||
double y = player.posY - e.posY - 1.f;
|
||||
double z = player.posZ - e.posZ;
|
||||
|
||||
double length = Math.sqrt(x * x + y * y + z * z) * 2;
|
||||
|
||||
if (length < 1.2f) continue;
|
||||
|
||||
x = x / length + player.motionX / 2;
|
||||
y = y / length + player.motionY / 2;
|
||||
z = z / length + player.motionZ / 2;
|
||||
|
||||
e.motionX = x;
|
||||
e.motionY = y;
|
||||
e.motionZ = z;
|
||||
e.isAirBorne = true;
|
||||
|
||||
if (e.isCollidedHorizontally) {
|
||||
e.motionY += 1;
|
||||
}
|
||||
|
||||
if (world.rand.nextFloat() < 0.2f) {
|
||||
float pitch = 0.85f - world.rand.nextFloat() * 3f / 10f;
|
||||
if (!Config.disableMagnetSound)
|
||||
world.playSoundEffect(e.posX, e.posY, e.posZ, "mob.endermen.portal", 0.6f, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 200 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user