mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-25 00:18:34 +01:00
chore: large refactors to new mappings
This commit is contained in:
parent
12206a03a3
commit
b7d4d600fc
328 changed files with 3942 additions and 3481 deletions
104
build.gradle
104
build.gradle
|
@ -1,71 +1,115 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
|
||||
version = "1.12.2-r152"
|
||||
version = "$mod_version"
|
||||
group = "de.ellpeck.actuallyadditions"
|
||||
archivesBaseName = "ActuallyAdditions"
|
||||
archivesBaseName = "ActuallyAdditions-$game_version"
|
||||
|
||||
if (System.getenv('BUILD_NUMBER') != null) {
|
||||
version += "." + System.getenv('BUILD_NUMBER')
|
||||
}
|
||||
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.5.2836"
|
||||
runDir = "run"
|
||||
mappings = "stable_39"
|
||||
makeObfSourceJar = false
|
||||
replaceIn "ActuallyAdditions.java"
|
||||
replace "@VERSION@", version.toString()
|
||||
mappings channel: 'snapshot', version: "${mcp_mappings}"
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/')
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "https://dvs1.progwml6.com/files/maven"
|
||||
// JEI
|
||||
name = "Progwml6 maven"
|
||||
url = "https://dvs1.progwml6.com/files/maven/"
|
||||
}
|
||||
maven {
|
||||
url "https://maven.tehnut.info"
|
||||
}
|
||||
maven {
|
||||
url "https://dl.bintray.com/cyclopsmc/dev/"
|
||||
url = "https://www.cursemaven.com"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "mezz.jei:jei_1.12.2:+"
|
||||
deobfCompile "mcp.mobius.waila:Hwyla:1.8+"
|
||||
deobfCompile ("org.cyclops.commoncapabilities:CommonCapabilities:1.12.2-+")
|
||||
minecraft "net.minecraftforge:forge:${game_version}-${forge_version}"
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}")
|
||||
}
|
||||
|
||||
// not sure if this is still needed
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
inputs.property('version', project.version)
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
||||
include 'META-INF/mods.toml'
|
||||
expand 'version': project.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
exclude 'META-INF/mods.toml'
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
group = 'artifact'
|
||||
manifest {
|
||||
attributes(["Specification-Title" : "BuildingGadgets",
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : project.archivesBaseName,
|
||||
"Implementation-Version" : project.version,
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
|
||||
}
|
||||
|
||||
from sourceSets.main.output
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
|
@ -95,8 +139,6 @@ task sourcesJar(type: Jar) {
|
|||
classifier = 'sources'
|
||||
}
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
artifacts {
|
||||
archives deobfJar, sourcesJar, apiJar, javadocJar
|
||||
}
|
||||
|
@ -128,4 +170,4 @@ publishing {
|
|||
url "file://" + System.getenv("local_maven")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
9
gradle.properties
Normal file
9
gradle.properties
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Actually Additions
|
||||
# TODO: check this version change is okay.
|
||||
mod_version=1.1.52
|
||||
# Forge
|
||||
game_version=1.16.5
|
||||
forge_version=36.0.43
|
||||
mcp_mappings=20201028-1.16.3
|
||||
# Other mods
|
||||
jei_version=1.16.4:7.6.1.71
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,5 @@
|
|||
#Sat Jul 01 10:16:13 EDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
|
||||
|
|
168
gradlew.bat
vendored
168
gradlew.bat
vendored
|
@ -1,84 +1,84 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@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=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@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=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
0
logs/debug.log
Normal file
0
logs/debug.log
Normal file
0
logs/latest.log
Normal file
0
logs/latest.log
Normal file
|
@ -34,7 +34,7 @@ import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe;
|
|||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
@ -217,7 +217,7 @@ public final class ActuallyAdditionsAPI {
|
|||
* @param output The itemstack to be output from the compost once conversion finishes
|
||||
* @param outputDisplay The state to display when there is output in the compost
|
||||
*/
|
||||
public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) {
|
||||
public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,16 +12,16 @@ package de.ellpeck.actuallyadditions.api.booklet;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public interface IBookletChapter {
|
||||
|
||||
IBookletPage[] getAllPages();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedName();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedNameWithFormatting();
|
||||
|
||||
IBookletEntry getEntry();
|
||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.booklet;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public interface IBookletEntry {
|
||||
|
||||
|
@ -21,19 +21,19 @@ public interface IBookletEntry {
|
|||
|
||||
String getIdentifier();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedName();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedNameWithFormatting();
|
||||
|
||||
void addChapter(IBookletChapter chapter);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
List<IBookletChapter> getChaptersForDisplay(String searchBarText);
|
||||
|
||||
int getSortingPriority();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
boolean visibleOnFrontPage();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.client.gui.GuiButton;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public interface IBookletPage {
|
||||
|
||||
|
@ -29,31 +29,31 @@ public interface IBookletPage {
|
|||
|
||||
void setChapter(IBookletChapter chapter);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getInfoText();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void actionPerformed(GuiBookletBase gui, GuiButton button);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void initGui(GuiBookletBase gui, int startX, int startY);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
||||
|
||||
boolean shouldBeOnLeftSide();
|
||||
|
|
|
@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
|||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
@ -40,7 +40,7 @@ public interface IMethodHandler {
|
|||
|
||||
PotionEffect[] getEffectsFromStack(ItemStack stack);
|
||||
|
||||
boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
boolean invokeReconstructor(IAtomicReconstructor tile);
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.api.laser;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IConnectionPair {
|
||||
|
||||
void writeToNBT(NBTTagCompound compound);
|
||||
void writeToNBT(CompoundNBT compound);
|
||||
|
||||
void readFromNBT(NBTTagCompound compound);
|
||||
void readFromNBT(CompoundNBT compound);
|
||||
|
||||
BlockPos[] getPositions();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api.lens;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public abstract class Lens {
|
|||
* @param tile The tile the lens was invoked from
|
||||
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
|
||||
*/
|
||||
public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
public abstract boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
/**
|
||||
* Returns the color in an array of 3 float values that are r, g, b
|
||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.lens;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
public class LensConversion extends Lens {
|
||||
|
||||
@Override
|
||||
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
||||
|
||||
@Override
|
||||
public ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
ItemStack newStack = stack.copy();
|
||||
int meta = newStack.getItemDamage();
|
||||
newStack.setItemDamage((meta + 1) % 16);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
|
@ -19,15 +19,15 @@ public class CompostRecipe {
|
|||
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
protected final IBlockState inputDisplay;
|
||||
protected final IBlockState outputDisplay;
|
||||
protected final BlockState inputDisplay;
|
||||
protected final BlockState outputDisplay;
|
||||
|
||||
@Deprecated
|
||||
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
||||
}
|
||||
|
||||
public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) {
|
||||
public CompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.inputDisplay = inputDisplay;
|
||||
|
@ -46,11 +46,11 @@ public class CompostRecipe {
|
|||
return this.output;
|
||||
}
|
||||
|
||||
public IBlockState getInputDisplay() {
|
||||
public BlockState getInputDisplay() {
|
||||
return this.inputDisplay;
|
||||
}
|
||||
|
||||
public IBlockState getOutputDisplay() {
|
||||
public BlockState getOutputDisplay() {
|
||||
return this.outputDisplay;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -35,6 +35,6 @@ public interface IColorLensChanger {
|
|||
* @param tile the Reconstructor doing the color conversion
|
||||
* @return the modified stack. Please make sure to return a modified COPY of the input stack.
|
||||
*/
|
||||
ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.recipe;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -56,6 +56,6 @@ public class LensConversionRecipe {
|
|||
return this.type;
|
||||
}
|
||||
|
||||
public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
||||
public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||
|
@ -23,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
|
|||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||
|
@ -41,6 +39,8 @@ import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -52,12 +52,10 @@ import net.minecraftforge.fml.common.Mod;
|
|||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
|
||||
import net.minecraftforge.fml.common.event.*;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = ActuallyAdditions.MODID, name = ActuallyAdditions.NAME, version = ActuallyAdditions.VERSION, guiFactory = ActuallyAdditions.GUIFACTORY, dependencies = ActuallyAdditions.DEPS)
|
||||
public class ActuallyAdditions {
|
||||
|
@ -69,6 +67,13 @@ public class ActuallyAdditions {
|
|||
public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)";
|
||||
public static final boolean DEOBF = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
||||
|
||||
public static final ItemGroup GROUP = new ItemGroup(MODID) {
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(InitItems.itemBooklet);
|
||||
}
|
||||
};
|
||||
|
||||
@Instance
|
||||
public static ActuallyAdditions INSTANCE;
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.ActualCompostModel;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.CompostModel;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -20,6 +16,9 @@ import net.minecraftforge.client.model.ModelLoader;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientRegistryHandler {
|
||||
|
||||
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
||||
|
|
|
@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
@ -96,11 +96,11 @@ public enum TheAchievements{
|
|||
this(name, x, y, displayStack, hasToHaveBefore, type, false, 0, specialItemsToBeGotten);
|
||||
}
|
||||
|
||||
public void get(EntityPlayer player){
|
||||
public void get(PlayerEntity player){
|
||||
this.get(player, 1);
|
||||
}
|
||||
|
||||
public void get(EntityPlayer player, int amount){
|
||||
public void get(PlayerEntity player, int amount){
|
||||
if(this.progressToReach > 0){
|
||||
this.updateStatus(player, amount);
|
||||
}
|
||||
|
@ -109,10 +109,10 @@ public enum TheAchievements{
|
|||
}
|
||||
}
|
||||
|
||||
private void updateStatus(EntityPlayer player, int amount){
|
||||
if(player instanceof EntityPlayerMP){
|
||||
private void updateStatus(PlayerEntity player, int amount){
|
||||
if(player instanceof ServerPlayerEntity){
|
||||
|
||||
StatisticsManager manager = ((EntityPlayerMP)player).getStatFile();
|
||||
StatisticsManager manager = ((ServerPlayerEntity)player).getStatFile();
|
||||
if(manager != null && !manager.hasAchievementUnlocked(this.chieve) && manager.canUnlockAchievement(this.chieve)){
|
||||
|
||||
JsonSerializableSet data = manager.getProgress(this.chieve);
|
||||
|
@ -143,4 +143,4 @@ public enum TheAchievements{
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
|
@ -25,20 +23,20 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -46,8 +44,10 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -63,14 +63,16 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos);
|
||||
if (reconstructor != null) {
|
||||
|
@ -105,8 +107,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
if (tile instanceof TileEntityAtomicReconstructor) {
|
||||
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
||||
|
@ -133,7 +135,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
|
@ -141,12 +143,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -156,12 +158,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
|
@ -205,12 +207,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos) {
|
||||
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) {
|
||||
TileEntity t = world.getTileEntity(pos);
|
||||
int i = 0;
|
||||
if (t instanceof TileEntityAtomicReconstructor) {
|
||||
|
@ -218,4 +220,4 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
return MathHelper.clamp(i / 20000, 0, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -39,7 +39,7 @@ public class BlockBatteryBox extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class BlockBatteryBox extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@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, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBatteryBox) {
|
||||
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;
|
||||
|
@ -74,7 +74,7 @@ public class BlockBatteryBox extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class BlockBioReactor extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
if (world.getTileEntity(pos) instanceof TileEntityBioReactor) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
|
|
@ -19,14 +19,14 @@ import net.minecraft.block.BlockDirectional;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -47,12 +47,16 @@ public class BlockBreaker extends BlockContainerBase {
|
|||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
|
||||
return this.isPlacer
|
||||
? new TileEntityPlacer()
|
||||
: new TileEntityBreaker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos);
|
||||
if (breaker != null) {
|
||||
|
@ -69,7 +73,7 @@ public class BlockBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
|
@ -77,12 +81,12 @@ public class BlockBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -92,12 +96,12 @@ public class BlockBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -37,12 +37,12 @@ public class BlockCanolaPress extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class BlockCanolaPress extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
|
||||
if (press != null) {
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
|
@ -20,21 +18,19 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCoalGenerator extends BlockContainerBase {
|
||||
|
||||
|
@ -48,12 +44,12 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -63,8 +59,8 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityCoalGenerator) {
|
||||
if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) {
|
||||
|
@ -76,7 +72,7 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
|
||||
if (press != null) {
|
||||
|
@ -88,7 +84,7 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
|
@ -100,12 +96,12 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -115,12 +111,12 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -47,22 +47,22 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
|
||||
if (machine != null) {
|
||||
|
@ -86,7 +86,7 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if (rotation == 0) {
|
||||
|
@ -106,12 +106,12 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -121,12 +121,12 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
|
@ -23,22 +21,24 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockColoredLamp extends BlockBase {
|
||||
|
||||
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
||||
|
@ -54,21 +54,23 @@ public class BlockColoredLamp extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||
public Item getItemDropped(BlockState state, Random rand, int par3) {
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
public int damageDropped(BlockState state) {
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
//Turning On
|
||||
if (hand == EnumHand.MAIN_HAND && stack.isEmpty()) {
|
||||
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
||||
if (hand == Hand.MAIN_HAND && stack.isEmpty()) {
|
||||
world.setBlockState(pos, (this.isOn
|
||||
? InitBlocks.blockColoredLamp
|
||||
: InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
||||
world.notifyLightSet(pos);
|
||||
return true;
|
||||
}
|
||||
|
@ -98,7 +100,7 @@ public class BlockColoredLamp extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int j = 0; j < ALL_LAMP_TYPES.length; j++) {
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
@ -106,8 +108,10 @@ public class BlockColoredLamp extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.isOn ? 15 : 0;
|
||||
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.isOn
|
||||
? 15
|
||||
: 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,12 +132,12 @@ public class BlockColoredLamp extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
|
@ -152,9 +156,16 @@ public class BlockColoredLamp extends BlockBase {
|
|||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { return StringUtil.BUGGED_ITEM_NAME; }
|
||||
if (Util.isClient()) return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" : "");
|
||||
else return super.getItemStackDisplayName(stack);
|
||||
if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) {
|
||||
return StringUtil.BUGGED_ITEM_NAME;
|
||||
}
|
||||
if (Util.isClient()) {
|
||||
return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn
|
||||
? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")"
|
||||
: "");
|
||||
} else {
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||
|
@ -25,17 +21,17 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -46,7 +42,10 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -66,32 +65,32 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
|
||||
public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
|
||||
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
||||
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
||||
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
|
||||
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
ItemStack stackPlayer = player.getHeldItem(hand);
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
@ -158,8 +157,8 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
if (tile instanceof TileEntityCompost) {
|
||||
ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0);
|
||||
|
@ -177,11 +176,11 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
|||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { COMPOST_PROP });
|
||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{COMPOST_PROP});
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public BlockState getExtendedState(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) {
|
||||
TileEntityCompost compost = (TileEntityCompost) te;
|
||||
|
|
|
@ -19,14 +19,14 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.common.IRarity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockCrystal extends BlockBase {
|
||||
|
||||
|
@ -44,12 +44,12 @@ public class BlockCrystal extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
public int damageDropped(BlockState state) {
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int j = 0; j < ALL_CRYSTALS.length; j++) {
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
@ -69,12 +69,12 @@ public class BlockCrystal extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(TYPE, TheCrystals.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ import net.minecraft.block.BlockDirectional;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -40,7 +40,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
|
||||
|
||||
|
@ -58,17 +58,17 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
||||
public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
||||
return this.getStateFromMeta(side.ordinal());
|
||||
}
|
||||
|
||||
|
@ -78,12 +78,12 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -93,17 +93,17 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IBlockColor getBlockColor() {
|
||||
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||
}
|
||||
|
@ -114,23 +114,23 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||
return InitItems.itemCrystalShard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
public int damageDropped(BlockState state) {
|
||||
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
public ItemStack getPickBlock(BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player) {
|
||||
return new ItemStack(this);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockDirectional;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -47,8 +47,10 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker) world.getTileEntity(pos);
|
||||
if (breaker != null) {
|
||||
|
@ -65,7 +67,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
|
@ -73,12 +75,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -88,12 +90,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -46,12 +46,12 @@ public class BlockDisplayStand extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
if (!world.isRemote) {
|
||||
TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos);
|
||||
|
@ -62,7 +62,9 @@ public class BlockDisplayStand extends BlockContainerBase {
|
|||
ItemStack toPut = heldItem.copy();
|
||||
toPut.setCount(1);
|
||||
stand.inv.setStackInSlot(0, toPut);
|
||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
||||
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||
|
@ -89,18 +91,20 @@ public class BlockDisplayStand extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
if (face == EnumFacing.DOWN) return BlockFaceShape.SOLID;
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing face) {
|
||||
if (face == EnumFacing.DOWN) {
|
||||
return BlockFaceShape.SOLID;
|
||||
}
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockDirectional;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -47,8 +47,10 @@ public class BlockDropper extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos);
|
||||
if (dropper != null) {
|
||||
|
@ -65,7 +67,7 @@ public class BlockDropper extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
|
@ -73,12 +75,12 @@ public class BlockDropper extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -88,12 +90,12 @@ public class BlockDropper extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -45,12 +45,12 @@ public class BlockEmpowerer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
if (!world.isRemote) {
|
||||
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);
|
||||
|
@ -61,7 +61,9 @@ public class BlockEmpowerer extends BlockContainerBase {
|
|||
ItemStack toPut = heldItem.copy();
|
||||
toPut.setCount(1);
|
||||
empowerer.inv.setStackInSlot(0, toPut);
|
||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
|
||||
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||
|
@ -88,7 +90,7 @@ public class BlockEmpowerer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -42,11 +42,13 @@ public class BlockEnergizer extends BlockContainerBase {
|
|||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
|
||||
return this.isEnergizer
|
||||
? new TileEntityEnergizer()
|
||||
: new TileEntityEnervator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
if (this.isEnergizer) {
|
||||
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);
|
||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -47,7 +47,7 @@ public class BlockFarmer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
|
||||
if (farmer != null) {
|
||||
|
@ -64,19 +64,19 @@ public class BlockFarmer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -86,12 +86,12 @@ public class BlockFarmer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class BlockFeeder extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
|
||||
if (feeder != null) {
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -37,12 +37,12 @@ public class BlockFermentingBarrel extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class BlockFermentingBarrel extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
|
||||
if (press != null) {
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class BlockFireworkBox extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
} else if (!world.isRemote) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -36,7 +36,7 @@ public class BlockFishingNet extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,12 @@ public class BlockFishingNet extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@ import net.minecraft.block.BlockDirectional;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -47,12 +47,16 @@ public class BlockFluidCollector extends BlockContainerBase {
|
|||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
||||
return this.isPlacer
|
||||
? new TileEntityFluidPlacer()
|
||||
: new TileEntityFluidCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos);
|
||||
if (collector != null) {
|
||||
|
@ -71,7 +75,7 @@ public class BlockFluidCollector extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
|
@ -79,12 +83,12 @@ public class BlockFluidCollector extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -94,12 +98,12 @@ public class BlockFluidCollector extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
|
@ -25,24 +22,23 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFurnaceDouble extends BlockContainerBase {
|
||||
|
||||
|
@ -63,8 +59,8 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
if (state.getValue(IS_ON)) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
|
@ -73,7 +69,7 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
|
||||
if (furnace != null) {
|
||||
|
@ -85,8 +81,10 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return state.getValue(IS_ON) ? 12 : 0;
|
||||
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return state.getValue(IS_ON)
|
||||
? 12
|
||||
: 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,23 +93,27 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
boolean isOn = meta >= 4;
|
||||
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta - 4 : meta);
|
||||
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn
|
||||
? meta - 4
|
||||
: meta);
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
return state.getValue(IS_ON) ? meta + 4 : meta;
|
||||
return state.getValue(IS_ON)
|
||||
? meta + 4
|
||||
: meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,12 +122,12 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -36,7 +36,7 @@ public class BlockFurnaceSolar extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,12 @@ public class BlockFurnaceSolar extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
|
@ -27,17 +25,17 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -45,6 +43,8 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockGiantChest extends BlockContainerBase {
|
||||
|
||||
public final int type;
|
||||
|
@ -63,27 +63,27 @@ public class BlockGiantChest extends BlockContainerBase {
|
|||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
return new TileEntityGiantChestMedium();
|
||||
case 2:
|
||||
return new TileEntityGiantChestLarge();
|
||||
default:
|
||||
return new TileEntityGiantChest();
|
||||
case 1:
|
||||
return new TileEntityGiantChestMedium();
|
||||
case 2:
|
||||
return new TileEntityGiantChestLarge();
|
||||
default:
|
||||
return new TileEntityGiantChest();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
|
||||
if (chest != null) {
|
||||
|
@ -101,17 +101,17 @@ public class BlockGiantChest extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
if (stack.getTagCompound() != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityGiantChest) {
|
||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||
ListNBT list = stack.getTagCompound().getList("Items", 10);
|
||||
IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
|
||||
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound compound = list.getCompoundTagAt(i);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CompoundNBT compound = list.getCompound(i);
|
||||
if (compound != null && compound.hasKey("id")) {
|
||||
inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
|
||||
inv.setStackInSlot(i, new ItemStack(list.getCompound(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,18 +121,18 @@ public class BlockGiantChest extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityGiantChest) {
|
||||
ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
|
||||
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
||||
if (place >= 0) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
for (int i = 0; i < slots.getSlots(); i++) {
|
||||
//Destroy the keeper
|
||||
if (i != place) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
if (StackUtil.isValid(slots.getStackInSlot(i))) {
|
||||
slots.getStackInSlot(i).writeToNBT(compound);
|
||||
}
|
||||
|
@ -140,11 +140,11 @@ public class BlockGiantChest extends BlockContainerBase {
|
|||
}
|
||||
}
|
||||
|
||||
if (list.tagCount() > 0) {
|
||||
if (list.size() > 0) {
|
||||
ItemStack stackInQuestion = drops.get(0);
|
||||
if (StackUtil.isValid(stackInQuestion)) {
|
||||
if (stackInQuestion.getTagCompound() == null) {
|
||||
stackInQuestion.setTagCompound(new NBTTagCompound());
|
||||
stackInQuestion.setTagCompound(new CompoundNBT());
|
||||
}
|
||||
stackInQuestion.getTagCompound().setTag("Items", list);
|
||||
}
|
||||
|
@ -172,7 +172,9 @@ public class BlockGiantChest extends BlockContainerBase {
|
|||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1;
|
||||
int type = this.block instanceof BlockGiantChest
|
||||
? ((BlockGiantChest) this.block).type
|
||||
: -1;
|
||||
if (type == 2) {
|
||||
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
|
||||
} else if (type == 0) {
|
||||
|
@ -181,7 +183,7 @@ public class BlockGiantChest extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTShareTag(ItemStack stack) {
|
||||
public CompoundNBT getNBTShareTag(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockGreenhouseGlass extends BlockBase {
|
||||
|
||||
|
@ -42,25 +42,25 @@ public class BlockGreenhouseGlass extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightOpacity(IBlockState state) {
|
||||
public int getLightOpacity(BlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
IBlockState otherState = world.getBlockState(pos.offset(side));
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean shouldSideBeRendered(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
BlockState otherState = world.getBlockState(pos.offset(side));
|
||||
Block block = otherState.getBlock();
|
||||
|
||||
return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side);
|
||||
|
@ -78,13 +78,13 @@ public class BlockGreenhouseGlass extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
public void updateTick(World world, BlockPos pos, BlockState state, Random rand) {
|
||||
if (world.isRemote) return;
|
||||
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
|
||||
Triple<BlockPos, IBlockState, IGrowable> trip = firstBlock(world, pos);
|
||||
Triple<BlockPos, BlockState, IGrowable> trip = firstBlock(world, pos);
|
||||
boolean once = false;
|
||||
if (trip != null) for (int i = 0; i < 3; i++) {
|
||||
IBlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
|
||||
BlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
|
||||
if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
|
||||
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
||||
once = true;
|
||||
|
@ -94,12 +94,12 @@ public class BlockGreenhouseGlass extends BlockBase {
|
|||
}
|
||||
}
|
||||
|
||||
public Triple<BlockPos, IBlockState, IGrowable> firstBlock(World world, BlockPos glassPos) {
|
||||
public Triple<BlockPos, BlockState, IGrowable> firstBlock(World world, BlockPos glassPos) {
|
||||
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
|
||||
while (true) {
|
||||
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
||||
if (mut.getY() < 0) return null;
|
||||
IBlockState state = world.getBlockState(mut);
|
||||
BlockState state = world.getBlockState(mut);
|
||||
if (state.isOpaqueCube() || state.getBlock() instanceof IGrowable || state.getBlock() == this) {
|
||||
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
||||
else return null;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
|
@ -20,19 +18,21 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGrinder extends BlockContainerBase {
|
||||
|
||||
|
@ -50,12 +50,14 @@ public class BlockGrinder extends BlockContainerBase {
|
|||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
|
||||
return this.isDouble
|
||||
? new TileEntityGrinderDouble()
|
||||
: new TileEntityGrinder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
if (state.getValue(BlockFurnaceDouble.IS_ON)) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
double xRand = rand.nextDouble() / 0.75D - 0.5D;
|
||||
|
@ -67,11 +69,13 @@ public class BlockGrinder extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
|
||||
if (grinder != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(ActuallyAdditions.INSTANCE, this.isDouble
|
||||
? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal()
|
||||
: GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -79,12 +83,14 @@ public class BlockGrinder extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.getMetaFromState(state) == 1
|
||||
? 12
|
||||
: 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
public int damageDropped(BlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -94,14 +100,16 @@ public class BlockGrinder extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
boolean isOn = meta == 1;
|
||||
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0;
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockFurnaceDouble.IS_ON)
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
|
@ -23,16 +21,18 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockInputter extends BlockContainerBase {
|
||||
|
||||
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
||||
|
@ -51,15 +51,19 @@ public class BlockInputter extends BlockContainerBase {
|
|||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
|
||||
return this.isAdvanced
|
||||
? new TileEntityInputterAdvanced()
|
||||
: new TileEntityInputter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
|
||||
if (inputter != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced
|
||||
? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal()
|
||||
: GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -109,7 +113,9 @@ public class BlockInputter extends BlockContainerBase {
|
|||
}
|
||||
|
||||
return StringUtil.localize(this.getTranslationKey() + ".name") + " (" + StringUtil.localize("tile." + ActuallyAdditions.MODID + ".block_inputter.add." + this.toPick + ".name") + ")";
|
||||
} else return super.getItemStackDisplayName(stack);
|
||||
} else {
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -44,7 +44,7 @@ public class BlockItemRepairer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
|
||||
if (repairer != null) {
|
||||
|
@ -56,8 +56,10 @@ public class BlockItemRepairer extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.getMetaFromState(state) == 1
|
||||
? 12
|
||||
: 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
|
||||
public class BlockItemViewerHopping extends BlockItemViewer {
|
||||
|
@ -46,13 +46,13 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||
public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
||||
|
@ -66,29 +66,29 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
EnumFacing opp = facing.getOpposite();
|
||||
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
||||
}
|
||||
|
||||
@Override //was isFullyOpaque, not sure if correct change.
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
public boolean isNormalCube(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -98,12 +98,12 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -113,12 +113,12 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.block.BlockDirectional;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -41,17 +41,17 @@ public class BlockLampPowerer extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
this.updateLamp(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
public void onBlockAdded(World world, BlockPos pos, BlockState state) {
|
||||
this.updateLamp(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
|
@ -60,14 +60,14 @@ public class BlockLampPowerer extends BlockBase {
|
|||
|
||||
private void updateLamp(World world, BlockPos pos) {
|
||||
if (!world.isRemote) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
||||
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (block instanceof BlockColoredLamp) {
|
||||
boolean isOn = ((BlockColoredLamp) block).isOn;
|
||||
|
@ -101,12 +101,12 @@ public class BlockLampPowerer extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -116,12 +116,12 @@ public class BlockLampPowerer extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
|
@ -33,16 +27,16 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -56,7 +50,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -87,13 +81,13 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
World world = event.getWorld();
|
||||
ItemStack stack = event.getItemStack();
|
||||
BlockPos pos = event.getPos();
|
||||
|
||||
if (player != null && world != null && StackUtil.isValid(stack) && pos != null) {
|
||||
IBlockState state = event.getWorld().getBlockState(pos);
|
||||
BlockState state = event.getWorld().getBlockState(pos);
|
||||
if (state != null && state.getBlock() instanceof BlockLaserRelay) {
|
||||
if (player.isSneaking()) {
|
||||
event.setUseBlock(Event.Result.ALLOW);
|
||||
|
@ -103,35 +97,35 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
switch (this.getMetaFromState(state)) {
|
||||
case 1:
|
||||
return AABB_UP;
|
||||
case 2:
|
||||
return AABB_NORTH;
|
||||
case 3:
|
||||
return AABB_SOUTH;
|
||||
case 4:
|
||||
return AABB_WEST;
|
||||
case 5:
|
||||
return AABB_EAST;
|
||||
default:
|
||||
return AABB_DOWN;
|
||||
case 1:
|
||||
return AABB_UP;
|
||||
case 2:
|
||||
return AABB_NORTH;
|
||||
case 3:
|
||||
return AABB_SOUTH;
|
||||
case 4:
|
||||
return AABB_WEST;
|
||||
case 5:
|
||||
return AABB_EAST;
|
||||
default:
|
||||
return AABB_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
||||
public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
||||
return this.getStateFromMeta(side.ordinal());
|
||||
}
|
||||
|
||||
|
@ -141,12 +135,12 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
|
@ -156,17 +150,17 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityLaserRelay) {
|
||||
|
@ -234,24 +228,24 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
switch (this.type) {
|
||||
case ITEM:
|
||||
return new TileEntityLaserRelayItem();
|
||||
case ITEM_WHITELIST:
|
||||
return new TileEntityLaserRelayItemWhitelist();
|
||||
case ENERGY_ADVANCED:
|
||||
return new TileEntityLaserRelayEnergyAdvanced();
|
||||
case ENERGY_EXTREME:
|
||||
return new TileEntityLaserRelayEnergyExtreme();
|
||||
case FLUIDS:
|
||||
return new TileEntityLaserRelayFluids();
|
||||
default:
|
||||
return new TileEntityLaserRelayEnergy();
|
||||
case ITEM:
|
||||
return new TileEntityLaserRelayItem();
|
||||
case ITEM_WHITELIST:
|
||||
return new TileEntityLaserRelayItemWhitelist();
|
||||
case ENERGY_ADVANCED:
|
||||
return new TileEntityLaserRelayEnergyAdvanced();
|
||||
case ENERGY_EXTREME:
|
||||
return new TileEntityLaserRelayEnergyExtreme();
|
||||
case FLUIDS:
|
||||
return new TileEntityLaserRelayFluids();
|
||||
default:
|
||||
return new TileEntityLaserRelayEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
if (posHit != null && posHit.getBlockPos() != null && minecraft.world != null) {
|
||||
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
||||
if (wearing || StackUtil.isValid(stack)) {
|
||||
|
@ -279,14 +273,14 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
public void breakBlock(World world, BlockPos pos, BlockState state) {
|
||||
super.breakBlock(world, pos, state);
|
||||
|
||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, EnumFacing face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
|
@ -298,4 +292,4 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|||
ITEM,
|
||||
ITEM_WHITELIST
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -48,8 +48,8 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
if (factory != null) {
|
||||
int state = factory.isMultiblock();
|
||||
|
|
|
@ -17,20 +17,20 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -43,12 +43,12 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityMiner) {
|
||||
|
@ -69,13 +69,17 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
if (tile instanceof TileEntityMiner) {
|
||||
TileEntityMiner miner = (TileEntityMiner) tile;
|
||||
String info = miner.checkY == 0 ? "Done Mining!" : miner.checkY == -1 ? "Calculating positions..." : "Mining at " + (miner.getPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getPos().getZ() + miner.checkZ) + ".";
|
||||
String info = miner.checkY == 0
|
||||
? "Done Mining!"
|
||||
: miner.checkY == -1
|
||||
? "Calculating positions..."
|
||||
: "Mining at " + (miner.getPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getPos().getZ() + miner.checkZ) + ".";
|
||||
minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -38,7 +38,7 @@ public class BlockMisc extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
public int damageDropped(BlockState state) {
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
|
@ -67,12 +67,12 @@ public class BlockMisc extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
|
@ -20,21 +18,19 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockOilGenerator extends BlockContainerBase {
|
||||
|
||||
|
@ -48,12 +44,12 @@ public class BlockOilGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -63,8 +59,8 @@ public class BlockOilGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityOilGenerator) {
|
||||
if (((TileEntityOilGenerator) tile).currentBurnTime > 0) {
|
||||
|
@ -76,7 +72,7 @@ public class BlockOilGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos);
|
||||
if (generator != null) {
|
||||
|
@ -90,7 +86,7 @@ public class BlockOilGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
|
@ -102,12 +98,12 @@ public class BlockOilGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -117,12 +113,12 @@ public class BlockOilGenerator extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,26 +13,21 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
|||
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -41,7 +36,7 @@ import net.minecraft.util.text.TextFormatting;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -57,24 +52,28 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower(IBlockState state) {
|
||||
public boolean canProvidePower(BlockState state) {
|
||||
return this.type == Type.REDSTONEFACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
if (this.type == Type.REDSTONEFACE) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; }
|
||||
if (tile instanceof TileEntityPhantomRedstoneface) {
|
||||
return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public int getStrongPower(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
if (this.type == Type.REDSTONEFACE) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; }
|
||||
if (tile instanceof TileEntityPhantomRedstoneface) {
|
||||
return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -87,24 +86,26 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
switch (this.type) {
|
||||
case PLACER:
|
||||
return new TileEntityPhantomPlacer();
|
||||
case BREAKER:
|
||||
return new TileEntityPhantomBreaker();
|
||||
case LIQUIFACE:
|
||||
return new TileEntityPhantomLiquiface();
|
||||
case ENERGYFACE:
|
||||
return new TileEntityPhantomEnergyface();
|
||||
case REDSTONEFACE:
|
||||
return new TileEntityPhantomRedstoneface();
|
||||
default:
|
||||
return new TileEntityPhantomItemface();
|
||||
case PLACER:
|
||||
return new TileEntityPhantomPlacer();
|
||||
case BREAKER:
|
||||
return new TileEntityPhantomBreaker();
|
||||
case LIQUIFACE:
|
||||
return new TileEntityPhantomLiquiface();
|
||||
case ENERGYFACE:
|
||||
return new TileEntityPhantomEnergyface();
|
||||
case REDSTONEFACE:
|
||||
return new TileEntityPhantomRedstoneface();
|
||||
default:
|
||||
return new TileEntityPhantomItemface();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
|
||||
|
@ -120,8 +121,8 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
if (tile != null) {
|
||||
if (tile instanceof IPhantomTile) {
|
||||
|
@ -129,10 +130,12 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 40, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
if (phantom.hasBoundPosition()) {
|
||||
int distance = MathHelper.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())));
|
||||
IBlockState state = minecraft.world.getBlockState(phantom.getBoundPosition());
|
||||
BlockState state = minecraft.world.getBlockState(phantom.getBoundPosition());
|
||||
Block block = state.getBlock();
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
String name = item == null ? "Something Unrecognizable" : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state)));
|
||||
String name = item == null
|
||||
? "Something Unrecognizable"
|
||||
: item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state)));
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
|
||||
if (phantom.isBoundThingInRange()) {
|
||||
|
@ -155,4 +158,4 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|||
ENERGYFACE,
|
||||
REDSTONEFACE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -36,17 +36,17 @@ public class BlockPhantomBooster extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,4 +59,4 @@ public class BlockPhantomBooster extends BlockContainerBase {
|
|||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityPhantomBooster();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.RayTraceResult;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityPlayerInterface) {
|
||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
||||
|
@ -67,8 +67,8 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
if (tile != null) {
|
||||
if (tile instanceof TileEntityPlayerInterface) {
|
||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -42,8 +42,10 @@ public class BlockRangedCollector extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityRangedCollector breaker = (TileEntityRangedCollector) world.getTileEntity(pos);
|
||||
if (breaker != null) {
|
||||
|
|
|
@ -17,34 +17,34 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockSlabs extends BlockBase {
|
||||
|
||||
public static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
|
||||
private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
|
||||
private final IBlockState fullBlockState;
|
||||
private final BlockState fullBlockState;
|
||||
|
||||
public BlockSlabs(String name, Block fullBlock) {
|
||||
this(name, fullBlock.getDefaultState());
|
||||
}
|
||||
|
||||
public BlockSlabs(String name, IBlockState fullBlockState) {
|
||||
public BlockSlabs(String name, BlockState fullBlockState) {
|
||||
super(fullBlockState.getMaterial(), name);
|
||||
this.setHardness(1.5F);
|
||||
this.setResistance(10.0F);
|
||||
|
@ -52,25 +52,31 @@ public class BlockSlabs extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
if (facing.ordinal() == 1) { return this.getStateFromMeta(meta); }
|
||||
if (facing.ordinal() == 0 || hitY >= 0.5F) { return this.getStateFromMeta(meta + 1); }
|
||||
public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
if (facing.ordinal() == 1) {
|
||||
return this.getStateFromMeta(meta);
|
||||
}
|
||||
if (facing.ordinal() == 0 || hitY >= 0.5F) {
|
||||
return this.getStateFromMeta(meta + 1);
|
||||
}
|
||||
return this.getStateFromMeta(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP
|
||||
? AABB_TOP_HALF
|
||||
: AABB_BOTTOM_HALF;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,13 +90,17 @@ public class BlockSlabs extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0
|
||||
? BlockSlab.EnumBlockHalf.BOTTOM
|
||||
: BlockSlab.EnumBlockHalf.TOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? 0 : 1;
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,15 +117,15 @@ public class BlockSlabs extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() == this.block) {
|
||||
BlockSlabs theBlock = (BlockSlabs) this.block;
|
||||
if (facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||
IBlockState newState = theBlock.fullBlockState;
|
||||
BlockState newState = theBlock.fullBlockState;
|
||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
||||
|
||||
if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) {
|
||||
|
@ -128,30 +138,34 @@ public class BlockSlabs extends BlockBase {
|
|||
}
|
||||
}
|
||||
|
||||
return this.tryPlace(player, stack, hand, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
return this.tryPlace(player, stack, hand, world, pos.offset(facing))
|
||||
? EnumActionResult.SUCCESS
|
||||
: super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
} else {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, PlayerEntity player, ItemStack stack) {
|
||||
BlockState state = worldIn.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() == this.block) {
|
||||
if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) { return true; }
|
||||
if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return worldIn.getBlockState(pos.offset(side)).getBlock() == this.block || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
|
||||
}
|
||||
|
||||
private boolean tryPlace(EntityPlayer player, ItemStack stack, EnumHand hand, World world, BlockPos pos) {
|
||||
IBlockState iblockstate = world.getBlockState(pos);
|
||||
private boolean tryPlace(PlayerEntity player, ItemStack stack, Hand hand, World world, BlockPos pos) {
|
||||
BlockState iblockstate = world.getBlockState(pos);
|
||||
|
||||
if (iblockstate.getBlock() == this.block) {
|
||||
BlockSlabs theBlock = (BlockSlabs) this.block;
|
||||
IBlockState newState = theBlock.fullBlockState;
|
||||
BlockState newState = theBlock.fullBlockState;
|
||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
||||
|
||||
if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) {
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
|
@ -20,21 +18,19 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSmileyCloud extends BlockContainerBase {
|
||||
|
||||
|
@ -47,18 +43,18 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
if (world.rand.nextInt(30) == 0) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double d = world.rand.nextGaussian() * 0.02D;
|
||||
|
@ -70,7 +66,7 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntitySmileyCloud) {
|
||||
|
@ -93,19 +89,19 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -115,12 +111,12 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -33,7 +33,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
//Copied from BlockTorch.
|
||||
//I have no idea what all of this means.
|
||||
|
@ -58,7 +58,7 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
switch (state.getValue(BlockTorch.FACING)) {
|
||||
case EAST:
|
||||
return TORCH_EAST_AABB;
|
||||
|
@ -75,32 +75,32 @@ public class BlockTinyTorch extends BlockBase {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return NULL_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
public boolean isNormalCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing facing) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing facing) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
private boolean canPlaceOn(World worldIn, BlockPos pos) {
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
BlockState state = worldIn.getBlockState(pos);
|
||||
return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
if (this.canPlaceAt(worldIn, pos, facing)) {
|
||||
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
|
||||
} else {
|
||||
|
@ -133,16 +133,16 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, BlockState state) {
|
||||
this.checkForDrop(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
this.onNeighborChangeInternal(worldIn, pos, state);
|
||||
}
|
||||
|
||||
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) {
|
||||
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, BlockState state) {
|
||||
if (!this.checkForDrop(worldIn, pos, state)) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -167,7 +167,7 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) {
|
||||
protected boolean checkForDrop(World worldIn, BlockPos pos, BlockState state) {
|
||||
if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -181,8 +181,8 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
if (rand.nextBoolean()) {
|
||||
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
|
||||
double d0 = pos.getX() + 0.5D;
|
||||
|
@ -201,8 +201,8 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
IBlockState iblockstate = this.getDefaultState();
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
BlockState iblockstate = this.getDefaultState();
|
||||
|
||||
switch (meta) {
|
||||
case 1:
|
||||
|
@ -231,7 +231,7 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
int i = 0;
|
||||
|
||||
switch (state.getValue(BlockTorch.FACING)) {
|
||||
|
@ -257,12 +257,12 @@ public class BlockTinyTorch extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirrorIn) {
|
||||
return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
|
@ -19,27 +17,23 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTreasureChest extends BlockBase {
|
||||
|
||||
|
@ -53,8 +47,8 @@ public class BlockTreasureChest extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (float f = 0; f <= 3; f += 0.5) {
|
||||
float particleX = rand.nextFloat();
|
||||
|
@ -65,12 +59,12 @@ public class BlockTreasureChest extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||
public Item getItemDropped(BlockState state, Random rand, int par3) {
|
||||
return Items.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F);
|
||||
this.dropItems(world, pos);
|
||||
|
@ -82,14 +76,14 @@ public class BlockTreasureChest extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -117,12 +111,12 @@ public class BlockTreasureChest extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -132,12 +126,12 @@ public class BlockTreasureChest extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.block.BlockFenceGate;
|
|||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -26,7 +26,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BlockWallAA extends BlockBase {
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class BlockWallAA extends BlockBase {
|
|||
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
|
||||
}
|
||||
|
||||
private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(IBlockState state) {
|
||||
private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(BlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(BlockWall.NORTH)) {
|
||||
|
@ -65,7 +65,7 @@ public class BlockWallAA extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
public BlockState getActualState(BlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
||||
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
||||
|
@ -75,7 +75,7 @@ public class BlockWallAA extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -85,48 +85,48 @@ public class BlockWallAA extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Deprecated
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
state = this.getActualState(state, source, pos);
|
||||
return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
blockState = this.getActualState(blockState, worldIn, pos);
|
||||
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
BlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -45,15 +45,15 @@ public class BlockWildPlant extends BlockBushBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state) {
|
||||
public boolean canBlockStay(World world, BlockPos pos, BlockState state) {
|
||||
BlockPos offset = pos.down();
|
||||
IBlockState offsetState = world.getBlockState(offset);
|
||||
BlockState offsetState = world.getBlockState(offset);
|
||||
Block offsetBlock = offsetState.getBlock();
|
||||
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
public ItemStack getPickBlock(BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player) {
|
||||
BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion();
|
||||
return new ItemStack(normal.seedItem);
|
||||
}
|
||||
|
@ -66,13 +66,13 @@ public class BlockWildPlant extends BlockBushBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||
Block normal = state.getValue(TYPE).getNormalVersion();
|
||||
normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -94,12 +94,12 @@ public class BlockWildPlant extends BlockBushBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -47,7 +47,7 @@ public class BlockXPSolidifier extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos);
|
||||
if (solidifier != null) {
|
||||
|
@ -64,19 +64,19 @@ public class BlockXPSolidifier extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
|
@ -86,12 +86,12 @@ public class BlockXPSolidifier extends BlockContainerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,15 +12,15 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public interface IHudDisplay {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,27 +11,16 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.IRarity;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
public class BlockBase extends Block {
|
||||
|
||||
private final String name;
|
||||
|
||||
public BlockBase(Material material, String name) {
|
||||
super(material);
|
||||
public BlockBase(Properties properties, String name) {
|
||||
super(properties);
|
||||
this.name = name;
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
|
||||
protected String getBaseName() {
|
||||
|
@ -39,20 +28,10 @@ public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHa
|
|||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP));
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,26 +11,17 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BushBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
public class BlockBushBase extends BushBlock {
|
||||
|
||||
private final String name;
|
||||
|
||||
public BlockBushBase(String name) {
|
||||
public BlockBushBase(Properties properties, String name) {
|
||||
super(properties.sound(SoundType.PLANT));
|
||||
this.name = name;
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
|
||||
protected String getBaseName() {
|
||||
|
@ -38,20 +29,10 @@ public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRar
|
|||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP));
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,50 +10,42 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ContainerBlock;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockContainerBase extends ContainerBlock {
|
||||
|
||||
private final String name;
|
||||
|
||||
public BlockContainerBase(Material material, String name) {
|
||||
super(material);
|
||||
public BlockContainerBase(Properties properties, String name) {
|
||||
super(properties);
|
||||
this.name = name;
|
||||
|
||||
this.register();
|
||||
|
@ -68,23 +60,13 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP));
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
private void dropInventory(World world, BlockPos position) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity aTile = world.getTileEntity(position);
|
||||
|
@ -101,20 +83,20 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
|
||||
private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) {
|
||||
ItemStack stack = tile.inv.getStackInSlot(i);
|
||||
if (StackUtil.isValid(stack)) {
|
||||
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = world.rand.nextGaussian() * factor;
|
||||
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
||||
world.spawnEntity(entityItem);
|
||||
if (stack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
||||
float factor = 0.05F;
|
||||
entityItem.addVelocity(world.rand.nextGaussian() * factor, world.rand.nextGaussian() * factor + 0.2F, world.rand.nextGaussian() * factor);
|
||||
world.addEntity(entityItem);
|
||||
}
|
||||
|
||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player) {
|
||||
public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) {
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
@ -132,7 +114,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
|
||||
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
|
@ -157,13 +139,13 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
||||
this.neighborsChangedCustom(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(world, pos, neighbor);
|
||||
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(state, world, pos, neighbor);
|
||||
if (world instanceof World) {
|
||||
this.neighborsChangedCustom((World) world, pos);
|
||||
}
|
||||
|
@ -178,7 +160,8 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
boolean wasPowered = base.isRedstonePowered;
|
||||
if (powered && !wasPowered) {
|
||||
if (base.respondsToPulses()) {
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
// TODO: [port] eval what this does? :D
|
||||
// world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
}
|
||||
base.setRedstonePowered(true);
|
||||
} else if (!powered && wasPowered) {
|
||||
|
@ -188,114 +171,115 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank) {
|
||||
protected boolean tryUseItemOnTank(PlayerEntity player, Hand hand, FluidTank tank) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
this.updateRedstoneState(world, pos);
|
||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
this.updateRedstoneState(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
TileEntityBase base = (TileEntityBase) tile;
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
||||
if (compound != null) {
|
||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
}
|
||||
CompoundNBT compound = stack.getOrCreateTag().getCompound("Data");
|
||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
if (!player.isCreative()) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
||||
player.sendMessage(new TextComponentTranslation("info." + ActuallyAdditions.MODID + ".machineBroke").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
player.sendStatusMessage(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".machineBroke").mergeStyle(TextFormatting.RED), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); }
|
||||
if (tile instanceof TileEntityBase) {
|
||||
return ((TileEntityBase) tile).getComparatorStrength();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: [port]: come back and fix this
|
||||
|
||||
// @Override
|
||||
// public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// if (tile instanceof TileEntityBase) {
|
||||
// TileEntityBase base = (TileEntityBase) tile;
|
||||
// if (!base.stopFromDropping) {
|
||||
// CompoundNBT data = new CompoundNBT();
|
||||
// base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
//
|
||||
// //Remove unnecessarily saved default values to avoid unstackability
|
||||
// List<String> keysToRemove = new ArrayList<>();
|
||||
// for (String key : data.getKeySet()) {
|
||||
// NBTBase tag = data.getTag(key);
|
||||
// //Remove only ints because they are the most common ones
|
||||
// //Add else if below here to remove more types
|
||||
// if (tag instanceof NBTTagInt) {
|
||||
// if (((NBTTagInt) tag).getInt() == 0) {
|
||||
// keysToRemove.add(key);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for (String key : keysToRemove) {
|
||||
// data.removeTag(key);
|
||||
// }
|
||||
//
|
||||
// ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
||||
// if (!data.isEmpty()) {
|
||||
// stack.setTagCompound(new CompoundNBT());
|
||||
// stack.getTagCompound().setTag("Data", data);
|
||||
// }
|
||||
//
|
||||
// drops.add(stack);
|
||||
// }
|
||||
// } else {
|
||||
// super.getDrops(drops, world, pos, state, fortune);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
TileEntityBase base = (TileEntityBase) tile;
|
||||
if (!base.stopFromDropping) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) {
|
||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid);
|
||||
}
|
||||
|
||||
//Remove unnecessarily saved default values to avoid unstackability
|
||||
List<String> keysToRemove = new ArrayList<>();
|
||||
for (String key : data.getKeySet()) {
|
||||
NBTBase tag = data.getTag(key);
|
||||
//Remove only ints because they are the most common ones
|
||||
//Add else if below here to remove more types
|
||||
if (tag instanceof NBTTagInt) {
|
||||
if (((NBTTagInt) tag).getInt() == 0) {
|
||||
keysToRemove.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String key : keysToRemove) {
|
||||
data.removeTag(key);
|
||||
}
|
||||
// TODO: [port]: eval
|
||||
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
||||
if (!data.isEmpty()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setTag("Data", data);
|
||||
}
|
||||
// @Override
|
||||
// public EnumBlockRenderType getRenderType(BlockState state) {
|
||||
// return EnumBlockRenderType.MODEL;
|
||||
// }
|
||||
|
||||
drops.add(stack);
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (state != newState) {
|
||||
if (this.shouldDropInventory(world, pos)) {
|
||||
this.dropInventory(world, pos);
|
||||
}
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
super.harvestBlock(worldIn, player, pos, state, te, stack);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
if (this.shouldDropInventory(world, pos)) {
|
||||
this.dropInventory(world, pos);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
super.onReplaced(state, world, pos, newState, isMoving);
|
||||
}
|
||||
|
||||
public boolean shouldDropInventory(World world, BlockPos pos) {
|
||||
|
|
|
@ -12,8 +12,6 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -57,9 +55,4 @@ public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBas
|
|||
public boolean displaceIfPossible(World world, BlockPos pos) {
|
||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
/*
|
||||
* This file ("BlockPlant.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
* This file ("BlockPlant.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -31,6 +28,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
|
||||
private final String name;
|
||||
|
@ -85,12 +84,14 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
||||
public int damageDropped(BlockState state) {
|
||||
return this.getMetaFromState(state) >= 7
|
||||
? this.returnMeta
|
||||
: 0;
|
||||
}
|
||||
|
||||
@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, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (this.getMetaFromState(state) >= 7) {
|
||||
if (!world.isRemote) {
|
||||
|
||||
|
@ -122,8 +123,10 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
|||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount) + this.minDropAmount : super.quantityDropped(state, fortune, random);
|
||||
public int quantityDropped(BlockState state, int fortune, Random random) {
|
||||
return this.getMetaFromState(state) >= 7
|
||||
? random.nextInt(this.addDropAmount) + this.minDropAmount
|
||||
: super.quantityDropped(state, fortune, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,8 +135,10 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||
public Item getItemDropped(BlockState state, Random rand, int par3) {
|
||||
return this.getMetaFromState(state) >= 7
|
||||
? this.getCrop()
|
||||
: this.getSeed();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -27,7 +26,7 @@ public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRari
|
|||
this(block.getDefaultState(), name);
|
||||
}
|
||||
|
||||
public BlockStair(IBlockState state, String name) {
|
||||
public BlockStair(BlockState state, String name) {
|
||||
super(state);
|
||||
this.name = name;
|
||||
this.setLightOpacity(0);
|
||||
|
|
|
@ -10,42 +10,12 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.IRarity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemBlockBase extends ItemBlock {
|
||||
|
||||
public ItemBlockBase(Block block) {
|
||||
super(block);
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
public class ItemBlockBase extends BlockItem {
|
||||
public ItemBlockBase(Block block, Item.Properties properties) {
|
||||
super(block, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
return this.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRarity getForgeRarity(ItemStack stack) {
|
||||
if (this.block instanceof ICustomRarity) {
|
||||
return ((ICustomRarity) this.block).getRarity(stack);
|
||||
} else {
|
||||
return Util.FALLBACK_RARITY;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICustomRarity {
|
||||
|
||||
IRarity getRarity(ItemStack stack);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,9 @@ public enum TheColoredLampColors implements IStringSerializable {
|
|||
for (int i = 0; i < values().length; i++) {
|
||||
String aName = values()[i].oreName;
|
||||
if (aName != null) {
|
||||
if (aName.equalsIgnoreCase(actualName)) { return values()[i]; }
|
||||
if (aName.equalsIgnoreCase(actualName)) {
|
||||
return values()[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +55,7 @@ public enum TheColoredLampColors implements IStringSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return this.regName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,32 +10,32 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum TheMiscBlocks implements IStringSerializable {
|
||||
|
||||
QUARTZ_PILLAR("black_quartz_pillar", EnumRarity.RARE),
|
||||
QUARTZ_CHISELED("black_quartz_chiseled", EnumRarity.RARE),
|
||||
QUARTZ("black_quartz", EnumRarity.RARE),
|
||||
ORE_QUARTZ("ore_black_quartz", EnumRarity.EPIC),
|
||||
WOOD_CASING("wood_casing", EnumRarity.COMMON),
|
||||
CHARCOAL_BLOCK("charcoal", EnumRarity.COMMON),
|
||||
ENDERPEARL_BLOCK("enderpearl", EnumRarity.RARE),
|
||||
LAVA_FACTORY_CASE("lava_factory_case", EnumRarity.UNCOMMON),
|
||||
ENDER_CASING("ender_casing", EnumRarity.EPIC),
|
||||
IRON_CASING("iron_casing", EnumRarity.RARE);
|
||||
QUARTZ_PILLAR("black_quartz_pillar", Rarity.RARE),
|
||||
QUARTZ_CHISELED("black_quartz_chiseled", Rarity.RARE),
|
||||
QUARTZ("black_quartz", Rarity.RARE),
|
||||
ORE_QUARTZ("ore_black_quartz", Rarity.EPIC),
|
||||
WOOD_CASING("wood_casing", Rarity.COMMON),
|
||||
CHARCOAL_BLOCK("charcoal", Rarity.COMMON),
|
||||
ENDERPEARL_BLOCK("enderpearl", Rarity.RARE),
|
||||
LAVA_FACTORY_CASE("lava_factory_case", Rarity.UNCOMMON),
|
||||
ENDER_CASING("ender_casing", Rarity.EPIC),
|
||||
IRON_CASING("iron_casing", Rarity.RARE);
|
||||
|
||||
public final String name;
|
||||
public final EnumRarity rarity;
|
||||
public final Rarity rarity;
|
||||
|
||||
TheMiscBlocks(String name, EnumRarity rarity) {
|
||||
TheMiscBlocks(String name, Rarity rarity) {
|
||||
this.name = name;
|
||||
this.rarity = rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,39 +11,38 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum TheWildPlants implements IStringSerializable {
|
||||
|
||||
CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola),
|
||||
FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax),
|
||||
RICE("rice", EnumRarity.RARE, InitBlocks.blockRice),
|
||||
COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee);
|
||||
CANOLA("canola", Rarity.RARE, InitBlocks.blockCanola),
|
||||
FLAX("flax", Rarity.RARE, InitBlocks.blockFlax),
|
||||
RICE("rice", Rarity.RARE, InitBlocks.blockRice),
|
||||
COFFEE("coffee", Rarity.RARE, InitBlocks.blockCoffee);
|
||||
|
||||
final String name;
|
||||
final EnumRarity rarity;
|
||||
final Rarity rarity;
|
||||
final Block normal;
|
||||
|
||||
TheWildPlants(String name, EnumRarity rarity, Block normal) {
|
||||
TheWildPlants(String name, Rarity rarity, Block normal) {
|
||||
this.name = name;
|
||||
this.rarity = rarity;
|
||||
this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity() {
|
||||
public Rarity getRarity() {
|
||||
return this.rarity;
|
||||
}
|
||||
|
||||
public Block getNormalVersion() {
|
||||
return this.normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,65 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
public class ActualCompostModel implements IBakedModel {
|
||||
|
||||
public static final Map<Pair<IBlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
Pair<IBlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
|
||||
if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
||||
IBakedModel model = MODELS.get(data);
|
||||
if (model == null) {
|
||||
model = new CompostModel(data.getLeft(), data.getRight());
|
||||
MODELS.put(data, model);
|
||||
}
|
||||
return model.getQuads(state, side, rand);
|
||||
}
|
||||
return CompostModel.compostBase.getQuads(state, side, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return CompostModel.compostBase.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return CompostModel.compostBase.getParticleTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return ItemOverrideList.NONE;
|
||||
}
|
||||
|
||||
}
|
||||
// TODO: [port] removed, not required?
|
||||
//package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//import net.minecraft.client.renderer.model.IBakedModel;
|
||||
//import org.apache.commons.lang3.tuple.Pair;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
||||
//import net.minecraft.block.state.BlockState;
|
||||
//import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
//import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
//import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
//import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
//import net.minecraft.util.EnumFacing;
|
||||
//import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
//
|
||||
//public class ActualCompostModel implements IBakedModel {
|
||||
//
|
||||
// public static final Map<Pair<BlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// @Override
|
||||
// public List<BakedQuad> getQuads(BlockState state, EnumFacing side, long rand) {
|
||||
// if (state instanceof IExtendedBlockState) {
|
||||
// Pair<BlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
|
||||
// if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
||||
// IBakedModel model = MODELS.get(data);
|
||||
// if (model == null) {
|
||||
// model = new CompostModel(data.getLeft(), data.getRight());
|
||||
// MODELS.put(data, model);
|
||||
// }
|
||||
// return model.getQuads(state, side, rand);
|
||||
// }
|
||||
// return CompostModel.compostBase.getQuads(state, side, rand);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isAmbientOcclusion() {
|
||||
// return CompostModel.compostBase.isAmbientOcclusion();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isGui3d() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isBuiltInRenderer() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TextureAtlasSprite getParticleTexture() {
|
||||
// return CompostModel.compostBase.getParticleTexture();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemOverrideList getOverrides() {
|
||||
// return ItemOverrideList.NONE;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,94 +1,96 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
// TODO: [port] removed, not required?
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
public class CompostModel implements IBakedModel {
|
||||
public static IBakedModel compostBase;
|
||||
private final IBakedModel display;
|
||||
private final ImmutableList<BakedQuad> general;
|
||||
private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
|
||||
|
||||
public CompostModel(IBlockState flowerState, float height) {
|
||||
this.display = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(flowerState);
|
||||
|
||||
TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
||||
|
||||
ImmutableList.Builder<BakedQuad> builder;
|
||||
EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
||||
|
||||
for (EnumFacing face : EnumFacing.values()) {
|
||||
builder = ImmutableList.builder();
|
||||
if (!this.display.isBuiltInRenderer()) {
|
||||
for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
|
||||
Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||
quad.pipe(transformer);
|
||||
builder.add(transformer.build());
|
||||
}
|
||||
builder.addAll(compostBase.getQuads(null, face, 0));
|
||||
}
|
||||
faces.put(face, builder.build());
|
||||
}
|
||||
|
||||
if (!this.display.isBuiltInRenderer()) {
|
||||
builder = ImmutableList.builder();
|
||||
for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) {
|
||||
Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||
quad.pipe(transformer);
|
||||
builder.add(transformer.build());
|
||||
}
|
||||
builder.addAll(compostBase.getQuads(null, null, 0));
|
||||
this.general = builder.build();
|
||||
} else this.general = ImmutableList.of();
|
||||
|
||||
this.faces = Maps.immutableEnumMap(faces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
||||
if (side == null) return this.general;
|
||||
return this.faces.get(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return compostBase.isAmbientOcclusion() && this.display.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return compostBase.getParticleTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return ItemOverrideList.NONE;
|
||||
}
|
||||
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
//
|
||||
//import java.util.EnumMap;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import javax.annotation.Nullable;
|
||||
//import javax.vecmath.Vector3f;
|
||||
//
|
||||
//import com.google.common.collect.ImmutableList;
|
||||
//import com.google.common.collect.ImmutableMap;
|
||||
//import com.google.common.collect.Maps;
|
||||
//
|
||||
//import net.minecraft.block.state.BlockState;
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
//import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
//import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
//import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
//import net.minecraft.util.EnumFacing;
|
||||
//import net.minecraftforge.common.model.TRSRTransformation;
|
||||
//
|
||||
//public class CompostModel implements IBakedModel {
|
||||
// public static IBakedModel compostBase;
|
||||
// private final IBakedModel display;
|
||||
// private final ImmutableList<BakedQuad> general;
|
||||
// private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
|
||||
//
|
||||
// public CompostModel(BlockState flowerState, float height) {
|
||||
// this.display = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(flowerState);
|
||||
//
|
||||
// TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
||||
//
|
||||
// ImmutableList.Builder<BakedQuad> builder;
|
||||
// EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
||||
//
|
||||
// for (EnumFacing face : EnumFacing.values()) {
|
||||
// builder = ImmutableList.builder();
|
||||
// if (!this.display.isBuiltInRenderer()) {
|
||||
// for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
|
||||
// Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||
// quad.pipe(transformer);
|
||||
// builder.add(transformer.build());
|
||||
// }
|
||||
// builder.addAll(compostBase.getQuads(null, face, 0));
|
||||
// }
|
||||
// faces.put(face, builder.build());
|
||||
// }
|
||||
//
|
||||
// if (!this.display.isBuiltInRenderer()) {
|
||||
// builder = ImmutableList.builder();
|
||||
// for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) {
|
||||
// Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||
// quad.pipe(transformer);
|
||||
// builder.add(transformer.build());
|
||||
// }
|
||||
// builder.addAll(compostBase.getQuads(null, null, 0));
|
||||
// this.general = builder.build();
|
||||
// } else this.general = ImmutableList.of();
|
||||
//
|
||||
// this.faces = Maps.immutableEnumMap(faces);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable EnumFacing side, long rand) {
|
||||
// if (side == null) return this.general;
|
||||
// return this.faces.get(side);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isAmbientOcclusion() {
|
||||
// return compostBase.isAmbientOcclusion() && this.display.isAmbientOcclusion();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isGui3d() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isBuiltInRenderer() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TextureAtlasSprite getParticleTexture() {
|
||||
// return compostBase.getParticleTexture();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemOverrideList getOverrides() {
|
||||
// return ItemOverrideList.NONE;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
public interface IHasModel {
|
||||
|
||||
public void registerRendering();
|
||||
|
||||
}
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
||||
|
@ -19,38 +19,42 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatteryBox> {
|
||||
import java.text.NumberFormat;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderBatteryBox extends TileEntityRenderer<TileEntityBatteryBox> {
|
||||
public RenderBatteryBox(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
super(rendererDispatcherIn);
|
||||
}
|
||||
|
||||
// TODO: [port] migrate to matric (see cleanstart)
|
||||
@Override
|
||||
public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f) {
|
||||
if (!(tile instanceof TileEntityBatteryBox)) { return; }
|
||||
|
||||
public void render(TileEntityBatteryBox tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.5F, 1F, 0.5F);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
GlStateManager.scale(0.0075F, 0.0075F, 0.0075F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(0F, 0F, -50F);
|
||||
RenderSystem.scalef(0.0075F, 0.0075F, 0.0075F);
|
||||
RenderSystem.rotatef(180F, 1F, 0F, 0F);
|
||||
RenderSystem.translatef(0F, 0F, -50F);
|
||||
|
||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
||||
IEnergyStorage cap = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
stack.getCapability(CapabilityEnergy.ENERGY).ifPresent(cap -> {
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
|
||||
String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored());
|
||||
float lengthS = -font.getStringWidth(s) / 2F;
|
||||
|
@ -58,29 +62,31 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatter
|
|||
float lengthS2 = -font.getStringWidth(s2) / 2F;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
font.drawString(s, lengthS, 10F, 0xFFFFFF, false);
|
||||
font.drawString(s2, lengthS2, 20F, 0xFFFFFF, false);
|
||||
font.drawString(matrixStackIn, s, lengthS, 10F, 0xFFFFFF);
|
||||
font.drawString(matrixStackIn, s2, lengthS2, 20F, 0xFFFFFF);
|
||||
|
||||
GlStateManager.translate(-50F, 0F, 50F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
RenderSystem.translatef(-50F, 0F, 50F);
|
||||
RenderSystem.rotatef(90F, 0F, 1F, 0F);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
double boop = Minecraft.getSystemTime() / 800D;
|
||||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||
double boop = Util.milliTime();
|
||||
RenderSystem.translated(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||
RenderSystem.rotatef((float) (boop * 40D % 360), 0, 1, 0);
|
||||
|
||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
float scale = stack.getItem() instanceof BlockItem
|
||||
? 0.85F
|
||||
: 0.65F;
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
try {
|
||||
AssetUtil.renderItemInWorld(stack);
|
||||
} catch (Exception e) {
|
||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + stack.getItem().getRegistryName() + "!", e);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,15 +19,17 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand> {
|
||||
|
||||
@Override
|
||||
public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f) {
|
||||
if (!(tile instanceof TileEntityDisplayStand)) { return; }
|
||||
if (!(tile instanceof TileEntityDisplayStand)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(stack)) {
|
||||
|
@ -38,7 +40,9 @@ public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisp
|
|||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||
|
||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
||||
float scale = stack.getItem() instanceof ItemBlock
|
||||
? 0.85F
|
||||
: 0.65F;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
try {
|
||||
AssetUtil.renderItemInWorld(stack);
|
||||
|
|
|
@ -23,15 +23,17 @@ import net.minecraft.item.ItemBlock;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer> {
|
||||
|
||||
@Override
|
||||
public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f) {
|
||||
if (!(tile instanceof TileEntityEmpowerer)) { return; }
|
||||
if (!(tile instanceof TileEntityEmpowerer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(stack)) {
|
||||
|
@ -42,7 +44,9 @@ public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpower
|
|||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||
|
||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
||||
float scale = stack.getItem() instanceof ItemBlock
|
||||
? 0.85F
|
||||
: 0.65F;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
try {
|
||||
AssetUtil.renderItemInWorld(stack);
|
||||
|
|
|
@ -24,20 +24,20 @@ import io.netty.util.internal.ConcurrentSet;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay> {
|
||||
|
||||
private static final float[] COLOR = new float[] { 1F, 0F, 0F };
|
||||
private static final float[] COLOR_ITEM = new float[] { 0F, 124F / 255F, 16F / 255F };
|
||||
private static final float[] COLOR_FLUIDS = new float[] { 0F, 97F / 255F, 198F / 255F };
|
||||
private static final float[] COLOR_INFRARED = new float[] { 209F / 255F, 179F / 255F, 239F / 255F };
|
||||
private static final float[] COLOR = new float[]{1F, 0F, 0F};
|
||||
private static final float[] COLOR_ITEM = new float[]{0F, 124F / 255F, 16F / 255F};
|
||||
private static final float[] COLOR_FLUIDS = new float[]{0F, 97F / 255F, 198F / 255F};
|
||||
private static final float[] COLOR_INFRARED = new float[]{209F / 255F, 179F / 255F, 239F / 255F};
|
||||
|
||||
@Override
|
||||
public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f) {
|
||||
|
@ -45,7 +45,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserR
|
|||
TileEntityLaserRelay relay = tile;
|
||||
boolean hasInvis = false;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
||||
|
||||
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
||||
|
@ -58,7 +58,9 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserR
|
|||
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName())) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
float yTrans = tile.getBlockMetadata() == 0 ? 0.2F : 0.8F;
|
||||
float yTrans = tile.getBlockMetadata() == 0
|
||||
? 0.2F
|
||||
: 0.8F;
|
||||
GlStateManager.translate((float) x + 0.5F, (float) y + yTrans, (float) z + 0.5F);
|
||||
GlStateManager.scale(0.2F, 0.2F, 0.2F);
|
||||
|
||||
|
@ -84,9 +86,17 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserR
|
|||
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
||||
|
||||
if (hasGoggles || !hasInvis || !otherInvis) {
|
||||
float[] color = hasInvis && otherInvis ? COLOR_INFRARED : relay.type == LaserType.ITEM ? COLOR_ITEM : relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR;
|
||||
float[] color = hasInvis && otherInvis
|
||||
? COLOR_INFRARED
|
||||
: relay.type == LaserType.ITEM
|
||||
? COLOR_ITEM
|
||||
: relay.type == LaserType.FLUID
|
||||
? COLOR_FLUIDS
|
||||
: COLOR;
|
||||
|
||||
AssetUtil.renderLaser(first.getX() + 0.5, first.getY() + 0.5, first.getZ() + 0.5, second.getX() + 0.5, second.getY() + 0.5, second.getZ() + 0.5, 120, hasInvis && otherInvis ? 0.1F : 0.35F, 0.05, color);
|
||||
AssetUtil.renderLaser(first.getX() + 0.5, first.getY() + 0.5, first.getZ() + 0.5, second.getX() + 0.5, second.getY() + 0.5, second.getZ() + 0.5, 120, hasInvis && otherInvis
|
||||
? 0.1F
|
||||
: 0.35F, 0.05, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,19 +14,21 @@ import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor> {
|
||||
|
||||
@Override
|
||||
public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f) {
|
||||
if (tile == null) return;
|
||||
if (tile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||
|
||||
|
@ -35,7 +37,7 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntit
|
|||
GlStateManager.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
BlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
int meta = state.getBlock().getMetaFromState(state);
|
||||
if (meta == 0) {
|
||||
GlStateManager.translate(0F, -0.5F, 0F);
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||
|
@ -20,14 +18,16 @@ import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
import java.util.Locale;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud> {
|
||||
|
||||
@Override
|
||||
|
@ -42,26 +42,27 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
|||
if (theCloud.name != null && !theCloud.name.isEmpty()) {
|
||||
boolean renderedEaster = false;
|
||||
|
||||
easterEggs: for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
||||
easterEggs:
|
||||
for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
||||
for (String triggerName : cloud.getTriggerNames()) {
|
||||
if (triggerName != null && theCloud.name != null) {
|
||||
if (triggerName.equalsIgnoreCase(theCloud.name)) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
||||
BlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
||||
if (state.getBlock() == InitBlocks.blockSmileyCloud) {
|
||||
switch (state.getValue(BlockHorizontal.FACING)) {
|
||||
case NORTH:
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.rotate(270, 0, 1, 0);
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.rotate(270, 0, 1, 0);
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,9 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
|||
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
||||
if (render != null) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0F, renderedEaster ? 0.05F : 0.25F, 0F);
|
||||
GlStateManager.translate(0F, renderedEaster
|
||||
? 0.05F
|
||||
: 0.25F, 0F);
|
||||
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
||||
render.render();
|
||||
|
@ -90,7 +93,7 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
|||
}
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI) {
|
||||
if (mc.player.getDistanceSq(theCloud.getPos()) <= 36) {
|
||||
AssetUtil.renderNameTag(theCloud.name, x + 0.5F, y + 1.5F, z + 0.5F);
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import javax.vecmath.Matrix3f;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.client.model.pipeline.VertexTransformer;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
public class Transformer extends VertexTransformer {
|
||||
|
||||
protected final Matrix4f transformation;
|
||||
protected final Matrix3f normalTransformation;
|
||||
|
||||
public Transformer(TRSRTransformation transformation, VertexFormat format) {
|
||||
super(new UnpackedBakedQuad.Builder(format));
|
||||
// position transform
|
||||
this.transformation = transformation.getMatrix();
|
||||
// normal transform
|
||||
this.normalTransformation = new Matrix3f();
|
||||
this.transformation.getRotationScale(this.normalTransformation);
|
||||
this.normalTransformation.invert();
|
||||
this.normalTransformation.transpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(int element, float... data) {
|
||||
VertexFormatElement.EnumUsage usage = this.parent.getVertexFormat().getElement(element).getUsage();
|
||||
|
||||
// transform normals and position
|
||||
if (usage == VertexFormatElement.EnumUsage.POSITION && data.length >= 3) {
|
||||
Vector4f vec = new Vector4f(data);
|
||||
vec.setW(1.0f);
|
||||
this.transformation.transform(vec);
|
||||
data = new float[4];
|
||||
vec.get(data);
|
||||
} else if (usage == VertexFormatElement.EnumUsage.NORMAL && data.length >= 3) {
|
||||
Vector3f vec = new Vector3f(data);
|
||||
this.normalTransformation.transform(vec);
|
||||
vec.normalize();
|
||||
data = new float[4];
|
||||
vec.get(data);
|
||||
}
|
||||
super.put(element, data);
|
||||
}
|
||||
|
||||
public UnpackedBakedQuad build() {
|
||||
return ((UnpackedBakedQuad.Builder) this.parent).build();
|
||||
}
|
||||
}
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
|
@ -29,10 +26,12 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class BookmarkButton extends GuiButton {
|
||||
|
||||
private final GuiBooklet booklet;
|
||||
|
@ -49,7 +48,7 @@ public class BookmarkButton extends GuiButton {
|
|||
this.assignedPage = null;
|
||||
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
||||
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage);
|
||||
Minecraft.getMinecraft().displayGuiScreen(gui);
|
||||
Minecraft.getInstance().displayGuiScreen(gui);
|
||||
}
|
||||
} else {
|
||||
if (this.booklet instanceof GuiPage) {
|
||||
|
@ -73,7 +72,9 @@ public class BookmarkButton extends GuiButton {
|
|||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
int renderHeight = 25;
|
||||
this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null ? 0 : 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight);
|
||||
this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null
|
||||
? 0
|
||||
: 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight);
|
||||
this.mouseDragged(minecraft, x, y);
|
||||
|
||||
if (this.assignedPage != null) {
|
||||
|
@ -107,7 +108,7 @@ public class BookmarkButton extends GuiButton {
|
|||
}
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.client.gui.GuiButton;
|
|||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class EntryButton extends GuiButton {
|
||||
|
||||
private final GuiBookletBase gui;
|
||||
|
|
|
@ -19,7 +19,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BookletChapter implements IBookletChapter {
|
||||
|
||||
|
@ -55,13 +55,13 @@ public class BookletChapter implements IBookletChapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getLocalizedName() {
|
||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getLocalizedNameWithFormatting() {
|
||||
return this.color + this.getLocalizedName();
|
||||
}
|
||||
|
|
|
@ -16,11 +16,10 @@ import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
|
|||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BookletChapterTrials extends BookletChapter {
|
||||
|
||||
|
@ -29,18 +28,20 @@ public class BookletChapterTrials extends BookletChapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getLocalizedName() {
|
||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getLocalizedNameWithFormatting() {
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||
boolean completed = data.completedTrials.contains(this.getIdentifier());
|
||||
|
||||
return (completed ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
|
||||
return (completed
|
||||
? TextFormatting.DARK_GREEN
|
||||
: TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet.entry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
|
@ -26,8 +22,11 @@ import net.minecraft.client.util.ITooltipFlag;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BookletEntry implements IBookletEntry {
|
||||
|
||||
|
@ -48,18 +47,22 @@ public class BookletEntry implements IBookletEntry {
|
|||
this.color = TextFormatting.RESET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static boolean fitsFilter(IBookletPage page, String searchBarText) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
page.getItemStacksForPage(items);
|
||||
if (!items.isEmpty()) {
|
||||
for (ItemStack stack : items) {
|
||||
if (StackUtil.isValid(stack)) {
|
||||
List<String> tooltip = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
List<String> tooltip = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips
|
||||
? ITooltipFlag.TooltipFlags.ADVANCED
|
||||
: ITooltipFlag.TooltipFlags.NORMAL);
|
||||
for (String strg : tooltip) {
|
||||
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { return true; }
|
||||
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +74,9 @@ public class BookletEntry implements IBookletEntry {
|
|||
for (FluidStack stack : fluids) {
|
||||
if (stack != null) {
|
||||
String strg = stack.getLocalizedName();
|
||||
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { return true; }
|
||||
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,13 +95,13 @@ public class BookletEntry implements IBookletEntry {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getLocalizedName() {
|
||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getLocalizedNameWithFormatting() {
|
||||
return this.color + this.getLocalizedName();
|
||||
}
|
||||
|
@ -107,7 +112,7 @@ public class BookletEntry implements IBookletEntry {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
|
||||
if (searchBarText != null && !searchBarText.isEmpty()) {
|
||||
String search = searchBarText.toLowerCase(Locale.ROOT);
|
||||
|
@ -138,7 +143,7 @@ public class BookletEntry implements IBookletEntry {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean visibleOnFrontPage() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract class GuiBooklet extends GuiBookletBase {
|
||||
|
||||
public static final int BUTTONS_PER_PAGE = 12;
|
||||
|
|
|
@ -24,9 +24,9 @@ import net.minecraft.client.gui.GuiButton;
|
|||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiEntry extends GuiBooklet {
|
||||
|
||||
//The page in the entry. Say you have 2 more chapters than fit on one double page, then those 2 would be displayed on entryPage 1 instead.
|
||||
|
|
|
@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
//TODO Fix achievement button
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiMainPage extends GuiBooklet {
|
||||
|
||||
private static final String[] QUOTES = new String[] { "Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best I’ve seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしい!ただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc" };
|
||||
|
|
|
@ -31,9 +31,9 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiPage extends GuiBooklet {
|
||||
|
||||
public final IBookletPage[] pages = new IBookletPage[2];
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.client.gui.GuiScreen;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public final class BookletUtils {
|
||||
|
||||
|
@ -41,7 +41,7 @@ public final class BookletUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) {
|
||||
GuiMainPage mainPage = new GuiMainPage(previousScreen);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public final class BookletUtils {
|
|||
return createPageGui(previousScreen, entry, page);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static GuiPage createPageGui(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue