Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e09f74cb5f | |||
| facc1b4ef4 |
@@ -1,23 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Set up OpenJDK 17
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
java-version: '17'
|
|
||||||
distribution: 'adopt' # You can choose other OpenJDK distributions.
|
|
||||||
- name: Update Build Script (Before Build)
|
|
||||||
run: ./gradlew updateBuildScript
|
|
||||||
- name: Build with Gradle
|
|
||||||
run: ./gradlew build
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: AE2-UEL
|
|
||||||
path: build/libs/*.jar # Make sure this path matches the location of your build artifacts
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
name: 'Lock threads'
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lock:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: dessant/lock-threads@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
issue-lock-inactive-days: '180'
|
||||||
|
pr-lock-inactive-days: '180'
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
# Publishes built jars to distribution platforms
|
|
||||||
name: Publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v[0-9]+.[0-9]+.[0-9]+' # any semver tag, e.g. 1.2.3
|
|
||||||
|
|
||||||
env:
|
|
||||||
# type of release
|
|
||||||
RELEASE_TYPE: "release"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write # needed to create GitHub releases
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Check for Duplicate Tags
|
|
||||||
run: |
|
|
||||||
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
|
|
||||||
echo "Tag already exists. A version bump is required."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '17'
|
|
||||||
|
|
||||||
- name: Build Project
|
|
||||||
uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
|
|
||||||
generate-job-summary: false
|
|
||||||
gradle-home-cache-includes: |
|
|
||||||
caches
|
|
||||||
jdks
|
|
||||||
notifications
|
|
||||||
wrapper
|
|
||||||
|
|
||||||
- name: Publish to GitHub
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
files: "build/libs/*.jar"
|
|
||||||
generate_release_notes: true
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
|
|
||||||
- name: Publish to Maven
|
|
||||||
uses: gradle/gradle-build-action@v2
|
|
||||||
env:
|
|
||||||
MAVEN_USER: "${{secrets.MAVEN_USER}}"
|
|
||||||
MAVEN_PASSWORD: "${{secrets.MAVEN_PASSWORD}}"
|
|
||||||
with:
|
|
||||||
arguments: 'publish --daemon'
|
|
||||||
generate-job-summary: false
|
|
||||||
gradle-home-cache-includes: |
|
|
||||||
caches
|
|
||||||
jdks
|
|
||||||
notifications
|
|
||||||
wrapper
|
|
||||||
|
|
||||||
- name: Publish to Curseforge
|
|
||||||
uses: gradle/gradle-build-action@v2
|
|
||||||
env:
|
|
||||||
CURSEFORGE_API_KEY: "${{secrets.CURSEFORGE_API_KEY}}"
|
|
||||||
CURSEFORGE_PROJECT_ID: "${{secrets.CURSEFORGE_PROJECT_ID}}"
|
|
||||||
RELEASE_TYPE: "${{env.RELEASE_TYPE}}"
|
|
||||||
with:
|
|
||||||
arguments: 'curseforge --daemon'
|
|
||||||
generate-job-summary: false
|
|
||||||
gradle-home-cache-includes: |
|
|
||||||
caches
|
|
||||||
jdks
|
|
||||||
notifications
|
|
||||||
wrapper
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# Updates the Gradle Cache when relevant files change
|
|
||||||
name: Update Gradle Cache
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
- "gradle**" # covers gradle folder, gradle.properties, gradlew
|
|
||||||
- "build.gradle*"
|
|
||||||
- "settings.gradle*"
|
|
||||||
- "src/main/resources/*_at.cfg" # access transformers
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Update_Cache:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '17'
|
|
||||||
|
|
||||||
- name: Update Cache
|
|
||||||
uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: 'test --build-cache --no-daemon' # disable daemon since only one gradle operation will happen
|
|
||||||
generate-job-summary: false
|
|
||||||
gradle-home-cache-includes: |
|
|
||||||
caches
|
|
||||||
jdks
|
|
||||||
notifications
|
|
||||||
wrapper
|
|
||||||
cache-write-only: true
|
|
||||||
+24
-76
@@ -1,83 +1,31 @@
|
|||||||
.nopublish
|
# exclude all
|
||||||
|
/*
|
||||||
|
|
||||||
### Windows ###
|
# include important folders
|
||||||
|
# need gradle
|
||||||
|
!gradle/
|
||||||
|
!gradlew
|
||||||
|
!gradlew.bat
|
||||||
|
!build.gradle
|
||||||
|
!gradle.properties
|
||||||
|
!.travis.yml
|
||||||
|
|
||||||
thumbs.db
|
# include markdowns
|
||||||
*.db
|
!README.md
|
||||||
|
!LICENSE
|
||||||
|
|
||||||
### Java ###
|
# include sourcecode
|
||||||
|
!src/
|
||||||
|
|
||||||
*.class
|
# include git important files
|
||||||
|
!.gitmodules
|
||||||
|
!.gitignore
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
# code format to reduce noise in git commits
|
||||||
.mtj.tmp/
|
!codeformat/
|
||||||
|
|
||||||
# Package Files #
|
# Github specific files and directories
|
||||||
*.war
|
!.github/
|
||||||
*.ear
|
|
||||||
*.txt
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
# Explicit ignores
|
||||||
hs_err_pid*
|
Thumbs.db
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
|
|
||||||
*.pydevproject
|
|
||||||
.metadata
|
|
||||||
.gradle
|
|
||||||
bin/
|
|
||||||
tmp/
|
|
||||||
*.tmp
|
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*~.nib
|
|
||||||
local.properties
|
|
||||||
.settings/
|
|
||||||
.loadpath
|
|
||||||
/eclipse
|
|
||||||
|
|
||||||
# Eclipse Core
|
|
||||||
.project
|
|
||||||
|
|
||||||
# External tool builders
|
|
||||||
.externalToolBuilders/
|
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
|
||||||
*.launch
|
|
||||||
|
|
||||||
# CDT-specific
|
|
||||||
.cproject
|
|
||||||
|
|
||||||
# JDT-specific (Eclipse Java Development Tools)
|
|
||||||
.classpath
|
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
|
||||||
.factorypath
|
|
||||||
|
|
||||||
# PDT-specific
|
|
||||||
.buildpath
|
|
||||||
|
|
||||||
# sbteclipse plugin
|
|
||||||
.target
|
|
||||||
|
|
||||||
# TeXlipse plugin
|
|
||||||
.texlipse
|
|
||||||
|
|
||||||
### Intellij IDEA ###
|
|
||||||
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
.idea/
|
|
||||||
.idea_modules/
|
|
||||||
/classes/
|
|
||||||
/out/
|
|
||||||
/build/
|
|
||||||
|
|
||||||
# Linux
|
|
||||||
*~
|
|
||||||
|
|
||||||
run/
|
|
||||||
|
|
||||||
logs/
|
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
sudo: required
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- oraclejdk8
|
||||||
|
- openjdk8
|
||||||
|
|
||||||
|
before_cache:
|
||||||
|
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||||
|
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||||
|
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json
|
||||||
|
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag
|
||||||
|
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
|
||||||
|
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
|
||||||
|
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- '$HOME/.m2/repository'
|
||||||
|
- '$HOME/.sonar/cache'
|
||||||
|
- '$HOME/.gradle/wrapper'
|
||||||
|
- '$HOME/.gradle/caches'
|
||||||
|
|
||||||
|
addons:
|
||||||
|
sonarcloud:
|
||||||
|
organization: "appliedenergistics"
|
||||||
|
|
||||||
|
install: "./gradlew setupCIWorkspace"
|
||||||
|
script:
|
||||||
|
- "./gradlew build"
|
||||||
|
- "./gradlew test"
|
||||||
|
- "./gradlew sonarqube"
|
||||||
@@ -1,27 +1,17 @@
|
|||||||
# Applied Energistics 2 Unofficial Extended Life
|
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
|
||||||
|
|
||||||
[](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [](https://github.com/AE2-UEL/Applied-Energistics-2/issues) [](https://github.com/AE2-UEL/Applied-Energistics-2/pulls)
|
See https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory branch for commits
|
||||||
|
and
|
||||||
|
https://github.com/PrototypeTrousers/Applied-Energistics-2/releases for the compiled jars.
|
||||||
|
|
||||||
---
|
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
A maintained fork of a Mod about Matter, Energy and using them to conquer the world.
|
A Mod about Matter, Energy and using them to conquer the world..
|
||||||
|
|
||||||
This project started as a fork of [Applied Energistics 2](https://github.com/AppliedEnergistics/Applied-Energistics-2) by [PrototypeTrousers](https://github.com/PrototypeTrousers), initially addressing issues related to the [Nomifactory](https://www.curseforge.com/minecraft/modpacks/nomifactory) modpack. It is now being maintained by the [AE2 Unofficial Extended Life Team](https://github.com/AE2-UEL).
|
|
||||||
|
|
||||||
See [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
|
|
||||||
|
|
||||||
## RecipeStages
|
|
||||||
|
|
||||||
You need to add the following into a CraftTweaker script:
|
|
||||||
```
|
|
||||||
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
|
|
||||||
```
|
|
||||||
|
|
||||||
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Not sure why you would do that, but we support that nonetheless!
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
* Applied Energistics 2 API
|
* Applied Energistics 2 API
|
||||||
- (c) 2013 - 2018 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](http://opensource.org/licenses/MIT)
|
- [](http://opensource.org/licenses/MIT)
|
||||||
@@ -36,9 +26,8 @@ The second argument allows you to customize which stages exactly you want to be
|
|||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Special thanks to:
|
Thanks to
|
||||||
|
|
||||||
* PrototypeTrousers for the initial fork
|
|
||||||
* Notch et al for Minecraft
|
* Notch et al for Minecraft
|
||||||
* Lex et al for MinecraftForge
|
* Lex et al for MinecraftForge
|
||||||
* AlgorithmX2 for AppliedEnergistics2
|
* AlgorithmX2 for AppliedEnergistics2
|
||||||
|
|||||||
+84
-1190
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
|||||||
//file:noinspection DependencyNotationArgument
|
|
||||||
// TODO remove when fixed in RFG ^
|
|
||||||
/*
|
|
||||||
* Add your dependencies here. Common configurations:
|
|
||||||
* - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod.
|
|
||||||
* Available at compiletime and runtime for your environment.
|
|
||||||
*
|
|
||||||
* - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod.
|
|
||||||
* Available at compiletime but not runtime for your environment.
|
|
||||||
*
|
|
||||||
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
|
|
||||||
*
|
|
||||||
* - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main
|
|
||||||
*
|
|
||||||
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed.
|
|
||||||
*
|
|
||||||
* To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")'
|
|
||||||
* Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757")
|
|
||||||
*
|
|
||||||
* To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md
|
|
||||||
*
|
|
||||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
|
||||||
*/
|
|
||||||
dependencies {
|
|
||||||
|
|
||||||
// Mods always in-game
|
|
||||||
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261") // GTCEu
|
|
||||||
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
|
|
||||||
implementation rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles
|
|
||||||
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175") // IC2
|
|
||||||
implementation rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry
|
|
||||||
|
|
||||||
// Mods only in code by default
|
|
||||||
compileOnly "curse.maven:chisel-235279:2915375"
|
|
||||||
compileOnly "curse.maven:hwyla-253449:2568751"
|
|
||||||
compileOnly "curse.maven:recipe-stages-280554:3405072"
|
|
||||||
compileOnly "curse.maven:item-stages-280316:2696769"
|
|
||||||
compileOnly "curse.maven:game-stages-268655:2951844"
|
|
||||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:1.0.63"
|
|
||||||
compileOnly "curse.maven:CoFHCore-69162:2920433"
|
|
||||||
compileOnly "CraftTweaker2:CraftTweaker2-API:4.1.20.684"
|
|
||||||
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
|
||||||
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
|
|
||||||
compileOnly rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
|
|
||||||
compileOnly rfg.deobf("curse.maven:actually-additions-228404:3117927") // ActuallyAdditions r152
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
injectedTags.put('AEVERSION', aeversion)
|
|
||||||
injectedTags.put('AECHANNEL', aechannel)
|
|
||||||
injectedTags.put('AEBUILD', aebuild)
|
|
||||||
}
|
|
||||||
+29
-177
@@ -1,184 +1,36 @@
|
|||||||
modName = AE2 Unofficial Extended Life
|
|
||||||
|
|
||||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
|
||||||
modId = appliedenergistics2
|
|
||||||
|
|
||||||
modGroup = appeng
|
|
||||||
|
|
||||||
# Version of your mod.
|
|
||||||
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
|
|
||||||
modVersion =
|
|
||||||
|
|
||||||
# AE2 Specific Version Settings
|
|
||||||
aeversion=rv6
|
aeversion=rv6
|
||||||
aechannel=stable
|
aechannel=stable
|
||||||
aebuild=7
|
aebuild=7
|
||||||
|
aegroup=appeng
|
||||||
|
aebasename=appliedenergistics2
|
||||||
|
trousers=omni-fixes-v47
|
||||||
|
|
||||||
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
|
#########################################################
|
||||||
includeMCVersionJar = false
|
# Versions #
|
||||||
|
#########################################################
|
||||||
|
minecraft_version=1.12.2
|
||||||
|
mcp_mappings=snapshot_20171003
|
||||||
|
forge_version=14.23.5.2847
|
||||||
|
|
||||||
# The name of your jar when you produce builds, not including any versioning info
|
#########################################################
|
||||||
modArchivesBaseName = ae2-uel
|
# Installable #
|
||||||
|
#########################################################
|
||||||
|
hwyla_version=1.8.26-B41_1.12.2
|
||||||
|
|
||||||
# Will update your build.gradle automatically whenever an update is available
|
#########################################################
|
||||||
autoUpdateBuildScript = false
|
# Provided APIs #
|
||||||
|
#########################################################
|
||||||
|
jei_version=4.16.1.302
|
||||||
|
tesla_version=1.0.63
|
||||||
|
ic2_version=2.8.73-ex112
|
||||||
|
top_version=1.12-1.4.23-16
|
||||||
|
cofhcore_version=1.12.2-4.5.2.19
|
||||||
|
crafttweaker_version=4.1.8.9
|
||||||
|
inventorytweaks_version=1.63
|
||||||
|
ctm_version=MC1.12.2-0.3.1.16
|
||||||
|
|
||||||
minecraftVersion = 1.12.2
|
#########################################################
|
||||||
|
# Deployment #
|
||||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
#########################################################
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
website_version=1.12.2
|
||||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
curse_versions=1.12.2
|
||||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
|
||||||
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
|
|
||||||
developmentEnvironmentUserName = Developer
|
|
||||||
|
|
||||||
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
|
||||||
# See https://github.com/bsideup/jabel for details on how this works.
|
|
||||||
# Using this requires that you use a Java 17 JDK for development.
|
|
||||||
enableModernJavaSyntax = true
|
|
||||||
|
|
||||||
# Generate a class with String fields for the mod id, name and version named with the fields below
|
|
||||||
generateGradleTokenClass = appeng.Tags
|
|
||||||
gradleTokenModId = MODID
|
|
||||||
gradleTokenModName = MODNAME
|
|
||||||
gradleTokenVersion = VERSION
|
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
|
||||||
# leave this property empty.
|
|
||||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
|
||||||
apiPackage = api
|
|
||||||
|
|
||||||
# If you want to keep your API code in src/api instead of src/main
|
|
||||||
useSrcApiPath = true
|
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
|
|
||||||
# There can be multiple files in a comma-separated list.
|
|
||||||
# Example value: mymodid_at.cfg,jei_at.cfg
|
|
||||||
accessTransformersFile = appliedenergistics2_at.cfg
|
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
|
||||||
usesMixins = false
|
|
||||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
|
||||||
mixinsPackage =
|
|
||||||
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
|
|
||||||
generateMixinConfig = false
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
|
||||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
|
||||||
coreModClass = core.AE2ELCore
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
|
|
||||||
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
|
||||||
containsMixinsAndOrCoreModOnly = false
|
|
||||||
|
|
||||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
|
||||||
forceEnableMixins = false
|
|
||||||
|
|
||||||
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
|
|
||||||
# diff to see exactly what your ASM or Mixins are changing in the target file.
|
|
||||||
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
|
|
||||||
enableCoreModDebug = false
|
|
||||||
|
|
||||||
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
|
|
||||||
includeWellKnownRepositories = true
|
|
||||||
|
|
||||||
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
|
|
||||||
# be available at compiletime and runtime for your mod (in-game and in-code).
|
|
||||||
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
|
|
||||||
includeCommonDevEnvMods = true
|
|
||||||
|
|
||||||
|
|
||||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
|
||||||
# responsibility check the licence and request permission for distribution, if required.
|
|
||||||
usesShadowedDependencies = false
|
|
||||||
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
|
|
||||||
# their own classes, making the minimization unreliable.
|
|
||||||
minimizeShadowedDependencies = true
|
|
||||||
# If disabled, won't rename the shadowed classes.
|
|
||||||
relocateShadowedDependencies = true
|
|
||||||
|
|
||||||
# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
|
|
||||||
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
|
|
||||||
separateRunDirectories = false
|
|
||||||
|
|
||||||
# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
|
|
||||||
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
|
|
||||||
versionDisplayFormat = $MOD_NAME \u2212 $VERSION
|
|
||||||
|
|
||||||
# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.
|
|
||||||
|
|
||||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
|
||||||
# Leave this empty if you don't want to publish on Modrinth.
|
|
||||||
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
|
|
||||||
modrinthProjectId =
|
|
||||||
|
|
||||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
|
||||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
|
||||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
|
||||||
# type can be one of [project, version],
|
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
|
||||||
# Example: required-project:jei;optional-project:top;incompatible-project:gregtech
|
|
||||||
modrinthRelations =
|
|
||||||
|
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens.
|
|
||||||
|
|
||||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
|
||||||
# Leave this empty if you don't want to publish on CurseForge.
|
|
||||||
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
|
|
||||||
curseForgeProjectId =
|
|
||||||
|
|
||||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
|
||||||
# Syntax: type1:name1;type2:name2;...
|
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
|
||||||
# and the name is the CurseForge project slug of the other mod.
|
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
|
||||||
curseForgeRelations =
|
|
||||||
|
|
||||||
# This project's release type on CurseForge and/or Modrinth
|
|
||||||
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
|
|
||||||
# Allowed types: release, beta, alpha
|
|
||||||
releaseType = release
|
|
||||||
|
|
||||||
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
|
|
||||||
# commits since the last tagged release.
|
|
||||||
generateDefaultChangelog = false
|
|
||||||
|
|
||||||
# Prevent the source code from being published
|
|
||||||
noPublishedSources = false
|
|
||||||
|
|
||||||
|
|
||||||
# Publish to a custom maven location. Follows a few rules:
|
|
||||||
# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group'
|
|
||||||
# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name'
|
|
||||||
# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion'
|
|
||||||
# For maven credentials:
|
|
||||||
# Username is set with the 'MAVEN_USER' environment variable, default to "NONE"
|
|
||||||
# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE"
|
|
||||||
customMavenPublishUrl = https://maven.gtceu.com
|
|
||||||
|
|
||||||
# The group for maven artifacts. Defaults to the 'project.modGroup' until the last '.' (if any).
|
|
||||||
# So 'mymod' becomes 'mymod' and 'com.myname.mymodid' 'becomes com.myname'
|
|
||||||
mavenArtifactGroup =
|
|
||||||
|
|
||||||
# Enable spotless checks
|
|
||||||
# Enforces code formatting on your source code
|
|
||||||
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
|
|
||||||
# to format your code. However, you can create your own version of these files and place them in your project's
|
|
||||||
# root directory to apply your own formatting options instead.
|
|
||||||
enableSpotless = false
|
|
||||||
|
|
||||||
# Enable JUnit testing platform used for testing your code.
|
|
||||||
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
|
|
||||||
enableJUnit = true
|
|
||||||
|
|
||||||
# Deployment debug setting
|
|
||||||
# Uncomment this to test deployments to CurseForge and Modrinth
|
|
||||||
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
|
|
||||||
deploymentDebug = false
|
|
||||||
|
|
||||||
|
|
||||||
# Gradle Settings
|
|
||||||
# Effectively applies the '--stacktrace' flag by default
|
|
||||||
org.gradle.logging.stacktrace = all
|
|
||||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
|
||||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
|
||||||
org.gradle.jvmargs = -Xmx3G
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Suppresses warnings/errors when building javadocs
|
||||||
|
allprojects {
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
options.charSet = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocs(type: Javadoc) {
|
||||||
|
source = sourceSets.api.java
|
||||||
|
include "appeng/api/**"
|
||||||
|
|
||||||
|
// Due to ForgeGradle having to be a special snowflake,
|
||||||
|
// we have to add some custom configurations to the normal compile configuration and hope it does not break.
|
||||||
|
classpath = configurations.compile + configurations.forgeGradleMc + configurations.forgeGradleMcDeps
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadocs) {
|
||||||
|
from javadoc.destinationDir
|
||||||
|
|
||||||
|
classifier = 'javadoc'
|
||||||
|
}
|
||||||
|
|
||||||
|
task apiJar(type: Jar) {
|
||||||
|
from sourceSets.api.java
|
||||||
|
include "appeng/api/**"
|
||||||
|
|
||||||
|
from sourceSets.api.output
|
||||||
|
include "appeng/api/**"
|
||||||
|
|
||||||
|
classifier = 'api'
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourceJar(type: Jar, overwrite: true) {
|
||||||
|
from sourceSets.api.allSource
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives apiJar
|
||||||
|
archives javadocJar
|
||||||
|
archives sourceJar
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name "Mobius"
|
||||||
|
url "http://mobiusstrip.eu/maven"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "JEI repo"
|
||||||
|
url "http://dvs1.progwml6.com/files/maven"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "Tesla repo"
|
||||||
|
url "http://maven.mcmoddev.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name "Ellpeck"
|
||||||
|
url "https://maven.ellpeck.de"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "IC2 repo"
|
||||||
|
url = "http://maven.ic2.player.to"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "CoFH Maven"
|
||||||
|
url = "http://maven.covers1624.net"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven { // TheOneProbe
|
||||||
|
name 'tterrag maven'
|
||||||
|
url "http://maven.tterrag.com/"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven { // McJtyLib
|
||||||
|
name 'mcjty'
|
||||||
|
url "http://maven.k-4u.nl/"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven { // CraftTweaker
|
||||||
|
name 'jared maven'
|
||||||
|
url "http://maven.blamejared.com/"
|
||||||
|
}
|
||||||
|
|
||||||
|
//maven { // modmaven, maven proxy
|
||||||
|
// name 'modmaven'
|
||||||
|
// url "https://modmaven.k-4u.nl/"
|
||||||
|
//}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "CurseForge"
|
||||||
|
url = "https://minecraft.curseforge.com/api/maven/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
mods
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||||
|
|
||||||
|
// installable runtime dependencies
|
||||||
|
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
|
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||||
|
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||||
|
|
||||||
|
// compile against provided APIs
|
||||||
|
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||||
|
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
|
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||||
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
|
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||||
|
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||||
|
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||||
|
compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
|
||||||
|
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
||||||
|
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
||||||
|
|
||||||
|
// at runtime, use the full JEI jar
|
||||||
|
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|
||||||
|
// unit test dependencies
|
||||||
|
testCompile "junit:junit:4.12"
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = "2.14"
|
||||||
|
}
|
||||||
|
|
||||||
|
// HWYLA
|
||||||
|
task installHwyla(type: Copy, dependsOn: "deinstallHwyla") {
|
||||||
|
from { configurations.mods }
|
||||||
|
include "**/*Hwyla*.jar"
|
||||||
|
into file(minecraft.runDir + "/mods")
|
||||||
|
}
|
||||||
|
|
||||||
|
task deinstallHwyla(type: Delete) {
|
||||||
|
delete fileTree(dir: minecraft.runDir + "/mods", include: "*Hwyla*.jar")
|
||||||
|
}
|
||||||
|
|
||||||
|
// IC2
|
||||||
|
task installIC2(type: Copy, dependsOn: "deinstallIC2") {
|
||||||
|
from { configurations.mods }
|
||||||
|
include "**/*industrialcraft-2*.jar"
|
||||||
|
into file(minecraft.runDir + "/mods")
|
||||||
|
}
|
||||||
|
|
||||||
|
task deinstallIC2(type: Delete) {
|
||||||
|
delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
|
||||||
|
}
|
||||||
|
|
||||||
|
// TOP
|
||||||
|
task installTop(type: Copy, dependsOn: ["deinstallTop"]) {
|
||||||
|
from { configurations.mods }
|
||||||
|
include "**/*TheOneProbe*.jar"
|
||||||
|
into file(minecraft.runDir + "/mods")
|
||||||
|
}
|
||||||
|
|
||||||
|
task deinstallTop(type: Delete) {
|
||||||
|
delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
|
||||||
|
}
|
||||||
|
|
||||||
Vendored
BIN
Binary file not shown.
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
|
||||||
|
|||||||
@@ -1,126 +1,78 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
##
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
## Gradle start up script for UN*X
|
||||||
#
|
##
|
||||||
# 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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
app_path=$0
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
# Need this for daisy-chained symlinks.
|
while [ -h "$PRG" ] ; do
|
||||||
while
|
ls=`ls -ld "$PRG"`
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
[ -h "$app_path" ]
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
do
|
PRG="$link"
|
||||||
ls=$( ls -ld "$app_path" )
|
else
|
||||||
link=${ls#*' -> '}
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
case $link in #(
|
fi
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
# This is normally unused
|
APP_NAME="Gradle"
|
||||||
# shellcheck disable=SC2034
|
APP_BASE_NAME=`basename "$0"`
|
||||||
APP_BASE_NAME=${0##*/}
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD="maximum"
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
} >&2
|
}
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
} >&2
|
}
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "$( uname )" in #(
|
case "`uname`" in
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
CYGWIN* )
|
||||||
Darwin* ) darwin=true ;; #(
|
cygwin=true
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
;;
|
||||||
NONSTOP* ) nonstop=true ;;
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
else
|
else
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -129,120 +81,92 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD="java"
|
||||||
if ! command -v java >/dev/null 2>&1
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
case $MAX_FD in #(
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
max*)
|
if [ $? -eq 0 ] ; then
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
# shellcheck disable=SC3045
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
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=SC3045
|
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# 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" )
|
|
||||||
|
|
||||||
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
|
fi
|
||||||
# Roll the args list around exactly as many times as the number of
|
ulimit -n $MAX_FD
|
||||||
# args, so each arg winds up back in the position where it started, but
|
if [ $? -ne 0 ] ; then
|
||||||
# possibly modified.
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
#
|
fi
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
else
|
||||||
# changing the positional parameters here affects neither the number of
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
# iterations, nor the values presented in `arg`.
|
fi
|
||||||
shift # remove old arg
|
fi
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
|
# 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, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; 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
|
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" ;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
cd "$(dirname "$0")"
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
|
||||||
|
|
||||||
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
|
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" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
Vendored
+24
-32
@@ -1,20 +1,4 @@
|
|||||||
@rem
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,23 +9,19 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
@rem This is normally unused
|
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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"
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -55,7 +35,7 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
@@ -65,26 +45,38 @@ echo location of your Java installation.
|
|||||||
|
|
||||||
goto fail
|
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
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
set EXIT_CODE=%ERRORLEVEL%
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
exit /b 1
|
||||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
||||||
exit /b %EXIT_CODE%
|
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
// RetroFuturaGradle
|
|
||||||
name 'GTNH Maven'
|
|
||||||
url 'https://nexus.gtnewhorizons.com/repository/public/'
|
|
||||||
//noinspection GroovyAssignabilityCheck
|
|
||||||
mavenContent {
|
|
||||||
includeGroup 'com.gtnewhorizons'
|
|
||||||
includeGroup 'com.gtnewhorizons.retrofuturagradle'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gradlePluginPortal()
|
|
||||||
mavenCentral()
|
|
||||||
mavenLocal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id 'com.diffplug.blowdryerSetup' version '1.7.0'
|
|
||||||
// Automatic toolchain provisioning
|
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
blowdryerSetup {
|
|
||||||
repoSubfolder 'spotless'
|
|
||||||
github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.7'
|
|
||||||
}
|
|
||||||
|
|
||||||
rootProject.name = rootProject.projectDir.getName()
|
|
||||||
@@ -38,11 +38,8 @@ public enum ActionItems
|
|||||||
DIVIDE_BY_THREE,
|
DIVIDE_BY_THREE,
|
||||||
DECREASE_BY_ONE,
|
DECREASE_BY_ONE,
|
||||||
MAX_COUNT,
|
MAX_COUNT,
|
||||||
MOLECULAR_ASSEMBLERS_ON,
|
FREE_MOLECULAR_SLOT_SHORTCUT,
|
||||||
MOLECULAR_ASSEMBLERS_OFF,
|
|
||||||
TOGGLE_SHOW_FULL_INTERFACES_ON,
|
TOGGLE_SHOW_FULL_INTERFACES_ON,
|
||||||
TOGGLE_SHOW_FULL_INTERFACES_OFF,
|
TOGGLE_SHOW_FULL_INTERFACES_OFF,
|
||||||
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON,
|
|
||||||
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF,
|
|
||||||
HIGHLIGHT_INTERFACE
|
HIGHLIGHT_INTERFACE
|
||||||
}
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package appeng.api.config;
|
|
||||||
|
|
||||||
public enum LockCraftingMode {
|
|
||||||
/**
|
|
||||||
* Crafting is never locked.
|
|
||||||
*/
|
|
||||||
NONE,
|
|
||||||
/**
|
|
||||||
* After pushing a pattern to an adjacent machine, the interface will not accept further crafts until a
|
|
||||||
* redstone pulse is received.
|
|
||||||
*/
|
|
||||||
LOCK_UNTIL_PULSE,
|
|
||||||
/**
|
|
||||||
* Crafting is locked while the interface is receiving a redstone signal.
|
|
||||||
*/
|
|
||||||
LOCK_WHILE_HIGH,
|
|
||||||
/**
|
|
||||||
* Crafting is locked while the interface is not receiving a redstone signal.
|
|
||||||
*/
|
|
||||||
LOCK_WHILE_LOW,
|
|
||||||
/**
|
|
||||||
* After pushing a pattern to an adjacent machine, the interface will not accept further crafts until the
|
|
||||||
* primary pattern result is returned to the network through the interface.
|
|
||||||
*/
|
|
||||||
LOCK_UNTIL_RESULT
|
|
||||||
}
|
|
||||||
@@ -28,8 +28,7 @@ public enum PowerUnits
|
|||||||
{
|
{
|
||||||
AE( "gui.appliedenergistics2.units.appliedenergstics" ), // Native Units - AE Energy
|
AE( "gui.appliedenergistics2.units.appliedenergstics" ), // Native Units - AE Energy
|
||||||
EU( "gui.appliedenergistics2.units.ic2" ), // IndustrialCraft 2 - Energy Units
|
EU( "gui.appliedenergistics2.units.ic2" ), // IndustrialCraft 2 - Energy Units
|
||||||
RF( "gui.appliedenergistics2.units.rf" ), // RF - Redstone Flux
|
RF( "gui.appliedenergistics2.units.rf" ); // RF - Redstone Flux
|
||||||
GTEU( "gui.appliedenergistics2.units.gteu" ); // RF - Redstone Flux
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unlocalized name for the power unit.
|
* unlocalized name for the power unit.
|
||||||
@@ -47,13 +46,14 @@ public enum PowerUnits
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* do power conversion using AE's conversion rates.
|
* do power conversion using AE's conversion rates.
|
||||||
* <p>
|
*
|
||||||
* Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 );
|
* Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 );
|
||||||
* <p>
|
*
|
||||||
* will normally returns 64, as it will convert the EU, to AE with AE's power settings.
|
* will normally returns 64, as it will convert the EU, to AE with AE's power settings.
|
||||||
*
|
*
|
||||||
* @param target target power unit
|
* @param target target power unit
|
||||||
* @param value value
|
* @param value value
|
||||||
|
*
|
||||||
* @return value converted to target units, from this units.
|
* @return value converted to target units, from this units.
|
||||||
*/
|
*/
|
||||||
public double convertTo( final PowerUnits target, final double value )
|
public double convertTo( final PowerUnits target, final double value )
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ public enum Settings
|
|||||||
|
|
||||||
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
||||||
|
|
||||||
UNLOCK(EnumSet.allOf(LockCraftingMode.class)),
|
|
||||||
|
|
||||||
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
||||||
@@ -83,11 +81,7 @@ public enum Settings
|
|||||||
|
|
||||||
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) ),
|
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
|
||||||
|
|
||||||
STICKY_MODE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final EnumSet<? extends Enum<?>> values;
|
private final EnumSet<? extends Enum<?>> values;
|
||||||
|
|
||||||
|
|||||||
@@ -24,65 +24,15 @@
|
|||||||
package appeng.api.config;
|
package appeng.api.config;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
public enum TunnelType
|
||||||
import appeng.api.definitions.IItemDefinition;
|
{
|
||||||
import appeng.api.definitions.IParts;
|
ME, // Network Tunnel
|
||||||
import appeng.api.parts.IPartItem;
|
IC2_POWER, // EU Tunnel
|
||||||
import com.google.common.base.Preconditions;
|
FE_POWER, // Forge Energy tunnel
|
||||||
import net.minecraft.item.ItemStack;
|
REDSTONE, // Redstone Tunnel
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
FLUID, // Fluid Tunnel
|
||||||
|
ITEM, // Item Tunnel
|
||||||
import javax.annotation.Nonnull;
|
LIGHT, // Light Tunnel
|
||||||
import java.util.function.Function;
|
BUNDLED_REDSTONE, // Bundled Redstone Tunnel
|
||||||
import java.util.function.Supplier;
|
COMPUTER_MESSAGE // Computer Message Tunnel
|
||||||
|
|
||||||
public enum TunnelType {
|
|
||||||
ME(tryPartStack(IParts::p2PTunnelME)),
|
|
||||||
IC2_POWER(tryPartStack(IParts::p2PTunnelEU)),
|
|
||||||
FE_POWER(tryPartStack(IParts::p2PTunnelFE)),
|
|
||||||
GTEU_POWER(tryPartStack(IParts::p2PTunnelGTEU)),
|
|
||||||
REDSTONE(tryPartStack(IParts::p2PTunnelRedstone)),
|
|
||||||
FLUID(tryPartStack(IParts::p2PTunnelFE)),
|
|
||||||
ITEM(tryPartStack(IParts::p2PTunnelItems)),
|
|
||||||
LIGHT(tryPartStack(IParts::p2PTunnelLight));
|
|
||||||
|
|
||||||
private ItemStack partItemStack;
|
|
||||||
private Supplier<ItemStack> partItemStackSupplier;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
TunnelType() {
|
|
||||||
this.partItemStack = ItemStack.EMPTY;
|
|
||||||
this.partItemStackSupplier = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Public facing.
|
|
||||||
TunnelType(ItemStack partItemStack) {
|
|
||||||
this.partItemStack = partItemStack;
|
|
||||||
this.partItemStackSupplier = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Work around things instantiating this class too early.
|
|
||||||
TunnelType(Supplier<ItemStack> supplier) {
|
|
||||||
this.partItemStack = null;
|
|
||||||
this.partItemStackSupplier = supplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Supplier<ItemStack> tryPartStack(Function<IParts, IItemDefinition> supplier) {
|
|
||||||
return () -> supplier.apply(AEApi.instance().definitions().parts()).maybeStack(1).orElse(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TunnelType registerTunnelType(@Nonnull String name, @Nonnull ItemStack partItemStack) {
|
|
||||||
Preconditions.checkArgument(partItemStack.isEmpty() || partItemStack.getItem() instanceof IPartItem<?>,
|
|
||||||
"Part item must be an instance of IPartItem");
|
|
||||||
|
|
||||||
return EnumHelper.addEnum(TunnelType.class, name, new Class[]{ItemStack.class}, partItemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getPartItemStack() {
|
|
||||||
if (this.partItemStackSupplier != null) {
|
|
||||||
this.partItemStack = this.partItemStackSupplier.get();
|
|
||||||
this.partItemStackSupplier = null;
|
|
||||||
}
|
|
||||||
return partItemStack;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,62 +32,66 @@ import net.minecraft.item.ItemStack;
|
|||||||
import appeng.api.definitions.IItemDefinition;
|
import appeng.api.definitions.IItemDefinition;
|
||||||
|
|
||||||
|
|
||||||
public enum Upgrades {
|
public enum Upgrades
|
||||||
/**
|
{
|
||||||
* Gold Tier Upgrades.
|
/**
|
||||||
*/
|
* Gold Tier Upgrades.
|
||||||
CAPACITY(0),
|
*/
|
||||||
REDSTONE(0),
|
CAPACITY( 0 ),
|
||||||
CRAFTING(0),
|
REDSTONE( 0 ),
|
||||||
MAGNET(0),
|
CRAFTING( 0 ),
|
||||||
STICKY(0),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diamond Tier Upgrades.
|
* Diamond Tier Upgrades.
|
||||||
*/
|
*/
|
||||||
FUZZY(1),
|
FUZZY( 1 ),
|
||||||
SPEED(1),
|
SPEED( 1 ),
|
||||||
INVERTER(1),
|
INVERTER( 1 ),
|
||||||
PATTERN_EXPANSION(1),
|
PATTERN_EXPANSION(1);
|
||||||
QUANTUM_LINK(1);
|
|
||||||
|
|
||||||
private final int tier;
|
private final int tier;
|
||||||
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
|
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
|
||||||
|
|
||||||
Upgrades(final int tier) {
|
Upgrades( final int tier )
|
||||||
this.tier = tier;
|
{
|
||||||
}
|
this.tier = tier;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return list of Items/Blocks that support this upgrade, and how many it supports.
|
* @return list of Items/Blocks that support this upgrade, and how many it supports.
|
||||||
*/
|
*/
|
||||||
public Map<ItemStack, Integer> getSupported() {
|
public Map<ItemStack, Integer> getSupported()
|
||||||
return this.supportedMax;
|
{
|
||||||
}
|
return this.supportedMax;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a specific amount of this upgrade into a specific machine
|
* Registers a specific amount of this upgrade into a specific machine
|
||||||
*
|
*
|
||||||
* @param item machine in which this upgrade can be installed
|
* @param item machine in which this upgrade can be installed
|
||||||
* @param maxSupported amount how many upgrades can be installed
|
* @param maxSupported amount how many upgrades can be installed
|
||||||
*/
|
*/
|
||||||
public void registerItem(final IItemDefinition item, final int maxSupported) {
|
public void registerItem( final IItemDefinition item, final int maxSupported )
|
||||||
item.maybeStack(1).ifPresent(is -> this.registerItem(is, maxSupported));
|
{
|
||||||
}
|
item.maybeStack( 1 ).ifPresent( is -> this.registerItem( is, maxSupported ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a specific amount of this upgrade into a specific machine
|
* Registers a specific amount of this upgrade into a specific machine
|
||||||
*
|
*
|
||||||
* @param stack machine in which this upgrade can be installed
|
* @param stack machine in which this upgrade can be installed
|
||||||
* @param maxSupported amount how many upgrades can be installed
|
* @param maxSupported amount how many upgrades can be installed
|
||||||
*/
|
*/
|
||||||
public void registerItem(final ItemStack stack, final int maxSupported) {
|
public void registerItem( final ItemStack stack, final int maxSupported )
|
||||||
if (stack != null) {
|
{
|
||||||
this.supportedMax.put(stack, maxSupported);
|
if( stack != null )
|
||||||
}
|
{
|
||||||
}
|
this.supportedMax.put( stack, maxSupported );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getTier() {
|
public int getTier()
|
||||||
return this.tier;
|
{
|
||||||
}
|
return this.tier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ import appeng.api.util.AEColoredItemDefinition;
|
|||||||
/**
|
/**
|
||||||
* A list of all items in AE
|
* A list of all items in AE
|
||||||
*/
|
*/
|
||||||
public interface IItems {
|
public interface IItems
|
||||||
|
{
|
||||||
IItemDefinition certusQuartzAxe();
|
IItemDefinition certusQuartzAxe();
|
||||||
|
|
||||||
IItemDefinition certusQuartzHoe();
|
IItemDefinition certusQuartzHoe();
|
||||||
@@ -63,14 +64,6 @@ public interface IItems {
|
|||||||
|
|
||||||
IItemDefinition wirelessTerminal();
|
IItemDefinition wirelessTerminal();
|
||||||
|
|
||||||
IItemDefinition wirelessCraftingTerminal();
|
|
||||||
|
|
||||||
IItemDefinition wirelessPatternTerminal();
|
|
||||||
|
|
||||||
IItemDefinition wirelessInterfaceTerminal();
|
|
||||||
|
|
||||||
IItemDefinition wirelessFluidTerminal();
|
|
||||||
|
|
||||||
IItemDefinition biometricCard();
|
IItemDefinition biometricCard();
|
||||||
|
|
||||||
IItemDefinition chargedStaff();
|
IItemDefinition chargedStaff();
|
||||||
|
|||||||
@@ -27,126 +27,121 @@ package appeng.api.definitions;
|
|||||||
/**
|
/**
|
||||||
* A list of all materials in AE
|
* A list of all materials in AE
|
||||||
*/
|
*/
|
||||||
public interface IMaterials {
|
public interface IMaterials
|
||||||
IItemDefinition cell2SpatialPart();
|
{
|
||||||
|
IItemDefinition cell2SpatialPart();
|
||||||
|
|
||||||
IItemDefinition cell16SpatialPart();
|
IItemDefinition cell16SpatialPart();
|
||||||
|
|
||||||
IItemDefinition cell128SpatialPart();
|
IItemDefinition cell128SpatialPart();
|
||||||
|
|
||||||
IItemDefinition silicon();
|
IItemDefinition silicon();
|
||||||
|
|
||||||
IItemDefinition skyDust();
|
IItemDefinition skyDust();
|
||||||
|
|
||||||
IItemDefinition calcProcessorPress();
|
IItemDefinition calcProcessorPress();
|
||||||
|
|
||||||
IItemDefinition engProcessorPress();
|
IItemDefinition engProcessorPress();
|
||||||
|
|
||||||
IItemDefinition logicProcessorPress();
|
IItemDefinition logicProcessorPress();
|
||||||
|
|
||||||
IItemDefinition calcProcessorPrint();
|
IItemDefinition calcProcessorPrint();
|
||||||
|
|
||||||
IItemDefinition engProcessorPrint();
|
IItemDefinition engProcessorPrint();
|
||||||
|
|
||||||
IItemDefinition logicProcessorPrint();
|
IItemDefinition logicProcessorPrint();
|
||||||
|
|
||||||
IItemDefinition siliconPress();
|
IItemDefinition siliconPress();
|
||||||
|
|
||||||
IItemDefinition siliconPrint();
|
IItemDefinition siliconPrint();
|
||||||
|
|
||||||
IItemDefinition namePress();
|
IItemDefinition namePress();
|
||||||
|
|
||||||
IItemDefinition logicProcessor();
|
IItemDefinition logicProcessor();
|
||||||
|
|
||||||
IItemDefinition calcProcessor();
|
IItemDefinition calcProcessor();
|
||||||
|
|
||||||
IItemDefinition engProcessor();
|
IItemDefinition engProcessor();
|
||||||
|
|
||||||
IItemDefinition basicCard();
|
IItemDefinition basicCard();
|
||||||
|
|
||||||
IItemDefinition advCard();
|
IItemDefinition advCard();
|
||||||
|
|
||||||
IItemDefinition purifiedCertusQuartzCrystal();
|
IItemDefinition purifiedCertusQuartzCrystal();
|
||||||
|
|
||||||
IItemDefinition purifiedNetherQuartzCrystal();
|
IItemDefinition purifiedNetherQuartzCrystal();
|
||||||
|
|
||||||
IItemDefinition purifiedFluixCrystal();
|
IItemDefinition purifiedFluixCrystal();
|
||||||
|
|
||||||
IItemDefinition cell1kPart();
|
IItemDefinition cell1kPart();
|
||||||
|
|
||||||
IItemDefinition cell4kPart();
|
IItemDefinition cell4kPart();
|
||||||
|
|
||||||
IItemDefinition cell16kPart();
|
IItemDefinition cell16kPart();
|
||||||
|
|
||||||
IItemDefinition cell64kPart();
|
IItemDefinition cell64kPart();
|
||||||
|
|
||||||
IItemDefinition emptyStorageCell();
|
IItemDefinition emptyStorageCell();
|
||||||
|
|
||||||
IItemDefinition cardRedstone();
|
IItemDefinition cardRedstone();
|
||||||
|
|
||||||
IItemDefinition cardSpeed();
|
IItemDefinition cardSpeed();
|
||||||
|
|
||||||
IItemDefinition cardCapacity();
|
IItemDefinition cardCapacity();
|
||||||
|
|
||||||
IItemDefinition cardPatternExpansion();
|
IItemDefinition cardPatternExpansion();
|
||||||
|
|
||||||
IItemDefinition cardQuantumLink();
|
IItemDefinition cardFuzzy();
|
||||||
|
|
||||||
IItemDefinition cardMagnet();
|
IItemDefinition cardInverter();
|
||||||
|
|
||||||
IItemDefinition cardFuzzy();
|
IItemDefinition cardCrafting();
|
||||||
|
|
||||||
IItemDefinition cardInverter();
|
IItemDefinition enderDust();
|
||||||
|
|
||||||
IItemDefinition cardCrafting();
|
IItemDefinition flour();
|
||||||
|
|
||||||
IItemDefinition cardSticky();
|
IItemDefinition goldDust();
|
||||||
|
|
||||||
IItemDefinition enderDust();
|
IItemDefinition ironDust();
|
||||||
|
|
||||||
IItemDefinition flour();
|
IItemDefinition fluixDust();
|
||||||
|
|
||||||
IItemDefinition goldDust();
|
IItemDefinition certusQuartzDust();
|
||||||
|
|
||||||
IItemDefinition ironDust();
|
IItemDefinition netherQuartzDust();
|
||||||
|
|
||||||
IItemDefinition fluixDust();
|
IItemDefinition matterBall();
|
||||||
|
|
||||||
IItemDefinition certusQuartzDust();
|
IItemDefinition certusQuartzCrystal();
|
||||||
|
|
||||||
IItemDefinition netherQuartzDust();
|
IItemDefinition certusQuartzCrystalCharged();
|
||||||
|
|
||||||
IItemDefinition matterBall();
|
IItemDefinition fluixCrystal();
|
||||||
|
|
||||||
IItemDefinition certusQuartzCrystal();
|
IItemDefinition fluixPearl();
|
||||||
|
|
||||||
IItemDefinition certusQuartzCrystalCharged();
|
IItemDefinition woodenGear();
|
||||||
|
|
||||||
IItemDefinition fluixCrystal();
|
IItemDefinition wirelessReceiver();
|
||||||
|
|
||||||
IItemDefinition fluixPearl();
|
IItemDefinition wirelessBooster();
|
||||||
|
|
||||||
IItemDefinition woodenGear();
|
IItemDefinition annihilationCore();
|
||||||
|
|
||||||
IItemDefinition wirelessReceiver();
|
IItemDefinition formationCore();
|
||||||
|
|
||||||
IItemDefinition wirelessBooster();
|
IItemDefinition singularity();
|
||||||
|
|
||||||
IItemDefinition annihilationCore();
|
IItemDefinition qESingularity();
|
||||||
|
|
||||||
IItemDefinition formationCore();
|
IItemDefinition blankPattern();
|
||||||
|
|
||||||
IItemDefinition singularity();
|
IItemDefinition fluidCell1kPart();
|
||||||
|
|
||||||
IItemDefinition qESingularity();
|
IItemDefinition fluidCell4kPart();
|
||||||
|
|
||||||
IItemDefinition blankPattern();
|
IItemDefinition fluidCell16kPart();
|
||||||
|
|
||||||
IItemDefinition fluidCell1kPart();
|
IItemDefinition fluidCell64kPart();
|
||||||
|
|
||||||
IItemDefinition fluidCell4kPart();
|
|
||||||
|
|
||||||
IItemDefinition fluidCell16kPart();
|
|
||||||
|
|
||||||
IItemDefinition fluidCell64kPart();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,106 +30,97 @@ import appeng.api.util.AEColoredItemDefinition;
|
|||||||
/**
|
/**
|
||||||
* A list of all parts in AE
|
* A list of all parts in AE
|
||||||
*/
|
*/
|
||||||
public interface IParts {
|
public interface IParts
|
||||||
AEColoredItemDefinition cableSmart();
|
{
|
||||||
|
AEColoredItemDefinition cableSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition cableCovered();
|
AEColoredItemDefinition cableCovered();
|
||||||
|
|
||||||
AEColoredItemDefinition cableGlass();
|
AEColoredItemDefinition cableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDenseCovered();
|
AEColoredItemDefinition cableDenseCovered();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDenseSmart();
|
AEColoredItemDefinition cableDenseSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableSmart();
|
AEColoredItemDefinition lumenCableSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableCovered();
|
AEColoredItemDefinition lumenCableCovered();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableGlass();
|
AEColoredItemDefinition lumenCableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenDenseCableSmart();
|
AEColoredItemDefinition lumenDenseCableSmart();
|
||||||
|
|
||||||
IItemDefinition quartzFiber();
|
IItemDefinition quartzFiber();
|
||||||
|
|
||||||
IItemDefinition toggleBus();
|
IItemDefinition toggleBus();
|
||||||
|
|
||||||
IItemDefinition invertedToggleBus();
|
IItemDefinition invertedToggleBus();
|
||||||
|
|
||||||
IItemDefinition storageBus();
|
IItemDefinition storageBus();
|
||||||
|
|
||||||
IItemDefinition oreDictStorageBus();
|
IItemDefinition importBus();
|
||||||
|
|
||||||
IItemDefinition importBus();
|
IItemDefinition exportBus();
|
||||||
|
|
||||||
IItemDefinition exportBus();
|
IItemDefinition iface();
|
||||||
|
|
||||||
IItemDefinition iface();
|
IItemDefinition fluidIface();
|
||||||
|
|
||||||
IItemDefinition fluidIface();
|
IItemDefinition levelEmitter();
|
||||||
|
|
||||||
IItemDefinition levelEmitter();
|
IItemDefinition annihilationPlane();
|
||||||
|
|
||||||
IItemDefinition annihilationPlane();
|
IItemDefinition identityAnnihilationPlane();
|
||||||
|
|
||||||
IItemDefinition identityAnnihilationPlane();
|
IItemDefinition formationPlane();
|
||||||
|
|
||||||
IItemDefinition formationPlane();
|
IItemDefinition p2PTunnelME();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelME();
|
IItemDefinition p2PTunnelRedstone();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelRedstone();
|
IItemDefinition p2PTunnelItems();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelItems();
|
IItemDefinition p2PTunnelFluids();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelFluids();
|
IItemDefinition p2PTunnelEU();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelEU();
|
IItemDefinition p2PTunnelFE();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelFE();
|
IItemDefinition p2PTunnelLight();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelGTEU();
|
// IItemDefinition p2PTunnelOpenComputers();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelLight();
|
IItemDefinition cableAnchor();
|
||||||
|
|
||||||
// IItemDefinition p2PTunnelOpenComputers();
|
IItemDefinition monitor();
|
||||||
|
|
||||||
IItemDefinition cableAnchor();
|
IItemDefinition semiDarkMonitor();
|
||||||
|
|
||||||
IItemDefinition monitor();
|
IItemDefinition darkMonitor();
|
||||||
|
|
||||||
IItemDefinition semiDarkMonitor();
|
IItemDefinition interfaceTerminal();
|
||||||
|
|
||||||
IItemDefinition darkMonitor();
|
IItemDefinition patternTerminal();
|
||||||
|
|
||||||
IItemDefinition interfaceTerminal();
|
IItemDefinition craftingTerminal();
|
||||||
|
|
||||||
IItemDefinition patternTerminal();
|
IItemDefinition terminal();
|
||||||
|
|
||||||
IItemDefinition expandedProcessingPatternTerminal();
|
IItemDefinition storageMonitor();
|
||||||
|
|
||||||
IItemDefinition interfaceConfigurationTerminal();
|
IItemDefinition conversionMonitor();
|
||||||
|
|
||||||
IItemDefinition fluidInterfaceConfigurationTerminal();
|
IItemDefinition fluidTerminal();
|
||||||
|
|
||||||
IItemDefinition craftingTerminal();
|
IItemDefinition fluidImportBus();
|
||||||
|
|
||||||
IItemDefinition terminal();
|
IItemDefinition fluidExportBus();
|
||||||
|
|
||||||
IItemDefinition storageMonitor();
|
IItemDefinition fluidStorageBus();
|
||||||
|
|
||||||
IItemDefinition conversionMonitor();
|
IItemDefinition fluidLevelEmitter();
|
||||||
|
|
||||||
IItemDefinition fluidTerminal();
|
IItemDefinition fluidAnnihilationPlane();
|
||||||
|
|
||||||
IItemDefinition fluidImportBus();
|
IItemDefinition fluidFormationnPlane();
|
||||||
|
|
||||||
IItemDefinition fluidExportBus();
|
|
||||||
|
|
||||||
IItemDefinition fluidStorageBus();
|
|
||||||
|
|
||||||
IItemDefinition fluidLevelEmitter();
|
|
||||||
|
|
||||||
IItemDefinition fluidAnnihilationPlane();
|
|
||||||
|
|
||||||
IItemDefinition fluidFormationnPlane();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,13 @@
|
|||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registration Records for {@link IInscriberRegistry}
|
* Registration Records for {@link IInscriberRegistry}
|
||||||
@@ -56,35 +57,21 @@ public interface IInscriberRecipe
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
ItemStack getOutput();
|
ItemStack getOutput();
|
||||||
|
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
List<ItemStack> getTopInputs();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the top optional
|
* gets the top optional
|
||||||
*
|
*
|
||||||
* @return item which is used top
|
* @return item which is used top
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
default Optional<ItemStack> getTopOptional(){
|
Optional<ItemStack> getTopOptional();
|
||||||
return getTopInputs().isEmpty() ? Optional.empty() : Optional.of(getTopInputs().get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
List<ItemStack> getBottomInputs();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the bottom optional
|
* gets the bottom optional
|
||||||
*
|
*
|
||||||
* @return item which is used bottom
|
* @return item which is used bottom
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
default Optional<ItemStack> getBottomOptional() {
|
Optional<ItemStack> getBottomOptional();
|
||||||
return getBottomInputs().isEmpty() ? Optional.empty() : Optional.of(getBottomInputs().get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* type of inscriber process
|
* type of inscriber process
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ public interface IInscriberRecipeBuilder
|
|||||||
* @return currently used builder
|
* @return currently used builder
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IInscriberRecipeBuilder withTopOptional(@Nonnull Collection<ItemStack> topOptional );
|
IInscriberRecipeBuilder withTopOptional( @Nonnull ItemStack topOptional );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an inscriber recipe with bot.
|
* Creates an inscriber recipe with bot.
|
||||||
@@ -77,7 +77,7 @@ public interface IInscriberRecipeBuilder
|
|||||||
* @return currently used builder
|
* @return currently used builder
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IInscriberRecipeBuilder withBottomOptional( @Nonnull Collection<ItemStack> bottomOptional );
|
IInscriberRecipeBuilder withBottomOptional( @Nonnull ItemStack bottomOptional );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an inscriber recipe with type.
|
* Creates an inscriber recipe with type.
|
||||||
@@ -104,14 +104,4 @@ public interface IInscriberRecipeBuilder
|
|||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IInscriberRecipe build();
|
IInscriberRecipe build();
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
default IInscriberRecipeBuilder withTopOptional(@Nonnull ItemStack topOptional){
|
|
||||||
return withTopOptional(Collections.singleton(topOptional));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
default IInscriberRecipeBuilder withBottomOptional(@Nonnull ItemStack bottomOptional){
|
|
||||||
return withBottomOptional(Collections.singleton(bottomOptional));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,13 @@
|
|||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.config.TunnelType;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.config.TunnelType;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,8 +59,6 @@ public interface IP2PTunnelRegistry
|
|||||||
*
|
*
|
||||||
* @return null if no attunement can be found or attunement
|
* @return null if no attunement can be found or attunement
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nonnull
|
||||||
TunnelType getTunnelTypeByItem( ItemStack trigger );
|
TunnelType getTunnelTypeByItem( ItemStack trigger );
|
||||||
|
|
||||||
TunnelType registerTunnelType( @Nonnull String enumName, @Nonnull ItemStack partStack );
|
|
||||||
}
|
}
|
||||||
@@ -28,45 +28,47 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A handler for a wireless terminal.
|
* A handler for a wireless terminal.
|
||||||
*/
|
*/
|
||||||
public interface IWirelessTermHandler extends INetworkEncodable {
|
public interface IWirelessTermHandler extends INetworkEncodable
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
* @return true, if usePower, hasPower, etc... can be called for the provided item
|
*
|
||||||
*/
|
* @return true, if usePower, hasPower, etc... can be called for the provided item
|
||||||
boolean canHandle(ItemStack is);
|
*/
|
||||||
|
boolean canHandle( ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use an amount of power, in AE units
|
* use an amount of power, in AE units
|
||||||
*
|
*
|
||||||
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
|
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
|
||||||
* hasPower
|
* hasPower
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
* @return true if wireless terminal uses power
|
*
|
||||||
*/
|
* @return true if wireless terminal uses power
|
||||||
boolean usePower(EntityPlayer player, double amount, ItemStack is);
|
*/
|
||||||
|
boolean usePower( EntityPlayer player, double amount, ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the power status of the item.
|
* gets the power status of the item.
|
||||||
*
|
*
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
* @return returns true if there is any power left.
|
*
|
||||||
*/
|
* @return returns true if there is any power left.
|
||||||
boolean hasPower(EntityPlayer player, double amount, ItemStack is);
|
*/
|
||||||
|
boolean hasPower( EntityPlayer player, double amount, ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the config manager for the wireless terminal.
|
* Return the config manager for the wireless terminal.
|
||||||
*
|
*
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
* @return config manager of wireless terminal
|
*
|
||||||
*/
|
* @return config manager of wireless terminal
|
||||||
IConfigManager getConfigManager(ItemStack is);
|
*/
|
||||||
|
IConfigManager getConfigManager( ItemStack is );
|
||||||
IGuiHandler getGuiHandler(ItemStack is);
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package appeng.api.implementations;
|
|
||||||
|
|
||||||
public interface IUpgradeableCellContainer {
|
|
||||||
int availableUpgrades();
|
|
||||||
|
|
||||||
void setupUpgrades();
|
|
||||||
}
|
|
||||||
@@ -40,13 +40,11 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
|
|||||||
/**
|
/**
|
||||||
* 0 - cell is missing.
|
* 0 - cell is missing.
|
||||||
*
|
*
|
||||||
* 1 - green, the cell is present and partially empty
|
* 1 - green,
|
||||||
*
|
*
|
||||||
* 2 - orange, the cell is present and full on types
|
* 2 - orange,
|
||||||
*
|
*
|
||||||
* 3 - red, the cell is present and full on bytes
|
* 3 - red
|
||||||
*
|
|
||||||
* 4 - blue, the cell is present but totally empty
|
|
||||||
*
|
*
|
||||||
* @param slot slot index
|
* @param slot slot index
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import appeng.api.networking.security.IActionSource;
|
|||||||
import appeng.api.networking.storage.IBaseMonitor;
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
|
|
||||||
public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
||||||
{
|
{
|
||||||
@@ -58,30 +56,4 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
|||||||
* @return an empty string or the name of the cpu.
|
* @return an empty string or the name of the cpu.
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return final output of the current crafting operation, or null if not crafting
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
default IAEItemStack getFinalOutput()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return remaining count of items (or other units of processing) for the current crafting job
|
|
||||||
*/
|
|
||||||
default long getRemainingItemCount()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return total count of items (or other units of processing) for the current crafting job
|
|
||||||
*/
|
|
||||||
default long getStartItemCount()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,14 +77,6 @@ public interface ICraftingPatternDetails
|
|||||||
*/
|
*/
|
||||||
IAEItemStack[] getCondensedOutputs();
|
IAEItemStack[] getCondensedOutputs();
|
||||||
|
|
||||||
/**
|
|
||||||
* The primary output of this pattern. The pattern will only be used to craft the primary output; the others are
|
|
||||||
* just byproducts.
|
|
||||||
*/
|
|
||||||
default IAEItemStack getPrimaryOutput() {
|
|
||||||
return getOutputs()[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of the outputs, will include nulls.
|
* @return a list of the outputs, will include nulls.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API(apiVersion = "rv6", owner = "appliedenergistics2", provides = "appliedenergistics2|API")
|
@API( apiVersion = "@aeversion@", owner = "appliedenergistics2", provides = "appliedenergistics2|API" )
|
||||||
package appeng.api;
|
package appeng.api;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ import appeng.api.util.AEPartLocation;
|
|||||||
public interface IFacadeContainer
|
public interface IFacadeContainer
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the {@link IFacadePart} can be added to the given side.
|
|
||||||
*
|
|
||||||
* @return true if the facade can be successfully added
|
|
||||||
*/
|
|
||||||
boolean canAddFacade( IFacadePart a );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to add the {@link IFacadePart} to the given side.
|
* Attempts to add the {@link IFacadePart} to the given side.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
package appeng.api.parts;
|
package appeng.api.parts;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
@@ -33,11 +32,35 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
|
|
||||||
public interface IPartHelper
|
public interface IPartHelper
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Register a new layer with the part layer system, this allows you to write an in between between tile entities and
|
||||||
|
* parts.
|
||||||
|
*
|
||||||
|
* AE By Default includes,
|
||||||
|
*
|
||||||
|
* 1. ISidedInventory ( and by extension IInventory. )
|
||||||
|
*
|
||||||
|
* 2. IFluidHandler Forge Fluids
|
||||||
|
*
|
||||||
|
* 3. IPowerEmitter BC Power output.
|
||||||
|
*
|
||||||
|
* 4. IPowerReceptor BC Power input.
|
||||||
|
*
|
||||||
|
* 5. IEnergySink IC2 Power input.
|
||||||
|
*
|
||||||
|
* 6. IEnergySource IC2 Power output.
|
||||||
|
*
|
||||||
|
* 7. IPipeConnection BC Pipe Connections
|
||||||
|
*
|
||||||
|
* As long as a valid layer is registered for a interface you can simply implement that interface on a part get
|
||||||
|
* implement it.
|
||||||
|
*
|
||||||
|
* @return true on success, false on failure, usually a error will be logged as well.
|
||||||
|
*/
|
||||||
|
boolean registerNewLayer( String string, String layerInterface );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use in use item, to try and place a IBusItem
|
* use in use item, to try and place a IBusItem
|
||||||
@@ -56,51 +79,4 @@ public interface IPartHelper
|
|||||||
* @return the render mode
|
* @return the render mode
|
||||||
*/
|
*/
|
||||||
CableRenderMode getCableRenderMode();
|
CableRenderMode getCableRenderMode();
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to get a part at a specific place in the world.
|
|
||||||
*
|
|
||||||
* @param w world the part is in
|
|
||||||
* @param pos pos of the part host
|
|
||||||
* @param side side to test for a part on.
|
|
||||||
*
|
|
||||||
* @return the part if it exists, null otherwise
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
IPart getPart( World w, BlockPos pos, AEPartLocation side );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to get a part host at a specific place in the world.
|
|
||||||
*
|
|
||||||
* @param w world the part host is in
|
|
||||||
* @param pos pos of the part host
|
|
||||||
*
|
|
||||||
* @return the part host if it exists, null otherwise
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
IPartHost getPartHost( World w, BlockPos pos );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a part host if it exists, or place one if it doesn't.
|
|
||||||
*
|
|
||||||
* @param w world the part host is in
|
|
||||||
* @param pos pos to get or place the part host
|
|
||||||
* @param force whether to skip permission and existing block checks and forcibly place the part host here.
|
|
||||||
* @param p the placing player, or null if none
|
|
||||||
*
|
|
||||||
* @return the existing or created part host, or null if it didn't already exist and part host is unable to be placed.
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
IPartHost getOrPlacePartHost( World w, BlockPos pos, boolean force, @Nullable EntityPlayer p );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if a part host can be successfully placed at a given position by the provided player.
|
|
||||||
*
|
|
||||||
* @param w world the part host is in
|
|
||||||
* @param pos pos to test for part host placement
|
|
||||||
* @param p the placing player, or null if none
|
|
||||||
*
|
|
||||||
* @return if the part can be placed at the provided world and position
|
|
||||||
*/
|
|
||||||
boolean canPlacePartHost( World w, BlockPos pos, @Nullable EntityPlayer p );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,24 +145,13 @@ public interface IPartHost extends ICustomCableConnection
|
|||||||
*/
|
*/
|
||||||
SelectedPart selectPart( Vec3d pos );
|
SelectedPart selectPart( Vec3d pos );
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as {@link #selectPart(Vec3d)}, but with global instead of local coordinates.
|
|
||||||
*/
|
|
||||||
default SelectedPart selectPartGlobal( Vec3d pos ) {
|
|
||||||
DimensionalCoord globalPos = getLocation();
|
|
||||||
return selectPart(pos.subtract(
|
|
||||||
globalPos.getPos().getX(),
|
|
||||||
globalPos.getPos().getY(),
|
|
||||||
globalPos.getPos().getZ()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* can be used by parts to trigger the tile or part to save.
|
* can be used by parts to trigger the tile or part to save.
|
||||||
*/
|
*/
|
||||||
void markForSave();
|
void markForSave();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called when parts are added or removed
|
* part of the {@link LayerBase}
|
||||||
*/
|
*/
|
||||||
void partChanged();
|
void partChanged();
|
||||||
|
|
||||||
@@ -180,6 +169,11 @@ public interface IPartHost extends ICustomCableConnection
|
|||||||
*/
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a mutable list of flags you can adjust to track state.
|
||||||
|
*/
|
||||||
|
Set<LayerFlags> getLayerFlags();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove host from world...
|
* remove host from world...
|
||||||
*/
|
*/
|
||||||
@@ -197,4 +191,4 @@ public interface IPartHost extends ICustomCableConnection
|
|||||||
*/
|
*/
|
||||||
boolean isInWorld();
|
boolean isInWorld();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 AlgorithmX2
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.api.parts;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
import appeng.api.util.AEPartLocation;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All Layers must extends this, this get part implementation is provided to interface with the parts, however a real
|
||||||
|
* implementation will be used at runtime.
|
||||||
|
*
|
||||||
|
* TODO: Consider removing and replacing with capabilities.
|
||||||
|
*/
|
||||||
|
public abstract class LayerBase extends TileEntity // implements IPartHost
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grants access for the layer to the parts of the host.
|
||||||
|
*
|
||||||
|
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
|
||||||
|
*
|
||||||
|
* @param side side of part
|
||||||
|
*
|
||||||
|
* @return the part for the requested side.
|
||||||
|
*/
|
||||||
|
public IPart getPart( final AEPartLocation side )
|
||||||
|
{
|
||||||
|
return null; // place holder.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grants access for the layer to the parts of the host.
|
||||||
|
*
|
||||||
|
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
|
||||||
|
*
|
||||||
|
* @param side side of part
|
||||||
|
*
|
||||||
|
* @return the part for the requested side.
|
||||||
|
*/
|
||||||
|
public IPart getPart( final EnumFacing side )
|
||||||
|
{
|
||||||
|
return null; // place holder.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
|
||||||
|
*/
|
||||||
|
public void notifyNeighbors()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
|
||||||
|
*/
|
||||||
|
public void partChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a mutable list of flags you can adjust to track state.
|
||||||
|
*/
|
||||||
|
public Set<LayerFlags> getLayerFlags()
|
||||||
|
{
|
||||||
|
return null; // place holder.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void markForSave()
|
||||||
|
{
|
||||||
|
// something!
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-13
@@ -21,21 +21,15 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.api.implementations;
|
package appeng.api.parts;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.config.Upgrades;
|
/**
|
||||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
* TODO: Consider removing and replacing with capabilities.
|
||||||
import appeng.api.util.IConfigurableObject;
|
*/
|
||||||
|
public enum LayerFlags
|
||||||
|
{
|
||||||
|
|
||||||
|
IC2_ENET
|
||||||
public interface IUpgradeableCellHost extends IConfigurableObject, ISegmentedInventory {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* determine how many of an upgrade are installed.
|
|
||||||
*/
|
|
||||||
default int getInstalledUpgrades(Upgrades u) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -123,8 +123,6 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
|
|||||||
*
|
*
|
||||||
* 3 - red, ( usually means the cell is 100% full )
|
* 3 - red, ( usually means the cell is 100% full )
|
||||||
*
|
*
|
||||||
* 4 - blue, ( usually means the cell is available and completely empty. )
|
|
||||||
*
|
|
||||||
* @return get the status of the cell based on its contents.
|
* @return get the status of the cell based on its contents.
|
||||||
*/
|
*/
|
||||||
int getStatusForCell();
|
int getStatusForCell();
|
||||||
|
|||||||
@@ -89,12 +89,4 @@ public interface IMEInventoryHandler<T extends IAEStack<T>> extends IMEInventory
|
|||||||
* @return true, if this inventory is valid for this pass.
|
* @return true, if this inventory is valid for this pass.
|
||||||
*/
|
*/
|
||||||
boolean validForPass( int i );
|
boolean validForPass( int i );
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets whether an inventory is "Sticky" i.e. only it and other sticky storages that have partitions with certain
|
|
||||||
* items are allowed to be put into sticky storages.
|
|
||||||
*/
|
|
||||||
default boolean isSticky() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,10 +119,6 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||||||
*
|
*
|
||||||
* @param is An item stack
|
* @param is An item stack
|
||||||
*/
|
*/
|
||||||
boolean equals( ItemStack is );
|
boolean equals(ItemStack is);
|
||||||
|
|
||||||
ItemStack getCachedItemStack( long stackSize );
|
|
||||||
|
|
||||||
void setCachedItemStack( ItemStack is );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.enderio.core.common.interfaces;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public interface IOverlayRenderAware {
|
|
||||||
|
|
||||||
public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -11,77 +11,77 @@ import net.minecraft.inventory.Slot;
|
|||||||
* or the MouseTweaksDisableWheelTweak annotations.
|
* or the MouseTweaksDisableWheelTweak annotations.
|
||||||
*/
|
*/
|
||||||
public interface IMTModGuiContainer2 {
|
public interface IMTModGuiContainer2 {
|
||||||
/**
|
/**
|
||||||
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
|
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
|
||||||
*
|
*
|
||||||
* @return True if Mouse Tweaks should be disabled, false otherwise.
|
* @return True if Mouse Tweaks should be disabled, false otherwise.
|
||||||
*/
|
*/
|
||||||
boolean MT_isMouseTweaksDisabled();
|
boolean MT_isMouseTweaksDisabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
|
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
|
||||||
*
|
*
|
||||||
* @return True if the Wheel Tweak should be disabled, false otherwise.
|
* @return True if the Wheel Tweak should be disabled, false otherwise.
|
||||||
*/
|
*/
|
||||||
boolean MT_isWheelTweakDisabled();
|
boolean MT_isWheelTweakDisabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Container.
|
* Returns the Container.
|
||||||
*
|
*
|
||||||
* @return Container that is currently in use.
|
* @return Container that is currently in use.
|
||||||
*/
|
*/
|
||||||
Container MT_getContainer();
|
Container MT_getContainer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
|
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
|
||||||
*
|
*
|
||||||
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
|
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
|
||||||
*/
|
*/
|
||||||
Slot MT_getSlotUnderMouse();
|
Slot MT_getSlotUnderMouse();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
|
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
|
||||||
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
|
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
|
||||||
*
|
*
|
||||||
* @param slot the slot to check
|
* @param slot the slot to check
|
||||||
* @return True if slot is a crafting output slot.
|
* @return True if slot is a crafting output slot.
|
||||||
*/
|
*/
|
||||||
boolean MT_isCraftingOutput(Slot slot);
|
boolean MT_isCraftingOutput(Slot slot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
|
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
|
||||||
* slots and the Destroy Item slot in the vanilla creative inventory.
|
* slots and the Destroy Item slot in the vanilla creative inventory.
|
||||||
*
|
*
|
||||||
* @param slot the slot to check
|
* @param slot the slot to check
|
||||||
* @return Tru if slot should be ignored by Mouse Tweaks.
|
* @return Tru if slot should be ignored by Mouse Tweaks.
|
||||||
*/
|
*/
|
||||||
boolean MT_isIgnored(Slot slot);
|
boolean MT_isIgnored(Slot slot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
|
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
|
||||||
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
|
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
|
||||||
* events are handled (although note these events are handled every game tick, which is far less frequent than every
|
* events are handled (although note these events are handled every game tick, which is far less frequent than every
|
||||||
* render tick).<br><br>
|
* render tick).<br><br>
|
||||||
* <p>
|
*
|
||||||
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
|
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
|
||||||
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
|
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
|
||||||
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
|
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
|
||||||
* <p>
|
*
|
||||||
* For vanilla containers this method looks like this:
|
* For vanilla containers this method looks like this:
|
||||||
* <pre>
|
* <pre>
|
||||||
* this.ignoreMouseUp = true;
|
* this.ignoreMouseUp = true;
|
||||||
*
|
*
|
||||||
* if (this.dragSplitting) {
|
* if (this.dragSplitting) {
|
||||||
* if (this.dragSplittingButton == 1) {
|
* if (this.dragSplittingButton == 1) {
|
||||||
* this.dragSplitting = false;
|
* this.dragSplitting = false;
|
||||||
* return true;
|
* return true;
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* return false;
|
* return false;
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
||||||
*/
|
*/
|
||||||
boolean MT_disableRMBDraggingFunctionality();
|
boolean MT_disableRMBDraggingFunctionality();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,11 @@
|
|||||||
package appeng.block;
|
package appeng.block;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.IOrientable;
|
import java.util.ArrayList;
|
||||||
import appeng.api.util.IOrientableBlock;
|
import java.util.List;
|
||||||
import appeng.helpers.AEGlassMaterial;
|
|
||||||
import appeng.helpers.ICustomCollision;
|
import javax.annotation.Nullable;
|
||||||
import appeng.util.LookDirection;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -47,378 +46,464 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.IOrientable;
|
||||||
import java.util.ArrayList;
|
import appeng.api.util.IOrientableBlock;
|
||||||
import java.util.List;
|
import appeng.helpers.AEGlassMaterial;
|
||||||
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.util.LookDirection;
|
||||||
public abstract class AEBaseBlock extends Block {
|
import appeng.util.Platform;
|
||||||
|
|
||||||
private boolean isOpaque = true;
|
|
||||||
private boolean isFullSize = true;
|
public abstract class AEBaseBlock extends Block
|
||||||
private boolean hasSubtypes = false;
|
{
|
||||||
private boolean isInventory = false;
|
|
||||||
|
private boolean isOpaque = true;
|
||||||
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
|
private boolean isFullSize = true;
|
||||||
|
private boolean hasSubtypes = false;
|
||||||
protected AEBaseBlock(final Material mat) {
|
private boolean isInventory = false;
|
||||||
super(mat);
|
|
||||||
|
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
|
||||||
if (mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS) {
|
|
||||||
this.setSoundType(SoundType.GLASS);
|
protected AEBaseBlock( final Material mat )
|
||||||
} else if (mat == Material.ROCK) {
|
{
|
||||||
this.setSoundType(SoundType.STONE);
|
super( mat );
|
||||||
} else if (mat == Material.WOOD) {
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
|
||||||
} else {
|
{
|
||||||
this.setSoundType(SoundType.METAL);
|
this.setSoundType( SoundType.GLASS );
|
||||||
}
|
}
|
||||||
|
else if( mat == Material.ROCK )
|
||||||
this.setLightOpacity(255);
|
{
|
||||||
this.setLightLevel(0);
|
this.setSoundType( SoundType.STONE );
|
||||||
this.setHardness(2.2F);
|
}
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
else if( mat == Material.WOOD )
|
||||||
|
{
|
||||||
// Workaround as vanilla sets it way too early.
|
this.setSoundType( SoundType.WOOD );
|
||||||
this.fullBlock = this.isFullSize();
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
@Override
|
this.setSoundType( SoundType.METAL );
|
||||||
protected BlockStateContainer createBlockState() {
|
}
|
||||||
return new BlockStateContainer(this, this.getAEStates());
|
|
||||||
}
|
this.setLightOpacity( 255 );
|
||||||
|
this.setLightLevel( 0 );
|
||||||
@Override
|
this.setHardness( 2.2F );
|
||||||
public final boolean isNormalCube(IBlockState state) {
|
this.setHarvestLevel( "pickaxe", 0 );
|
||||||
return this.isFullSize() && this.isOpaque();
|
|
||||||
}
|
// Workaround as vanilla sets it way too early.
|
||||||
|
this.fullBlock = this.isFullSize();
|
||||||
@Override
|
}
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return this.boundingBox;
|
@Override
|
||||||
}
|
protected BlockStateContainer createBlockState()
|
||||||
|
{
|
||||||
@SuppressWarnings("deprecation")
|
return new BlockStateContainer( this, this.getAEStates() );
|
||||||
@Override
|
}
|
||||||
public void addCollisionBoxToList(final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_) {
|
|
||||||
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos);
|
@Override
|
||||||
|
public final boolean isNormalCube( IBlockState state )
|
||||||
if (collisionHandler != null && bb != null) {
|
{
|
||||||
final List<AxisAlignedBB> tmp = new ArrayList<>();
|
return this.isFullSize() && this.isOpaque();
|
||||||
collisionHandler.addCollidingBlockToList(w, pos, bb, tmp, e);
|
}
|
||||||
for (final AxisAlignedBB b : tmp) {
|
|
||||||
final AxisAlignedBB offset = b.offset(pos.getX(), pos.getY(), pos.getZ());
|
@Override
|
||||||
if (bb.intersects(offset)) {
|
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
|
||||||
out.add(offset);
|
{
|
||||||
}
|
return this.boundingBox;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
super.addCollisionBoxToList(state, w, pos, bb, out, e, p_185477_7_);
|
@SuppressWarnings( "deprecation" )
|
||||||
}
|
@Override
|
||||||
}
|
public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_ )
|
||||||
|
{
|
||||||
@SuppressWarnings("deprecation")
|
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
if( collisionHandler != null && bb != null )
|
||||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, final World w, final BlockPos pos) {
|
{
|
||||||
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos);
|
final List<AxisAlignedBB> tmp = new ArrayList<>();
|
||||||
|
collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
|
||||||
if (collisionHandler != null) {
|
for( final AxisAlignedBB b : tmp )
|
||||||
if (Platform.isClient()) {
|
{
|
||||||
final EntityPlayer player = Minecraft.getMinecraft().player;
|
final AxisAlignedBB offset = b.offset( pos.getX(), pos.getY(), pos.getZ() );
|
||||||
final LookDirection ld = Platform.getPlayerRay(player, Platform.getEyeOffset(player));
|
if( bb.intersects( offset ) )
|
||||||
|
{
|
||||||
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, Minecraft.getMinecraft().player, true);
|
out.add( offset );
|
||||||
AxisAlignedBB br = null;
|
}
|
||||||
|
}
|
||||||
double lastDist = 0;
|
}
|
||||||
|
else
|
||||||
for (final AxisAlignedBB bb : bbs) {
|
{
|
||||||
this.boundingBox = bb;
|
super.addCollisionBoxToList( state, w, pos, bb, out, e, p_185477_7_ );
|
||||||
|
}
|
||||||
final RayTraceResult r = super.collisionRayTrace(state, w, pos, ld.getA(), ld.getB());
|
}
|
||||||
|
|
||||||
this.boundingBox = FULL_BLOCK_AABB;
|
@SuppressWarnings( "deprecation" )
|
||||||
|
@Override
|
||||||
if (r != null) {
|
@SideOnly( Side.CLIENT )
|
||||||
final double xLen = (ld.getA().x - r.hitVec.x);
|
public AxisAlignedBB getSelectedBoundingBox( IBlockState state, final World w, final BlockPos pos )
|
||||||
final double yLen = (ld.getA().y - r.hitVec.y);
|
{
|
||||||
final double zLen = (ld.getA().z - r.hitVec.z);
|
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
|
||||||
|
|
||||||
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
if( collisionHandler != null )
|
||||||
|
{
|
||||||
if (br == null || lastDist > thisDist) {
|
if( Platform.isClient() )
|
||||||
lastDist = thisDist;
|
{
|
||||||
br = bb;
|
final EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
}
|
final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
|
||||||
}
|
|
||||||
}
|
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().player, true );
|
||||||
|
AxisAlignedBB br = null;
|
||||||
if (br != null) {
|
|
||||||
br = new AxisAlignedBB(br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
|
double lastDist = 0;
|
||||||
.getY(), br.maxZ + pos.getZ());
|
|
||||||
return br;
|
for( final AxisAlignedBB bb : bbs )
|
||||||
}
|
{
|
||||||
}
|
this.boundingBox = bb;
|
||||||
|
|
||||||
AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
|
final RayTraceResult r = super.collisionRayTrace( state, w, pos, ld.getA(), ld.getB() );
|
||||||
|
|
||||||
for (final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, null, false)) {
|
this.boundingBox = FULL_BLOCK_AABB;
|
||||||
if (b == null) {
|
|
||||||
b = bx;
|
if( r != null )
|
||||||
continue;
|
{
|
||||||
}
|
final double xLen = ( ld.getA().x - r.hitVec.x );
|
||||||
|
final double yLen = ( ld.getA().y - r.hitVec.y );
|
||||||
final double minX = Math.min(b.minX, bx.minX);
|
final double zLen = ( ld.getA().z - r.hitVec.z );
|
||||||
final double minY = Math.min(b.minY, bx.minY);
|
|
||||||
final double minZ = Math.min(b.minZ, bx.minZ);
|
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
||||||
final double maxX = Math.max(b.maxX, bx.maxX);
|
|
||||||
final double maxY = Math.max(b.maxY, bx.maxY);
|
if( br == null || lastDist > thisDist )
|
||||||
final double maxZ = Math.max(b.maxZ, bx.maxZ);
|
{
|
||||||
|
lastDist = thisDist;
|
||||||
b = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
br = bb;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (b == null) {
|
}
|
||||||
b = new AxisAlignedBB(16d, 16d, 16d, 0d, 0d, 0d);
|
|
||||||
} else {
|
if( br != null )
|
||||||
b = new AxisAlignedBB(b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
|
{
|
||||||
.getZ());
|
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
|
||||||
}
|
.getY(), br.maxZ + pos.getZ() );
|
||||||
|
return br;
|
||||||
return b;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getSelectedBoundingBox(state, w, pos);
|
AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
|
||||||
}
|
|
||||||
|
for( final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) )
|
||||||
@Override
|
{
|
||||||
public final boolean isOpaqueCube(IBlockState state) {
|
if( b == null )
|
||||||
return this.isOpaque();
|
{
|
||||||
}
|
b = bx;
|
||||||
|
continue;
|
||||||
@SuppressWarnings("deprecation")
|
}
|
||||||
@Override
|
|
||||||
public RayTraceResult collisionRayTrace(final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b) {
|
final double minX = Math.min( b.minX, bx.minX );
|
||||||
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos);
|
final double minY = Math.min( b.minY, bx.minY );
|
||||||
|
final double minZ = Math.min( b.minZ, bx.minZ );
|
||||||
if (collisionHandler != null) {
|
final double maxX = Math.max( b.maxX, bx.maxX );
|
||||||
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, null, true);
|
final double maxY = Math.max( b.maxY, bx.maxY );
|
||||||
RayTraceResult br = null;
|
final double maxZ = Math.max( b.maxZ, bx.maxZ );
|
||||||
|
|
||||||
double lastDist = 0;
|
b = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
|
||||||
|
}
|
||||||
for (final AxisAlignedBB bb : bbs) {
|
|
||||||
this.boundingBox = bb;
|
if( b == null )
|
||||||
|
{
|
||||||
final RayTraceResult r = super.collisionRayTrace(state, w, pos, a, b);
|
b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
|
||||||
|
}
|
||||||
this.boundingBox = FULL_BLOCK_AABB;
|
else
|
||||||
|
{
|
||||||
if (r != null) {
|
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
|
||||||
final double xLen = (a.x - r.hitVec.x);
|
.getZ() );
|
||||||
final double yLen = (a.y - r.hitVec.y);
|
}
|
||||||
final double zLen = (a.z - r.hitVec.z);
|
|
||||||
|
return b;
|
||||||
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
}
|
||||||
if (br == null || lastDist > thisDist) {
|
|
||||||
lastDist = thisDist;
|
return super.getSelectedBoundingBox( state, w, pos );
|
||||||
br = r;
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
}
|
public final boolean isOpaqueCube( IBlockState state )
|
||||||
|
{
|
||||||
return br;
|
return this.isOpaque();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.boundingBox = FULL_BLOCK_AABB;
|
@SuppressWarnings( "deprecation" )
|
||||||
return super.collisionRayTrace(state, w, pos, a, b);
|
@Override
|
||||||
}
|
public RayTraceResult collisionRayTrace( final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b )
|
||||||
|
{
|
||||||
@Override
|
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
|
||||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
|
||||||
return this.isInventory();
|
if( collisionHandler != null )
|
||||||
}
|
{
|
||||||
|
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, true );
|
||||||
@Override
|
RayTraceResult br = null;
|
||||||
public int getComparatorInputOverride(IBlockState state, final World worldIn, final BlockPos pos) {
|
|
||||||
return 0;
|
double lastDist = 0;
|
||||||
}
|
|
||||||
|
for( final AxisAlignedBB bb : bbs )
|
||||||
@Override
|
{
|
||||||
public final boolean isNormalCube(IBlockState state, final IBlockAccess world, final BlockPos pos) {
|
this.boundingBox = bb;
|
||||||
return this.isFullSize();
|
|
||||||
}
|
final RayTraceResult r = super.collisionRayTrace( state, w, pos, a, b );
|
||||||
|
|
||||||
@Override
|
this.boundingBox = FULL_BLOCK_AABB;
|
||||||
public boolean rotateBlock(final World w, final BlockPos pos, final EnumFacing axis) {
|
|
||||||
final IOrientable rotatable = this.getOrientable(w, pos);
|
if( r != null )
|
||||||
|
{
|
||||||
if (rotatable != null && rotatable.canBeRotated()) {
|
final double xLen = ( a.x - r.hitVec.x );
|
||||||
if (this.hasCustomRotation()) {
|
final double yLen = ( a.y - r.hitVec.y );
|
||||||
this.customRotateBlock(rotatable, axis);
|
final double zLen = ( a.z - r.hitVec.z );
|
||||||
return true;
|
|
||||||
} else {
|
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
||||||
EnumFacing forward = rotatable.getForward();
|
if( br == null || lastDist > thisDist )
|
||||||
EnumFacing up = rotatable.getUp();
|
{
|
||||||
|
lastDist = thisDist;
|
||||||
for (int rs = 0; rs < 4; rs++) {
|
br = r;
|
||||||
forward = Platform.rotateAround(forward, axis);
|
}
|
||||||
up = Platform.rotateAround(up, axis);
|
}
|
||||||
|
}
|
||||||
if (this.isValidOrientation(w, pos, forward, up)) {
|
|
||||||
rotatable.setOrientation(forward, up);
|
if( br != null )
|
||||||
return true;
|
{
|
||||||
}
|
return br;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
return super.rotateBlock(w, pos, axis);
|
|
||||||
}
|
this.boundingBox = FULL_BLOCK_AABB;
|
||||||
|
return super.collisionRayTrace( state, w, pos, a, b );
|
||||||
@Override
|
}
|
||||||
public EnumFacing[] getValidRotations(final World w, final BlockPos pos) {
|
|
||||||
return new EnumFacing[0];
|
@Override
|
||||||
}
|
public boolean hasComparatorInputOverride( IBlockState state )
|
||||||
|
{
|
||||||
@SideOnly(Side.CLIENT)
|
return this.isInventory();
|
||||||
@Override
|
}
|
||||||
public void addInformation(final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips) {
|
|
||||||
|
@Override
|
||||||
}
|
public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
|
||||||
|
{
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
return 0;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
public final EnumFacing mapRotation(final IOrientable ori, final EnumFacing dir) {
|
public final boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
|
||||||
// case DOWN: return bottomIcon;
|
{
|
||||||
// case UP: return blockIcon;
|
return this.isFullSize();
|
||||||
// case NORTH: return northIcon;
|
}
|
||||||
// case SOUTH: return southIcon;
|
|
||||||
// case WEST: return sideIcon;
|
@Override
|
||||||
// case EAST: return sideIcon;
|
public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
|
||||||
|
{
|
||||||
final EnumFacing forward = ori.getForward();
|
final IOrientable rotatable = this.getOrientable( w, pos );
|
||||||
final EnumFacing up = ori.getUp();
|
|
||||||
|
if( rotatable != null && rotatable.canBeRotated() )
|
||||||
if (forward == null || up == null) {
|
{
|
||||||
return dir;
|
if( this.hasCustomRotation() )
|
||||||
}
|
{
|
||||||
|
this.customRotateBlock( rotatable, axis );
|
||||||
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
return true;
|
||||||
final int west_y = forward.getZOffset() * up.getYOffset() - forward.getXOffset() * up.getZOffset();
|
}
|
||||||
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
else
|
||||||
|
{
|
||||||
EnumFacing west = null;
|
EnumFacing forward = rotatable.getForward();
|
||||||
for (final EnumFacing dx : EnumFacing.VALUES) {
|
EnumFacing up = rotatable.getUp();
|
||||||
if (dx.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z) {
|
|
||||||
west = dx;
|
for( int rs = 0; rs < 4; rs++ )
|
||||||
}
|
{
|
||||||
}
|
forward = Platform.rotateAround( forward, axis );
|
||||||
|
up = Platform.rotateAround( up, axis );
|
||||||
if (west == null) {
|
|
||||||
return dir;
|
if( this.isValidOrientation( w, pos, forward, up ) )
|
||||||
}
|
{
|
||||||
|
rotatable.setOrientation( forward, up );
|
||||||
if (dir == forward) {
|
return true;
|
||||||
return EnumFacing.SOUTH;
|
}
|
||||||
}
|
}
|
||||||
if (dir == forward.getOpposite()) {
|
}
|
||||||
return EnumFacing.NORTH;
|
}
|
||||||
}
|
|
||||||
|
return super.rotateBlock( w, pos, axis );
|
||||||
if (dir == up) {
|
}
|
||||||
return EnumFacing.UP;
|
|
||||||
}
|
@Override
|
||||||
if (dir == up.getOpposite()) {
|
public EnumFacing[] getValidRotations( final World w, final BlockPos pos )
|
||||||
return EnumFacing.DOWN;
|
{
|
||||||
}
|
return new EnumFacing[0];
|
||||||
|
}
|
||||||
if (dir == west) {
|
|
||||||
return EnumFacing.WEST;
|
@SideOnly( Side.CLIENT )
|
||||||
}
|
@Override
|
||||||
if (dir == west.getOpposite()) {
|
public void addInformation( final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips )
|
||||||
return EnumFacing.EAST;
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
return null;
|
|
||||||
}
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
|
{
|
||||||
@Override
|
return false;
|
||||||
public String toString() {
|
}
|
||||||
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
|
|
||||||
return this.getClass().getSimpleName() + "[" + regName + "]";
|
public final EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
|
||||||
}
|
{
|
||||||
|
// case DOWN: return bottomIcon;
|
||||||
protected String getTranslationKey(final ItemStack is) {
|
// case UP: return blockIcon;
|
||||||
return this.getTranslationKey();
|
// case NORTH: return northIcon;
|
||||||
}
|
// case SOUTH: return southIcon;
|
||||||
|
// case WEST: return sideIcon;
|
||||||
protected boolean hasCustomRotation() {
|
// case EAST: return sideIcon;
|
||||||
return false;
|
|
||||||
}
|
final EnumFacing forward = ori.getForward();
|
||||||
|
final EnumFacing up = ori.getUp();
|
||||||
protected void customRotateBlock(final IOrientable rotatable, final EnumFacing axis) {
|
|
||||||
|
if( forward == null || up == null )
|
||||||
}
|
{
|
||||||
|
return dir;
|
||||||
protected IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
|
}
|
||||||
if (this instanceof IOrientableBlock) {
|
|
||||||
IOrientableBlock orientable = (IOrientableBlock) this;
|
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||||
return orientable.getOrientable(w, pos);
|
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||||
}
|
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||||
return null;
|
|
||||||
}
|
EnumFacing west = null;
|
||||||
|
for( final EnumFacing dx : EnumFacing.VALUES )
|
||||||
protected boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
|
{
|
||||||
return true;
|
if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
|
||||||
}
|
{
|
||||||
|
west = dx;
|
||||||
protected ICustomCollision getCustomCollision(final World w, final BlockPos pos) {
|
}
|
||||||
if (this instanceof ICustomCollision) {
|
}
|
||||||
return (ICustomCollision) this;
|
|
||||||
}
|
if( west == null )
|
||||||
return null;
|
{
|
||||||
}
|
return dir;
|
||||||
|
}
|
||||||
protected IProperty[] getAEStates() {
|
|
||||||
return new IProperty[0];
|
if( dir == forward )
|
||||||
}
|
{
|
||||||
|
return EnumFacing.SOUTH;
|
||||||
protected boolean isOpaque() {
|
}
|
||||||
return this.isOpaque;
|
if( dir == forward.getOpposite() )
|
||||||
}
|
{
|
||||||
|
return EnumFacing.NORTH;
|
||||||
protected boolean setOpaque(final boolean isOpaque) {
|
}
|
||||||
this.isOpaque = isOpaque;
|
|
||||||
return isOpaque;
|
if( dir == up )
|
||||||
}
|
{
|
||||||
|
return EnumFacing.UP;
|
||||||
protected boolean hasSubtypes() {
|
}
|
||||||
return this.hasSubtypes;
|
if( dir == up.getOpposite() )
|
||||||
}
|
{
|
||||||
|
return EnumFacing.DOWN;
|
||||||
protected void setHasSubtypes(final boolean hasSubtypes) {
|
}
|
||||||
this.hasSubtypes = hasSubtypes;
|
|
||||||
}
|
if( dir == west )
|
||||||
|
{
|
||||||
protected boolean isFullSize() {
|
return EnumFacing.WEST;
|
||||||
return this.isFullSize;
|
}
|
||||||
}
|
if( dir == west.getOpposite() )
|
||||||
|
{
|
||||||
protected boolean setFullSize(final boolean isFullSize) {
|
return EnumFacing.EAST;
|
||||||
this.isFullSize = isFullSize;
|
}
|
||||||
return isFullSize;
|
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
protected boolean isInventory() {
|
|
||||||
return this.isInventory;
|
@Override
|
||||||
}
|
public String toString()
|
||||||
|
{
|
||||||
protected void setInventory(final boolean isInventory) {
|
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
|
||||||
this.isInventory = isInventory;
|
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getUnlocalizedName( final ItemStack is )
|
||||||
|
{
|
||||||
|
return this.getUnlocalizedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean hasCustomRotation()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||||
|
{
|
||||||
|
if( this instanceof IOrientableBlock )
|
||||||
|
{
|
||||||
|
IOrientableBlock orientable = (IOrientableBlock) this;
|
||||||
|
return orientable.getOrientable( w, pos );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||||
|
{
|
||||||
|
if( this instanceof ICustomCollision )
|
||||||
|
{
|
||||||
|
return (ICustomCollision) this;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IProperty[] getAEStates()
|
||||||
|
{
|
||||||
|
return new IProperty[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isOpaque()
|
||||||
|
{
|
||||||
|
return this.isOpaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean setOpaque( final boolean isOpaque )
|
||||||
|
{
|
||||||
|
this.isOpaque = isOpaque;
|
||||||
|
return isOpaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean hasSubtypes()
|
||||||
|
{
|
||||||
|
return this.hasSubtypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setHasSubtypes( final boolean hasSubtypes )
|
||||||
|
{
|
||||||
|
this.hasSubtypes = hasSubtypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isFullSize()
|
||||||
|
{
|
||||||
|
return this.isFullSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean setFullSize( final boolean isFullSize )
|
||||||
|
{
|
||||||
|
this.isFullSize = isFullSize;
|
||||||
|
return isFullSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isInventory()
|
||||||
|
{
|
||||||
|
return this.isInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setInventory( final boolean isInventory )
|
||||||
|
{
|
||||||
|
this.isInventory = isInventory;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,8 @@
|
|||||||
package appeng.block;
|
package appeng.block;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.IOrientable;
|
import java.util.List;
|
||||||
import appeng.api.util.IOrientableBlock;
|
|
||||||
import appeng.block.misc.BlockLightDetector;
|
|
||||||
import appeng.block.misc.BlockSkyCompass;
|
|
||||||
import appeng.block.networking.BlockWireless;
|
|
||||||
import appeng.me.helpers.IGridProxyable;
|
|
||||||
import appeng.tile.AEBaseTile;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
@@ -38,140 +33,179 @@ import net.minecraft.util.math.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
import appeng.api.util.IOrientable;
|
||||||
|
import appeng.api.util.IOrientableBlock;
|
||||||
|
import appeng.block.misc.BlockLightDetector;
|
||||||
|
import appeng.block.misc.BlockSkyCompass;
|
||||||
|
import appeng.block.networking.BlockWireless;
|
||||||
|
import appeng.me.helpers.IGridProxyable;
|
||||||
|
import appeng.tile.AEBaseTile;
|
||||||
|
|
||||||
|
|
||||||
public class AEBaseItemBlock extends ItemBlock {
|
public class AEBaseItemBlock extends ItemBlock
|
||||||
|
{
|
||||||
|
|
||||||
private final AEBaseBlock blockType;
|
private final AEBaseBlock blockType;
|
||||||
|
|
||||||
public AEBaseItemBlock(final Block id) {
|
public AEBaseItemBlock( final Block id )
|
||||||
super(id);
|
{
|
||||||
this.blockType = (AEBaseBlock) id;
|
super( id );
|
||||||
this.hasSubtypes = this.blockType.hasSubtypes();
|
this.blockType = (AEBaseBlock) id;
|
||||||
}
|
this.hasSubtypes = this.blockType.hasSubtypes();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(final int dmg) {
|
public int getMetadata( final int dmg )
|
||||||
if (this.hasSubtypes) {
|
{
|
||||||
return dmg;
|
if( this.hasSubtypes )
|
||||||
}
|
{
|
||||||
return 0;
|
return dmg;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public final void addInformation(final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips) {
|
public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||||
this.addCheckedInformation(itemStack, world, toolTip, advancedTooltips);
|
{
|
||||||
}
|
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips) {
|
public void addCheckedInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||||
this.blockType.addInformation(itemStack, world, toolTip, advancedTooltips);
|
{
|
||||||
}
|
this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBookEnchantable(final ItemStack itemstack1, final ItemStack itemstack2) {
|
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
public String getUnlocalizedName( final ItemStack is )
|
||||||
public String getTranslationKey(final ItemStack is) {
|
{
|
||||||
return this.blockType.getTranslationKey(is);
|
return this.blockType.getUnlocalizedName( is );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState) {
|
public boolean placeBlockAt( final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState )
|
||||||
EnumFacing up = null;
|
{
|
||||||
EnumFacing forward = null;
|
EnumFacing up = null;
|
||||||
|
EnumFacing forward = null;
|
||||||
|
|
||||||
if (this.blockType instanceof AEBaseTileBlock) {
|
if( this.blockType instanceof AEBaseTileBlock )
|
||||||
if (this.blockType instanceof BlockLightDetector) {
|
{
|
||||||
up = side;
|
if( this.blockType instanceof BlockLightDetector )
|
||||||
if (up == EnumFacing.UP || up == EnumFacing.DOWN) {
|
{
|
||||||
forward = EnumFacing.SOUTH;
|
up = side;
|
||||||
} else {
|
if( up == EnumFacing.UP || up == EnumFacing.DOWN )
|
||||||
forward = EnumFacing.UP;
|
{
|
||||||
}
|
forward = EnumFacing.SOUTH;
|
||||||
} else if (this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass) {
|
}
|
||||||
forward = side;
|
else
|
||||||
if (forward == EnumFacing.UP || forward == EnumFacing.DOWN) {
|
{
|
||||||
up = EnumFacing.SOUTH;
|
forward = EnumFacing.UP;
|
||||||
} else {
|
}
|
||||||
up = EnumFacing.UP;
|
}
|
||||||
}
|
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||||
} else {
|
{
|
||||||
up = EnumFacing.UP;
|
forward = side;
|
||||||
|
if( forward == EnumFacing.UP || forward == EnumFacing.DOWN )
|
||||||
|
{
|
||||||
|
up = EnumFacing.SOUTH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
up = EnumFacing.UP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
up = EnumFacing.UP;
|
||||||
|
|
||||||
final byte rotation = (byte) (MathHelper.floor((player.rotationYaw * 4F) / 360F + 2.5D) & 3);
|
final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||||
|
|
||||||
switch (rotation) {
|
switch( rotation )
|
||||||
default:
|
{
|
||||||
case 0:
|
default:
|
||||||
forward = EnumFacing.SOUTH;
|
case 0:
|
||||||
break;
|
forward = EnumFacing.SOUTH;
|
||||||
case 1:
|
break;
|
||||||
forward = EnumFacing.WEST;
|
case 1:
|
||||||
break;
|
forward = EnumFacing.WEST;
|
||||||
case 2:
|
break;
|
||||||
forward = EnumFacing.NORTH;
|
case 2:
|
||||||
break;
|
forward = EnumFacing.NORTH;
|
||||||
case 3:
|
break;
|
||||||
forward = EnumFacing.EAST;
|
case 3:
|
||||||
break;
|
forward = EnumFacing.EAST;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (player.rotationPitch > 65) {
|
if( player.rotationPitch > 65 )
|
||||||
up = forward.getOpposite();
|
{
|
||||||
forward = EnumFacing.UP;
|
up = forward.getOpposite();
|
||||||
} else if (player.rotationPitch < -65) {
|
forward = EnumFacing.UP;
|
||||||
up = forward.getOpposite();
|
}
|
||||||
forward = EnumFacing.DOWN;
|
else if( player.rotationPitch < -65 )
|
||||||
}
|
{
|
||||||
}
|
up = forward.getOpposite();
|
||||||
}
|
forward = EnumFacing.DOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IOrientable ori = null;
|
IOrientable ori = null;
|
||||||
if (this.blockType instanceof IOrientableBlock) {
|
if( this.blockType instanceof IOrientableBlock )
|
||||||
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
|
{
|
||||||
up = side;
|
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
|
||||||
forward = EnumFacing.SOUTH;
|
up = side;
|
||||||
if (up.getYOffset() == 0) {
|
forward = EnumFacing.SOUTH;
|
||||||
forward = EnumFacing.UP;
|
if( up.getFrontOffsetY() == 0 )
|
||||||
}
|
{
|
||||||
}
|
forward = EnumFacing.UP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.blockType.isValidOrientation(w, pos, forward, up)) {
|
if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (super.placeBlockAt(stack, player, w, pos, side, hitX, hitY, hitZ, newState)) {
|
if( super.placeBlockAt( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
|
||||||
if (this.blockType instanceof AEBaseTileBlock && !(this.blockType instanceof BlockLightDetector)) {
|
{
|
||||||
final AEBaseTile tile = ((AEBaseTileBlock) this.blockType).getTileEntity(w, pos);
|
if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
|
||||||
ori = tile;
|
{
|
||||||
|
final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
|
||||||
|
ori = tile;
|
||||||
|
|
||||||
if (tile == null) {
|
if( tile == null )
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ori.canBeRotated() && !this.blockType.hasCustomRotation()) {
|
if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||||
ori.setOrientation(forward, up);
|
{
|
||||||
}
|
ori.setOrientation( forward, up );
|
||||||
|
}
|
||||||
|
|
||||||
if (tile instanceof IGridProxyable) {
|
if( tile instanceof IGridProxyable )
|
||||||
((IGridProxyable) tile).getProxy().setOwner(player);
|
{
|
||||||
}
|
( (IGridProxyable) tile ).getProxy().setOwner( player );
|
||||||
|
}
|
||||||
|
|
||||||
tile.onPlacement(stack, player, side);
|
tile.onPlacement( stack, player, side );
|
||||||
} else if (this.blockType instanceof IOrientableBlock) {
|
}
|
||||||
ori.setOrientation(forward, up);
|
else if( this.blockType instanceof IOrientableBlock )
|
||||||
}
|
{
|
||||||
|
ori.setOrientation( forward, up );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,9 @@
|
|||||||
package appeng.block;
|
package appeng.block;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import java.text.MessageFormat;
|
||||||
import appeng.api.config.Actionable;
|
import java.util.List;
|
||||||
import appeng.api.definitions.IBlockDefinition;
|
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
|
||||||
import appeng.core.Api;
|
|
||||||
import appeng.core.localization.Tooltips;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -34,98 +30,126 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerUnits;
|
||||||
|
import appeng.api.definitions.IBlockDefinition;
|
||||||
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
|
import appeng.core.Api;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage {
|
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage
|
||||||
|
{
|
||||||
|
|
||||||
public AEBaseItemBlockChargeable(final Block id) {
|
public AEBaseItemBlockChargeable( final Block id )
|
||||||
super(id);
|
{
|
||||||
}
|
super( id );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void addCheckedInformation(final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips) {
|
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||||
final NBTTagCompound tag = stack.getTagCompound();
|
{
|
||||||
double internalCurrentPower = 0;
|
final NBTTagCompound tag = stack.getTagCompound();
|
||||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
double internalCurrentPower = 0;
|
||||||
|
final double internalMaxPower = this.getMaxEnergyCapacity();
|
||||||
|
|
||||||
if (internalMaxPower > 0) {
|
if( internalMaxPower > 0 )
|
||||||
if (tag != null) {
|
{
|
||||||
internalCurrentPower = tag.getDouble("internalCurrentPower");
|
if( tag != null )
|
||||||
}
|
{
|
||||||
|
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
||||||
|
}
|
||||||
|
|
||||||
lines.add(Tooltips.energyStorageComponent(internalCurrentPower, internalMaxPower).getFormattedText());
|
final double percent = internalCurrentPower / internalMaxPower;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
||||||
public double injectAEPower(final ItemStack is, double amount, Actionable mode) {
|
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||||
final double internalCurrentPower = this.getInternal(is);
|
}
|
||||||
final double internalMaxPower = this.getAEMaxPower(is);
|
}
|
||||||
final double required = internalMaxPower - internalCurrentPower;
|
|
||||||
final double overflow = Math.max(0, amount - required);
|
|
||||||
|
|
||||||
if (mode == Actionable.MODULATE) {
|
@Override
|
||||||
final double toAdd = Math.min(required, amount);
|
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
|
||||||
final double newPowerStored = internalCurrentPower + toAdd;
|
{
|
||||||
|
final double internalCurrentPower = this.getInternal( is );
|
||||||
|
final double internalMaxPower = this.getAEMaxPower( is );
|
||||||
|
final double required = internalMaxPower - internalCurrentPower;
|
||||||
|
final double overflow = Math.max( 0, amount - required );
|
||||||
|
|
||||||
this.setInternal(is, newPowerStored);
|
if( mode == Actionable.MODULATE )
|
||||||
}
|
{
|
||||||
|
final double toAdd = Math.min( required, amount );
|
||||||
|
final double newPowerStored = internalCurrentPower + toAdd;
|
||||||
|
|
||||||
return overflow;
|
this.setInternal( is, newPowerStored );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return overflow;
|
||||||
public double extractAEPower(final ItemStack is, double amount, Actionable mode) {
|
}
|
||||||
final double internalCurrentPower = this.getInternal(is);
|
|
||||||
final double fulfillable = Math.min(amount, internalCurrentPower);
|
|
||||||
|
|
||||||
if (mode == Actionable.MODULATE) {
|
@Override
|
||||||
final double newPowerStored = internalCurrentPower - fulfillable;
|
public double extractAEPower( final ItemStack is, double amount, Actionable mode )
|
||||||
|
{
|
||||||
|
final double internalCurrentPower = this.getInternal( is );
|
||||||
|
final double fulfillable = Math.min( amount, internalCurrentPower );
|
||||||
|
|
||||||
this.setInternal(is, newPowerStored);
|
if( mode == Actionable.MODULATE )
|
||||||
}
|
{
|
||||||
|
final double newPowerStored = internalCurrentPower - fulfillable;
|
||||||
|
|
||||||
return fulfillable;
|
this.setInternal( is, newPowerStored );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return fulfillable;
|
||||||
public double getAEMaxPower(final ItemStack is) {
|
}
|
||||||
return this.getMaxEnergyCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getAECurrentPower(final ItemStack is) {
|
public double getAEMaxPower( final ItemStack is )
|
||||||
return this.getInternal(is);
|
{
|
||||||
}
|
return this.getMaxEnergyCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccessRestriction getPowerFlow(final ItemStack is) {
|
public double getAECurrentPower( final ItemStack is )
|
||||||
return AccessRestriction.WRITE;
|
{
|
||||||
}
|
return this.getInternal( is );
|
||||||
|
}
|
||||||
|
|
||||||
private double getMaxEnergyCapacity() {
|
@Override
|
||||||
final Block blockID = Block.getBlockFromItem(this);
|
public AccessRestriction getPowerFlow( final ItemStack is )
|
||||||
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
{
|
||||||
|
return AccessRestriction.WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
return energyCell.maybeBlock().map(block ->
|
private double getMaxEnergyCapacity()
|
||||||
{
|
{
|
||||||
if (blockID == block) {
|
final Block blockID = Block.getBlockFromItem( this );
|
||||||
return 200000;
|
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
||||||
} else {
|
|
||||||
return 8 * 200000;
|
|
||||||
}
|
|
||||||
}).orElse(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getInternal(final ItemStack is) {
|
return energyCell.maybeBlock().map( block ->
|
||||||
final NBTTagCompound nbt = Platform.openNbtData(is);
|
{
|
||||||
return nbt.getDouble("internalCurrentPower");
|
if( blockID == block )
|
||||||
}
|
{
|
||||||
|
return 200000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 8 * 200000;
|
||||||
|
}
|
||||||
|
} ).orElse( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
private void setInternal(final ItemStack is, final double amt) {
|
private double getInternal( final ItemStack is )
|
||||||
final NBTTagCompound nbt = Platform.openNbtData(is);
|
{
|
||||||
nbt.setDouble("internalCurrentPower", amt);
|
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||||
}
|
return nbt.getDouble( "internalCurrentPower" );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setInternal( final ItemStack is, final double amt )
|
||||||
|
{
|
||||||
|
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||||
|
nbt.setDouble( "internalCurrentPower", amt );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,38 +20,31 @@ package appeng.block;
|
|||||||
|
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockStairs;
|
import net.minecraft.block.BlockStairs;
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEBaseStairBlock extends BlockStairs {
|
public abstract class AEBaseStairBlock extends BlockStairs
|
||||||
|
{
|
||||||
|
|
||||||
protected AEBaseStairBlock(final Block block, final String type) {
|
protected AEBaseStairBlock( final Block block, final String type )
|
||||||
super(block.getDefaultState());
|
{
|
||||||
|
super( block.getDefaultState() );
|
||||||
|
|
||||||
Preconditions.checkNotNull(block);
|
Preconditions.checkNotNull( block );
|
||||||
Preconditions.checkNotNull(block.getTranslationKey());
|
Preconditions.checkNotNull( block.getUnlocalizedName() );
|
||||||
Preconditions.checkArgument(block.getTranslationKey().length() > 0);
|
Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 );
|
||||||
|
|
||||||
this.setTranslationKey("stair." + type);
|
this.setUnlocalizedName( "stair." + type );
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString()
|
||||||
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
|
{
|
||||||
return this.getClass().getSimpleName() + "[" + regName + "]";
|
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
|
||||||
}
|
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,23 +19,14 @@
|
|||||||
package appeng.block;
|
package appeng.block;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.implementations.items.IMemoryCard;
|
import java.util.ArrayList;
|
||||||
import appeng.api.implementations.items.MemoryCardMessages;
|
import java.util.List;
|
||||||
import appeng.api.implementations.tiles.IColorableTile;
|
|
||||||
import appeng.api.util.AEColor;
|
import javax.annotation.Nonnull;
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.api.util.IOrientable;
|
|
||||||
import appeng.block.networking.BlockCableBus;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.helpers.ICustomCollision;
|
|
||||||
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
|
|
||||||
import appeng.tile.AEBaseInvTile;
|
|
||||||
import appeng.tile.AEBaseTile;
|
|
||||||
import appeng.tile.networking.TileCableBus;
|
|
||||||
import appeng.tile.storage.TileSkyChest;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import appeng.util.SettingsFrom;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -55,287 +46,348 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.event.ForgeEventFactory;
|
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.implementations.items.IMemoryCard;
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.implementations.items.MemoryCardMessages;
|
||||||
import java.util.ArrayList;
|
import appeng.api.implementations.tiles.IColorableTile;
|
||||||
import java.util.List;
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.api.util.IOrientable;
|
||||||
|
import appeng.block.networking.BlockCableBus;
|
||||||
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.tile.AEBaseInvTile;
|
||||||
|
import appeng.tile.AEBaseTile;
|
||||||
|
import appeng.tile.networking.TileCableBus;
|
||||||
|
import appeng.tile.storage.TileSkyChest;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.SettingsFrom;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider {
|
public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private Class<? extends AEBaseTile> tileEntityType;
|
private Class<? extends AEBaseTile> tileEntityType;
|
||||||
|
|
||||||
public AEBaseTileBlock(final Material mat) {
|
public AEBaseTileBlock( final Material mat )
|
||||||
super(mat);
|
{
|
||||||
}
|
super( mat );
|
||||||
|
}
|
||||||
|
|
||||||
public static final UnlistedDirection FORWARD = new UnlistedDirection("forward");
|
public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||||
public static final UnlistedDirection UP = new UnlistedDirection("up");
|
public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
// A subclass may decide it doesn't want extended block state for whatever reason
|
{
|
||||||
if (!(state instanceof IExtendedBlockState)) {
|
// A subclass may decide it doesn't want extended block state for whatever reason
|
||||||
return state;
|
if( !( state instanceof IExtendedBlockState ) )
|
||||||
}
|
{
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
AEBaseTile tile = this.getTileEntity(world, pos);
|
AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
if (tile == null) {
|
if( tile == null )
|
||||||
return state; // No info available
|
{
|
||||||
}
|
return state; // No info available
|
||||||
|
}
|
||||||
|
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||||
return extState.withProperty(FORWARD, tile.getForward()).withProperty(UP, tile.getUp());
|
return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState()
|
||||||
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{
|
{
|
||||||
FORWARD,
|
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||||
UP
|
FORWARD,
|
||||||
});
|
UP
|
||||||
}
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState( IBlockState state )
|
||||||
return 0;
|
{
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO : Was this change needed?
|
// TODO : Was this change needed?
|
||||||
public void setTileEntity(final Class<? extends AEBaseTile> c) {
|
public void setTileEntity( final Class<? extends AEBaseTile> c )
|
||||||
this.tileEntityType = c;
|
{
|
||||||
this.setInventory(AEBaseInvTile.class.isAssignableFrom(c));
|
this.tileEntityType = c;
|
||||||
}
|
this.setInventory( AEBaseInvTile.class.isAssignableFrom( c ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(IBlockState state) {
|
public boolean hasTileEntity( IBlockState state )
|
||||||
return this.hasBlockTileEntity();
|
{
|
||||||
}
|
return this.hasBlockTileEntity();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean hasBlockTileEntity() {
|
private boolean hasBlockTileEntity()
|
||||||
return this.tileEntityType != null;
|
{
|
||||||
}
|
return this.tileEntityType != null;
|
||||||
|
}
|
||||||
|
|
||||||
public Class<? extends AEBaseTile> getTileEntityClass() {
|
public Class<? extends AEBaseTile> getTileEntityClass()
|
||||||
return this.tileEntityType;
|
{
|
||||||
}
|
return this.tileEntityType;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public <T extends AEBaseTile> T getTileEntity(final IBlockAccess w, final int x, final int y, final int z) {
|
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final int x, final int y, final int z )
|
||||||
return this.getTileEntity(w, new BlockPos(x, y, z));
|
{
|
||||||
}
|
return this.getTileEntity( w, new BlockPos( x, y, z ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public <T extends AEBaseTile> T getTileEntity(final IBlockAccess w, final BlockPos pos) {
|
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final BlockPos pos )
|
||||||
if (!this.hasBlockTileEntity()) {
|
{
|
||||||
return null;
|
if( !this.hasBlockTileEntity() )
|
||||||
}
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
final TileEntity te = w.getTileEntity(pos);
|
final TileEntity te = w.getTileEntity( pos );
|
||||||
if (this.tileEntityType.isInstance(te)) {
|
if( this.tileEntityType.isInstance( te ) )
|
||||||
return (T) te;
|
{
|
||||||
}
|
return (T) te;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final TileEntity createNewTileEntity(final World var1, final int var2) {
|
public final TileEntity createNewTileEntity( final World var1, final int var2 )
|
||||||
if (this.hasBlockTileEntity()) {
|
{
|
||||||
try {
|
if( this.hasBlockTileEntity() )
|
||||||
return this.tileEntityType.newInstance();
|
{
|
||||||
} catch (final InstantiationException e) {
|
try
|
||||||
throw new IllegalStateException("Failed to create a new instance of an illegal class " + this.tileEntityType, e);
|
{
|
||||||
} catch (final IllegalAccessException e) {
|
return this.tileEntityType.newInstance();
|
||||||
throw new IllegalStateException("Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e);
|
}
|
||||||
}
|
catch( final InstantiationException e )
|
||||||
}
|
{
|
||||||
|
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.tileEntityType, e );
|
||||||
|
}
|
||||||
|
catch( final IllegalAccessException e )
|
||||||
|
{
|
||||||
|
throw new IllegalStateException( "Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(final World w, final BlockPos pos, final IBlockState state) {
|
public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
|
||||||
final AEBaseTile te = this.getTileEntity(w, pos);
|
{
|
||||||
if (te != null) {
|
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||||
final ArrayList<ItemStack> drops = new ArrayList<>();
|
if( te != null )
|
||||||
if (te.dropItems()) {
|
{
|
||||||
te.getDrops(w, pos, drops);
|
final ArrayList<ItemStack> drops = new ArrayList<>();
|
||||||
} else {
|
if( te.dropItems() )
|
||||||
te.getNoDrops(w, pos, drops);
|
{
|
||||||
}
|
te.getDrops( w, pos, drops );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
te.getNoDrops( w, pos, drops );
|
||||||
|
}
|
||||||
|
|
||||||
// Cry ;_; ...
|
// Cry ;_; ...
|
||||||
Platform.spawnDrops(w, pos, drops);
|
Platform.spawnDrops( w, pos, drops );
|
||||||
}
|
}
|
||||||
|
|
||||||
// super will remove the TE, as it is not an instance of BlockContainer
|
// super will remove the TE, as it is not an instance of BlockContainer
|
||||||
super.breakBlock(w, pos, state);
|
super.breakBlock( w, pos, state );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final EnumFacing[] getValidRotations(final World w, final BlockPos pos) {
|
public final EnumFacing[] getValidRotations( final World w, final BlockPos pos )
|
||||||
final AEBaseTile obj = this.getTileEntity(w, pos);
|
{
|
||||||
if (obj != null && obj.canBeRotated()) {
|
final AEBaseTile obj = this.getTileEntity( w, pos );
|
||||||
return EnumFacing.VALUES;
|
if( obj != null && obj.canBeRotated() )
|
||||||
}
|
{
|
||||||
|
return EnumFacing.VALUES;
|
||||||
|
}
|
||||||
|
|
||||||
return super.getValidRotations(w, pos);
|
return super.getValidRotations( w, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color) {
|
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color )
|
||||||
final TileEntity te = this.getTileEntity(world, pos);
|
{
|
||||||
|
final TileEntity te = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
if (te instanceof IColorableTile) {
|
if( te instanceof IColorableTile )
|
||||||
final IColorableTile ct = (IColorableTile) te;
|
{
|
||||||
final AEColor c = ct.getColor();
|
final IColorableTile ct = (IColorableTile) te;
|
||||||
final AEColor newColor = AEColor.values()[color.getMetadata()];
|
final AEColor c = ct.getColor();
|
||||||
|
final AEColor newColor = AEColor.values()[color.getMetadata()];
|
||||||
|
|
||||||
if (c != newColor) {
|
if( c != newColor )
|
||||||
ct.recolourBlock(side, newColor, null);
|
{
|
||||||
return true;
|
ct.recolourBlock( side, newColor, null );
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return super.recolorBlock(world, pos, side, color);
|
return super.recolorBlock( world, pos, side, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(IBlockState state, final World w, final BlockPos pos) {
|
public int getComparatorInputOverride( IBlockState state, final World w, final BlockPos pos )
|
||||||
final TileEntity te = this.getTileEntity(w, pos);
|
{
|
||||||
if (te instanceof AEBaseInvTile) {
|
final TileEntity te = this.getTileEntity( w, pos );
|
||||||
AEBaseInvTile invTile = (AEBaseInvTile) te;
|
if( te instanceof AEBaseInvTile )
|
||||||
if (invTile.getInternalInventory().getSlots() > 0) {
|
{
|
||||||
return ItemHandlerHelper.calcRedstoneFromInventory(invTile.getInternalInventory());
|
AEBaseInvTile invTile = (AEBaseInvTile) te;
|
||||||
}
|
if( invTile.getInternalInventory().getSlots() > 0 )
|
||||||
}
|
{
|
||||||
return 0;
|
return ItemHandlerHelper.calcRedstoneFromInventory( invTile.getInternalInventory() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean eventReceived(final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam) {
|
public boolean eventReceived( final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam )
|
||||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
{
|
||||||
final TileEntity tileentity = worldIn.getTileEntity(pos);
|
super.eventReceived( state, worldIn, pos, eventID, eventParam );
|
||||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
final TileEntity tileentity = worldIn.getTileEntity( pos );
|
||||||
}
|
return tileentity != null ? tileentity.receiveClientEvent( eventID, eventParam ) : false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is) {
|
public void onBlockPlacedBy( final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is )
|
||||||
if (is.hasDisplayName()) {
|
{
|
||||||
final TileEntity te = this.getTileEntity(w, pos);
|
if( is.hasDisplayName() )
|
||||||
if (te instanceof AEBaseTile) {
|
{
|
||||||
((AEBaseTile) w.getTileEntity(pos)).setName(is.getDisplayName());
|
final TileEntity te = this.getTileEntity( w, pos );
|
||||||
}
|
if( te instanceof AEBaseTile )
|
||||||
}
|
{
|
||||||
}
|
( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ )
|
||||||
ItemStack heldItem;
|
{
|
||||||
if (player != null && !player.getHeldItem(hand).isEmpty()) {
|
ItemStack heldItem;
|
||||||
heldItem = player.getHeldItem(hand);
|
if( player != null && !player.getHeldItem( hand ).isEmpty() )
|
||||||
|
{
|
||||||
|
heldItem = player.getHeldItem( hand );
|
||||||
|
|
||||||
if (Platform.isWrench(player, heldItem, pos) && player.isSneaking()) {
|
if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() )
|
||||||
final IBlockState blockState = world.getBlockState(pos);
|
{
|
||||||
final Block block = blockState.getBlock();
|
final IBlockState blockState = world.getBlockState( pos );
|
||||||
|
final Block block = blockState.getBlock();
|
||||||
|
|
||||||
if (block == null) {
|
if( block == null )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final AEBaseTile tile = this.getTileEntity(world, pos);
|
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
if (tile == null) {
|
if( tile == null )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (tile instanceof TileCableBus || tile instanceof TileSkyChest) {
|
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final ItemStack[] itemDropCandidates = Platform.getBlockDrops(world, pos);
|
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
|
||||||
final ItemStack op = new ItemStack(this);
|
final ItemStack op = new ItemStack( this );
|
||||||
|
|
||||||
for (final ItemStack ol : itemDropCandidates) {
|
for( final ItemStack ol : itemDropCandidates )
|
||||||
if (Platform.itemComparisons().isEqualItemType(ol, op)) {
|
{
|
||||||
final NBTTagCompound tag = tile.downloadSettings(SettingsFrom.DISMANTLE_ITEM);
|
if( Platform.itemComparisons().isEqualItemType( ol, op ) )
|
||||||
if (tag != null) {
|
{
|
||||||
ol.setTagCompound(tag);
|
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
|
||||||
}
|
if( tag != null )
|
||||||
}
|
{
|
||||||
}
|
ol.setTagCompound( tag );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (block.removedByPlayer(blockState, world, pos, player, false)) {
|
if( block.removedByPlayer( blockState, world, pos, player, false ) )
|
||||||
final List<ItemStack> itemsToDrop = Lists.newArrayList(itemDropCandidates);
|
{
|
||||||
Platform.spawnDrops(world, pos, itemsToDrop);
|
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
|
||||||
world.setBlockToAir(pos);
|
Platform.spawnDrops( world, pos, itemsToDrop );
|
||||||
}
|
world.setBlockToAir( pos );
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heldItem.getItem() instanceof IMemoryCard && !(this instanceof BlockCableBus)) {
|
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
|
||||||
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
{
|
||||||
final AEBaseTile tileEntity = this.getTileEntity(world, pos);
|
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
||||||
|
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
if (tileEntity == null) {
|
if( tileEntity == null )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final String name = this.getTranslationKey();
|
final String name = this.getUnlocalizedName();
|
||||||
|
|
||||||
if (player.isSneaking()) {
|
if( player.isSneaking() )
|
||||||
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
|
{
|
||||||
if (data != null) {
|
final NBTTagCompound data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||||
memoryCard.setMemoryCardContents(heldItem, name, data);
|
if( data != null )
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_SAVED);
|
{
|
||||||
}
|
memoryCard.setMemoryCardContents( heldItem, name, data );
|
||||||
} else {
|
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
|
||||||
final String savedName = memoryCard.getSettingsName(heldItem);
|
}
|
||||||
final NBTTagCompound data = memoryCard.getData(heldItem);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final String savedName = memoryCard.getSettingsName( heldItem );
|
||||||
|
final NBTTagCompound data = memoryCard.getData( heldItem );
|
||||||
|
|
||||||
if (this.getTranslationKey().equals(savedName)) {
|
if( this.getUnlocalizedName().equals( savedName ) )
|
||||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
{
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
tileEntity.uploadSettings( SettingsFrom.MEMORY_CARD, data );
|
||||||
} else {
|
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (heldItem.getItem() instanceof ToolQuartzCuttingKnife && !(this instanceof BlockCableBus)) {
|
return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), facing, hitX, hitY, hitZ );
|
||||||
if (ForgeEventFactory.onItemUseStart(player, heldItem, 1) <= 0) return false;
|
}
|
||||||
final AEBaseTile tile = this.getTileEntity(world, pos);
|
|
||||||
if (tile == null) return false;
|
|
||||||
Platform.openGUI(player, tile, AEPartLocation.fromFacing(facing), GuiBridge.GUI_RENAMER);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.onActivated(world, pos, player, hand, player.getHeldItem(hand), facing, hitX, hitY, hitZ);
|
@Override
|
||||||
}
|
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||||
|
{
|
||||||
|
return this.getTileEntity( w, pos );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
|
public ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||||
return this.getTileEntity(w, pos);
|
{
|
||||||
}
|
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||||
|
if( te instanceof ICustomCollision )
|
||||||
|
{
|
||||||
|
return (ICustomCollision) te;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return super.getCustomCollision( w, pos );
|
||||||
public ICustomCollision getCustomCollision(final World w, final BlockPos pos) {
|
}
|
||||||
final AEBaseTile te = this.getTileEntity(w, pos);
|
|
||||||
if (te instanceof ICustomCollision) {
|
|
||||||
return (ICustomCollision) te;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.getCustomCollision(w, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ package appeng.block;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEDecorativeBlock extends AEBaseBlock {
|
public abstract class AEDecorativeBlock extends AEBaseBlock
|
||||||
public AEDecorativeBlock(final Material mat) {
|
{
|
||||||
super(mat);
|
public AEDecorativeBlock( final Material mat )
|
||||||
}
|
{
|
||||||
|
super( mat );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,24 +23,29 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
|
||||||
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockAccess> {
|
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockAccess>
|
||||||
@Override
|
{
|
||||||
public String getName() {
|
@Override
|
||||||
return "ba";
|
public String getName()
|
||||||
}
|
{
|
||||||
|
return "ba";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(final IBlockAccess value) {
|
public boolean isValid( final IBlockAccess value )
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<IBlockAccess> getType() {
|
public Class<IBlockAccess> getType()
|
||||||
return IBlockAccess.class;
|
{
|
||||||
}
|
return IBlockAccess.class;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String valueToString(final IBlockAccess value) {
|
public String valueToString( final IBlockAccess value )
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -23,24 +23,29 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
|
||||||
public final class UnlistedBlockPos implements IUnlistedProperty<BlockPos> {
|
public final class UnlistedBlockPos implements IUnlistedProperty<BlockPos>
|
||||||
@Override
|
{
|
||||||
public String getName() {
|
@Override
|
||||||
return "pos";
|
public String getName()
|
||||||
}
|
{
|
||||||
|
return "pos";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(final BlockPos value) {
|
public boolean isValid( final BlockPos value )
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<BlockPos> getType() {
|
public Class<BlockPos> getType()
|
||||||
return BlockPos.class;
|
{
|
||||||
}
|
return BlockPos.class;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String valueToString(final BlockPos value) {
|
public String valueToString( final BlockPos value )
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -23,32 +23,38 @@ import net.minecraft.util.EnumFacing;
|
|||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
|
||||||
public class UnlistedDirection implements IUnlistedProperty<EnumFacing> {
|
public class UnlistedDirection implements IUnlistedProperty<EnumFacing>
|
||||||
|
{
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public UnlistedDirection(String name) {
|
public UnlistedDirection( String name )
|
||||||
this.name = name;
|
{
|
||||||
}
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
return this.name;
|
{
|
||||||
}
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(EnumFacing value) {
|
public boolean isValid( EnumFacing value )
|
||||||
return value != null;
|
{
|
||||||
}
|
return value != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<EnumFacing> getType() {
|
public Class<EnumFacing> getType()
|
||||||
return EnumFacing.class;
|
{
|
||||||
}
|
return EnumFacing.class;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String valueToString(EnumFacing value) {
|
public String valueToString( EnumFacing value )
|
||||||
return value.getName();
|
{
|
||||||
}
|
return value.getName();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
package appeng.block.crafting;
|
package appeng.block.crafting;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEColor;
|
|
||||||
import appeng.client.UnlistedProperty;
|
|
||||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
@@ -36,47 +33,57 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.UnlistedProperty;
|
||||||
|
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||||
|
|
||||||
public class BlockCraftingMonitor extends BlockCraftingUnit {
|
|
||||||
|
|
||||||
public static final UnlistedProperty<AEColor> COLOR = new UnlistedProperty<>("color", AEColor.class);
|
public class BlockCraftingMonitor extends BlockCraftingUnit
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCraftingMonitor() {
|
public static final UnlistedProperty<AEColor> COLOR = new UnlistedProperty<>( "color", AEColor.class );
|
||||||
super(CraftingUnitType.MONITOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BlockCraftingMonitor()
|
||||||
protected BlockStateContainer createBlockState() {
|
{
|
||||||
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{
|
super( CraftingUnitType.MONITOR );
|
||||||
STATE,
|
}
|
||||||
COLOR,
|
|
||||||
FORWARD,
|
|
||||||
UP
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
protected BlockStateContainer createBlockState()
|
||||||
AEColor color = AEColor.TRANSPARENT;
|
{
|
||||||
EnumFacing forward = EnumFacing.NORTH;
|
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||||
EnumFacing up = EnumFacing.UP;
|
STATE,
|
||||||
|
COLOR,
|
||||||
|
FORWARD,
|
||||||
|
UP
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
TileCraftingMonitorTile te = this.getTileEntity(world, pos);
|
@Override
|
||||||
if (te != null) {
|
public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
color = te.getColor();
|
{
|
||||||
forward = te.getForward();
|
AEColor color = AEColor.TRANSPARENT;
|
||||||
up = te.getUp();
|
EnumFacing forward = EnumFacing.NORTH;
|
||||||
}
|
EnumFacing up = EnumFacing.UP;
|
||||||
|
|
||||||
return super.getExtendedState(state, world, pos)
|
TileCraftingMonitorTile te = this.getTileEntity( world, pos );
|
||||||
.withProperty(COLOR, color)
|
if( te != null )
|
||||||
.withProperty(FORWARD, forward)
|
{
|
||||||
.withProperty(UP, up);
|
color = te.getColor();
|
||||||
}
|
forward = te.getForward();
|
||||||
|
up = te.getUp();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return super.getExtendedState( state, world, pos )
|
||||||
@SideOnly(Side.CLIENT)
|
.withProperty( COLOR, color )
|
||||||
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
|
.withProperty( FORWARD, forward )
|
||||||
itemStacks.add(new ItemStack(this, 1, 0));
|
.withProperty( UP, up );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
|
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
|
||||||
|
{
|
||||||
|
itemStacks.add( new ItemStack( this, 1, 0 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,12 @@
|
|||||||
package appeng.block.crafting;
|
package appeng.block.crafting;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCraftingStorage extends BlockCraftingUnit {
|
public class BlockCraftingStorage extends BlockCraftingUnit
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCraftingStorage(final CraftingUnitType type) {
|
public BlockCraftingStorage( final CraftingUnitType type )
|
||||||
super(type);
|
{
|
||||||
}
|
super( type );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,8 @@
|
|||||||
package appeng.block.crafting;
|
package appeng.block.crafting;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import java.util.EnumSet;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.client.UnlistedProperty;
|
|
||||||
import appeng.client.render.crafting.CraftingCubeState;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.crafting.TileCraftingTile;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
@@ -43,106 +38,130 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.util.AEPartLocation;
|
||||||
import java.util.EnumSet;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.client.UnlistedProperty;
|
||||||
|
import appeng.client.render.crafting.CraftingCubeState;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.crafting.TileCraftingTile;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCraftingUnit extends AEBaseTileBlock {
|
public class BlockCraftingUnit extends AEBaseTileBlock
|
||||||
public static final PropertyBool FORMED = PropertyBool.create("formed");
|
{
|
||||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
public static final PropertyBool FORMED = PropertyBool.create( "formed" );
|
||||||
public static final UnlistedProperty<CraftingCubeState> STATE = new UnlistedProperty<>("state", CraftingCubeState.class);
|
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||||
|
public static final UnlistedProperty<CraftingCubeState> STATE = new UnlistedProperty<>( "state", CraftingCubeState.class );
|
||||||
|
|
||||||
public final CraftingUnitType type;
|
public final CraftingUnitType type;
|
||||||
|
|
||||||
public BlockCraftingUnit(final CraftingUnitType type) {
|
public BlockCraftingUnit( final CraftingUnitType type )
|
||||||
super(Material.IRON);
|
{
|
||||||
|
super( Material.IRON );
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{POWERED, FORMED};
|
{
|
||||||
}
|
return new IProperty[] { POWERED, FORMED };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
|
{
|
||||||
|
|
||||||
EnumSet<EnumFacing> connections = EnumSet.noneOf(EnumFacing.class);
|
EnumSet<EnumFacing> connections = EnumSet.noneOf( EnumFacing.class );
|
||||||
|
|
||||||
for (EnumFacing facing : EnumFacing.values()) {
|
for( EnumFacing facing : EnumFacing.values() )
|
||||||
if (this.isConnected(world, pos, facing)) {
|
{
|
||||||
connections.add(facing);
|
if( this.isConnected( world, pos, facing ) )
|
||||||
}
|
{
|
||||||
}
|
connections.add( facing );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||||
|
|
||||||
return extState.withProperty(STATE, new CraftingCubeState(connections));
|
return extState.withProperty( STATE, new CraftingCubeState( connections ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConnected(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
private boolean isConnected( IBlockAccess world, BlockPos pos, EnumFacing side )
|
||||||
BlockPos adjacentPos = pos.offset(side);
|
{
|
||||||
return world.getBlockState(adjacentPos).getBlock() instanceof BlockCraftingUnit;
|
BlockPos adjacentPos = pos.offset( side );
|
||||||
}
|
return world.getBlockState( adjacentPos ).getBlock() instanceof BlockCraftingUnit;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState()
|
||||||
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{STATE});
|
{
|
||||||
}
|
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { STATE } );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(final int meta) {
|
public IBlockState getStateFromMeta( final int meta )
|
||||||
return this.getDefaultState().withProperty(POWERED, (meta & 1) == 1).withProperty(FORMED, (meta & 2) == 2);
|
{
|
||||||
}
|
return this.getDefaultState().withProperty( POWERED, ( meta & 1 ) == 1 ).withProperty( FORMED, ( meta & 2 ) == 2 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(final IBlockState state) {
|
public int getMetaFromState( final IBlockState state )
|
||||||
boolean p = state.getValue(POWERED);
|
{
|
||||||
boolean f = state.getValue(FORMED);
|
boolean p = state.getValue( POWERED );
|
||||||
return (p ? 1 : 0) | (f ? 2 : 0);
|
boolean f = state.getValue( FORMED );
|
||||||
}
|
return ( p ? 1 : 0 ) | ( f ? 2 : 0 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos) {
|
public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos )
|
||||||
final TileCraftingTile cp = this.getTileEntity(worldIn, pos);
|
{
|
||||||
if (cp != null) {
|
final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
|
||||||
cp.updateMultiBlock();
|
if( cp != null )
|
||||||
}
|
{
|
||||||
}
|
cp.updateMultiBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(final World w, final BlockPos pos, final IBlockState state) {
|
public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
|
||||||
final TileCraftingTile cp = this.getTileEntity(w, pos);
|
{
|
||||||
if (cp != null) {
|
final TileCraftingTile cp = this.getTileEntity( w, pos );
|
||||||
cp.breakCluster();
|
if( cp != null )
|
||||||
}
|
{
|
||||||
|
cp.breakCluster();
|
||||||
|
}
|
||||||
|
|
||||||
super.breakBlock(w, pos, state);
|
super.breakBlock( w, pos, state );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
final TileCraftingTile tg = this.getTileEntity(w, pos);
|
{
|
||||||
|
final TileCraftingTile tg = this.getTileEntity( w, pos );
|
||||||
|
|
||||||
if (tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive()) {
|
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
|
||||||
if (Platform.isClient()) {
|
{
|
||||||
return true;
|
if( Platform.isClient() )
|
||||||
}
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_CRAFTING_CPU);
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onBlockActivated(w, pos, state, p, hand, side, hitX, hitY, hitZ);
|
return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CraftingUnitType {
|
public enum CraftingUnitType
|
||||||
UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
|
{
|
||||||
}
|
UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
package appeng.block.crafting;
|
package appeng.block.crafting;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.crafting.TileMolecularAssembler;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
@@ -38,73 +33,79 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.crafting.TileMolecularAssembler;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockMolecularAssembler extends AEBaseTileBlock {
|
public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||||
|
|
||||||
public BlockMolecularAssembler() {
|
public BlockMolecularAssembler()
|
||||||
super(Material.IRON);
|
{
|
||||||
|
super( Material.IRON );
|
||||||
|
|
||||||
this.setOpaque(false);
|
this.setOpaque( false );
|
||||||
this.lightOpacity = 1;
|
this.lightOpacity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{POWERED};
|
{
|
||||||
}
|
return new IProperty[] { POWERED };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||||
boolean powered = false;
|
{
|
||||||
TileMolecularAssembler te = this.getTileEntity(worldIn, pos);
|
boolean powered = false;
|
||||||
if (te != null) {
|
TileMolecularAssembler te = this.getTileEntity( worldIn, pos );
|
||||||
powered = te.isPowered();
|
if( te != null )
|
||||||
}
|
{
|
||||||
|
powered = te.isPowered();
|
||||||
|
}
|
||||||
|
|
||||||
return super.getActualState(state, worldIn, pos).withProperty(POWERED, powered);
|
return super.getActualState( state, worldIn, pos ).withProperty( POWERED, powered );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE: This is only used to determine how to render an item being held in hand.
|
* NOTE: This is only used to determine how to render an item being held in hand.
|
||||||
* For determining block rendering, the method below is used (canRenderInLayer).
|
* For determining block rendering, the method below is used (canRenderInLayer).
|
||||||
*/
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
@Override
|
@Override
|
||||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
|
||||||
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
|
{
|
||||||
}
|
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
final TileMolecularAssembler tg = this.getTileEntity(w, pos);
|
{
|
||||||
if (tg != null && !p.isSneaking()) {
|
final TileMolecularAssembler tg = this.getTileEntity( w, pos );
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_MAC);
|
if( tg != null && !p.isSneaking() )
|
||||||
return true;
|
{
|
||||||
}
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return super.onBlockActivated(w, pos, state, p, hand, side, hitX, hitY, hitZ);
|
return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
|
||||||
final TileMolecularAssembler tg = this.getTileEntity(world, pos);
|
|
||||||
if (tg != null) {
|
|
||||||
tg.updateNeighbors(world, pos, neighbor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,27 +19,32 @@
|
|||||||
package appeng.block.crafting;
|
package appeng.block.crafting;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.block.AEBaseItemBlock;
|
import appeng.block.AEBaseItemBlock;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
|
|
||||||
public class ItemCraftingStorage extends AEBaseItemBlock {
|
public class ItemCraftingStorage extends AEBaseItemBlock
|
||||||
|
{
|
||||||
|
|
||||||
public ItemCraftingStorage(final Block id) {
|
public ItemCraftingStorage( final Block id )
|
||||||
super(id);
|
{
|
||||||
}
|
super( id );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
public ItemStack getContainerItem( final ItemStack itemStack )
|
||||||
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack(1).orElse(ItemStack.EMPTY);
|
{
|
||||||
}
|
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasContainerItem(final ItemStack stack) {
|
public boolean hasContainerItem( final ItemStack stack )
|
||||||
return AEConfig.instance().isFeatureEnabled(AEFeature.ENABLE_DISASSEMBLY_CRAFTING);
|
{
|
||||||
}
|
return AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
package appeng.block.grindstone;
|
package appeng.block.grindstone;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.implementations.tiles.ICrankable;
|
import javax.annotation.Nullable;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.stats.Stats;
|
|
||||||
import appeng.tile.AEBaseTile;
|
|
||||||
import appeng.tile.grindstone.TileCrank;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
@@ -40,114 +37,145 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.implementations.tiles.ICrankable;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.stats.Stats;
|
||||||
|
import appeng.tile.AEBaseTile;
|
||||||
|
import appeng.tile.grindstone.TileCrank;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCrank extends AEBaseTileBlock {
|
public class BlockCrank extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCrank() {
|
public BlockCrank()
|
||||||
super(Material.WOOD);
|
{
|
||||||
|
super( Material.WOOD );
|
||||||
|
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity( 0 );
|
||||||
this.setHarvestLevel("axe", 0);
|
this.setHarvestLevel( "axe", 0 );
|
||||||
this.setFullSize(this.setOpaque(false));
|
this.setFullSize( this.setOpaque( false ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (player instanceof FakePlayer || player == null) {
|
{
|
||||||
this.dropCrank(w, pos);
|
if( player instanceof FakePlayer || player == null )
|
||||||
return true;
|
{
|
||||||
}
|
this.dropCrank( w, pos );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
final AEBaseTile tile = this.getTileEntity(w, pos);
|
final AEBaseTile tile = this.getTileEntity( w, pos );
|
||||||
if (tile instanceof TileCrank) {
|
if( tile instanceof TileCrank )
|
||||||
if (((TileCrank) tile).power()) {
|
{
|
||||||
Stats.TurnedCranks.addToPlayer(player, 1);
|
if( ( (TileCrank) tile ).power() )
|
||||||
}
|
{
|
||||||
}
|
Stats.TurnedCranks.addToPlayer( player, 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropCrank(final World world, final BlockPos pos) {
|
private void dropCrank( final World world, final BlockPos pos )
|
||||||
world.destroyBlock(pos, true); // w.destroyBlock( x, y, z, true );
|
{
|
||||||
world.notifyBlockUpdate(pos, this.getDefaultState(), world.getBlockState(pos), 3);
|
world.destroyBlock( pos, true ); // w.destroyBlock( x, y, z, true );
|
||||||
}
|
world.notifyBlockUpdate( pos, this.getDefaultState(), world.getBlockState( pos ), 3 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(final World world, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack stack) {
|
public void onBlockPlacedBy( final World world, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack stack )
|
||||||
final AEBaseTile tile = this.getTileEntity(world, pos);
|
{
|
||||||
if (tile != null) {
|
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
final EnumFacing mnt = this.findCrankable(world, pos);
|
if( tile != null )
|
||||||
EnumFacing forward = EnumFacing.UP;
|
{
|
||||||
if (mnt == EnumFacing.UP || mnt == EnumFacing.DOWN) {
|
final EnumFacing mnt = this.findCrankable( world, pos );
|
||||||
forward = EnumFacing.SOUTH;
|
EnumFacing forward = EnumFacing.UP;
|
||||||
}
|
if( mnt == EnumFacing.UP || mnt == EnumFacing.DOWN )
|
||||||
tile.setOrientation(forward, mnt.getOpposite());
|
{
|
||||||
} else {
|
forward = EnumFacing.SOUTH;
|
||||||
this.dropCrank(world, pos);
|
}
|
||||||
}
|
tile.setOrientation( forward, mnt.getOpposite() );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.dropCrank( world, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
|
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||||
final TileEntity te = w.getTileEntity(pos);
|
{
|
||||||
return !(te instanceof TileCrank) || this.isCrankable(w, pos, up.getOpposite());
|
final TileEntity te = w.getTileEntity( pos );
|
||||||
}
|
return !( te instanceof TileCrank ) || this.isCrankable( w, pos, up.getOpposite() );
|
||||||
|
}
|
||||||
|
|
||||||
private EnumFacing findCrankable(final World world, final BlockPos pos) {
|
private EnumFacing findCrankable( final World world, final BlockPos pos )
|
||||||
for (final EnumFacing dir : EnumFacing.VALUES) {
|
{
|
||||||
if (this.isCrankable(world, pos, dir)) {
|
for( final EnumFacing dir : EnumFacing.VALUES )
|
||||||
return dir;
|
{
|
||||||
}
|
if( this.isCrankable( world, pos, dir ) )
|
||||||
}
|
{
|
||||||
return null;
|
return dir;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isCrankable(final World world, final BlockPos pos, final EnumFacing offset) {
|
private boolean isCrankable( final World world, final BlockPos pos, final EnumFacing offset )
|
||||||
final BlockPos o = pos.offset(offset);
|
{
|
||||||
final TileEntity te = world.getTileEntity(o);
|
final BlockPos o = pos.offset( offset );
|
||||||
|
final TileEntity te = world.getTileEntity( o );
|
||||||
|
|
||||||
return te instanceof ICrankable && ((ICrankable) te).canCrankAttach(offset.getOpposite());
|
return te instanceof ICrankable && ( (ICrankable) te ).canCrankAttach( offset.getOpposite() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
public EnumBlockRenderType getRenderType( IBlockState state )
|
||||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
{
|
||||||
}
|
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
|
{
|
||||||
|
|
||||||
final AEBaseTile tile = this.getTileEntity(world, pos);
|
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
if (tile != null) {
|
if( tile != null )
|
||||||
if (!this.isCrankable(world, pos, tile.getUp().getOpposite())) {
|
{
|
||||||
this.dropCrank(world, pos);
|
if( !this.isCrankable( world, pos, tile.getUp().getOpposite() ) )
|
||||||
}
|
{
|
||||||
} else {
|
this.dropCrank( world, pos );
|
||||||
this.dropCrank(world, pos);
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
this.dropCrank( world, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(final World world, final BlockPos pos) {
|
public boolean canPlaceBlockAt( final World world, final BlockPos pos )
|
||||||
return this.findCrankable(world, pos) != null;
|
{
|
||||||
}
|
return this.findCrankable( world, pos ) != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public boolean canPlaceTorchOnTop( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
public BlockFaceShape getBlockFaceShape( IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face )
|
||||||
return BlockFaceShape.UNDEFINED;
|
{
|
||||||
}
|
return BlockFaceShape.UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
package appeng.block.grindstone;
|
package appeng.block.grindstone;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.grindstone.TileGrinder;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -32,24 +29,32 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.grindstone.TileGrinder;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockGrinder extends AEBaseTileBlock {
|
public class BlockGrinder extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public BlockGrinder() {
|
public BlockGrinder()
|
||||||
super(Material.ROCK);
|
{
|
||||||
|
super( Material.ROCK );
|
||||||
|
|
||||||
this.setHardness(3.2F);
|
this.setHardness( 3.2F );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
final TileGrinder tg = this.getTileEntity(w, pos);
|
{
|
||||||
if (tg != null && !p.isSneaking()) {
|
final TileGrinder tg = this.getTileEntity( w, pos );
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_GRINDER);
|
if( tg != null && !p.isSneaking() )
|
||||||
return true;
|
{
|
||||||
}
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_GRINDER );
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,19 +19,22 @@
|
|||||||
package appeng.block.grindstone;
|
package appeng.block.grindstone;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.client.render.tesr.CrankTESR;
|
import appeng.client.render.tesr.CrankTESR;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
public class CrankRendering extends BlockRenderingCustomizer {
|
public class CrankRendering extends BlockRenderingCustomizer
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.tesr(new CrankTESR());
|
{
|
||||||
}
|
rendering.tesr( new CrankTESR() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.misc.TileCellWorkbench;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -32,28 +29,38 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.misc.TileCellWorkbench;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCellWorkbench extends AEBaseTileBlock {
|
public class BlockCellWorkbench extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCellWorkbench() {
|
public BlockCellWorkbench()
|
||||||
super(Material.IRON);
|
{
|
||||||
}
|
super( Material.IRON );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (p.isSneaking()) {
|
{
|
||||||
return false;
|
if( p.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TileCellWorkbench tg = this.getTileEntity(w, pos);
|
final TileCellWorkbench tg = this.getTileEntity( w, pos );
|
||||||
if (tg != null) {
|
if( tg != null )
|
||||||
if (Platform.isServer()) {
|
{
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_CELL_WORKBENCH);
|
if( Platform.isServer() )
|
||||||
}
|
{
|
||||||
return true;
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CELL_WORKBENCH );
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,17 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import java.util.Collections;
|
||||||
import appeng.api.util.AEAxisAlignedBB;
|
import java.util.List;
|
||||||
import appeng.block.AEBaseTileBlock;
|
import java.util.Random;
|
||||||
import appeng.client.render.effects.LightningFX;
|
|
||||||
import appeng.client.render.renderable.ItemRenderable;
|
import javax.annotation.Nullable;
|
||||||
import appeng.client.render.tesr.ModularTESR;
|
|
||||||
import appeng.core.AEConfig;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import appeng.core.AppEng;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import appeng.helpers.ICustomCollision;
|
import org.lwjgl.util.vector.Matrix4f;
|
||||||
import appeng.tile.AEBaseTile;
|
import org.lwjgl.util.vector.Vector3f;
|
||||||
import appeng.tile.misc.TileCharger;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -45,138 +44,164 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.lwjgl.util.vector.Matrix4f;
|
|
||||||
import org.lwjgl.util.vector.Vector3f;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.AEApi;
|
||||||
import java.util.Collections;
|
import appeng.api.util.AEAxisAlignedBB;
|
||||||
import java.util.List;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import java.util.Random;
|
import appeng.client.render.effects.LightningFX;
|
||||||
|
import appeng.client.render.renderable.ItemRenderable;
|
||||||
|
import appeng.client.render.tesr.ModularTESR;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AppEng;
|
||||||
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.tile.AEBaseTile;
|
||||||
|
import appeng.tile.misc.TileCharger;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
|
public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCharger() {
|
public BlockCharger()
|
||||||
super(Material.IRON);
|
{
|
||||||
|
super( Material.IRON );
|
||||||
|
|
||||||
this.setLightOpacity(2);
|
this.setLightOpacity( 2 );
|
||||||
this.setFullSize(this.setOpaque(false));
|
this.setFullSize( this.setOpaque( false ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (player.isSneaking()) {
|
{
|
||||||
return false;
|
if( player.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Platform.isServer()) {
|
if( Platform.isServer() )
|
||||||
final TileCharger tc = this.getTileEntity(w, pos);
|
{
|
||||||
if (tc != null) {
|
final TileCharger tc = this.getTileEntity( w, pos );
|
||||||
tc.activate(player);
|
if( tc != null )
|
||||||
}
|
{
|
||||||
}
|
tc.activate( player );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
|
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||||
if (!AEConfig.instance().isEnableEffects()) {
|
{
|
||||||
return;
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.nextFloat() < 0.98) {
|
if( r.nextFloat() < 0.98 )
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final AEBaseTile tile = this.getTileEntity(w, pos);
|
final AEBaseTile tile = this.getTileEntity( w, pos );
|
||||||
if (tile instanceof TileCharger) {
|
if( tile instanceof TileCharger )
|
||||||
final TileCharger tc = (TileCharger) tile;
|
{
|
||||||
|
final TileCharger tc = (TileCharger) tile;
|
||||||
|
|
||||||
if (AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs(tc.getInternalInventory().getStackInSlot(0))) {
|
if( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getInternalInventory().getStackInSlot( 0 ) ) )
|
||||||
final double xOff = 0.0;
|
{
|
||||||
final double yOff = 0.0;
|
final double xOff = 0.0;
|
||||||
final double zOff = 0.0;
|
final double yOff = 0.0;
|
||||||
|
final double zOff = 0.0;
|
||||||
|
|
||||||
for (int bolts = 0; bolts < 3; bolts++) {
|
for( int bolts = 0; bolts < 3; bolts++ )
|
||||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
{
|
||||||
final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
|
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||||
.getZ(), 0.0D, 0.0D, 0.0D);
|
{
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
|
||||||
}
|
.getZ(), 0.0D, 0.0D, 0.0D );
|
||||||
}
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
final TileCharger tile = this.getTileEntity(w, pos);
|
{
|
||||||
if (tile != null) {
|
final TileCharger tile = this.getTileEntity( w, pos );
|
||||||
final double twoPixels = 2.0 / 16.0;
|
if( tile != null )
|
||||||
final EnumFacing up = tile.getUp();
|
{
|
||||||
final EnumFacing forward = tile.getForward();
|
final double twoPixels = 2.0 / 16.0;
|
||||||
final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels);
|
final EnumFacing up = tile.getUp();
|
||||||
|
final EnumFacing forward = tile.getForward();
|
||||||
|
final AEAxisAlignedBB bb = new AEAxisAlignedBB( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels );
|
||||||
|
|
||||||
if (up.getXOffset() != 0) {
|
if( up.getFrontOffsetX() != 0 )
|
||||||
bb.minX = 0;
|
{
|
||||||
bb.maxX = 1;
|
bb.minX = 0;
|
||||||
}
|
bb.maxX = 1;
|
||||||
if (up.getYOffset() != 0) {
|
}
|
||||||
bb.minY = 0;
|
if( up.getFrontOffsetY() != 0 )
|
||||||
bb.maxY = 1;
|
{
|
||||||
}
|
bb.minY = 0;
|
||||||
if (up.getZOffset() != 0) {
|
bb.maxY = 1;
|
||||||
bb.minZ = 0;
|
}
|
||||||
bb.maxZ = 1;
|
if( up.getFrontOffsetZ() != 0 )
|
||||||
}
|
{
|
||||||
|
bb.minZ = 0;
|
||||||
|
bb.maxZ = 1;
|
||||||
|
}
|
||||||
|
|
||||||
switch (forward) {
|
switch( forward )
|
||||||
case DOWN:
|
{
|
||||||
bb.maxY = 1;
|
case DOWN:
|
||||||
break;
|
bb.maxY = 1;
|
||||||
case UP:
|
break;
|
||||||
bb.minY = 0;
|
case UP:
|
||||||
break;
|
bb.minY = 0;
|
||||||
case NORTH:
|
break;
|
||||||
bb.maxZ = 1;
|
case NORTH:
|
||||||
break;
|
bb.maxZ = 1;
|
||||||
case SOUTH:
|
break;
|
||||||
bb.minZ = 0;
|
case SOUTH:
|
||||||
break;
|
bb.minZ = 0;
|
||||||
case EAST:
|
break;
|
||||||
bb.minX = 0;
|
case EAST:
|
||||||
break;
|
bb.minX = 0;
|
||||||
case WEST:
|
break;
|
||||||
bb.maxX = 1;
|
case WEST:
|
||||||
break;
|
bb.maxX = 1;
|
||||||
default:
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return Collections.singletonList(bb.getBoundingBox());
|
return Collections.singletonList( bb.getBoundingBox() );
|
||||||
}
|
}
|
||||||
return Collections.singletonList(new AxisAlignedBB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
|
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
out.add(new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
|
{
|
||||||
}
|
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public static TileEntitySpecialRenderer<TileCharger> createTesr() {
|
public static TileEntitySpecialRenderer<TileCharger> createTesr()
|
||||||
return new ModularTESR<>(new ItemRenderable<>(BlockCharger::getRenderedItem));
|
{
|
||||||
}
|
return new ModularTESR<>( new ItemRenderable<>( BlockCharger::getRenderedItem ) );
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
private static Pair<ItemStack, Matrix4f> getRenderedItem(TileCharger tile) {
|
private static Pair<ItemStack, Matrix4f> getRenderedItem( TileCharger tile )
|
||||||
Matrix4f transform = new Matrix4f();
|
{
|
||||||
transform.translate(new Vector3f(0.5f, 0.4f, 0.5f));
|
Matrix4f transform = new Matrix4f();
|
||||||
return new ImmutablePair<>(tile.getInternalInventory().getStackInSlot(0), transform);
|
transform.translate( new Vector3f( 0.5f, 0.4f, 0.5f ) );
|
||||||
}
|
return new ImmutablePair<>( tile.getInternalInventory().getStackInSlot( 0 ), transform );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.misc.TileCondenser;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -32,29 +29,39 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.misc.TileCondenser;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCondenser extends AEBaseTileBlock {
|
public class BlockCondenser extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCondenser() {
|
public BlockCondenser()
|
||||||
super(Material.IRON);
|
{
|
||||||
}
|
super( Material.IRON );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (player.isSneaking()) {
|
{
|
||||||
return false;
|
if( player.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Platform.isServer()) {
|
if( Platform.isServer() )
|
||||||
final TileCondenser tc = this.getTileEntity(w, pos);
|
{
|
||||||
if (tc != null && !player.isSneaking()) {
|
final TileCondenser tc = this.getTileEntity( w, pos );
|
||||||
Platform.openGUI(player, tc, AEPartLocation.fromFacing(side), GuiBridge.GUI_CONDENSER);
|
if( tc != null && !player.isSneaking() )
|
||||||
return true;
|
{
|
||||||
}
|
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CONDENSER );
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.misc.TileInscriber;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -34,41 +31,53 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.misc.TileInscriber;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockInscriber extends AEBaseTileBlock {
|
public class BlockInscriber extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public BlockInscriber() {
|
public BlockInscriber()
|
||||||
super(Material.IRON);
|
{
|
||||||
|
super( Material.IRON );
|
||||||
|
|
||||||
this.setLightOpacity(2);
|
this.setLightOpacity( 2 );
|
||||||
this.setFullSize(this.setOpaque(false));
|
this.setFullSize( this.setOpaque( false ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (p.isSneaking()) {
|
{
|
||||||
return false;
|
if( p.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TileInscriber tg = this.getTileEntity(w, pos);
|
final TileInscriber tg = this.getTileEntity( w, pos );
|
||||||
if (tg != null) {
|
if( tg != null )
|
||||||
if (Platform.isServer()) {
|
{
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_INSCRIBER);
|
if( Platform.isServer() )
|
||||||
}
|
{
|
||||||
return true;
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INSCRIBER );
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
public EnumBlockRenderType getRenderType( IBlockState state )
|
||||||
return EnumBlockRenderType.MODEL;
|
{
|
||||||
}
|
return EnumBlockRenderType.MODEL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(final ItemStack is) {
|
public String getUnlocalizedName( final ItemStack is )
|
||||||
return super.getTranslationKey(is);
|
{
|
||||||
}
|
return super.getUnlocalizedName( is );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,88 +19,91 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.api.util.IOrientable;
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.misc.TileInterface;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.api.util.IOrientable;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.misc.TileInterface;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockInterface extends AEBaseTileBlock {
|
public class BlockInterface extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create("omnidirectional");
|
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create( "omnidirectional" );
|
||||||
|
|
||||||
public BlockInterface() {
|
public BlockInterface()
|
||||||
super(Material.IRON);
|
{
|
||||||
}
|
super( Material.IRON );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{OMNIDIRECTIONAL};
|
{
|
||||||
}
|
return new IProperty[] { OMNIDIRECTIONAL };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
// Determine whether the interface is omni-directional or not
|
{
|
||||||
TileInterface te = this.getTileEntity(world, pos);
|
// Determine whether the interface is omni-directional or not
|
||||||
boolean omniDirectional = true; // The default
|
TileInterface te = this.getTileEntity( world, pos );
|
||||||
if (te != null) {
|
boolean omniDirectional = true; // The default
|
||||||
omniDirectional = te.isOmniDirectional();
|
if( te != null )
|
||||||
}
|
{
|
||||||
|
omniDirectional = te.isOmniDirectional();
|
||||||
|
}
|
||||||
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState( state, world, pos )
|
||||||
.withProperty(OMNIDIRECTIONAL, omniDirectional);
|
.withProperty( OMNIDIRECTIONAL, omniDirectional );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (p.isSneaking()) {
|
{
|
||||||
return false;
|
if( p.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TileInterface tg = this.getTileEntity(w, pos);
|
final TileInterface tg = this.getTileEntity( w, pos );
|
||||||
if (tg != null) {
|
if( tg != null )
|
||||||
if (Platform.isServer()) {
|
{
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_INTERFACE);
|
if( Platform.isServer() )
|
||||||
}
|
{
|
||||||
return true;
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INTERFACE );
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCustomRotation() {
|
protected boolean hasCustomRotation()
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void customRotateBlock(final IOrientable rotatable, final EnumFacing axis) {
|
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
|
||||||
if (rotatable instanceof TileInterface) {
|
{
|
||||||
((TileInterface) rotatable).setSide(axis);
|
if( rotatable instanceof TileInterface )
|
||||||
}
|
{
|
||||||
}
|
( (TileInterface) rotatable ).setSide( axis );
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
|
||||||
TileEntity tileEntity = this.getTileEntity(worldIn, pos);
|
|
||||||
if (tileEntity != null) {
|
|
||||||
((TileInterface) tileEntity).updateRedstoneState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,10 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.IOrientable;
|
import java.util.Collections;
|
||||||
import appeng.api.util.IOrientableBlock;
|
import java.util.List;
|
||||||
import appeng.block.AEBaseTileBlock;
|
import java.util.Random;
|
||||||
import appeng.helpers.ICustomCollision;
|
|
||||||
import appeng.helpers.MetaRotation;
|
|
||||||
import appeng.tile.misc.TileLightDetector;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
@@ -41,140 +39,166 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.util.IOrientable;
|
||||||
import java.util.Collections;
|
import appeng.api.util.IOrientableBlock;
|
||||||
import java.util.List;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import java.util.Random;
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.helpers.MetaRotation;
|
||||||
|
import appeng.tile.misc.TileLightDetector;
|
||||||
|
|
||||||
|
|
||||||
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision {
|
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
||||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
public static final PropertyDirection FACING = PropertyDirection.create( "facing" );
|
||||||
|
|
||||||
// Used to alternate between two variants of the fixture on adjacent blocks
|
// Used to alternate between two variants of the fixture on adjacent blocks
|
||||||
public static final PropertyBool ODD = PropertyBool.create("odd");
|
public static final PropertyBool ODD = PropertyBool.create( "odd" );
|
||||||
|
|
||||||
public BlockLightDetector() {
|
public BlockLightDetector()
|
||||||
super(Material.CIRCUITS);
|
{
|
||||||
|
super( Material.CIRCUITS );
|
||||||
|
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(ODD, false));
|
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity( 0 );
|
||||||
this.setFullSize(false);
|
this.setFullSize( false );
|
||||||
this.setOpaque(false);
|
this.setOpaque( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(final IBlockState state) {
|
public int getMetaFromState( final IBlockState state )
|
||||||
return state.getValue(FACING).ordinal();
|
{
|
||||||
}
|
return state.getValue( FACING ).ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(final int meta) {
|
public IBlockState getStateFromMeta( final int meta )
|
||||||
EnumFacing facing = EnumFacing.values()[meta];
|
{
|
||||||
return this.getDefaultState().withProperty(FACING, facing);
|
EnumFacing facing = EnumFacing.values()[meta];
|
||||||
}
|
return this.getDefaultState().withProperty( FACING, facing );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{FACING, ODD};
|
{
|
||||||
}
|
return new IProperty[] { FACING, ODD };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWeakPower(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
|
public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||||
if (w instanceof World && ((TileLightDetector) this.getTileEntity(w, pos)).isReady()) {
|
{
|
||||||
return ((World) w).getLightFromNeighbors(pos) - 6;
|
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
|
||||||
}
|
{
|
||||||
|
return ( (World) w ).getLightFromNeighbors( pos ) - 6;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborChange(final IBlockAccess world, final BlockPos pos, final BlockPos neighbor) {
|
public void onNeighborChange( final IBlockAccess world, final BlockPos pos, final BlockPos neighbor )
|
||||||
super.onNeighborChange(world, pos, neighbor);
|
{
|
||||||
|
super.onNeighborChange( world, pos, neighbor );
|
||||||
|
|
||||||
final TileLightDetector tld = this.getTileEntity(world, pos);
|
final TileLightDetector tld = this.getTileEntity( world, pos );
|
||||||
if (tld != null) {
|
if( tld != null )
|
||||||
tld.updateLight();
|
{
|
||||||
}
|
tld.updateLight();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(final IBlockState state, final World worldIn, final BlockPos pos, final Random rand) {
|
public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||||
// cancel out lightning
|
{
|
||||||
}
|
// cancel out lightning
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
|
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||||
return this.canPlaceAt(w, pos, up.getOpposite());
|
{
|
||||||
}
|
return this.canPlaceAt( w, pos, up.getOpposite() );
|
||||||
|
}
|
||||||
|
|
||||||
private boolean canPlaceAt(final World w, final BlockPos pos, final EnumFacing dir) {
|
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
|
||||||
return w.isSideSolid(pos.offset(dir), dir.getOpposite(), false);
|
{
|
||||||
}
|
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
final EnumFacing up = this.getOrientable(w, pos).getUp();
|
{
|
||||||
final double xOff = -0.3 * up.getXOffset();
|
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||||
final double yOff = -0.3 * up.getYOffset();
|
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||||
final double zOff = -0.3 * up.getZOffset();
|
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||||
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||||
}
|
return Collections.singletonList( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {/*
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
|
{/*
|
||||||
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
|
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
|
||||||
* AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff +
|
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
|
||||||
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x
|
* AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff +
|
||||||
* + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x
|
||||||
*/
|
* + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final EnumFacing up = this.getOrientable(world, pos).getUp();
|
{
|
||||||
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
|
final EnumFacing up = this.getOrientable( world, pos ).getUp();
|
||||||
this.dropTorch(world, pos);
|
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
|
||||||
}
|
{
|
||||||
}
|
this.dropTorch( world, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void dropTorch(final World w, final BlockPos pos) {
|
private void dropTorch( final World w, final BlockPos pos )
|
||||||
final IBlockState prev = w.getBlockState(pos);
|
{
|
||||||
w.destroyBlock(pos, true);
|
final IBlockState prev = w.getBlockState( pos );
|
||||||
w.notifyBlockUpdate(pos, prev, w.getBlockState(pos), 3);
|
w.destroyBlock( pos, true );
|
||||||
}
|
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(final World w, final BlockPos pos) {
|
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
|
||||||
for (final EnumFacing dir : EnumFacing.VALUES) {
|
{
|
||||||
if (this.canPlaceAt(w, pos, dir)) {
|
for( final EnumFacing dir : EnumFacing.VALUES )
|
||||||
return true;
|
{
|
||||||
}
|
if( this.canPlaceAt( w, pos, dir ) )
|
||||||
}
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean usesMetadata() {
|
public boolean usesMetadata()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
|
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||||
return new MetaRotation(w, pos, FACING);
|
{
|
||||||
}
|
return new MetaRotation( w, pos, FACING );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,10 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.IOrientable;
|
import java.util.Collections;
|
||||||
import appeng.api.util.IOrientableBlock;
|
import java.util.List;
|
||||||
import appeng.block.AEBaseBlock;
|
import java.util.Random;
|
||||||
import appeng.client.render.effects.LightningFX;
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.helpers.ICustomCollision;
|
|
||||||
import appeng.helpers.MetaRotation;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
@@ -44,157 +40,187 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.util.IOrientable;
|
||||||
import java.util.Collections;
|
import appeng.api.util.IOrientableBlock;
|
||||||
import java.util.List;
|
import appeng.block.AEBaseBlock;
|
||||||
import java.util.Random;
|
import appeng.client.render.effects.LightningFX;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AppEng;
|
||||||
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.helpers.MetaRotation;
|
||||||
|
|
||||||
|
|
||||||
public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, ICustomCollision {
|
public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
||||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
public static final PropertyDirection FACING = PropertyDirection.create( "facing" );
|
||||||
|
|
||||||
// Used to alternate between two variants of the fixture on adjacent blocks
|
// Used to alternate between two variants of the fixture on adjacent blocks
|
||||||
public static final PropertyBool ODD = PropertyBool.create("odd");
|
public static final PropertyBool ODD = PropertyBool.create( "odd" );
|
||||||
|
|
||||||
public BlockQuartzFixture() {
|
public BlockQuartzFixture()
|
||||||
super(Material.CIRCUITS);
|
{
|
||||||
|
super( Material.CIRCUITS );
|
||||||
|
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(ODD, false));
|
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
|
||||||
this.setLightLevel(0.9375F);
|
this.setLightLevel( 0.9375F );
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity( 0 );
|
||||||
this.setFullSize(false);
|
this.setFullSize( false );
|
||||||
this.setOpaque(false);
|
this.setOpaque( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the "ODD" property of the block state according to the placement of the block.
|
* Sets the "ODD" property of the block state according to the placement of the block.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||||
boolean oddPlacement = ((pos.getX() + pos.getY() + pos.getZ()) % 2) != 0;
|
{
|
||||||
|
boolean oddPlacement = ( ( pos.getX() + pos.getY() + pos.getZ() ) % 2 ) != 0;
|
||||||
|
|
||||||
return super.getActualState(state, worldIn, pos)
|
return super.getActualState( state, worldIn, pos )
|
||||||
.withProperty(ODD, oddPlacement);
|
.withProperty( ODD, oddPlacement );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(final IBlockState state) {
|
public int getMetaFromState( final IBlockState state )
|
||||||
return state.getValue(FACING).ordinal();
|
{
|
||||||
}
|
return state.getValue( FACING ).ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(final int meta) {
|
public IBlockState getStateFromMeta( final int meta )
|
||||||
EnumFacing facing = EnumFacing.values()[meta];
|
{
|
||||||
return this.getDefaultState().withProperty(FACING, facing);
|
EnumFacing facing = EnumFacing.values()[meta];
|
||||||
}
|
return this.getDefaultState().withProperty( FACING, facing );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{FACING, ODD};
|
{
|
||||||
}
|
return new IProperty[] { FACING, ODD };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
|
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||||
return this.canPlaceAt(w, pos, up.getOpposite());
|
{
|
||||||
}
|
return this.canPlaceAt( w, pos, up.getOpposite() );
|
||||||
|
}
|
||||||
|
|
||||||
private boolean canPlaceAt(final World w, final BlockPos pos, final EnumFacing dir) {
|
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
|
||||||
final BlockPos test = pos.offset(dir);
|
{
|
||||||
return w.isSideSolid(test, dir.getOpposite(), false);
|
final BlockPos test = pos.offset( dir );
|
||||||
}
|
return w.isSideSolid( test, dir.getOpposite(), false );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean isVisual )
|
||||||
final EnumFacing up = this.getOrientable(w, pos).getUp();
|
{
|
||||||
final double xOff = -0.3 * up.getXOffset();
|
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||||
final double yOff = -0.3 * up.getYOffset();
|
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||||
final double zOff = -0.3 * up.getZOffset();
|
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||||
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||||
}
|
return Collections.singletonList( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e) {/*
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e )
|
||||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
|
{/*
|
||||||
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15,
|
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
|
||||||
* zOff
|
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15,
|
||||||
* + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
* zOff
|
||||||
*/
|
* + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
|
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||||
if (!AEConfig.instance().isEnableEffects()) {
|
{
|
||||||
return;
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.nextFloat() < 0.98) {
|
if( r.nextFloat() < 0.98 )
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final EnumFacing up = this.getOrientable(w, pos).getUp();
|
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||||
final double xOff = -0.3 * up.getXOffset();
|
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||||
final double yOff = -0.3 * up.getYOffset();
|
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||||
final double zOff = -0.3 * up.getZOffset();
|
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||||
for (int bolts = 0; bolts < 3; bolts++) {
|
for( int bolts = 0; bolts < 3; bolts++ )
|
||||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
{
|
||||||
final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D);
|
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||||
|
{
|
||||||
|
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D );
|
||||||
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final EnumFacing up = this.getOrientable(world, pos).getUp();
|
{
|
||||||
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
|
final EnumFacing up = this.getOrientable( world, pos ).getUp();
|
||||||
this.dropTorch(world, pos);
|
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
|
||||||
}
|
{
|
||||||
}
|
this.dropTorch( world, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void dropTorch(final World w, final BlockPos pos) {
|
private void dropTorch( final World w, final BlockPos pos )
|
||||||
final IBlockState prev = w.getBlockState(pos);
|
{
|
||||||
w.destroyBlock(pos, true);
|
final IBlockState prev = w.getBlockState( pos );
|
||||||
w.notifyBlockUpdate(pos, prev, w.getBlockState(pos), 3);
|
w.destroyBlock( pos, true );
|
||||||
}
|
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(final World w, final BlockPos pos) {
|
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
|
||||||
for (final EnumFacing dir : EnumFacing.VALUES) {
|
{
|
||||||
if (this.canPlaceAt(w, pos, dir)) {
|
for( final EnumFacing dir : EnumFacing.VALUES )
|
||||||
return true;
|
{
|
||||||
}
|
if( this.canPlaceAt( w, pos, dir ) )
|
||||||
}
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean usesMetadata() {
|
public boolean usesMetadata()
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
|
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||||
return new MetaRotation(w, pos, FACING);
|
{
|
||||||
}
|
return new MetaRotation( w, pos, FACING );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaque() {
|
public boolean isOpaque()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,8 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.IOrientableBlock;
|
import java.util.Random;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.client.render.effects.LightningFX;
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
@@ -39,113 +34,129 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Random;
|
import appeng.api.util.IOrientableBlock;
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.client.render.effects.LightningFX;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AppEng;
|
||||||
|
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock {
|
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock
|
||||||
|
{
|
||||||
|
|
||||||
private static final PropertyBool POWERED = PropertyBool.create("powered");
|
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||||
|
|
||||||
public BlockQuartzGrowthAccelerator() {
|
public BlockQuartzGrowthAccelerator()
|
||||||
super(Material.ROCK);
|
{
|
||||||
this.setSoundType(SoundType.METAL);
|
super( Material.ROCK );
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(POWERED, false));
|
this.setSoundType( SoundType.METAL );
|
||||||
}
|
this.setDefaultState( this.getDefaultState().withProperty( POWERED, false ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
TileQuartzGrowthAccelerator te = this.getTileEntity(world, pos);
|
{
|
||||||
boolean powered = te != null && te.isPowered();
|
TileQuartzGrowthAccelerator te = this.getTileEntity( world, pos );
|
||||||
|
boolean powered = te != null && te.isPowered();
|
||||||
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState( state, world, pos )
|
||||||
.withProperty(POWERED, powered);
|
.withProperty( POWERED, powered );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{POWERED};
|
{
|
||||||
}
|
return new IProperty[] { POWERED };
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
|
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||||
if (!AEConfig.instance().isEnableEffects()) {
|
{
|
||||||
return;
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final TileQuartzGrowthAccelerator cga = this.getTileEntity(w, pos);
|
final TileQuartzGrowthAccelerator cga = this.getTileEntity( w, pos );
|
||||||
|
|
||||||
if (cga != null && cga.isPowered() && AppEng.proxy.shouldAddParticles(r)) {
|
if( cga != null && cga.isPowered() && AppEng.proxy.shouldAddParticles( r ) )
|
||||||
final double d0 = r.nextFloat() - 0.5F;
|
{
|
||||||
final double d1 = r.nextFloat() - 0.5F;
|
final double d0 = r.nextFloat() - 0.5F;
|
||||||
|
final double d1 = r.nextFloat() - 0.5F;
|
||||||
|
|
||||||
final EnumFacing up = cga.getUp();
|
final EnumFacing up = cga.getUp();
|
||||||
final EnumFacing forward = cga.getForward();
|
final EnumFacing forward = cga.getForward();
|
||||||
final EnumFacing west = Platform.crossProduct(forward, up);
|
final EnumFacing west = Platform.crossProduct( forward, up );
|
||||||
|
|
||||||
double rx = 0.5 + pos.getX();
|
double rx = 0.5 + pos.getX();
|
||||||
double ry = 0.5 + pos.getY();
|
double ry = 0.5 + pos.getY();
|
||||||
double rz = 0.5 + pos.getZ();
|
double rz = 0.5 + pos.getZ();
|
||||||
|
|
||||||
rx += up.getXOffset() * d0;
|
rx += up.getFrontOffsetX() * d0;
|
||||||
ry += up.getYOffset() * d0;
|
ry += up.getFrontOffsetY() * d0;
|
||||||
rz += up.getZOffset() * d0;
|
rz += up.getFrontOffsetZ() * d0;
|
||||||
|
|
||||||
final int x = pos.getX();
|
final int x = pos.getX();
|
||||||
final int y = pos.getY();
|
final int y = pos.getY();
|
||||||
final int z = pos.getZ();
|
final int z = pos.getZ();
|
||||||
|
|
||||||
double dz = 0;
|
double dz = 0;
|
||||||
double dx = 0;
|
double dx = 0;
|
||||||
BlockPos pt = null;
|
BlockPos pt = null;
|
||||||
|
|
||||||
switch (r.nextInt(4)) {
|
switch( r.nextInt( 4 ) )
|
||||||
case 0:
|
{
|
||||||
dx = 0.6;
|
case 0:
|
||||||
dz = d1;
|
dx = 0.6;
|
||||||
pt = new BlockPos(x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset());
|
dz = d1;
|
||||||
|
pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
dx = d1;
|
dx = d1;
|
||||||
dz += 0.6;
|
dz += 0.6;
|
||||||
pt = new BlockPos(x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset());
|
pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
dx = d1;
|
dx = d1;
|
||||||
dz = -0.6;
|
dz = -0.6;
|
||||||
pt = new BlockPos(x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset());
|
pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
dx = -0.6;
|
dx = -0.6;
|
||||||
dz = d1;
|
dz = d1;
|
||||||
pt = new BlockPos(x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset());
|
pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!w.getBlockState(pt).getBlock().isAir(w.getBlockState(pt), w, pt)) {
|
if( !w.getBlockState( pt ).getBlock().isAir( w.getBlockState( pt ), w, pt ) )
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rx += dx * west.getXOffset();
|
rx += dx * west.getFrontOffsetX();
|
||||||
ry += dx * west.getYOffset();
|
ry += dx * west.getFrontOffsetY();
|
||||||
rz += dx * west.getZOffset();
|
rz += dx * west.getFrontOffsetZ();
|
||||||
|
|
||||||
rx += dz * forward.getXOffset();
|
rx += dz * forward.getFrontOffsetX();
|
||||||
ry += dz * forward.getYOffset();
|
ry += dz * forward.getFrontOffsetY();
|
||||||
rz += dz * forward.getZOffset();
|
rz += dz * forward.getFrontOffsetZ();
|
||||||
|
|
||||||
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
final LightningFX fx = new LightningFX( w, rx, ry, rz, 0.0D, 0.0D, 0.0D );
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean usesMetadata() {
|
public boolean usesMetadata()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import javax.annotation.Nullable;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.misc.TileSecurityStation;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
@@ -37,57 +34,70 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.util.AEPartLocation;
|
||||||
import javax.annotation.Nullable;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.misc.TileSecurityStation;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockSecurityStation extends AEBaseTileBlock {
|
public class BlockSecurityStation extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
private static final PropertyBool POWERED = PropertyBool.create("powered");
|
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||||
|
|
||||||
public BlockSecurityStation() {
|
public BlockSecurityStation()
|
||||||
super(Material.IRON);
|
{
|
||||||
|
super( Material.IRON );
|
||||||
|
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(POWERED, false));
|
this.setDefaultState( this.getDefaultState().withProperty( POWERED, false ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{POWERED};
|
{
|
||||||
}
|
return new IProperty[] { POWERED };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
boolean powered = false;
|
{
|
||||||
TileSecurityStation te = this.getTileEntity(world, pos);
|
boolean powered = false;
|
||||||
if (te != null) {
|
TileSecurityStation te = this.getTileEntity( world, pos );
|
||||||
powered = te.isActive();
|
if( te != null )
|
||||||
}
|
{
|
||||||
|
powered = te.isActive();
|
||||||
|
}
|
||||||
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState( state, world, pos )
|
||||||
.withProperty(POWERED, powered);
|
.withProperty( POWERED, powered );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (p.isSneaking()) {
|
{
|
||||||
return false;
|
if( p.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TileSecurityStation tg = this.getTileEntity(w, pos);
|
final TileSecurityStation tg = this.getTileEntity( w, pos );
|
||||||
if (tg != null) {
|
if( tg != null )
|
||||||
if (Platform.isClient()) {
|
{
|
||||||
return true;
|
if( Platform.isClient() )
|
||||||
}
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_SECURITY);
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_SECURITY );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import java.util.Collections;
|
||||||
import appeng.helpers.ICustomCollision;
|
import java.util.List;
|
||||||
import appeng.tile.misc.TileSkyCompass;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
@@ -36,137 +36,156 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.common.property.PropertyFloat;
|
import net.minecraftforge.common.property.PropertyFloat;
|
||||||
|
|
||||||
import java.util.Collections;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import java.util.List;
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.tile.misc.TileSkyCompass;
|
||||||
|
|
||||||
|
|
||||||
public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision {
|
public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
// Rotation is expressed as radians
|
// Rotation is expressed as radians
|
||||||
public static final PropertyFloat ROTATION = new PropertyFloat("rotation");
|
public static final PropertyFloat ROTATION = new PropertyFloat( "rotation" );
|
||||||
|
|
||||||
public BlockSkyCompass() {
|
public BlockSkyCompass()
|
||||||
super(Material.CIRCUITS);
|
{
|
||||||
this.setLightOpacity(0);
|
super( Material.CIRCUITS );
|
||||||
this.setFullSize(false);
|
this.setLightOpacity( 0 );
|
||||||
this.setOpaque(false);
|
this.setFullSize( false );
|
||||||
}
|
this.setOpaque( false );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState()
|
||||||
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{FORWARD, UP, ROTATION});
|
{
|
||||||
}
|
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { FORWARD, UP, ROTATION } );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
|
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
|
||||||
final TileSkyCompass sc = this.getTileEntity(w, pos);
|
{
|
||||||
if (sc != null) {
|
final TileSkyCompass sc = this.getTileEntity( w, pos );
|
||||||
return false;
|
if( sc != null )
|
||||||
}
|
{
|
||||||
return this.canPlaceAt(w, pos, forward.getOpposite());
|
return false;
|
||||||
}
|
}
|
||||||
|
return this.canPlaceAt( w, pos, forward.getOpposite() );
|
||||||
|
}
|
||||||
|
|
||||||
private boolean canPlaceAt(final World w, final BlockPos pos, final EnumFacing dir) {
|
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
|
||||||
return w.isSideSolid(pos.offset(dir), dir.getOpposite(), false);
|
{
|
||||||
}
|
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final TileSkyCompass sc = this.getTileEntity(world, pos);
|
{
|
||||||
final EnumFacing forward = sc.getForward();
|
final TileSkyCompass sc = this.getTileEntity( world, pos );
|
||||||
if (!this.canPlaceAt(world, pos, forward.getOpposite())) {
|
final EnumFacing forward = sc.getForward();
|
||||||
this.dropTorch(world, pos);
|
if( !this.canPlaceAt( world, pos, forward.getOpposite() ) )
|
||||||
}
|
{
|
||||||
}
|
this.dropTorch( world, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void dropTorch(final World w, final BlockPos pos) {
|
private void dropTorch( final World w, final BlockPos pos )
|
||||||
final IBlockState prev = w.getBlockState(pos);
|
{
|
||||||
w.destroyBlock(pos, true);
|
final IBlockState prev = w.getBlockState( pos );
|
||||||
w.notifyBlockUpdate(pos, prev, w.getBlockState(pos), 3);
|
w.destroyBlock( pos, true );
|
||||||
}
|
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(final World w, final BlockPos pos) {
|
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
|
||||||
for (final EnumFacing dir : EnumFacing.VALUES) {
|
{
|
||||||
if (this.canPlaceAt(w, pos, dir)) {
|
for( final EnumFacing dir : EnumFacing.VALUES )
|
||||||
return true;
|
{
|
||||||
}
|
if( this.canPlaceAt( w, pos, dir ) )
|
||||||
}
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
final TileSkyCompass tile = this.getTileEntity(w, pos);
|
{
|
||||||
if (tile != null) {
|
final TileSkyCompass tile = this.getTileEntity( w, pos );
|
||||||
final EnumFacing forward = tile.getForward();
|
if( tile != null )
|
||||||
|
{
|
||||||
|
final EnumFacing forward = tile.getForward();
|
||||||
|
|
||||||
double minX = 0;
|
double minX = 0;
|
||||||
double minY = 0;
|
double minY = 0;
|
||||||
double minZ = 0;
|
double minZ = 0;
|
||||||
double maxX = 1;
|
double maxX = 1;
|
||||||
double maxY = 1;
|
double maxY = 1;
|
||||||
double maxZ = 1;
|
double maxZ = 1;
|
||||||
|
|
||||||
switch (forward) {
|
switch( forward )
|
||||||
case DOWN:
|
{
|
||||||
minZ = minX = 5.0 / 16.0;
|
case DOWN:
|
||||||
maxZ = maxX = 11.0 / 16.0;
|
minZ = minX = 5.0 / 16.0;
|
||||||
maxY = 1.0;
|
maxZ = maxX = 11.0 / 16.0;
|
||||||
minY = 14.0 / 16.0;
|
maxY = 1.0;
|
||||||
break;
|
minY = 14.0 / 16.0;
|
||||||
case EAST:
|
break;
|
||||||
minZ = minY = 5.0 / 16.0;
|
case EAST:
|
||||||
maxZ = maxY = 11.0 / 16.0;
|
minZ = minY = 5.0 / 16.0;
|
||||||
maxX = 2.0 / 16.0;
|
maxZ = maxY = 11.0 / 16.0;
|
||||||
minX = 0.0;
|
maxX = 2.0 / 16.0;
|
||||||
break;
|
minX = 0.0;
|
||||||
case NORTH:
|
break;
|
||||||
minY = minX = 5.0 / 16.0;
|
case NORTH:
|
||||||
maxY = maxX = 11.0 / 16.0;
|
minY = minX = 5.0 / 16.0;
|
||||||
maxZ = 1.0;
|
maxY = maxX = 11.0 / 16.0;
|
||||||
minZ = 14.0 / 16.0;
|
maxZ = 1.0;
|
||||||
break;
|
minZ = 14.0 / 16.0;
|
||||||
case SOUTH:
|
break;
|
||||||
minY = minX = 5.0 / 16.0;
|
case SOUTH:
|
||||||
maxY = maxX = 11.0 / 16.0;
|
minY = minX = 5.0 / 16.0;
|
||||||
maxZ = 2.0 / 16.0;
|
maxY = maxX = 11.0 / 16.0;
|
||||||
minZ = 0.0;
|
maxZ = 2.0 / 16.0;
|
||||||
break;
|
minZ = 0.0;
|
||||||
case UP:
|
break;
|
||||||
minZ = minX = 5.0 / 16.0;
|
case UP:
|
||||||
maxZ = maxX = 11.0 / 16.0;
|
minZ = minX = 5.0 / 16.0;
|
||||||
maxY = 2.0 / 16.0;
|
maxZ = maxX = 11.0 / 16.0;
|
||||||
minY = 0.0;
|
maxY = 2.0 / 16.0;
|
||||||
break;
|
minY = 0.0;
|
||||||
case WEST:
|
break;
|
||||||
minZ = minY = 5.0 / 16.0;
|
case WEST:
|
||||||
maxZ = maxY = 11.0 / 16.0;
|
minZ = minY = 5.0 / 16.0;
|
||||||
maxX = 1.0;
|
maxZ = maxY = 11.0 / 16.0;
|
||||||
minX = 14.0 / 16.0;
|
maxX = 1.0;
|
||||||
break;
|
minX = 14.0 / 16.0;
|
||||||
default:
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return Collections.singletonList(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
|
return Collections.singletonList( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||||
}
|
}
|
||||||
return Collections.singletonList(new AxisAlignedBB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
|
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
public EnumBlockRenderType getRenderType( IBlockState state )
|
||||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
{
|
||||||
}
|
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullBlock(IBlockState state) {
|
public boolean isFullBlock( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseBlock;
|
import java.util.Collections;
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
import java.util.List;
|
||||||
import appeng.helpers.ICustomCollision;
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -41,105 +43,126 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.block.AEBaseBlock;
|
||||||
import java.util.Collections;
|
import appeng.entity.EntityTinyTNTPrimed;
|
||||||
import java.util.List;
|
import appeng.helpers.ICustomCollision;
|
||||||
|
|
||||||
|
|
||||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
|
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
public BlockTinyTNT() {
|
public BlockTinyTNT()
|
||||||
super(Material.TNT);
|
{
|
||||||
|
super( Material.TNT );
|
||||||
|
|
||||||
this.boundingBox = new AxisAlignedBB(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f);
|
this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||||
|
|
||||||
this.setLightOpacity(2);
|
this.setLightOpacity( 2 );
|
||||||
this.setFullSize(false);
|
this.setFullSize( false );
|
||||||
this.setOpaque(false);
|
this.setOpaque( false );
|
||||||
|
|
||||||
this.setSoundType(SoundType.GROUND);
|
this.setSoundType( SoundType.GROUND );
|
||||||
this.setHardness(0F);
|
this.setHardness( 0F );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL) {
|
{
|
||||||
this.startFuse(w, pos, player);
|
if( heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL )
|
||||||
w.setBlockToAir(pos);
|
{
|
||||||
heldItem.damageItem(1, player);
|
this.startFuse( w, pos, player );
|
||||||
return true;
|
w.setBlockToAir( pos );
|
||||||
} else {
|
heldItem.damageItem( 1, player );
|
||||||
return super.onActivated(w, pos, player, hand, heldItem, side, hitX, hitY, hitZ);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
return super.onActivated( w, pos, player, hand, heldItem, side, hitX, hitY, hitZ );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void startFuse(final World w, final BlockPos pos, final EntityLivingBase igniter) {
|
public void startFuse( final World w, final BlockPos pos, final EntityLivingBase igniter )
|
||||||
if (!w.isRemote) {
|
{
|
||||||
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed(w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter);
|
if( !w.isRemote )
|
||||||
w.spawnEntity(primedTinyTNTEntity);
|
{
|
||||||
w.playSound(null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED,
|
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter );
|
||||||
SoundCategory.BLOCKS, 1, 1);
|
w.spawnEntity( primedTinyTNTEntity );
|
||||||
}
|
w.playSound( null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED,
|
||||||
}
|
SoundCategory.BLOCKS, 1, 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
|
{
|
||||||
this.startFuse(world, pos, null);
|
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||||
world.setBlockToAir(pos);
|
{
|
||||||
}
|
this.startFuse( world, pos, null );
|
||||||
}
|
world.setBlockToAir( pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
|
public void onBlockAdded( final World w, final BlockPos pos, final IBlockState state )
|
||||||
super.onBlockAdded(w, pos, state);
|
{
|
||||||
|
super.onBlockAdded( w, pos, state );
|
||||||
|
|
||||||
if (w.getRedstonePowerFromNeighbors(pos) > 0) {
|
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||||
this.startFuse(w, pos, null);
|
{
|
||||||
w.setBlockToAir(pos);
|
this.startFuse( w, pos, null );
|
||||||
}
|
w.setBlockToAir( pos );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityWalk(final World w, final BlockPos pos, final Entity entity) {
|
public void onEntityWalk( final World w, final BlockPos pos, final Entity entity )
|
||||||
if (entity instanceof EntityArrow && !w.isRemote) {
|
{
|
||||||
final EntityArrow entityarrow = (EntityArrow) entity;
|
if( entity instanceof EntityArrow && !w.isRemote )
|
||||||
|
{
|
||||||
|
final EntityArrow entityarrow = (EntityArrow) entity;
|
||||||
|
|
||||||
if (entityarrow.isBurning()) {
|
if( entityarrow.isBurning() )
|
||||||
this.startFuse(w, pos, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null);
|
{
|
||||||
w.setBlockToAir(pos);
|
this.startFuse( w, pos, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null );
|
||||||
}
|
w.setBlockToAir( pos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDropFromExplosion(final Explosion exp) {
|
public boolean canDropFromExplosion( final Explosion exp )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockExploded(final World w, final BlockPos pos, final Explosion exp) {
|
public void onBlockExploded( final World w, final BlockPos pos, final Explosion exp )
|
||||||
super.onBlockExploded(w, pos, exp);
|
{
|
||||||
if (!w.isRemote) {
|
super.onBlockExploded( w, pos, exp );
|
||||||
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed(w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp
|
if( !w.isRemote )
|
||||||
.getExplosivePlacedBy());
|
{
|
||||||
primedTinyTNTEntity.setFuse(w.rand.nextInt(primedTinyTNTEntity.getFuse() / 4) + primedTinyTNTEntity.getFuse() / 8);
|
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp
|
||||||
w.spawnEntity(primedTinyTNTEntity);
|
.getExplosivePlacedBy() );
|
||||||
}
|
primedTinyTNTEntity.setFuse( w.rand.nextInt( primedTinyTNTEntity.getFuse() / 4 ) + primedTinyTNTEntity.getFuse() / 8 );
|
||||||
}
|
w.spawnEntity( primedTinyTNTEntity );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
return Collections.singletonList(new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.5, 0.75));
|
{
|
||||||
}
|
return Collections.singletonList( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
out.add(new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.5, 0.75));
|
{
|
||||||
}
|
out.add( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,10 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import java.util.Random;
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.core.AEConfig;
|
import javax.annotation.Nullable;
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.tile.AEBaseTile;
|
|
||||||
import appeng.tile.misc.TileVibrationChamber;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
@@ -39,91 +36,108 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
import java.util.Random;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.AEBaseTile;
|
||||||
|
import appeng.tile.misc.TileVibrationChamber;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public final class BlockVibrationChamber extends AEBaseTileBlock {
|
public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
// Indicates that the vibration chamber is currently working
|
// Indicates that the vibration chamber is currently working
|
||||||
private static final PropertyBool ACTIVE = PropertyBool.create("active");
|
private static final PropertyBool ACTIVE = PropertyBool.create( "active" );
|
||||||
|
|
||||||
public BlockVibrationChamber() {
|
public BlockVibrationChamber()
|
||||||
super(Material.IRON);
|
{
|
||||||
this.setHardness(4.2F);
|
super( Material.IRON );
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(ACTIVE, false));
|
this.setHardness( 4.2F );
|
||||||
}
|
this.setDefaultState( this.getDefaultState().withProperty( ACTIVE, false ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
TileVibrationChamber te = this.getTileEntity(world, pos);
|
{
|
||||||
boolean active = te != null && te.isOn;
|
TileVibrationChamber te = this.getTileEntity( world, pos );
|
||||||
|
boolean active = te != null && te.isOn;
|
||||||
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState( state, world, pos )
|
||||||
.withProperty(ACTIVE, active);
|
.withProperty( ACTIVE, active );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{ACTIVE};
|
{
|
||||||
}
|
return new IProperty[] { ACTIVE };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (player.isSneaking()) {
|
{
|
||||||
return false;
|
if( player.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Platform.isServer()) {
|
if( Platform.isServer() )
|
||||||
final TileVibrationChamber tc = this.getTileEntity(w, pos);
|
{
|
||||||
if (tc != null && !player.isSneaking()) {
|
final TileVibrationChamber tc = this.getTileEntity( w, pos );
|
||||||
Platform.openGUI(player, tc, AEPartLocation.fromFacing(side), GuiBridge.GUI_VIBRATION_CHAMBER);
|
if( tc != null && !player.isSneaking() )
|
||||||
return true;
|
{
|
||||||
}
|
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
|
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||||
if (!AEConfig.instance().isEnableEffects()) {
|
{
|
||||||
return;
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final AEBaseTile tile = this.getTileEntity(w, pos);
|
final AEBaseTile tile = this.getTileEntity( w, pos );
|
||||||
if (tile instanceof TileVibrationChamber) {
|
if( tile instanceof TileVibrationChamber )
|
||||||
final TileVibrationChamber tc = (TileVibrationChamber) tile;
|
{
|
||||||
if (tc.isOn) {
|
final TileVibrationChamber tc = (TileVibrationChamber) tile;
|
||||||
float f1 = pos.getX() + 0.5F;
|
if( tc.isOn )
|
||||||
float f2 = pos.getY() + 0.5F;
|
{
|
||||||
float f3 = pos.getZ() + 0.5F;
|
float f1 = pos.getX() + 0.5F;
|
||||||
|
float f2 = pos.getY() + 0.5F;
|
||||||
|
float f3 = pos.getZ() + 0.5F;
|
||||||
|
|
||||||
final EnumFacing forward = tc.getForward();
|
final EnumFacing forward = tc.getForward();
|
||||||
final EnumFacing up = tc.getUp();
|
final EnumFacing up = tc.getUp();
|
||||||
|
|
||||||
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||||
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
|
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||||
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||||
|
|
||||||
f1 += forward.getXOffset() * 0.6;
|
f1 += forward.getFrontOffsetX() * 0.6;
|
||||||
f2 += forward.getYOffset() * 0.6;
|
f2 += forward.getFrontOffsetY() * 0.6;
|
||||||
f3 += forward.getZOffset() * 0.6;
|
f3 += forward.getFrontOffsetZ() * 0.6;
|
||||||
|
|
||||||
final float ox = r.nextFloat();
|
final float ox = r.nextFloat();
|
||||||
final float oy = r.nextFloat() * 0.2f;
|
final float oy = r.nextFloat() * 0.2f;
|
||||||
|
|
||||||
f1 += up.getXOffset() * (-0.3 + oy);
|
f1 += up.getFrontOffsetX() * ( -0.3 + oy );
|
||||||
f2 += up.getYOffset() * (-0.3 + oy);
|
f2 += up.getFrontOffsetY() * ( -0.3 + oy );
|
||||||
f3 += up.getZOffset() * (-0.3 + oy);
|
f3 += up.getFrontOffsetZ() * ( -0.3 + oy );
|
||||||
|
|
||||||
f1 += west_x * (0.3 * ox - 0.15);
|
f1 += west_x * ( 0.3 * ox - 0.15 );
|
||||||
f2 += west_y * (0.3 * ox - 0.15);
|
f2 += west_y * ( 0.3 * ox - 0.15 );
|
||||||
f3 += west_z * (0.3 * ox - 0.15);
|
f3 += west_z * ( 0.3 * ox - 0.15 );
|
||||||
|
|
||||||
w.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D);
|
w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
|
||||||
w.spawnParticle(EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D);
|
w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
|
|
||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.client.render.tesr.InscriberTESR;
|
import appeng.client.render.tesr.InscriberTESR;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
public class InscriberRendering extends BlockRenderingCustomizer {
|
public class InscriberRendering extends BlockRenderingCustomizer
|
||||||
|
{
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
@Override
|
@Override
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.tesr(new InscriberTESR());
|
{
|
||||||
}
|
rendering.tesr( new InscriberTESR() );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,22 +19,25 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.client.render.ColorableTileBlockColor;
|
import appeng.client.render.ColorableTileBlockColor;
|
||||||
import appeng.client.render.StaticItemColor;
|
import appeng.client.render.StaticItemColor;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
public class SecurityStationRendering extends BlockRenderingCustomizer {
|
public class SecurityStationRendering extends BlockRenderingCustomizer
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.blockColor(ColorableTileBlockColor.INSTANCE);
|
{
|
||||||
itemRendering.color(new StaticItemColor(AEColor.TRANSPARENT));
|
rendering.blockColor( ColorableTileBlockColor.INSTANCE );
|
||||||
}
|
itemRendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,26 +19,29 @@
|
|||||||
package appeng.block.misc;
|
package appeng.block.misc;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.client.render.model.SkyCompassModel;
|
import appeng.client.render.model.SkyCompassModel;
|
||||||
import appeng.client.render.tesr.SkyCompassTESR;
|
import appeng.client.render.tesr.SkyCompassTESR;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
public class SkyCompassRendering extends BlockRenderingCustomizer {
|
public class SkyCompassRendering extends BlockRenderingCustomizer
|
||||||
|
{
|
||||||
|
|
||||||
private static final ModelResourceLocation ITEM_MODEL = new ModelResourceLocation("appliedenergistics2:sky_compass", "normal");
|
private static final ModelResourceLocation ITEM_MODEL = new ModelResourceLocation( "appliedenergistics2:sky_compass", "normal" );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.tesr(new SkyCompassTESR());
|
{
|
||||||
itemRendering.model(ITEM_MODEL);
|
rendering.tesr( new SkyCompassTESR() );
|
||||||
itemRendering.builtInModel("models/block/builtin/sky_compass", new SkyCompassModel());
|
itemRendering.model( ITEM_MODEL );
|
||||||
}
|
itemRendering.builtInModel( "models/block/builtin/sky_compass", new SkyCompassModel() );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,33 +19,14 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.parts.IFacadeContainer;
|
import java.util.EnumSet;
|
||||||
import appeng.api.parts.IFacadePart;
|
import java.util.List;
|
||||||
import appeng.api.parts.PartItemStack;
|
import java.util.Random;
|
||||||
import appeng.api.parts.SelectedPart;
|
|
||||||
import appeng.api.util.AEColor;
|
import javax.annotation.Nullable;
|
||||||
import appeng.api.util.AEPartLocation;
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.client.UnlistedProperty;
|
|
||||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
|
||||||
import appeng.client.render.cablebus.CableBusRenderState;
|
|
||||||
import appeng.client.render.cablebus.FacadeRenderState;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
|
||||||
import appeng.core.sync.packets.PacketCableBusLandingParticle;
|
|
||||||
import appeng.core.sync.packets.PacketClick;
|
|
||||||
import appeng.helpers.AEGlassMaterial;
|
|
||||||
import appeng.integration.abstraction.IAEFacade;
|
|
||||||
import appeng.parts.ICableBusContainer;
|
|
||||||
import appeng.parts.NullCableBusContainer;
|
|
||||||
import appeng.tile.AEBaseTile;
|
|
||||||
import appeng.tile.networking.CableBusTESR;
|
|
||||||
import appeng.tile.networking.TileCableBus;
|
|
||||||
import appeng.tile.networking.TileCableBusTESR;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -72,458 +53,447 @@ import net.minecraft.util.math.RayTraceResult.Type;
|
|||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.parts.IFacadeContainer;
|
||||||
import java.util.EnumSet;
|
import appeng.api.parts.IFacadePart;
|
||||||
import java.util.List;
|
import appeng.api.parts.PartItemStack;
|
||||||
import java.util.Random;
|
import appeng.api.parts.SelectedPart;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.api.util.AEPartLocation;
|
||||||
public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.client.UnlistedProperty;
|
||||||
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>("cable_bus_render_state", CableBusRenderState.class);
|
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||||
|
import appeng.client.render.cablebus.CableBusRenderState;
|
||||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
import appeng.core.Api;
|
||||||
|
import appeng.core.AppEng;
|
||||||
public BlockCableBus() {
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
super(AEGlassMaterial.INSTANCE);
|
import appeng.core.sync.packets.PacketClick;
|
||||||
this.setLightOpacity(0);
|
import appeng.helpers.AEGlassMaterial;
|
||||||
this.setFullSize(false);
|
import appeng.integration.abstraction.IAEFacade;
|
||||||
this.setOpaque(false);
|
import appeng.parts.ICableBusContainer;
|
||||||
|
import appeng.parts.NullCableBusContainer;
|
||||||
// this will actually be overwritten later through setupTile and the
|
import appeng.tile.AEBaseTile;
|
||||||
// combined layers
|
import appeng.tile.networking.CableBusTESR;
|
||||||
this.setTileEntity(TileCableBus.class);
|
import appeng.tile.networking.TileCableBus;
|
||||||
}
|
import appeng.tile.networking.TileCableBusTESR;
|
||||||
|
import appeng.util.Platform;
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||||
}
|
{
|
||||||
|
|
||||||
@Override
|
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>( "cable_bus_render_state", CableBusRenderState.class );
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{RENDER_STATE_PROPERTY});
|
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||||
}
|
|
||||||
|
private static Class<? extends AEBaseTile> noTesrTile;
|
||||||
@Override
|
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
private static Class<? extends AEBaseTile> tesrTile;
|
||||||
CableBusRenderState renderState = this.cb(world, pos).getRenderState();
|
|
||||||
renderState.setWorld(world);
|
public BlockCableBus()
|
||||||
renderState.setPos(pos);
|
{
|
||||||
return ((IExtendedBlockState) state).withProperty(RENDER_STATE_PROPERTY, renderState);
|
super( AEGlassMaterial.INSTANCE );
|
||||||
}
|
this.setLightOpacity( 0 );
|
||||||
|
this.setFullSize( false );
|
||||||
@Override
|
this.setOpaque( false );
|
||||||
public void randomDisplayTick(final IBlockState state, final World worldIn, final BlockPos pos, final Random rand) {
|
|
||||||
this.cb(worldIn, pos).randomDisplayTick(worldIn, pos, rand);
|
// this will actually be overwritten later through setupTile and the
|
||||||
}
|
// combined layers
|
||||||
|
this.setTileEntity( TileCableBus.class );
|
||||||
@Override
|
}
|
||||||
public void onNeighborChange(final IBlockAccess w, final BlockPos pos, final BlockPos neighbor) {
|
|
||||||
this.cb(w, pos).onNeighborChanged(w, pos, neighbor);
|
@Override
|
||||||
}
|
public boolean isFullCube( IBlockState state )
|
||||||
|
{
|
||||||
@Override
|
return false;
|
||||||
public Item getItemDropped(final IBlockState state, final Random rand, final int fortune) {
|
}
|
||||||
return null;
|
|
||||||
}
|
@Override
|
||||||
|
protected BlockStateContainer createBlockState()
|
||||||
@Override
|
{
|
||||||
public int getWeakPower(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
|
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { RENDER_STATE_PROPERTY } );
|
||||||
return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO:
|
}
|
||||||
// IS
|
|
||||||
// OPPOSITE!?
|
@Override
|
||||||
}
|
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
|
{
|
||||||
@Override
|
CableBusRenderState renderState = this.cb( world, pos ).getRenderState();
|
||||||
public boolean canProvidePower(final IBlockState state) {
|
renderState.setWorld( world );
|
||||||
return true;
|
renderState.setPos( pos );
|
||||||
}
|
return ( (IExtendedBlockState) state ).withProperty( RENDER_STATE_PROPERTY, renderState );
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onEntityCollision(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
|
@Override
|
||||||
this.cb(w, pos).onEntityCollision(entityIn);
|
public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||||
}
|
{
|
||||||
|
this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
|
||||||
@Override
|
}
|
||||||
public int getStrongPower(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
|
|
||||||
return this.cb(w, pos).isProvidingStrongPower(side.getOpposite()); // TODO:
|
@Override
|
||||||
// IS
|
public void onNeighborChange( final IBlockAccess w, final BlockPos pos, final BlockPos neighbor )
|
||||||
// OPPOSITE!?
|
{
|
||||||
}
|
this.cb( w, pos ).onNeighborChanged( w, pos, neighbor );
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public int getLightValue(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
|
@Override
|
||||||
if (state.getBlock() != this) {
|
public Item getItemDropped( final IBlockState state, final Random rand, final int fortune )
|
||||||
return state.getBlock().getLightValue(state, world, pos);
|
{
|
||||||
}
|
return null;
|
||||||
return this.cb(world, pos).getLightValue();
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||||
public boolean isLadder(final IBlockState state, final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity) {
|
{
|
||||||
return this.cb(world, pos).isLadder(entity);
|
return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO:
|
||||||
}
|
// IS
|
||||||
|
// OPPOSITE!?
|
||||||
@Override
|
}
|
||||||
public boolean isSideSolid(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
|
|
||||||
return this.cb(w, pos).isSolidOnSide(side);
|
@Override
|
||||||
}
|
public boolean canProvidePower( final IBlockState state )
|
||||||
|
{
|
||||||
@Override
|
return true;
|
||||||
public boolean isReplaceable(final IBlockAccess w, final BlockPos pos) {
|
}
|
||||||
return this.cb(w, pos).isEmpty();
|
|
||||||
}
|
@Override
|
||||||
|
public void onEntityCollidedWithBlock( final World w, final BlockPos pos, final IBlockState state, final Entity entityIn )
|
||||||
@Override
|
{
|
||||||
public boolean removedByPlayer(final IBlockState state, final World world, final BlockPos pos, final EntityPlayer player, final boolean willHarvest) {
|
this.cb( w, pos ).onEntityCollision( entityIn );
|
||||||
if (player.capabilities.isCreativeMode) {
|
}
|
||||||
final AEBaseTile tile = this.getTileEntity(world, pos);
|
|
||||||
if (tile != null) {
|
@Override
|
||||||
tile.disableDrops();
|
public int getStrongPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||||
}
|
{
|
||||||
// maybe ray trace?
|
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO:
|
||||||
}
|
// IS
|
||||||
return super.removedByPlayer(state, world, pos, player, willHarvest);
|
// OPPOSITE!?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnectRedstone(final IBlockState state, final IBlockAccess w, final BlockPos pos, EnumFacing side) {
|
public int getLightValue( final IBlockState state, final IBlockAccess world, final BlockPos pos )
|
||||||
if (side == null) {
|
{
|
||||||
side = EnumFacing.UP;
|
if( state.getBlock() != this )
|
||||||
}
|
{
|
||||||
|
return state.getBlock().getLightValue( state, world, pos );
|
||||||
return this.cb(w, pos).canConnectRedstone(EnumSet.of(side));
|
}
|
||||||
}
|
return this.cb( world, pos ).getLightValue();
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public ItemStack getPickBlock(final IBlockState state, final RayTraceResult target, final World world, final BlockPos pos, final EntityPlayer player) {
|
@Override
|
||||||
final Vec3d v3 = target.hitVec.subtract(pos.getX(), pos.getY(), pos.getZ());
|
public boolean isLadder( final IBlockState state, final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity )
|
||||||
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
|
{
|
||||||
|
return this.cb( world, pos ).isLadder( entity );
|
||||||
if (sp.part != null) {
|
}
|
||||||
return sp.part.getItemStack(PartItemStack.PICK);
|
|
||||||
} else if (sp.facade != null) {
|
@Override
|
||||||
return sp.facade.getItemStack();
|
public boolean isSideSolid( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||||
}
|
{
|
||||||
|
return this.cb( w, pos ).isSolidOnSide( side );
|
||||||
return ItemStack.EMPTY;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public boolean isReplaceable( final IBlockAccess w, final BlockPos pos )
|
||||||
@SideOnly(Side.CLIENT)
|
{
|
||||||
public boolean addHitEffects(final IBlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer) {
|
return this.cb( w, pos ).isEmpty();
|
||||||
|
}
|
||||||
// Half the particle rate. Since we're spawning concentrated on a specific spot,
|
|
||||||
// our particle effect otherwise looks too strong
|
@Override
|
||||||
if (Platform.getRandom().nextBoolean()) {
|
public boolean removedByPlayer( final IBlockState state, final World world, final BlockPos pos, final EntityPlayer player, final boolean willHarvest )
|
||||||
return true;
|
{
|
||||||
}
|
if( player.capabilities.isCreativeMode )
|
||||||
|
{
|
||||||
ICableBusContainer cb = this.cb(world, target.getBlockPos());
|
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
|
if( tile != null )
|
||||||
// Our built-in model has the actual baked sprites we need
|
{
|
||||||
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
tile.disableDrops();
|
||||||
|
}
|
||||||
// We cannot add the effect if we don't have the model
|
// maybe ray trace?
|
||||||
if (!(model instanceof CableBusBakedModel)) {
|
}
|
||||||
return true;
|
return super.removedByPlayer( state, world, pos, player, willHarvest );
|
||||||
}
|
}
|
||||||
|
|
||||||
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
|
@Override
|
||||||
|
public boolean canConnectRedstone( final IBlockState state, final IBlockAccess w, final BlockPos pos, EnumFacing side )
|
||||||
CableBusRenderState renderState = cb.getRenderState();
|
{
|
||||||
|
if( side == null )
|
||||||
// Spawn a particle for one of the particle textures
|
{
|
||||||
TextureAtlasSprite texture = Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
|
side = EnumFacing.UP;
|
||||||
if (texture != null) {
|
}
|
||||||
double x = target.hitVec.x;
|
|
||||||
double y = target.hitVec.y;
|
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
|
||||||
double z = target.hitVec.z;
|
}
|
||||||
|
|
||||||
Particle fx = new DestroyFX(world, x, y, z, 0.0D, 0.0D, 0.0D, state).setBlockPos(target.getBlockPos()).multipleParticleScaleBy(0.8F);
|
@Override
|
||||||
fx.setParticleTexture(texture);
|
public ItemStack getPickBlock( final IBlockState state, final RayTraceResult target, final World world, final BlockPos pos, final EntityPlayer player )
|
||||||
effectRenderer.addEffect(fx);
|
{
|
||||||
}
|
final Vec3d v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() );
|
||||||
|
final SelectedPart sp = this.cb( world, pos ).selectPart( v3 );
|
||||||
return true;
|
|
||||||
}
|
if( sp.part != null )
|
||||||
|
{
|
||||||
@Override
|
return sp.part.getItemStack( PartItemStack.PICK );
|
||||||
@SideOnly(Side.CLIENT)
|
}
|
||||||
public boolean addDestroyEffects(final World world, final BlockPos pos, final ParticleManager effectRenderer) {
|
else if( sp.facade != null )
|
||||||
ICableBusContainer cb = this.cb(world, pos);
|
{
|
||||||
|
return sp.facade.getItemStack();
|
||||||
// Our built-in model has the actual baked sprites we need
|
}
|
||||||
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
|
||||||
|
return ItemStack.EMPTY;
|
||||||
// We cannot add the effect if we dont have the model
|
}
|
||||||
if (!(model instanceof CableBusBakedModel)) {
|
|
||||||
return true;
|
@Override
|
||||||
}
|
@SideOnly( Side.CLIENT )
|
||||||
|
public boolean addHitEffects( final IBlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer )
|
||||||
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
|
{
|
||||||
|
|
||||||
CableBusRenderState renderState = cb.getRenderState();
|
// Half the particle rate. Since we're spawning concentrated on a specific spot,
|
||||||
|
// our particle effect otherwise looks too strong
|
||||||
List<TextureAtlasSprite> textures = cableBusModel.getParticleTextures(renderState);
|
if( Platform.getRandom().nextBoolean() )
|
||||||
|
{
|
||||||
if (!textures.isEmpty()) {
|
return true;
|
||||||
// Shamelessly inspired by ParticleManager.addBlockDestroyEffects
|
}
|
||||||
for (int j = 0; j < 4; ++j) {
|
|
||||||
for (int k = 0; k < 4; ++k) {
|
ICableBusContainer cb = this.cb( world, target.getBlockPos() );
|
||||||
for (int l = 0; l < 4; ++l) {
|
|
||||||
// Randomly select one of the textures if the cable bus has more than just one possibility here
|
// Our built-in model has the actual baked sprites we need
|
||||||
final TextureAtlasSprite texture = Platform.pickRandom(textures);
|
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( this.getDefaultState() );
|
||||||
|
|
||||||
final double d0 = pos.getX() + (j + 0.5D) / 4.0D;
|
// We cannot add the effect if we don't have the model
|
||||||
final double d1 = pos.getY() + (k + 0.5D) / 4.0D;
|
if( !( model instanceof CableBusBakedModel ) )
|
||||||
final double d2 = pos.getZ() + (l + 0.5D) / 4.0D;
|
{
|
||||||
final ParticleDigging particle = new DestroyFX(world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
|
return true;
|
||||||
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState()).setBlockPos(pos);
|
}
|
||||||
|
|
||||||
particle.setParticleTexture(texture);
|
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
|
||||||
effectRenderer.addEffect(particle);
|
|
||||||
}
|
CableBusRenderState renderState = cb.getRenderState();
|
||||||
}
|
|
||||||
}
|
// Spawn a particle for one of the particle textures
|
||||||
}
|
TextureAtlasSprite texture = Platform.pickRandom( cableBusModel.getParticleTextures( renderState ) );
|
||||||
|
if( texture != null )
|
||||||
return true;
|
{
|
||||||
}
|
double x = target.hitVec.x;
|
||||||
|
double y = target.hitVec.y;
|
||||||
@Override
|
double z = target.hitVec.z;
|
||||||
public boolean addRunningEffects(IBlockState state, World world, BlockPos pos, Entity entity) {
|
|
||||||
if (world.isRemote) {
|
Particle fx = new DestroyFX( world, x, y, z, 0.0D, 0.0D, 0.0D, state ).setBlockPos( target.getBlockPos() ).multipleParticleScaleBy( 0.8F );
|
||||||
addRunningParticle(world, pos, entity);
|
fx.setParticleTexture( texture );
|
||||||
}
|
effectRenderer.addEffect( fx );
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
return true;
|
||||||
@SideOnly(Side.CLIENT)
|
}
|
||||||
private void addRunningParticle(World world, BlockPos pos, Entity entity) {
|
|
||||||
final ICableBusContainer cb = this.cb(world, pos);
|
@Override
|
||||||
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
@SideOnly( Side.CLIENT )
|
||||||
|
public boolean addDestroyEffects( final World world, final BlockPos pos, final ParticleManager effectRenderer )
|
||||||
if (!(model instanceof CableBusBakedModel cableBusModel)) {
|
{
|
||||||
return;
|
ICableBusContainer cb = this.cb( world, pos );
|
||||||
}
|
|
||||||
|
// Our built-in model has the actual baked sprites we need
|
||||||
final CableBusRenderState renderState = cb.getRenderState();
|
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( this.getDefaultState() );
|
||||||
final TextureAtlasSprite texture = getSpriteForParticle(renderState, cableBusModel);
|
|
||||||
if (texture != null) {
|
// We cannot add the effect if we dont have the model
|
||||||
final double d0 = entity.posX + (world.rand.nextFloat() - 0.5f) * entity.width;
|
if( !( model instanceof CableBusBakedModel ) )
|
||||||
final double d1 = entity.getEntityBoundingBox().minY + 0.1f;
|
{
|
||||||
final double d2 = entity.posZ + (world.rand.nextFloat() - 0.5f) * entity.width;
|
return true;
|
||||||
|
}
|
||||||
final ParticleDigging particle = new DestroyFX(world, d0, d1, d2, -entity.motionX * 4.0f, 1.5f, -entity.motionZ * 4.0f, this.getDefaultState()).setBlockPos(pos);
|
|
||||||
particle.setParticleTexture(texture);
|
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
|
||||||
}
|
CableBusRenderState renderState = cb.getRenderState();
|
||||||
}
|
|
||||||
|
List<TextureAtlasSprite> textures = cableBusModel.getParticleTextures( renderState );
|
||||||
@Override
|
|
||||||
public boolean addLandingEffects(IBlockState state, WorldServer world, BlockPos pos, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
|
if( !textures.isEmpty() )
|
||||||
// for reasons only notch can explain, this method is only called on the server, so we have to sync
|
{
|
||||||
// a packet to all tracking players for landing particle effects
|
// Shamelessly inspired by ParticleManager.addBlockDestroyEffects
|
||||||
if (!world.isRemote) {
|
for( int j = 0; j < 4; ++j )
|
||||||
final PacketCableBusLandingParticle packet = new PacketCableBusLandingParticle(pos, entity, numberOfParticles);
|
{
|
||||||
final NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 32);
|
for( int k = 0; k < 4; ++k )
|
||||||
NetworkHandler.instance().sendToAllTracking(packet, point);
|
{
|
||||||
}
|
for( int l = 0; l < 4; ++l )
|
||||||
return true;
|
{
|
||||||
}
|
// Randomly select one of the textures if the cable bus has more than just one possibility here
|
||||||
|
final TextureAtlasSprite texture = Platform.pickRandom( textures );
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addLandingParticle(BlockPos pos, double entityX, double entityY, double entityZ, int numberOfParticles) {
|
final double d0 = pos.getX() + ( j + 0.5D ) / 4.0D;
|
||||||
final World world = Minecraft.getMinecraft().world;
|
final double d1 = pos.getY() + ( k + 0.5D ) / 4.0D;
|
||||||
final ICableBusContainer cb = this.cb(world, pos);
|
final double d2 = pos.getZ() + ( l + 0.5D ) / 4.0D;
|
||||||
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
final ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
|
||||||
|
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
|
||||||
if (!(model instanceof CableBusBakedModel cableBusModel)) {
|
|
||||||
return;
|
particle.setParticleTexture( texture );
|
||||||
}
|
effectRenderer.addEffect( particle );
|
||||||
|
}
|
||||||
final TextureAtlasSprite texture = getSpriteForParticle(cb.getRenderState(), cableBusModel);
|
}
|
||||||
if (texture != null) {
|
}
|
||||||
final Vec3d startVec = new Vec3d(entityX, entityY, entityZ);
|
}
|
||||||
final Vec3d endVec = startVec.add(0.0f, -4.0f, 0.0f);
|
|
||||||
RayTraceResult result = world.rayTraceBlocks(startVec, endVec, true, false, true);
|
return true;
|
||||||
final double speed = 0.15f;
|
}
|
||||||
|
|
||||||
if (result != null && result.typeOfHit == Type.BLOCK && numberOfParticles != 0) {
|
@Override
|
||||||
for (int i = 0; i < numberOfParticles; i++) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final double d0 = world.rand.nextGaussian() * speed;
|
{
|
||||||
final double d1 = world.rand.nextGaussian() * speed;
|
if( Platform.isServer() )
|
||||||
final double d2 = world.rand.nextGaussian() * speed;
|
{
|
||||||
|
this.cb( world, pos ).onNeighborChanged( world, pos, fromPos );
|
||||||
final ParticleDigging particle = new DestroyFX(world, entityX, entityY, entityZ, d0, d1, d2, this.getDefaultState()).setBlockPos(pos);
|
}
|
||||||
particle.setParticleTexture(texture);
|
}
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
|
||||||
}
|
private ICableBusContainer cb( final IBlockAccess w, final BlockPos pos )
|
||||||
}
|
{
|
||||||
}
|
final TileEntity te = w.getTileEntity( pos );
|
||||||
}
|
ICableBusContainer out = null;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
if( te instanceof TileCableBus )
|
||||||
private TextureAtlasSprite getSpriteForParticle(CableBusRenderState renderState, CableBusBakedModel cableBusModel) {
|
{
|
||||||
final FacadeRenderState frs = renderState.getFacades().get(EnumFacing.UP);
|
out = ( (TileCableBus) te ).getCableBus();
|
||||||
if (frs != null) {
|
}
|
||||||
final IBlockState state = frs.getSourceBlock();
|
|
||||||
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
|
return out == null ? NULL_CABLE_BUS : out;
|
||||||
return model.getParticleTexture();
|
}
|
||||||
}
|
|
||||||
return Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
|
@Nullable
|
||||||
}
|
private IFacadeContainer fc( final IBlockAccess w, final BlockPos pos )
|
||||||
|
{
|
||||||
@Override
|
final TileEntity te = w.getTileEntity( pos );
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
IFacadeContainer out = null;
|
||||||
if (Platform.isServer()) {
|
|
||||||
this.cb(world, pos).onNeighborChanged(world, pos, fromPos);
|
if( te instanceof TileCableBus )
|
||||||
}
|
{
|
||||||
}
|
out = ( (TileCableBus) te ).getCableBus().getFacadeContainer();
|
||||||
|
}
|
||||||
private ICableBusContainer cb(final IBlockAccess w, final BlockPos pos) {
|
|
||||||
final TileEntity te = w.getTileEntity(pos);
|
return out;
|
||||||
ICableBusContainer out = null;
|
}
|
||||||
|
|
||||||
if (te instanceof TileCableBus) {
|
@Override
|
||||||
out = ((TileCableBus) te).getCableBus();
|
public void onBlockClicked( World worldIn, BlockPos pos, EntityPlayer playerIn )
|
||||||
}
|
{
|
||||||
|
if( Platform.isClient() )
|
||||||
return out == null ? NULL_CABLE_BUS : out;
|
{
|
||||||
}
|
final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver;
|
||||||
|
if( rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals( rtr.getBlockPos() ) )
|
||||||
@Nullable
|
{
|
||||||
private IFacadeContainer fc(final IBlockAccess w, final BlockPos pos) {
|
final Vec3d hitVec = rtr.hitVec.subtract( new Vec3d( pos ) );
|
||||||
final TileEntity te = w.getTileEntity(pos);
|
|
||||||
IFacadeContainer out = null;
|
if( this.cb( worldIn, pos ).clicked( playerIn, EnumHand.MAIN_HAND, hitVec ) )
|
||||||
|
{
|
||||||
if (te instanceof TileCableBus) {
|
NetworkHandler.instance()
|
||||||
out = ((TileCableBus) te).getCableBus().getFacadeContainer();
|
.sendToServer(
|
||||||
}
|
new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true ) );
|
||||||
|
}
|
||||||
return out;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) {
|
public void onBlockClickPacket( World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec )
|
||||||
if (Platform.isClient()) {
|
{
|
||||||
final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver;
|
this.cb( worldIn, pos ).clicked( playerIn, hand, hitVec );
|
||||||
if (rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals(rtr.getBlockPos())) {
|
}
|
||||||
final Vec3d hitVec = rtr.hitVec.subtract(new Vec3d(pos));
|
|
||||||
|
@Override
|
||||||
if (this.cb(worldIn, pos).clicked(playerIn, EnumHand.MAIN_HAND, hitVec)) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
NetworkHandler.instance()
|
{
|
||||||
.sendToServer(
|
return this.cb( w, pos ).activate( player, hand, new Vec3d( hitX, hitY, hitZ ) );
|
||||||
new PacketClick(pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true));
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
}
|
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color )
|
||||||
}
|
{
|
||||||
|
return this.recolorBlock( world, pos, side, color, null );
|
||||||
public void onBlockClickPacket(World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec) {
|
}
|
||||||
this.cb(worldIn, pos).clicked(playerIn, hand, hitVec);
|
|
||||||
}
|
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color, final EntityPlayer who )
|
||||||
|
{
|
||||||
@Override
|
try
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
{
|
||||||
return this.cb(w, pos).activate(player, hand, new Vec3d(hitX, hitY, hitZ));
|
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
|
||||||
}
|
}
|
||||||
|
catch( final Throwable ignored )
|
||||||
@Override
|
{
|
||||||
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color) {
|
}
|
||||||
return this.recolorBlock(world, pos, side, color, null);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color, final EntityPlayer who) {
|
@Override
|
||||||
try {
|
@SideOnly( Side.CLIENT )
|
||||||
return this.cb(world, pos).recolourBlock(side, AEColor.values()[color.ordinal()], who);
|
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
|
||||||
} catch (final Throwable ignored) {
|
{
|
||||||
}
|
// do nothing
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
public void setupTile()
|
||||||
@Override
|
{
|
||||||
@SideOnly(Side.CLIENT)
|
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class );
|
||||||
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
|
this.setTileEntity( noTesrTile );
|
||||||
// do nothing
|
|
||||||
}
|
GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" );
|
||||||
|
|
||||||
public void setupTile() {
|
if( Platform.isClient() )
|
||||||
this.setTileEntity(TileCableBus.class);
|
{
|
||||||
|
setupTesr();
|
||||||
GameRegistry.registerTileEntity(TileCableBus.class, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
|
}
|
||||||
|
}
|
||||||
if (Platform.isClient()) {
|
|
||||||
setupTesr();
|
@SideOnly( Side.CLIENT )
|
||||||
}
|
private static void setupTesr()
|
||||||
}
|
{
|
||||||
|
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class );
|
||||||
@SideOnly(Side.CLIENT)
|
GameRegistry.registerTileEntity( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus" );
|
||||||
private static void setupTesr() {
|
ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() );
|
||||||
GameRegistry.registerTileEntity(TileCableBusTESR.class, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
|
}
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCableBusTESR.class, new CableBusTESR());
|
|
||||||
}
|
@Override
|
||||||
|
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
|
||||||
@Override
|
{
|
||||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public IBlockState getFacadeState( IBlockAccess world, BlockPos pos, EnumFacing side )
|
||||||
public IBlockState getFacadeState(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
{
|
||||||
if (side != null) {
|
if( side != null )
|
||||||
IFacadeContainer container = this.fc(world, pos);
|
{
|
||||||
if (container != null) {
|
IFacadeContainer container = this.fc( world, pos );
|
||||||
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
|
if( container != null )
|
||||||
if (facade != null) {
|
{
|
||||||
return facade.getBlockState();
|
IFacadePart facade = container.getFacade( AEPartLocation.fromFacing( side ) );
|
||||||
}
|
if( facade != null )
|
||||||
}
|
{
|
||||||
}
|
return facade.getBlockState();
|
||||||
return world.getBlockState(pos);
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
return world.getBlockState( pos );
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
|
}
|
||||||
IFacadeContainer container = this.fc(world, pos);
|
|
||||||
if (container != null) {
|
public static Class<? extends AEBaseTile> getNoTesrTile()
|
||||||
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
|
{
|
||||||
if (facade != null) {
|
return noTesrTile;
|
||||||
return BlockFaceShape.SOLID;
|
}
|
||||||
}
|
|
||||||
}
|
public static Class<? extends AEBaseTile> getTesrTile()
|
||||||
return BlockFaceShape.UNDEFINED;
|
{
|
||||||
}
|
return tesrTile;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onEntityWalk(World world, BlockPos pos, Entity entityIn) {
|
// Helper to get access to the protected constructor
|
||||||
IFacadeContainer container = this.fc(world, pos);
|
@SideOnly( Side.CLIENT )
|
||||||
if (container != null) {
|
private static class DestroyFX extends ParticleDigging
|
||||||
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(EnumFacing.UP));
|
{
|
||||||
if (facade != null) {
|
DestroyFX( World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state )
|
||||||
facade.getBlockState().getBlock().onEntityWalk(world, pos, entityIn);
|
{
|
||||||
}
|
super( worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state );
|
||||||
}
|
}
|
||||||
super.onEntityWalk(world, pos, entityIn);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Helper to get access to the protected constructor
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private static class DestroyFX extends ParticleDigging {
|
|
||||||
DestroyFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state) {
|
|
||||||
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.tile.networking.TileController;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
@@ -33,128 +31,154 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.tile.networking.TileController;
|
||||||
|
|
||||||
|
|
||||||
public class BlockController extends AEBaseTileBlock {
|
public class BlockController extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public enum ControllerBlockState implements IStringSerializable {
|
public enum ControllerBlockState implements IStringSerializable
|
||||||
offline, online, conflicted;
|
{
|
||||||
|
offline, online, conflicted;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
return this.name();
|
{
|
||||||
}
|
return this.name();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the rendering of the controller block (connected texture style).
|
* Controls the rendering of the controller block (connected texture style).
|
||||||
* inside_a and inside_b are alternating patterns for a controller that is enclosed by other controllers,
|
* inside_a and inside_b are alternating patterns for a controller that is enclosed by other controllers,
|
||||||
* and since they are always offline, they do not have the usual sub-states.
|
* and since they are always offline, they do not have the usual sub-states.
|
||||||
*/
|
*/
|
||||||
public enum ControllerRenderType implements IStringSerializable {
|
public enum ControllerRenderType implements IStringSerializable
|
||||||
block, column_x, column_y, column_z, inside_a, inside_b;
|
{
|
||||||
|
block, column_x, column_y, column_z, inside_a, inside_b;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
return this.name();
|
{
|
||||||
}
|
return this.name();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final PropertyEnum<ControllerBlockState> CONTROLLER_STATE = PropertyEnum.create("state", ControllerBlockState.class);
|
public static final PropertyEnum<ControllerBlockState> CONTROLLER_STATE = PropertyEnum.create( "state", ControllerBlockState.class );
|
||||||
|
|
||||||
public static final PropertyEnum<ControllerRenderType> CONTROLLER_TYPE = PropertyEnum.create("type", ControllerRenderType.class);
|
public static final PropertyEnum<ControllerRenderType> CONTROLLER_TYPE = PropertyEnum.create( "type", ControllerRenderType.class );
|
||||||
|
|
||||||
public BlockController() {
|
public BlockController()
|
||||||
super(Material.IRON);
|
{
|
||||||
this.setHardness(6);
|
super( Material.IRON );
|
||||||
this.setDefaultState(this.getDefaultState()
|
this.setHardness( 6 );
|
||||||
.withProperty(CONTROLLER_STATE, ControllerBlockState.offline)
|
this.setDefaultState( this.getDefaultState()
|
||||||
.withProperty(CONTROLLER_TYPE, ControllerRenderType.block));
|
.withProperty( CONTROLLER_STATE, ControllerBlockState.offline )
|
||||||
}
|
.withProperty( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{CONTROLLER_STATE, CONTROLLER_TYPE};
|
{
|
||||||
}
|
return new IProperty[] { CONTROLLER_STATE, CONTROLLER_TYPE };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState()
|
||||||
return new BlockStateContainer(this, this.getAEStates());
|
{
|
||||||
}
|
return new BlockStateContainer( this, this.getAEStates() );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will compute the AE_BLOCK_FORWARD, AE_BLOCK_UP and CONTROLLER_TYPE block states based on adjacent
|
* This will compute the AE_BLOCK_FORWARD, AE_BLOCK_UP and CONTROLLER_TYPE block states based on adjacent
|
||||||
* controllers and the network state of this controller (offline, online, conflicted). This is used to
|
* controllers and the network state of this controller (offline, online, conflicted). This is used to
|
||||||
* get a rudimentary connected texture feel for the controller based on how it is placed.
|
* get a rudimentary connected texture feel for the controller based on how it is placed.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
|
{
|
||||||
|
|
||||||
// Only used for columns, really
|
// Only used for columns, really
|
||||||
ControllerRenderType type = ControllerRenderType.block;
|
ControllerRenderType type = ControllerRenderType.block;
|
||||||
|
|
||||||
int x = pos.getX();
|
int x = pos.getX();
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ();
|
int z = pos.getZ();
|
||||||
|
|
||||||
// Detect whether controllers are on both sides of the x, y, and z axes
|
// Detect whether controllers are on both sides of the x, y, and z axes
|
||||||
final boolean xx = this.getTileEntity(world, x - 1, y, z) instanceof TileController && this.getTileEntity(world, x + 1, y,
|
final boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y,
|
||||||
z) instanceof TileController;
|
z ) instanceof TileController;
|
||||||
final boolean yy = this.getTileEntity(world, x, y - 1, z) instanceof TileController && this.getTileEntity(world, x, y + 1,
|
final boolean yy = this.getTileEntity( world, x, y - 1, z ) instanceof TileController && this.getTileEntity( world, x, y + 1,
|
||||||
z) instanceof TileController;
|
z ) instanceof TileController;
|
||||||
final boolean zz = this.getTileEntity(world, x, y, z - 1) instanceof TileController && this.getTileEntity(world, x, y,
|
final boolean zz = this.getTileEntity( world, x, y, z - 1 ) instanceof TileController && this.getTileEntity( world, x, y,
|
||||||
z + 1) instanceof TileController;
|
z + 1 ) instanceof TileController;
|
||||||
|
|
||||||
if (xx && !yy && !zz) {
|
if( xx && !yy && !zz )
|
||||||
type = ControllerRenderType.column_x;
|
{
|
||||||
} else if (!xx && yy && !zz) {
|
type = ControllerRenderType.column_x;
|
||||||
type = ControllerRenderType.column_y;
|
}
|
||||||
} else if (!xx && !yy && zz) {
|
else if( !xx && yy && !zz )
|
||||||
type = ControllerRenderType.column_z;
|
{
|
||||||
} else if ((xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) >= 2) {
|
type = ControllerRenderType.column_y;
|
||||||
final int v = (Math.abs(x) + Math.abs(y) + Math.abs(z)) % 2;
|
}
|
||||||
|
else if( !xx && !yy && zz )
|
||||||
|
{
|
||||||
|
type = ControllerRenderType.column_z;
|
||||||
|
}
|
||||||
|
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
|
||||||
|
{
|
||||||
|
final int v = ( Math.abs( x ) + Math.abs( y ) + Math.abs( z ) ) % 2;
|
||||||
|
|
||||||
// While i'd like this to be based on the blockstate randomization feature, this generates
|
// While i'd like this to be based on the blockstate randomization feature, this generates
|
||||||
// an alternating pattern based on world position, so this is not 100% doable with blockstates.
|
// an alternating pattern based on world position, so this is not 100% doable with blockstates.
|
||||||
if (v == 0) {
|
if( v == 0 )
|
||||||
type = ControllerRenderType.inside_a;
|
{
|
||||||
} else {
|
type = ControllerRenderType.inside_a;
|
||||||
type = ControllerRenderType.inside_b;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
type = ControllerRenderType.inside_b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return state.withProperty(CONTROLLER_TYPE, type);
|
return state.withProperty( CONTROLLER_TYPE, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
return state;
|
{
|
||||||
}
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(final IBlockState state) {
|
public int getMetaFromState( final IBlockState state )
|
||||||
return state.getValue(CONTROLLER_STATE).ordinal();
|
{
|
||||||
}
|
return state.getValue( CONTROLLER_STATE ).ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(final int meta) {
|
public IBlockState getStateFromMeta( final int meta )
|
||||||
ControllerBlockState state = ControllerBlockState.values()[meta];
|
{
|
||||||
return this.getDefaultState().withProperty(CONTROLLER_STATE, state);
|
ControllerBlockState state = ControllerBlockState.values()[meta];
|
||||||
}
|
return this.getDefaultState().withProperty( CONTROLLER_STATE, state );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final TileController tc = this.getTileEntity(world, pos);
|
{
|
||||||
if (tc != null) {
|
final TileController tc = this.getTileEntity( world, pos );
|
||||||
tc.onNeighborChange(false);
|
if( tc != null )
|
||||||
}
|
{
|
||||||
}
|
tc.onNeighborChange( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ import appeng.block.AEBaseTileBlock;
|
|||||||
import appeng.helpers.AEGlassMaterial;
|
import appeng.helpers.AEGlassMaterial;
|
||||||
|
|
||||||
|
|
||||||
public class BlockCreativeEnergyCell extends AEBaseTileBlock {
|
public class BlockCreativeEnergyCell extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
public BlockCreativeEnergyCell() {
|
public BlockCreativeEnergyCell()
|
||||||
super(AEGlassMaterial.INSTANCE);
|
{
|
||||||
}
|
super( AEGlassMaterial.INSTANCE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,17 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
public class BlockDenseEnergyCell extends BlockEnergyCell {
|
public class BlockDenseEnergyCell extends BlockEnergyCell
|
||||||
|
{
|
||||||
|
|
||||||
public BlockDenseEnergyCell() {
|
public BlockDenseEnergyCell()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower() {
|
public double getMaxPower()
|
||||||
return 200000.0 * 8.0;
|
{
|
||||||
}
|
return 200000.0 * 8.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,16 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
|
||||||
public class BlockEnergyAcceptor extends AEBaseTileBlock {
|
|
||||||
|
|
||||||
public BlockEnergyAcceptor() {
|
public class BlockEnergyAcceptor extends AEBaseTileBlock
|
||||||
super(Material.IRON);
|
{
|
||||||
}
|
|
||||||
|
public BlockEnergyAcceptor()
|
||||||
|
{
|
||||||
|
super( Material.IRON );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.helpers.AEGlassMaterial;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyInteger;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
@@ -32,45 +29,56 @@ import net.minecraft.util.NonNullList;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.helpers.AEGlassMaterial;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class BlockEnergyCell extends AEBaseTileBlock {
|
|
||||||
|
|
||||||
public static final PropertyInteger ENERGY_STORAGE = PropertyInteger.create("fullness", 0, 7);
|
public class BlockEnergyCell extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
public static final PropertyInteger ENERGY_STORAGE = PropertyInteger.create( "fullness", 0, 7 );
|
||||||
public int getMetaFromState(final IBlockState state) {
|
|
||||||
return state.getValue(ENERGY_STORAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(final int meta) {
|
public int getMetaFromState( final IBlockState state )
|
||||||
return this.getDefaultState().withProperty(ENERGY_STORAGE, Math.min(7, Math.max(0, meta)));
|
{
|
||||||
}
|
return state.getValue( ENERGY_STORAGE );
|
||||||
|
}
|
||||||
|
|
||||||
public BlockEnergyCell() {
|
@Override
|
||||||
super(AEGlassMaterial.INSTANCE);
|
public IBlockState getStateFromMeta( final int meta )
|
||||||
}
|
{
|
||||||
|
return this.getDefaultState().withProperty( ENERGY_STORAGE, Math.min( 7, Math.max( 0, meta ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public BlockEnergyCell()
|
||||||
@SideOnly(Side.CLIENT)
|
{
|
||||||
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
|
super( AEGlassMaterial.INSTANCE );
|
||||||
super.getSubBlocks(tabs, itemStacks);
|
}
|
||||||
|
|
||||||
final ItemStack charged = new ItemStack(this, 1);
|
@Override
|
||||||
final NBTTagCompound tag = Platform.openNbtData(charged);
|
@SideOnly( Side.CLIENT )
|
||||||
tag.setDouble("internalCurrentPower", this.getMaxPower());
|
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
|
||||||
tag.setDouble("internalMaxPower", this.getMaxPower());
|
{
|
||||||
|
super.getSubBlocks( tabs, itemStacks );
|
||||||
|
|
||||||
itemStacks.add(charged);
|
final ItemStack charged = new ItemStack( this, 1 );
|
||||||
}
|
final NBTTagCompound tag = Platform.openNbtData( charged );
|
||||||
|
tag.setDouble( "internalCurrentPower", this.getMaxPower() );
|
||||||
|
tag.setDouble( "internalMaxPower", this.getMaxPower() );
|
||||||
|
|
||||||
public double getMaxPower() {
|
itemStacks.add( charged );
|
||||||
return 200000.0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public double getMaxPower()
|
||||||
protected IProperty[] getAEStates() {
|
{
|
||||||
return new IProperty[]{ENERGY_STORAGE};
|
return 200000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IProperty[] getAEStates()
|
||||||
|
{
|
||||||
|
return new IProperty[] { ENERGY_STORAGE };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,55 +19,62 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
import appeng.block.AEBaseItemBlockChargeable;
|
import appeng.block.AEBaseItemBlockChargeable;
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.tile.networking.TileEnergyCell;
|
import appeng.tile.networking.TileEnergyCell;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
|
|
||||||
public class BlockEnergyCellRendering extends BlockRenderingCustomizer {
|
public class BlockEnergyCellRendering extends BlockRenderingCustomizer
|
||||||
|
{
|
||||||
|
|
||||||
private final ResourceLocation baseModel;
|
private final ResourceLocation baseModel;
|
||||||
|
|
||||||
public BlockEnergyCellRendering(ResourceLocation baseModel) {
|
public BlockEnergyCellRendering( ResourceLocation baseModel )
|
||||||
this.baseModel = baseModel;
|
{
|
||||||
}
|
this.baseModel = baseModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
itemRendering.meshDefinition(this::getItemModel);
|
{
|
||||||
// Note: Since we use the block models, we dont need to register custom variants
|
itemRendering.meshDefinition( this::getItemModel );
|
||||||
}
|
// Note: Since we use the block models, we dont need to register custom variants
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines which version of the energy cell model should be used depending on the fill factor
|
* Determines which version of the energy cell model should be used depending on the fill factor
|
||||||
* of the item stack.
|
* of the item stack.
|
||||||
*/
|
*/
|
||||||
private ModelResourceLocation getItemModel(ItemStack is) {
|
private ModelResourceLocation getItemModel( ItemStack is )
|
||||||
double fillFactor = getFillFactor(is);
|
{
|
||||||
|
double fillFactor = getFillFactor( is );
|
||||||
|
|
||||||
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor(fillFactor);
|
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor( fillFactor );
|
||||||
return new ModelResourceLocation(this.baseModel, "fullness=" + storageLevel);
|
return new ModelResourceLocation( this.baseModel, "fullness=" + storageLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
|
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
|
||||||
* Returns 0 if the item stack has no fill factor.
|
* Returns 0 if the item stack has no fill factor.
|
||||||
*/
|
*/
|
||||||
private static double getFillFactor(ItemStack is) {
|
private static double getFillFactor( ItemStack is )
|
||||||
if (!(is.getItem() instanceof IAEItemPowerStorage)) {
|
{
|
||||||
return 0;
|
if( !( is.getItem() instanceof IAEItemPowerStorage ) )
|
||||||
}
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem();
|
AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem();
|
||||||
double curPower = itemChargeable.getAECurrentPower(is);
|
double curPower = itemChargeable.getAECurrentPower( is );
|
||||||
double maxPower = itemChargeable.getAEMaxPower(is);
|
double maxPower = itemChargeable.getAEMaxPower( is );
|
||||||
|
|
||||||
return curPower / maxPower;
|
return curPower / maxPower;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,9 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import java.util.Collections;
|
||||||
import appeng.block.AEBaseTileBlock;
|
import java.util.List;
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.helpers.AEGlassMaterial;
|
|
||||||
import appeng.helpers.ICustomCollision;
|
|
||||||
import appeng.tile.networking.TileWireless;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
@@ -40,197 +36,224 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.util.AEPartLocation;
|
||||||
import java.util.Collections;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import java.util.List;
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.helpers.AEGlassMaterial;
|
||||||
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.tile.networking.TileWireless;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
|
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
enum State implements IStringSerializable {
|
enum State implements IStringSerializable
|
||||||
OFF,
|
{
|
||||||
ON,
|
OFF,
|
||||||
HAS_CHANNEL;
|
ON,
|
||||||
|
HAS_CHANNEL;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
return this.name().toLowerCase();
|
{
|
||||||
}
|
return this.name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
|
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
|
||||||
|
|
||||||
public BlockWireless() {
|
public BlockWireless()
|
||||||
super(AEGlassMaterial.INSTANCE);
|
{
|
||||||
this.setLightOpacity(0);
|
super( AEGlassMaterial.INSTANCE );
|
||||||
this.setFullSize(false);
|
this.setLightOpacity( 0 );
|
||||||
this.setOpaque(false);
|
this.setFullSize( false );
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(STATE, State.OFF));
|
this.setOpaque( false );
|
||||||
}
|
this.setDefaultState( this.getDefaultState().withProperty( STATE, State.OFF ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||||
State teState = State.OFF;
|
{
|
||||||
|
State teState = State.OFF;
|
||||||
|
|
||||||
TileWireless te = this.getTileEntity(worldIn, pos);
|
TileWireless te = this.getTileEntity( worldIn, pos );
|
||||||
if (te != null) {
|
if( te != null )
|
||||||
if (te.isActive()) {
|
{
|
||||||
teState = State.HAS_CHANNEL;
|
if( te.isActive() )
|
||||||
} else if (te.isPowered()) {
|
{
|
||||||
teState = State.ON;
|
teState = State.HAS_CHANNEL;
|
||||||
}
|
}
|
||||||
}
|
else if( te.isPowered() )
|
||||||
|
{
|
||||||
|
teState = State.ON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return super.getActualState(state, worldIn, pos)
|
return super.getActualState( state, worldIn, pos )
|
||||||
.withProperty(STATE, teState);
|
.withProperty( STATE, teState );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{STATE};
|
{
|
||||||
}
|
return new IProperty[] { STATE };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
final TileWireless tg = this.getTileEntity(w, pos);
|
{
|
||||||
|
final TileWireless tg = this.getTileEntity( w, pos );
|
||||||
|
|
||||||
if (tg != null && !player.isSneaking()) {
|
if( tg != null && !player.isSneaking() )
|
||||||
if (Platform.isServer()) {
|
{
|
||||||
Platform.openGUI(player, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_WIRELESS);
|
if( Platform.isServer() )
|
||||||
}
|
{
|
||||||
return true;
|
Platform.openGUI( player, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_WIRELESS );
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return super.onBlockActivated(w, pos, state, player, hand, side, hitX, hitY, hitZ);
|
return super.onBlockActivated( w, pos, state, player, hand, side, hitX, hitY, hitZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
final TileWireless tile = this.getTileEntity(w, pos);
|
{
|
||||||
if (tile != null) {
|
final TileWireless tile = this.getTileEntity( w, pos );
|
||||||
final EnumFacing forward = tile.getForward();
|
if( tile != null )
|
||||||
|
{
|
||||||
|
final EnumFacing forward = tile.getForward();
|
||||||
|
|
||||||
double minX = 0;
|
double minX = 0;
|
||||||
double minY = 0;
|
double minY = 0;
|
||||||
double minZ = 0;
|
double minZ = 0;
|
||||||
double maxX = 1;
|
double maxX = 1;
|
||||||
double maxY = 1;
|
double maxY = 1;
|
||||||
double maxZ = 1;
|
double maxZ = 1;
|
||||||
|
|
||||||
switch (forward) {
|
switch( forward )
|
||||||
case DOWN:
|
{
|
||||||
minZ = minX = 3.0 / 16.0;
|
case DOWN:
|
||||||
maxZ = maxX = 13.0 / 16.0;
|
minZ = minX = 3.0 / 16.0;
|
||||||
maxY = 1.0;
|
maxZ = maxX = 13.0 / 16.0;
|
||||||
minY = 5.0 / 16.0;
|
maxY = 1.0;
|
||||||
break;
|
minY = 5.0 / 16.0;
|
||||||
case EAST:
|
break;
|
||||||
minZ = minY = 3.0 / 16.0;
|
case EAST:
|
||||||
maxZ = maxY = 13.0 / 16.0;
|
minZ = minY = 3.0 / 16.0;
|
||||||
maxX = 11.0 / 16.0;
|
maxZ = maxY = 13.0 / 16.0;
|
||||||
minX = 0.0;
|
maxX = 11.0 / 16.0;
|
||||||
break;
|
minX = 0.0;
|
||||||
case NORTH:
|
break;
|
||||||
minY = minX = 3.0 / 16.0;
|
case NORTH:
|
||||||
maxY = maxX = 13.0 / 16.0;
|
minY = minX = 3.0 / 16.0;
|
||||||
maxZ = 1.0;
|
maxY = maxX = 13.0 / 16.0;
|
||||||
minZ = 5.0 / 16.0;
|
maxZ = 1.0;
|
||||||
break;
|
minZ = 5.0 / 16.0;
|
||||||
case SOUTH:
|
break;
|
||||||
minY = minX = 3.0 / 16.0;
|
case SOUTH:
|
||||||
maxY = maxX = 13.0 / 16.0;
|
minY = minX = 3.0 / 16.0;
|
||||||
maxZ = 11.0 / 16.0;
|
maxY = maxX = 13.0 / 16.0;
|
||||||
minZ = 0.0;
|
maxZ = 11.0 / 16.0;
|
||||||
break;
|
minZ = 0.0;
|
||||||
case UP:
|
break;
|
||||||
minZ = minX = 3.0 / 16.0;
|
case UP:
|
||||||
maxZ = maxX = 13.0 / 16.0;
|
minZ = minX = 3.0 / 16.0;
|
||||||
maxY = 11.0 / 16.0;
|
maxZ = maxX = 13.0 / 16.0;
|
||||||
minY = 0.0;
|
maxY = 11.0 / 16.0;
|
||||||
break;
|
minY = 0.0;
|
||||||
case WEST:
|
break;
|
||||||
minZ = minY = 3.0 / 16.0;
|
case WEST:
|
||||||
maxZ = maxY = 13.0 / 16.0;
|
minZ = minY = 3.0 / 16.0;
|
||||||
maxX = 1.0;
|
maxZ = maxY = 13.0 / 16.0;
|
||||||
minX = 5.0 / 16.0;
|
maxX = 1.0;
|
||||||
break;
|
minX = 5.0 / 16.0;
|
||||||
default:
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return Collections.singletonList(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
|
return Collections.singletonList( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||||
}
|
}
|
||||||
return Collections.singletonList(new AxisAlignedBB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
|
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
final TileWireless tile = this.getTileEntity(w, pos);
|
{
|
||||||
if (tile != null) {
|
final TileWireless tile = this.getTileEntity( w, pos );
|
||||||
final EnumFacing forward = tile.getForward();
|
if( tile != null )
|
||||||
|
{
|
||||||
|
final EnumFacing forward = tile.getForward();
|
||||||
|
|
||||||
double minX = 0;
|
double minX = 0;
|
||||||
double minY = 0;
|
double minY = 0;
|
||||||
double minZ = 0;
|
double minZ = 0;
|
||||||
double maxX = 1;
|
double maxX = 1;
|
||||||
double maxY = 1;
|
double maxY = 1;
|
||||||
double maxZ = 1;
|
double maxZ = 1;
|
||||||
|
|
||||||
switch (forward) {
|
switch( forward )
|
||||||
case DOWN:
|
{
|
||||||
minZ = minX = 3.0 / 16.0;
|
case DOWN:
|
||||||
maxZ = maxX = 13.0 / 16.0;
|
minZ = minX = 3.0 / 16.0;
|
||||||
maxY = 1.0;
|
maxZ = maxX = 13.0 / 16.0;
|
||||||
minY = 5.0 / 16.0;
|
maxY = 1.0;
|
||||||
break;
|
minY = 5.0 / 16.0;
|
||||||
case EAST:
|
break;
|
||||||
minZ = minY = 3.0 / 16.0;
|
case EAST:
|
||||||
maxZ = maxY = 13.0 / 16.0;
|
minZ = minY = 3.0 / 16.0;
|
||||||
maxX = 11.0 / 16.0;
|
maxZ = maxY = 13.0 / 16.0;
|
||||||
minX = 0.0;
|
maxX = 11.0 / 16.0;
|
||||||
break;
|
minX = 0.0;
|
||||||
case NORTH:
|
break;
|
||||||
minY = minX = 3.0 / 16.0;
|
case NORTH:
|
||||||
maxY = maxX = 13.0 / 16.0;
|
minY = minX = 3.0 / 16.0;
|
||||||
maxZ = 1.0;
|
maxY = maxX = 13.0 / 16.0;
|
||||||
minZ = 5.0 / 16.0;
|
maxZ = 1.0;
|
||||||
break;
|
minZ = 5.0 / 16.0;
|
||||||
case SOUTH:
|
break;
|
||||||
minY = minX = 3.0 / 16.0;
|
case SOUTH:
|
||||||
maxY = maxX = 13.0 / 16.0;
|
minY = minX = 3.0 / 16.0;
|
||||||
maxZ = 11.0 / 16.0;
|
maxY = maxX = 13.0 / 16.0;
|
||||||
minZ = 0.0;
|
maxZ = 11.0 / 16.0;
|
||||||
break;
|
minZ = 0.0;
|
||||||
case UP:
|
break;
|
||||||
minZ = minX = 3.0 / 16.0;
|
case UP:
|
||||||
maxZ = maxX = 13.0 / 16.0;
|
minZ = minX = 3.0 / 16.0;
|
||||||
maxY = 11.0 / 16.0;
|
maxZ = maxX = 13.0 / 16.0;
|
||||||
minY = 0.0;
|
maxY = 11.0 / 16.0;
|
||||||
break;
|
minY = 0.0;
|
||||||
case WEST:
|
break;
|
||||||
minZ = minY = 3.0 / 16.0;
|
case WEST:
|
||||||
maxZ = maxY = 13.0 / 16.0;
|
minZ = minY = 3.0 / 16.0;
|
||||||
maxX = 1.0;
|
maxZ = maxY = 13.0 / 16.0;
|
||||||
minX = 5.0 / 16.0;
|
maxX = 1.0;
|
||||||
break;
|
minX = 5.0 / 16.0;
|
||||||
default:
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
out.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
|
out.add( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||||
} else {
|
}
|
||||||
out.add(new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
|
else
|
||||||
}
|
{
|
||||||
}
|
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEColor;
|
|
||||||
import appeng.client.render.cablebus.CableBusRenderState;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
import net.minecraft.client.renderer.color.IBlockColor;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -29,26 +27,33 @@ import net.minecraftforge.common.property.IExtendedBlockState;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.render.cablebus.CableBusRenderState;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exposes the cable bus color as tint indices 0 (dark variant), 1 (medium variant) and 2 (bright variant).
|
* Exposes the cable bus color as tint indices 0 (dark variant), 1 (medium variant) and 2 (bright variant).
|
||||||
*/
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public class CableBusColor implements IBlockColor {
|
public class CableBusColor implements IBlockColor
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int color) {
|
public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int color )
|
||||||
|
{
|
||||||
|
|
||||||
AEColor busColor = AEColor.TRANSPARENT;
|
AEColor busColor = AEColor.TRANSPARENT;
|
||||||
|
|
||||||
if (state instanceof IExtendedBlockState) {
|
if( state instanceof IExtendedBlockState )
|
||||||
CableBusRenderState renderState = ((IExtendedBlockState) state).getValue(BlockCableBus.RENDER_STATE_PROPERTY);
|
{
|
||||||
if (renderState != null) {
|
CableBusRenderState renderState = ( (IExtendedBlockState) state ).getValue( BlockCableBus.RENDER_STATE_PROPERTY );
|
||||||
busColor = renderState.getCableColor();
|
if( renderState != null )
|
||||||
}
|
{
|
||||||
}
|
busColor = renderState.getCableColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return busColor.getVariantByTintIndex(color);
|
return busColor.getVariantByTintIndex( color );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,30 +19,34 @@
|
|||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.client.render.cablebus.CableBusModel;
|
import appeng.client.render.cablebus.CableBusModel;
|
||||||
import appeng.core.features.registries.PartModels;
|
import appeng.core.features.registries.PartModels;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customizes the rendering behavior for cable busses, which are the biggest multipart of AE2.
|
* Customizes the rendering behavior for cable busses, which are the biggest multipart of AE2.
|
||||||
*/
|
*/
|
||||||
public class CableBusRendering extends BlockRenderingCustomizer {
|
public class CableBusRendering extends BlockRenderingCustomizer
|
||||||
private final PartModels partModels;
|
{
|
||||||
|
private final PartModels partModels;
|
||||||
|
|
||||||
public CableBusRendering(PartModels partModels) {
|
public CableBusRendering( PartModels partModels )
|
||||||
this.partModels = partModels;
|
{
|
||||||
}
|
this.partModels = partModels;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.builtInModel("models/block/builtin/cable_bus", new CableBusModel(this.partModels));
|
{
|
||||||
rendering.blockColor(new CableBusColor());
|
rendering.builtInModel( "models/block/builtin/cable_bus", new CableBusModel( this.partModels ) );
|
||||||
rendering.modelCustomizer((loc, model) -> model);
|
rendering.blockColor( new CableBusColor() );
|
||||||
}
|
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,12 @@ import appeng.bootstrap.IBlockRendering;
|
|||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
|
|
||||||
|
|
||||||
public class ControllerRendering extends BlockRenderingCustomizer {
|
public class ControllerRendering extends BlockRenderingCustomizer
|
||||||
@Override
|
{
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
@Override
|
||||||
// Disables the default model rotator
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.modelCustomizer((loc, model) -> model);
|
{
|
||||||
}
|
// Disables the default model rotator
|
||||||
|
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
|
|
||||||
package appeng.block.networking;
|
package appeng.block.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import appeng.client.render.StaticBlockColor;
|
import appeng.client.render.StaticBlockColor;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
public class WirelessRendering extends BlockRenderingCustomizer {
|
public class WirelessRendering extends BlockRenderingCustomizer
|
||||||
@Override
|
{
|
||||||
@SideOnly(Side.CLIENT)
|
@Override
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
@SideOnly( Side.CLIENT )
|
||||||
rendering.blockColor(new StaticBlockColor(AEColor.TRANSPARENT));
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
}
|
{
|
||||||
|
rendering.blockColor( new StaticBlockColor( AEColor.TRANSPARENT ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
package appeng.block.paint;
|
package appeng.block.paint;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import java.util.Collection;
|
||||||
import appeng.helpers.Splotch;
|
import java.util.Collections;
|
||||||
import appeng.tile.misc.TilePaint;
|
import java.util.Random;
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.MapColor;
|
import net.minecraft.block.material.MapColor;
|
||||||
import net.minecraft.block.material.MaterialLiquid;
|
import net.minecraft.block.material.MaterialLiquid;
|
||||||
@@ -44,109 +44,128 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import java.util.Collection;
|
import appeng.helpers.Splotch;
|
||||||
import java.util.Collections;
|
import appeng.tile.misc.TilePaint;
|
||||||
import java.util.Random;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockPaint extends AEBaseTileBlock {
|
public class BlockPaint extends AEBaseTileBlock
|
||||||
|
{
|
||||||
|
|
||||||
static final PaintSplotchesProperty SPLOTCHES = new PaintSplotchesProperty();
|
static final PaintSplotchesProperty SPLOTCHES = new PaintSplotchesProperty();
|
||||||
|
|
||||||
public BlockPaint() {
|
public BlockPaint()
|
||||||
super(new MaterialLiquid(MapColor.AIR));
|
{
|
||||||
|
super( new MaterialLiquid( MapColor.AIR ) );
|
||||||
|
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity( 0 );
|
||||||
this.setFullSize(false);
|
this.setFullSize( false );
|
||||||
this.setOpaque(false);
|
this.setOpaque( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState()
|
||||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{SPLOTCHES});
|
{
|
||||||
}
|
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { SPLOTCHES } );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
{
|
||||||
|
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||||
|
|
||||||
TilePaint te = this.getTileEntity(world, pos);
|
TilePaint te = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
Collection<Splotch> splotches = Collections.emptyList();
|
Collection<Splotch> splotches = Collections.emptyList();
|
||||||
if (te != null) {
|
if( te != null )
|
||||||
splotches = te.getDots();
|
{
|
||||||
}
|
splotches = te.getDots();
|
||||||
|
}
|
||||||
|
|
||||||
return extState.withProperty(SPLOTCHES, new PaintSplotches(splotches));
|
return extState.withProperty( SPLOTCHES, new PaintSplotches( splotches ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
|
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
|
||||||
// do nothing
|
{
|
||||||
}
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
public AxisAlignedBB getCollisionBoundingBox( IBlockState blockState, IBlockAccess worldIn, BlockPos pos )
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCollideCheck(final IBlockState state, final boolean hitIfLiquid) {
|
public boolean canCollideCheck( final IBlockState state, final boolean hitIfLiquid )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final TilePaint tp = this.getTileEntity(world, pos);
|
{
|
||||||
|
final TilePaint tp = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
if (tp != null) {
|
if( tp != null )
|
||||||
tp.neighborChanged();
|
{
|
||||||
}
|
tp.neighborChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(final IBlockState state, final Random rand, final int fortune) {
|
public Item getItemDropped( final IBlockState state, final Random rand, final int fortune )
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropBlockAsItemWithChance(final World worldIn, final BlockPos pos, final IBlockState state, final float chance, final int fortune) {
|
public void dropBlockAsItemWithChance( final World worldIn, final BlockPos pos, final IBlockState state, final float chance, final int fortune )
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillWithRain(final World w, final BlockPos pos) {
|
public void fillWithRain( final World w, final BlockPos pos )
|
||||||
if (Platform.isServer()) {
|
{
|
||||||
w.setBlockToAir(pos);
|
if( Platform.isServer() )
|
||||||
}
|
{
|
||||||
}
|
w.setBlockToAir( pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(final IBlockState state, final IBlockAccess w, final BlockPos pos) {
|
public int getLightValue( final IBlockState state, final IBlockAccess w, final BlockPos pos )
|
||||||
final TilePaint tp = this.getTileEntity(w, pos);
|
{
|
||||||
|
final TilePaint tp = this.getTileEntity( w, pos );
|
||||||
|
|
||||||
if (tp != null) {
|
if( tp != null )
|
||||||
return tp.getLightLevel();
|
{
|
||||||
}
|
return tp.getLightLevel();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAir(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
|
public boolean isAir( final IBlockState state, final IBlockAccess world, final BlockPos pos )
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(final IBlockAccess worldIn, final BlockPos pos) {
|
public boolean isReplaceable( final IBlockAccess worldIn, final BlockPos pos )
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
|
|
||||||
package appeng.block.paint;
|
package appeng.block.paint;
|
||||||
|
|
||||||
|
|
||||||
import appeng.client.render.cablebus.CubeBuilder;
|
import java.util.ArrayList;
|
||||||
import appeng.core.AppEng;
|
import java.util.Collections;
|
||||||
import appeng.helpers.Splotch;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
@@ -16,11 +22,9 @@ import net.minecraft.util.EnumFacing;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.client.render.cablebus.CubeBuilder;
|
||||||
import java.util.ArrayList;
|
import appeng.core.AppEng;
|
||||||
import java.util.Collections;
|
import appeng.helpers.Splotch;
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,150 +32,168 @@ import java.util.function.Function;
|
|||||||
* a
|
* a
|
||||||
* matter cannon with paint balls.
|
* matter cannon with paint balls.
|
||||||
*/
|
*/
|
||||||
class PaintBakedModel implements IBakedModel {
|
class PaintBakedModel implements IBakedModel
|
||||||
|
{
|
||||||
|
|
||||||
private static final ResourceLocation TEXTURE_PAINT1 = new ResourceLocation(AppEng.MOD_ID, "blocks/paint1");
|
private static final ResourceLocation TEXTURE_PAINT1 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint1" );
|
||||||
private static final ResourceLocation TEXTURE_PAINT2 = new ResourceLocation(AppEng.MOD_ID, "blocks/paint2");
|
private static final ResourceLocation TEXTURE_PAINT2 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint2" );
|
||||||
private static final ResourceLocation TEXTURE_PAINT3 = new ResourceLocation(AppEng.MOD_ID, "blocks/paint3");
|
private static final ResourceLocation TEXTURE_PAINT3 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint3" );
|
||||||
|
|
||||||
private final VertexFormat vertexFormat;
|
private final VertexFormat vertexFormat;
|
||||||
|
|
||||||
private final TextureAtlasSprite[] textures;
|
private final TextureAtlasSprite[] textures;
|
||||||
|
|
||||||
PaintBakedModel(VertexFormat vertexFormat, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
PaintBakedModel( VertexFormat vertexFormat, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
this.vertexFormat = vertexFormat;
|
{
|
||||||
this.textures = new TextureAtlasSprite[]{
|
this.vertexFormat = vertexFormat;
|
||||||
bakedTextureGetter.apply(TEXTURE_PAINT1),
|
this.textures = new TextureAtlasSprite[] {
|
||||||
bakedTextureGetter.apply(TEXTURE_PAINT2),
|
bakedTextureGetter.apply( TEXTURE_PAINT1 ),
|
||||||
bakedTextureGetter.apply(TEXTURE_PAINT3)
|
bakedTextureGetter.apply( TEXTURE_PAINT2 ),
|
||||||
};
|
bakedTextureGetter.apply( TEXTURE_PAINT3 )
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
|
||||||
if (side != null) {
|
{
|
||||||
return Collections.emptyList();
|
if( side != null )
|
||||||
}
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
if (!(state instanceof IExtendedBlockState)) {
|
if( !( state instanceof IExtendedBlockState ) )
|
||||||
// This is the inventory model which should usually not be used other than in special cases
|
{
|
||||||
List<BakedQuad> quads = new ArrayList<>(1);
|
// This is the inventory model which should usually not be used other than in special cases
|
||||||
CubeBuilder builder = new CubeBuilder(this.vertexFormat, quads);
|
List<BakedQuad> quads = new ArrayList<>( 1 );
|
||||||
builder.setTexture(this.textures[0]);
|
CubeBuilder builder = new CubeBuilder( this.vertexFormat, quads );
|
||||||
builder.addCube(0, 0, 0, 16, 16, 16);
|
builder.setTexture( this.textures[0] );
|
||||||
return quads;
|
builder.addCube( 0, 0, 0, 16, 16, 16 );
|
||||||
}
|
return quads;
|
||||||
|
}
|
||||||
|
|
||||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||||
PaintSplotches splotchesState = extendedBlockState.getValue(BlockPaint.SPLOTCHES);
|
PaintSplotches splotchesState = extendedBlockState.getValue( BlockPaint.SPLOTCHES );
|
||||||
|
|
||||||
if (splotchesState == null) {
|
if( splotchesState == null )
|
||||||
return Collections.emptyList();
|
{
|
||||||
}
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
List<Splotch> splotches = splotchesState.getSplotches();
|
List<Splotch> splotches = splotchesState.getSplotches();
|
||||||
|
|
||||||
CubeBuilder builder = new CubeBuilder(this.vertexFormat);
|
CubeBuilder builder = new CubeBuilder( this.vertexFormat );
|
||||||
|
|
||||||
float offsetConstant = 0.001f;
|
float offsetConstant = 0.001f;
|
||||||
for (final Splotch s : splotches) {
|
for( final Splotch s : splotches )
|
||||||
|
{
|
||||||
|
|
||||||
if (s.isLumen()) {
|
if( s.isLumen() )
|
||||||
builder.setColorRGB(s.getColor().whiteVariant);
|
{
|
||||||
builder.setRenderFullBright(true);
|
builder.setColorRGB( s.getColor().whiteVariant );
|
||||||
} else {
|
builder.setRenderFullBright( true );
|
||||||
builder.setColorRGB(s.getColor().mediumVariant);
|
}
|
||||||
builder.setRenderFullBright(false);
|
else
|
||||||
}
|
{
|
||||||
|
builder.setColorRGB( s.getColor().mediumVariant );
|
||||||
|
builder.setRenderFullBright( false );
|
||||||
|
}
|
||||||
|
|
||||||
float offset = offsetConstant;
|
float offset = offsetConstant;
|
||||||
offsetConstant += 0.001f;
|
offsetConstant += 0.001f;
|
||||||
|
|
||||||
final float buffer = 0.1f;
|
final float buffer = 0.1f;
|
||||||
|
|
||||||
float pos_x = s.x();
|
float pos_x = s.x();
|
||||||
float pos_y = s.y();
|
float pos_y = s.y();
|
||||||
|
|
||||||
pos_x = Math.max(buffer, Math.min(1.0f - buffer, pos_x));
|
pos_x = Math.max( buffer, Math.min( 1.0f - buffer, pos_x ) );
|
||||||
pos_y = Math.max(buffer, Math.min(1.0f - buffer, pos_y));
|
pos_y = Math.max( buffer, Math.min( 1.0f - buffer, pos_y ) );
|
||||||
|
|
||||||
TextureAtlasSprite ico = this.textures[s.getSeed() % this.textures.length];
|
TextureAtlasSprite ico = this.textures[s.getSeed() % this.textures.length];
|
||||||
builder.setTexture(ico);
|
builder.setTexture( ico );
|
||||||
builder.setCustomUv(s.getSide().getOpposite(), 0, 0, 16, 16);
|
builder.setCustomUv( s.getSide().getOpposite(), 0, 0, 16, 16 );
|
||||||
|
|
||||||
switch (s.getSide()) {
|
switch( s.getSide() )
|
||||||
case UP:
|
{
|
||||||
offset = 1.0f - offset;
|
case UP:
|
||||||
builder.addQuad(EnumFacing.DOWN, pos_x - buffer, offset, pos_y - buffer,
|
offset = 1.0f - offset;
|
||||||
pos_x + buffer, offset, pos_y + buffer);
|
builder.addQuad( EnumFacing.DOWN, pos_x - buffer, offset, pos_y - buffer,
|
||||||
break;
|
pos_x + buffer, offset, pos_y + buffer );
|
||||||
|
break;
|
||||||
|
|
||||||
case DOWN:
|
case DOWN:
|
||||||
builder.addQuad(EnumFacing.UP, pos_x - buffer, offset, pos_y - buffer,
|
builder.addQuad( EnumFacing.UP, pos_x - buffer, offset, pos_y - buffer,
|
||||||
pos_x + buffer, offset, pos_y + buffer);
|
pos_x + buffer, offset, pos_y + buffer );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EAST:
|
case EAST:
|
||||||
offset = 1.0f - offset;
|
offset = 1.0f - offset;
|
||||||
builder.addQuad(EnumFacing.WEST, offset, pos_x - buffer, pos_y - buffer,
|
builder.addQuad( EnumFacing.WEST, offset, pos_x - buffer, pos_y - buffer,
|
||||||
offset, pos_x + buffer, pos_y + buffer);
|
offset, pos_x + buffer, pos_y + buffer );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEST:
|
case WEST:
|
||||||
builder.addQuad(EnumFacing.EAST, offset, pos_x - buffer, pos_y - buffer,
|
builder.addQuad( EnumFacing.EAST, offset, pos_x - buffer, pos_y - buffer,
|
||||||
offset, pos_x + buffer, pos_y + buffer);
|
offset, pos_x + buffer, pos_y + buffer );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
offset = 1.0f - offset;
|
offset = 1.0f - offset;
|
||||||
builder.addQuad(EnumFacing.NORTH, pos_x - buffer, pos_y - buffer, offset,
|
builder.addQuad( EnumFacing.NORTH, pos_x - buffer, pos_y - buffer, offset,
|
||||||
pos_x + buffer, pos_y + buffer, offset);
|
pos_x + buffer, pos_y + buffer, offset );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NORTH:
|
case NORTH:
|
||||||
builder.addQuad(EnumFacing.SOUTH, pos_x - buffer, pos_y - buffer, offset,
|
builder.addQuad( EnumFacing.SOUTH, pos_x - buffer, pos_y - buffer, offset,
|
||||||
pos_x + buffer, pos_y + buffer, offset);
|
pos_x + buffer, pos_y + buffer, offset );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.getOutput();
|
return builder.getOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAmbientOcclusion() {
|
public boolean isAmbientOcclusion()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGui3d() {
|
public boolean isGui3d()
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBuiltInRenderer() {
|
public boolean isBuiltInRenderer()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
public TextureAtlasSprite getParticleTexture()
|
||||||
return this.textures[0];
|
{
|
||||||
}
|
return this.textures[0];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
public ItemCameraTransforms getItemCameraTransforms()
|
||||||
return ItemCameraTransforms.DEFAULT;
|
{
|
||||||
}
|
return ItemCameraTransforms.DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides()
|
||||||
return ItemOverrideList.NONE;
|
{
|
||||||
}
|
return ItemOverrideList.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static List<ResourceLocation> getRequiredTextures() {
|
static List<ResourceLocation> getRequiredTextures()
|
||||||
return ImmutableList.of(
|
{
|
||||||
TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3);
|
return ImmutableList.of(
|
||||||
}
|
TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
|
|
||||||
package appeng.block.paint;
|
package appeng.block.paint;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
@@ -9,31 +14,32 @@ import net.minecraftforge.client.model.IModel;
|
|||||||
import net.minecraftforge.common.model.IModelState;
|
import net.minecraftforge.common.model.IModelState;
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
|
class PaintModel implements IModel
|
||||||
|
{
|
||||||
|
|
||||||
class PaintModel implements IModel {
|
@Override
|
||||||
|
public Collection<ResourceLocation> getDependencies()
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ResourceLocation> getDependencies() {
|
public Collection<ResourceLocation> getTextures()
|
||||||
return Collections.emptyList();
|
{
|
||||||
}
|
return PaintBakedModel.getRequiredTextures();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ResourceLocation> getTextures() {
|
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
return PaintBakedModel.getRequiredTextures();
|
{
|
||||||
}
|
return new PaintBakedModel( format, bakedTextureGetter );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
public IModelState getDefaultState()
|
||||||
return new PaintBakedModel(format, bakedTextureGetter);
|
{
|
||||||
}
|
return TRSRTransformation.identity();
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public IModelState getDefaultState() {
|
|
||||||
return TRSRTransformation.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
|
|
||||||
package appeng.block.paint;
|
package appeng.block.paint;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
public class PaintRendering extends BlockRenderingCustomizer {
|
public class PaintRendering extends BlockRenderingCustomizer
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||||
rendering.builtInModel("models/block/paint", new PaintModel());
|
{
|
||||||
// Disable auto rotation
|
rendering.builtInModel( "models/block/paint", new PaintModel() );
|
||||||
rendering.modelCustomizer((location, model) -> model);
|
// Disable auto rotation
|
||||||
}
|
rendering.modelCustomizer( ( location, model ) -> model );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
|
|
||||||
package appeng.block.paint;
|
package appeng.block.paint;
|
||||||
|
|
||||||
|
|
||||||
import appeng.helpers.Splotch;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import appeng.helpers.Splotch;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to transfer the state about paint splotches from the game thread to the render thread.
|
* Used to transfer the state about paint splotches from the game thread to the render thread.
|
||||||
*/
|
*/
|
||||||
class PaintSplotches {
|
class PaintSplotches
|
||||||
|
{
|
||||||
|
|
||||||
private final List<Splotch> splotches;
|
private final List<Splotch> splotches;
|
||||||
|
|
||||||
PaintSplotches(Collection<Splotch> splotches) {
|
PaintSplotches( Collection<Splotch> splotches )
|
||||||
this.splotches = ImmutableList.copyOf(splotches);
|
{
|
||||||
}
|
this.splotches = ImmutableList.copyOf( splotches );
|
||||||
|
}
|
||||||
|
|
||||||
List<Splotch> getSplotches() {
|
List<Splotch> getSplotches()
|
||||||
return this.splotches;
|
{
|
||||||
}
|
return this.splotches;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,34 @@
|
|||||||
|
|
||||||
package appeng.block.paint;
|
package appeng.block.paint;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
|
||||||
class PaintSplotchesProperty implements IUnlistedProperty<PaintSplotches> {
|
class PaintSplotchesProperty implements IUnlistedProperty<PaintSplotches>
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
return "paint_splots";
|
{
|
||||||
}
|
return "paint_splots";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(PaintSplotches value) {
|
public boolean isValid( PaintSplotches value )
|
||||||
return value != null;
|
{
|
||||||
}
|
return value != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<PaintSplotches> getType() {
|
public Class<PaintSplotches> getType()
|
||||||
return PaintSplotches.class;
|
{
|
||||||
}
|
return PaintSplotches.class;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String valueToString(PaintSplotches value) {
|
public String valueToString( PaintSplotches value )
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
package appeng.block.qnb;
|
package appeng.block.qnb;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
|
||||||
import appeng.helpers.ICustomCollision;
|
|
||||||
import appeng.tile.qnb.TileQuantumBridge;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
@@ -37,81 +34,97 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import appeng.tile.qnb.TileQuantumBridge;
|
||||||
|
|
||||||
|
|
||||||
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
|
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision
|
||||||
|
{
|
||||||
|
|
||||||
public static final PropertyBool FORMED = PropertyBool.create("formed");
|
public static final PropertyBool FORMED = PropertyBool.create( "formed" );
|
||||||
|
|
||||||
public static final QnbFormedStateProperty FORMED_STATE = new QnbFormedStateProperty();
|
public static final QnbFormedStateProperty FORMED_STATE = new QnbFormedStateProperty();
|
||||||
|
|
||||||
public BlockQuantumBase(final Material mat) {
|
public BlockQuantumBase( final Material mat )
|
||||||
super(mat);
|
{
|
||||||
final float shave = 2.0f / 16.0f;
|
super( mat );
|
||||||
this.boundingBox = new AxisAlignedBB(shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave);
|
final float shave = 2.0f / 16.0f;
|
||||||
this.setLightOpacity(0);
|
this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||||
this.setFullSize(this.setOpaque(false));
|
this.setLightOpacity( 0 );
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(FORMED, false));
|
this.setFullSize( this.setOpaque( false ) );
|
||||||
}
|
this.setDefaultState( this.getDefaultState().withProperty( FORMED, false ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProperty[] getAEStates() {
|
protected IProperty[] getAEStates()
|
||||||
return new IProperty[]{FORMED};
|
{
|
||||||
}
|
return new IProperty[] { FORMED };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState()
|
||||||
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{FORMED_STATE});
|
{
|
||||||
}
|
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { FORMED_STATE } );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
{
|
||||||
|
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||||
|
|
||||||
TileQuantumBridge bridge = this.getTileEntity(world, pos);
|
TileQuantumBridge bridge = this.getTileEntity( world, pos );
|
||||||
if (bridge != null) {
|
if( bridge != null )
|
||||||
QnbFormedState formedState = new QnbFormedState(bridge.getAdjacentQuantumBridges(), bridge.isCorner(), bridge.isPowered());
|
{
|
||||||
extState = extState.withProperty(FORMED_STATE, formedState);
|
QnbFormedState formedState = new QnbFormedState( bridge.getAdjacentQuantumBridges(), bridge.isCorner(), bridge.isPowered() );
|
||||||
}
|
extState = extState.withProperty( FORMED_STATE, formedState );
|
||||||
|
}
|
||||||
|
|
||||||
return extState;
|
return extState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||||
TileQuantumBridge bridge = this.getTileEntity(worldIn, pos);
|
{
|
||||||
if (bridge != null) {
|
TileQuantumBridge bridge = this.getTileEntity( worldIn, pos );
|
||||||
state = state.withProperty(FORMED, bridge.isFormed());
|
if( bridge != null )
|
||||||
}
|
{
|
||||||
return state;
|
state = state.withProperty( FORMED, bridge.isFormed() );
|
||||||
}
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
public BlockRenderLayer getBlockLayer()
|
||||||
return BlockRenderLayer.CUTOUT;
|
{
|
||||||
}
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||||
final TileQuantumBridge bridge = this.getTileEntity(world, pos);
|
{
|
||||||
if (bridge != null) {
|
final TileQuantumBridge bridge = this.getTileEntity( world, pos );
|
||||||
bridge.neighborUpdate();
|
if( bridge != null )
|
||||||
}
|
{
|
||||||
}
|
bridge.neighborUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(final World w, final BlockPos pos, final IBlockState state) {
|
public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
|
||||||
final TileQuantumBridge bridge = this.getTileEntity(w, pos);
|
{
|
||||||
if (bridge != null) {
|
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||||
bridge.breakCluster();
|
if( bridge != null )
|
||||||
}
|
{
|
||||||
|
bridge.breakCluster();
|
||||||
|
}
|
||||||
|
|
||||||
super.breakBlock(w, pos, state);
|
super.breakBlock( w, pos, state );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( IBlockState state )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,12 @@
|
|||||||
package appeng.block.qnb;
|
package appeng.block.qnb;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import java.util.Collections;
|
||||||
import appeng.client.EffectType;
|
import java.util.List;
|
||||||
import appeng.core.AppEng;
|
import java.util.Random;
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.helpers.AEGlassMaterial;
|
import javax.annotation.Nullable;
|
||||||
import appeng.tile.qnb.TileQuantumBridge;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -36,55 +35,70 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.util.AEPartLocation;
|
||||||
import java.util.Collections;
|
import appeng.client.EffectType;
|
||||||
import java.util.List;
|
import appeng.core.AppEng;
|
||||||
import java.util.Random;
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.helpers.AEGlassMaterial;
|
||||||
|
import appeng.tile.qnb.TileQuantumBridge;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class BlockQuantumLinkChamber extends BlockQuantumBase {
|
public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||||
|
{
|
||||||
|
|
||||||
public BlockQuantumLinkChamber() {
|
public BlockQuantumLinkChamber()
|
||||||
super(AEGlassMaterial.INSTANCE);
|
{
|
||||||
}
|
super( AEGlassMaterial.INSTANCE );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random rand) {
|
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random rand )
|
||||||
final TileQuantumBridge bridge = this.getTileEntity(w, pos);
|
{
|
||||||
if (bridge != null) {
|
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||||
if (bridge.hasQES()) {
|
if( bridge != null )
|
||||||
if (AppEng.proxy.shouldAddParticles(rand)) {
|
{
|
||||||
AppEng.proxy.spawnEffect(EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, null);
|
if( bridge.hasQES() )
|
||||||
}
|
{
|
||||||
}
|
if( AppEng.proxy.shouldAddParticles( rand ) )
|
||||||
}
|
{
|
||||||
}
|
AppEng.proxy.spawnEffect( EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
if (p.isSneaking()) {
|
{
|
||||||
return false;
|
if( p.isSneaking() )
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TileQuantumBridge tg = this.getTileEntity(w, pos);
|
final TileQuantumBridge tg = this.getTileEntity( w, pos );
|
||||||
if (tg != null) {
|
if( tg != null )
|
||||||
if (Platform.isServer()) {
|
{
|
||||||
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_QNB);
|
if( Platform.isServer() )
|
||||||
}
|
{
|
||||||
return true;
|
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_QNB );
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
final double onePixel = 2.0 / 16.0;
|
{
|
||||||
return Collections.singletonList(new AxisAlignedBB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
final double onePixel = 2.0 / 16.0;
|
||||||
}
|
return Collections.singletonList( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
final double onePixel = 2.0 / 16.0;
|
{
|
||||||
out.add(new AxisAlignedBB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
final double onePixel = 2.0 / 16.0;
|
||||||
}
|
out.add( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,44 +19,55 @@
|
|||||||
package appeng.block.qnb;
|
package appeng.block.qnb;
|
||||||
|
|
||||||
|
|
||||||
import appeng.tile.qnb.TileQuantumBridge;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Collections;
|
import appeng.tile.qnb.TileQuantumBridge;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class BlockQuantumRing extends BlockQuantumBase {
|
public class BlockQuantumRing extends BlockQuantumBase
|
||||||
|
{
|
||||||
|
|
||||||
public BlockQuantumRing() {
|
public BlockQuantumRing()
|
||||||
super(Material.IRON);
|
{
|
||||||
}
|
super( Material.IRON );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||||
double onePixel = 2.0 / 16.0;
|
{
|
||||||
final TileQuantumBridge bridge = this.getTileEntity(w, pos);
|
double onePixel = 2.0 / 16.0;
|
||||||
if (bridge != null && bridge.isCorner()) {
|
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||||
onePixel = 4.0 / 16.0;
|
if( bridge != null && bridge.isCorner() )
|
||||||
} else if (bridge != null && bridge.isFormed()) {
|
{
|
||||||
onePixel = 1.0 / 16.0;
|
onePixel = 4.0 / 16.0;
|
||||||
}
|
}
|
||||||
return Collections.singletonList(new AxisAlignedBB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
else if( bridge != null && bridge.isFormed() )
|
||||||
}
|
{
|
||||||
|
onePixel = 1.0 / 16.0;
|
||||||
|
}
|
||||||
|
return Collections.singletonList( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
|
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||||
double onePixel = 2.0 / 16.0;
|
{
|
||||||
final TileQuantumBridge bridge = this.getTileEntity(w, pos);
|
double onePixel = 2.0 / 16.0;
|
||||||
if (bridge != null && bridge.isCorner()) {
|
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||||
onePixel = 4.0 / 16.0;
|
if( bridge != null && bridge.isCorner() )
|
||||||
} else if (bridge != null && bridge.isFormed()) {
|
{
|
||||||
onePixel = 1.0 / 16.0;
|
onePixel = 4.0 / 16.0;
|
||||||
}
|
}
|
||||||
out.add(new AxisAlignedBB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
else if( bridge != null && bridge.isFormed() )
|
||||||
}
|
{
|
||||||
|
onePixel = 1.0 / 16.0;
|
||||||
|
}
|
||||||
|
out.add( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
|
|
||||||
package appeng.block.qnb;
|
package appeng.block.qnb;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import java.util.EnumSet;
|
||||||
import appeng.client.render.cablebus.CubeBuilder;
|
import java.util.List;
|
||||||
import appeng.core.AppEng;
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
@@ -17,195 +23,222 @@ import net.minecraft.util.EnumFacing;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import appeng.api.AEApi;
|
||||||
import java.util.EnumSet;
|
import appeng.client.render.cablebus.CubeBuilder;
|
||||||
import java.util.List;
|
import appeng.core.AppEng;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
|
|
||||||
class QnbFormedBakedModel implements IBakedModel {
|
class QnbFormedBakedModel implements IBakedModel
|
||||||
|
{
|
||||||
|
|
||||||
private static final ResourceLocation TEXTURE_LINK = new ResourceLocation(AppEng.MOD_ID, "blocks/quantum_link");
|
private static final ResourceLocation TEXTURE_LINK = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_link" );
|
||||||
private static final ResourceLocation TEXTURE_RING = new ResourceLocation(AppEng.MOD_ID, "blocks/quantum_ring");
|
private static final ResourceLocation TEXTURE_RING = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring" );
|
||||||
private static final ResourceLocation TEXTURE_RING_LIGHT = new ResourceLocation(AppEng.MOD_ID, "blocks/quantum_ring_light");
|
private static final ResourceLocation TEXTURE_RING_LIGHT = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light" );
|
||||||
private static final ResourceLocation TEXTURE_RING_LIGHT_CORNER = new ResourceLocation(AppEng.MOD_ID, "blocks/quantum_ring_light_corner");
|
private static final ResourceLocation TEXTURE_RING_LIGHT_CORNER = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light_corner" );
|
||||||
private static final ResourceLocation TEXTURE_CABLE_GLASS = new ResourceLocation(AppEng.MOD_ID, "parts/cable/glass/transparent");
|
private static final ResourceLocation TEXTURE_CABLE_GLASS = new ResourceLocation( AppEng.MOD_ID, "parts/cable/glass/transparent" );
|
||||||
private static final ResourceLocation TEXTURE_COVERED_CABLE = new ResourceLocation(AppEng.MOD_ID, "parts/cable/covered/transparent");
|
private static final ResourceLocation TEXTURE_COVERED_CABLE = new ResourceLocation( AppEng.MOD_ID, "parts/cable/covered/transparent" );
|
||||||
|
|
||||||
private static final float DEFAULT_RENDER_MIN = 2.0f;
|
private static final float DEFAULT_RENDER_MIN = 2.0f;
|
||||||
private static final float DEFAULT_RENDER_MAX = 14.0f;
|
private static final float DEFAULT_RENDER_MAX = 14.0f;
|
||||||
|
|
||||||
private static final float CORNER_POWERED_RENDER_MIN = 3.9f;
|
private static final float CORNER_POWERED_RENDER_MIN = 3.9f;
|
||||||
private static final float CORNER_POWERED_RENDER_MAX = 12.1f;
|
private static final float CORNER_POWERED_RENDER_MAX = 12.1f;
|
||||||
|
|
||||||
private static final float CENTER_POWERED_RENDER_MIN = -0.01f;
|
private static final float CENTER_POWERED_RENDER_MIN = -0.01f;
|
||||||
private static final float CENTER_POWERED_RENDER_MAX = 16.01f;
|
private static final float CENTER_POWERED_RENDER_MAX = 16.01f;
|
||||||
|
|
||||||
private final VertexFormat vertexFormat;
|
private final VertexFormat vertexFormat;
|
||||||
|
|
||||||
private final IBakedModel baseModel;
|
private final IBakedModel baseModel;
|
||||||
|
|
||||||
private final Block linkBlock;
|
private final Block linkBlock;
|
||||||
|
|
||||||
private final TextureAtlasSprite linkTexture;
|
private final TextureAtlasSprite linkTexture;
|
||||||
private final TextureAtlasSprite ringTexture;
|
private final TextureAtlasSprite ringTexture;
|
||||||
private final TextureAtlasSprite glassCableTexture;
|
private final TextureAtlasSprite glassCableTexture;
|
||||||
private final TextureAtlasSprite coveredCableTexture;
|
private final TextureAtlasSprite coveredCableTexture;
|
||||||
private final TextureAtlasSprite lightTexture;
|
private final TextureAtlasSprite lightTexture;
|
||||||
private final TextureAtlasSprite lightCornerTexture;
|
private final TextureAtlasSprite lightCornerTexture;
|
||||||
|
|
||||||
public QnbFormedBakedModel(VertexFormat vertexFormat, IBakedModel baseModel, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
public QnbFormedBakedModel( VertexFormat vertexFormat, IBakedModel baseModel, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
this.vertexFormat = vertexFormat;
|
{
|
||||||
this.baseModel = baseModel;
|
this.vertexFormat = vertexFormat;
|
||||||
this.linkTexture = bakedTextureGetter.apply(TEXTURE_LINK);
|
this.baseModel = baseModel;
|
||||||
this.ringTexture = bakedTextureGetter.apply(TEXTURE_RING);
|
this.linkTexture = bakedTextureGetter.apply( TEXTURE_LINK );
|
||||||
this.glassCableTexture = bakedTextureGetter.apply(TEXTURE_CABLE_GLASS);
|
this.ringTexture = bakedTextureGetter.apply( TEXTURE_RING );
|
||||||
this.coveredCableTexture = bakedTextureGetter.apply(TEXTURE_COVERED_CABLE);
|
this.glassCableTexture = bakedTextureGetter.apply( TEXTURE_CABLE_GLASS );
|
||||||
this.lightTexture = bakedTextureGetter.apply(TEXTURE_RING_LIGHT);
|
this.coveredCableTexture = bakedTextureGetter.apply( TEXTURE_COVERED_CABLE );
|
||||||
this.lightCornerTexture = bakedTextureGetter.apply(TEXTURE_RING_LIGHT_CORNER);
|
this.lightTexture = bakedTextureGetter.apply( TEXTURE_RING_LIGHT );
|
||||||
this.linkBlock = AEApi.instance().definitions().blocks().quantumLink().maybeBlock().orElse(null);
|
this.lightCornerTexture = bakedTextureGetter.apply( TEXTURE_RING_LIGHT_CORNER );
|
||||||
}
|
this.linkBlock = AEApi.instance().definitions().blocks().quantumLink().maybeBlock().orElse( null );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
|
||||||
// Get the correct base model
|
{
|
||||||
if (!(state instanceof IExtendedBlockState)) {
|
// Get the correct base model
|
||||||
return this.baseModel.getQuads(state, side, rand);
|
if( !( state instanceof IExtendedBlockState ) )
|
||||||
}
|
{
|
||||||
|
return this.baseModel.getQuads( state, side, rand );
|
||||||
|
}
|
||||||
|
|
||||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||||
QnbFormedState formedState = extendedBlockState.getValue(BlockQuantumBase.FORMED_STATE);
|
QnbFormedState formedState = extendedBlockState.getValue( BlockQuantumBase.FORMED_STATE );
|
||||||
|
|
||||||
return this.getQuads(formedState, state, side, rand);
|
return this.getQuads( formedState, state, side, rand );
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<BakedQuad> getQuads(QnbFormedState formedState, IBlockState state, EnumFacing side, long rand) {
|
private List<BakedQuad> getQuads( QnbFormedState formedState, IBlockState state, EnumFacing side, long rand )
|
||||||
CubeBuilder builder = new CubeBuilder(this.vertexFormat);
|
{
|
||||||
|
CubeBuilder builder = new CubeBuilder( this.vertexFormat );
|
||||||
|
|
||||||
if (state.getBlock() == this.linkBlock) {
|
if( state.getBlock() == this.linkBlock )
|
||||||
Set<EnumFacing> sides = formedState.getAdjacentQuantumBridges();
|
{
|
||||||
|
Set<EnumFacing> sides = formedState.getAdjacentQuantumBridges();
|
||||||
|
|
||||||
this.renderCableAt(builder, 0.11f * 16, this.glassCableTexture, 0.141f * 16, sides);
|
this.renderCableAt( builder, 0.11f * 16, this.glassCableTexture, 0.141f * 16, sides );
|
||||||
|
|
||||||
this.renderCableAt(builder, 0.188f * 16, this.coveredCableTexture, 0.1875f * 16, sides);
|
this.renderCableAt( builder, 0.188f * 16, this.coveredCableTexture, 0.1875f * 16, sides );
|
||||||
|
|
||||||
builder.setTexture(this.linkTexture);
|
builder.setTexture( this.linkTexture );
|
||||||
builder.addCube(DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX);
|
builder.addCube( DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX );
|
||||||
} else {
|
}
|
||||||
if (formedState.isCorner()) {
|
else
|
||||||
this.renderCableAt(builder, 0.188f * 16, this.coveredCableTexture, 0.05f * 16, formedState.getAdjacentQuantumBridges());
|
{
|
||||||
|
if( formedState.isCorner() )
|
||||||
|
{
|
||||||
|
this.renderCableAt( builder, 0.188f * 16, this.coveredCableTexture, 0.05f * 16, formedState.getAdjacentQuantumBridges() );
|
||||||
|
|
||||||
builder.setTexture(this.ringTexture);
|
builder.setTexture( this.ringTexture );
|
||||||
builder.addCube(DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX);
|
builder.addCube( DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX );
|
||||||
|
|
||||||
if (formedState.isPowered()) {
|
if( formedState.isPowered() )
|
||||||
builder.setTexture(this.lightCornerTexture);
|
{
|
||||||
builder.setRenderFullBright(true);
|
builder.setTexture( this.lightCornerTexture );
|
||||||
for (EnumFacing facing : EnumFacing.values()) {
|
builder.setRenderFullBright( true );
|
||||||
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
for( EnumFacing facing : EnumFacing.values() )
|
||||||
// (avoids z-fighting)
|
{
|
||||||
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
|
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
||||||
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
|
// (avoids z-fighting)
|
||||||
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
|
float xOffset = Math.abs( facing.getFrontOffsetX() * 0.01f );
|
||||||
|
float yOffset = Math.abs( facing.getFrontOffsetY() * 0.01f );
|
||||||
|
float zOffset = Math.abs( facing.getFrontOffsetZ() * 0.01f );
|
||||||
|
|
||||||
builder.setDrawFaces(EnumSet.of(facing));
|
builder.setDrawFaces( EnumSet.of( facing ) );
|
||||||
builder.addCube(
|
builder.addCube(
|
||||||
DEFAULT_RENDER_MIN - xOffset, DEFAULT_RENDER_MIN - yOffset, DEFAULT_RENDER_MIN - zOffset,
|
DEFAULT_RENDER_MIN - xOffset, DEFAULT_RENDER_MIN - yOffset, DEFAULT_RENDER_MIN - zOffset,
|
||||||
DEFAULT_RENDER_MAX + xOffset, DEFAULT_RENDER_MAX + yOffset, DEFAULT_RENDER_MAX + zOffset);
|
DEFAULT_RENDER_MAX + xOffset, DEFAULT_RENDER_MAX + yOffset, DEFAULT_RENDER_MAX + zOffset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
builder.setTexture(this.ringTexture);
|
else
|
||||||
|
{
|
||||||
|
builder.setTexture( this.ringTexture );
|
||||||
|
|
||||||
builder.addCube(0, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, 16, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX);
|
builder.addCube( 0, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, 16, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX );
|
||||||
|
|
||||||
builder.addCube(DEFAULT_RENDER_MIN, 0, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, 16, DEFAULT_RENDER_MAX);
|
builder.addCube( DEFAULT_RENDER_MIN, 0, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, 16, DEFAULT_RENDER_MAX );
|
||||||
|
|
||||||
builder.addCube(DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, 0, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, 16);
|
builder.addCube( DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, 0, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, 16 );
|
||||||
|
|
||||||
if (formedState.isPowered()) {
|
if( formedState.isPowered() )
|
||||||
builder.setTexture(this.lightTexture);
|
{
|
||||||
builder.setRenderFullBright(true);
|
builder.setTexture( this.lightTexture );
|
||||||
for (EnumFacing facing : EnumFacing.values()) {
|
builder.setRenderFullBright( true );
|
||||||
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
for( EnumFacing facing : EnumFacing.values() )
|
||||||
// (avoids z-fighting)
|
{
|
||||||
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
|
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
||||||
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
|
// (avoids z-fighting)
|
||||||
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
|
float xOffset = Math.abs( facing.getFrontOffsetX() * 0.01f );
|
||||||
|
float yOffset = Math.abs( facing.getFrontOffsetY() * 0.01f );
|
||||||
|
float zOffset = Math.abs( facing.getFrontOffsetZ() * 0.01f );
|
||||||
|
|
||||||
builder.setDrawFaces(EnumSet.of(facing));
|
builder.setDrawFaces( EnumSet.of( facing ) );
|
||||||
builder.addCube(
|
builder.addCube(
|
||||||
-xOffset, -yOffset, -zOffset,
|
-xOffset, -yOffset, -zOffset,
|
||||||
16 + xOffset, 16 + yOffset, 16 + zOffset);
|
16 + xOffset, 16 + yOffset, 16 + zOffset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.getOutput();
|
return builder.getOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderCableAt(CubeBuilder builder, float thickness, TextureAtlasSprite texture, float pull, Set<EnumFacing> connections) {
|
private void renderCableAt( CubeBuilder builder, float thickness, TextureAtlasSprite texture, float pull, Set<EnumFacing> connections )
|
||||||
builder.setTexture(texture);
|
{
|
||||||
|
builder.setTexture( texture );
|
||||||
|
|
||||||
if (connections.contains(EnumFacing.WEST)) {
|
if( connections.contains( EnumFacing.WEST ) )
|
||||||
builder.addCube(0, 8 - thickness, 8 - thickness, 8 - thickness - pull, 8 + thickness, 8 + thickness);
|
{
|
||||||
}
|
builder.addCube( 0, 8 - thickness, 8 - thickness, 8 - thickness - pull, 8 + thickness, 8 + thickness );
|
||||||
|
}
|
||||||
|
|
||||||
if (connections.contains(EnumFacing.EAST)) {
|
if( connections.contains( EnumFacing.EAST ) )
|
||||||
builder.addCube(8 + thickness + pull, 8 - thickness, 8 - thickness, 16, 8 + thickness, 8 + thickness);
|
{
|
||||||
}
|
builder.addCube( 8 + thickness + pull, 8 - thickness, 8 - thickness, 16, 8 + thickness, 8 + thickness );
|
||||||
|
}
|
||||||
|
|
||||||
if (connections.contains(EnumFacing.NORTH)) {
|
if( connections.contains( EnumFacing.NORTH ) )
|
||||||
builder.addCube(8 - thickness, 8 - thickness, 0, 8 + thickness, 8 + thickness, 8 - thickness - pull);
|
{
|
||||||
}
|
builder.addCube( 8 - thickness, 8 - thickness, 0, 8 + thickness, 8 + thickness, 8 - thickness - pull );
|
||||||
|
}
|
||||||
|
|
||||||
if (connections.contains(EnumFacing.SOUTH)) {
|
if( connections.contains( EnumFacing.SOUTH ) )
|
||||||
builder.addCube(8 - thickness, 8 - thickness, 8 + thickness + pull, 8 + thickness, 8 + thickness, 16);
|
{
|
||||||
}
|
builder.addCube( 8 - thickness, 8 - thickness, 8 + thickness + pull, 8 + thickness, 8 + thickness, 16 );
|
||||||
|
}
|
||||||
|
|
||||||
if (connections.contains(EnumFacing.DOWN)) {
|
if( connections.contains( EnumFacing.DOWN ) )
|
||||||
builder.addCube(8 - thickness, 0, 8 - thickness, 8 + thickness, 8 - thickness - pull, 8 + thickness);
|
{
|
||||||
}
|
builder.addCube( 8 - thickness, 0, 8 - thickness, 8 + thickness, 8 - thickness - pull, 8 + thickness );
|
||||||
|
}
|
||||||
|
|
||||||
if (connections.contains(EnumFacing.UP)) {
|
if( connections.contains( EnumFacing.UP ) )
|
||||||
builder.addCube(8 - thickness, 8 + thickness + pull, 8 - thickness, 8 + thickness, 16, 8 + thickness);
|
{
|
||||||
}
|
builder.addCube( 8 - thickness, 8 + thickness + pull, 8 - thickness, 8 + thickness, 16, 8 + thickness );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAmbientOcclusion() {
|
public boolean isAmbientOcclusion()
|
||||||
return this.baseModel.isAmbientOcclusion();
|
{
|
||||||
}
|
return this.baseModel.isAmbientOcclusion();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGui3d() {
|
public boolean isGui3d()
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBuiltInRenderer() {
|
public boolean isBuiltInRenderer()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
public TextureAtlasSprite getParticleTexture()
|
||||||
return this.baseModel.getParticleTexture();
|
{
|
||||||
}
|
return this.baseModel.getParticleTexture();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
public ItemCameraTransforms getItemCameraTransforms()
|
||||||
return this.baseModel.getItemCameraTransforms();
|
{
|
||||||
}
|
return this.baseModel.getItemCameraTransforms();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides()
|
||||||
return this.baseModel.getOverrides();
|
{
|
||||||
}
|
return this.baseModel.getOverrides();
|
||||||
|
}
|
||||||
|
|
||||||
public static List<ResourceLocation> getRequiredTextures() {
|
public static List<ResourceLocation> getRequiredTextures()
|
||||||
return ImmutableList.of(
|
{
|
||||||
TEXTURE_LINK, TEXTURE_RING, TEXTURE_CABLE_GLASS, TEXTURE_COVERED_CABLE, TEXTURE_RING_LIGHT, TEXTURE_RING_LIGHT_CORNER);
|
return ImmutableList.of(
|
||||||
}
|
TEXTURE_LINK, TEXTURE_RING, TEXTURE_CABLE_GLASS, TEXTURE_COVERED_CABLE, TEXTURE_RING_LIGHT, TEXTURE_RING_LIGHT_CORNER );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user