mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-10-31 22:50:50 +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
102
build.gradle
102
build.gradle
|
@ -1,71 +1,115 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||||
jcenter()
|
jcenter()
|
||||||
maven {
|
mavenCentral()
|
||||||
name = "forge"
|
|
||||||
url = "http://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dependencies {
|
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: 'idea'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
|
|
||||||
version = "1.12.2-r152"
|
version = "$mod_version"
|
||||||
group = "de.ellpeck.actuallyadditions"
|
group = "de.ellpeck.actuallyadditions"
|
||||||
archivesBaseName = "ActuallyAdditions"
|
archivesBaseName = "ActuallyAdditions-$game_version"
|
||||||
|
|
||||||
if (System.getenv('BUILD_NUMBER') != null) {
|
if (System.getenv('BUILD_NUMBER') != null) {
|
||||||
version += "." + System.getenv('BUILD_NUMBER')
|
version += "." + System.getenv('BUILD_NUMBER')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.12.2-14.23.5.2836"
|
mappings channel: 'snapshot', version: "${mcp_mappings}"
|
||||||
runDir = "run"
|
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||||
mappings = "stable_39"
|
|
||||||
makeObfSourceJar = false
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
replaceIn "ActuallyAdditions.java"
|
|
||||||
replace "@VERSION@", version.toString()
|
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 {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url "https://dvs1.progwml6.com/files/maven"
|
// JEI
|
||||||
|
name = "Progwml6 maven"
|
||||||
|
url = "https://dvs1.progwml6.com/files/maven/"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
url "https://maven.tehnut.info"
|
url = "https://www.cursemaven.com"
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url "https://dl.bintray.com/cyclopsmc/dev/"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mezz.jei:jei_1.12.2:+"
|
minecraft "net.minecraftforge:forge:${game_version}-${forge_version}"
|
||||||
deobfCompile "mcp.mobius.waila:Hwyla:1.8+"
|
|
||||||
deobfCompile ("org.cyclops.commoncapabilities:CommonCapabilities:1.12.2-+")
|
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 {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property('version', project.version)
|
||||||
inputs.property "mcversion", project.minecraft.version
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
include 'mcmod.info'
|
include 'META-INF/mods.toml'
|
||||||
|
expand 'version': project.version
|
||||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'META-INF/mods.toml'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
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) {
|
task deobfJar(type: Jar) {
|
||||||
|
@ -95,8 +139,6 @@ task sourcesJar(type: Jar) {
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives deobfJar, sourcesJar, apiJar, javadocJar
|
archives deobfJar, sourcesJar, apiJar, javadocJar
|
||||||
}
|
}
|
||||||
|
|
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
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
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
|
||||||
|
|
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.TreasureChestLoot;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
||||||
import net.minecraft.block.Block;
|
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.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
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 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
|
* @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));
|
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.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public interface IBookletChapter {
|
public interface IBookletChapter {
|
||||||
|
|
||||||
IBookletPage[] getAllPages();
|
IBookletPage[] getAllPages();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
String getLocalizedName();
|
String getLocalizedName();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
String getLocalizedNameWithFormatting();
|
String getLocalizedNameWithFormatting();
|
||||||
|
|
||||||
IBookletEntry getEntry();
|
IBookletEntry getEntry();
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public interface IBookletEntry {
|
public interface IBookletEntry {
|
||||||
|
|
||||||
|
@ -21,19 +21,19 @@ public interface IBookletEntry {
|
||||||
|
|
||||||
String getIdentifier();
|
String getIdentifier();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
String getLocalizedName();
|
String getLocalizedName();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
String getLocalizedNameWithFormatting();
|
String getLocalizedNameWithFormatting();
|
||||||
|
|
||||||
void addChapter(IBookletChapter chapter);
|
void addChapter(IBookletChapter chapter);
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
List<IBookletChapter> getChaptersForDisplay(String searchBarText);
|
List<IBookletChapter> getChaptersForDisplay(String searchBarText);
|
||||||
|
|
||||||
int getSortingPriority();
|
int getSortingPriority();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
boolean visibleOnFrontPage();
|
boolean visibleOnFrontPage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public interface IBookletPage {
|
public interface IBookletPage {
|
||||||
|
|
||||||
|
@ -29,31 +29,31 @@ public interface IBookletPage {
|
||||||
|
|
||||||
void setChapter(IBookletChapter chapter);
|
void setChapter(IBookletChapter chapter);
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
String getInfoText();
|
String getInfoText();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton);
|
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);
|
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);
|
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void actionPerformed(GuiBookletBase gui, GuiButton button);
|
void actionPerformed(GuiBookletBase gui, GuiButton button);
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void initGui(GuiBookletBase gui, int startX, int startY);
|
void initGui(GuiBookletBase gui, int startX, int startY);
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer);
|
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);
|
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);
|
void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
||||||
|
|
||||||
boolean shouldBeOnLeftSide();
|
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.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
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.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
@ -40,7 +40,7 @@ public interface IMethodHandler {
|
||||||
|
|
||||||
PotionEffect[] getEffectsFromStack(ItemStack stack);
|
PotionEffect[] getEffectsFromStack(ItemStack stack);
|
||||||
|
|
||||||
boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||||
|
|
||||||
boolean invokeReconstructor(IAtomicReconstructor tile);
|
boolean invokeReconstructor(IAtomicReconstructor tile);
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.laser;
|
package de.ellpeck.actuallyadditions.api.laser;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public interface IConnectionPair {
|
public interface IConnectionPair {
|
||||||
|
|
||||||
void writeToNBT(NBTTagCompound compound);
|
void writeToNBT(CompoundNBT compound);
|
||||||
|
|
||||||
void readFromNBT(NBTTagCompound compound);
|
void readFromNBT(CompoundNBT compound);
|
||||||
|
|
||||||
BlockPos[] getPositions();
|
BlockPos[] getPositions();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.api.lens;
|
package de.ellpeck.actuallyadditions.api.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
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.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public abstract class Lens {
|
||||||
* @param tile The tile the lens was invoked from
|
* @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)
|
* @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
|
* 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.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
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;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
public class LensConversion extends Lens {
|
public class LensConversion extends Lens {
|
||||||
|
|
||||||
@Override
|
@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);
|
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
||||||
|
|
||||||
@Override
|
@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();
|
ItemStack newStack = stack.copy();
|
||||||
int meta = newStack.getItemDamage();
|
int meta = newStack.getItemDamage();
|
||||||
newStack.setItemDamage((meta + 1) % 16);
|
newStack.setItemDamage((meta + 1) % 16);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
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.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
|
@ -19,15 +19,15 @@ public class CompostRecipe {
|
||||||
|
|
||||||
protected final Ingredient input;
|
protected final Ingredient input;
|
||||||
protected final ItemStack output;
|
protected final ItemStack output;
|
||||||
protected final IBlockState inputDisplay;
|
protected final BlockState inputDisplay;
|
||||||
protected final IBlockState outputDisplay;
|
protected final BlockState outputDisplay;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||||
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
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.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.inputDisplay = inputDisplay;
|
this.inputDisplay = inputDisplay;
|
||||||
|
@ -46,11 +46,11 @@ public class CompostRecipe {
|
||||||
return this.output;
|
return this.output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBlockState getInputDisplay() {
|
public BlockState getInputDisplay() {
|
||||||
return this.inputDisplay;
|
return this.inputDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBlockState getOutputDisplay() {
|
public BlockState getOutputDisplay() {
|
||||||
return this.outputDisplay;
|
return this.outputDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -35,6 +35,6 @@ public interface IColorLensChanger {
|
||||||
* @param tile the Reconstructor doing the color conversion
|
* @param tile the Reconstructor doing the color conversion
|
||||||
* @return the modified stack. Please make sure to return a modified COPY of the input stack.
|
* @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.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
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.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -56,6 +56,6 @@ public class LensConversionRecipe {
|
||||||
return this.type;
|
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;
|
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.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
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.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen;
|
import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
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.ItemCoffee;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
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.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
|
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.launchwrapper.Launch;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.World;
|
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.EventHandler;
|
||||||
import net.minecraftforge.fml.common.Mod.Instance;
|
import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.*;
|
||||||
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.registry.GameRegistry;
|
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)
|
@Mod(modid = ActuallyAdditions.MODID, name = ActuallyAdditions.NAME, version = ActuallyAdditions.VERSION, guiFactory = ActuallyAdditions.GUIFACTORY, dependencies = ActuallyAdditions.DEPS)
|
||||||
public class ActuallyAdditions {
|
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 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 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
|
@Instance
|
||||||
public static ActuallyAdditions INSTANCE;
|
public static ActuallyAdditions INSTANCE;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
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.ActualCompostModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.CompostModel;
|
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.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -20,6 +16,9 @@ import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class ClientRegistryHandler {
|
public class ClientRegistryHandler {
|
||||||
|
|
||||||
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
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.items.metalists.TheCrystals;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.stats.Achievement;
|
import net.minecraft.stats.Achievement;
|
||||||
|
@ -96,11 +96,11 @@ public enum TheAchievements{
|
||||||
this(name, x, y, displayStack, hasToHaveBefore, type, false, 0, specialItemsToBeGotten);
|
this(name, x, y, displayStack, hasToHaveBefore, type, false, 0, specialItemsToBeGotten);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void get(EntityPlayer player){
|
public void get(PlayerEntity player){
|
||||||
this.get(player, 1);
|
this.get(player, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void get(EntityPlayer player, int amount){
|
public void get(PlayerEntity player, int amount){
|
||||||
if(this.progressToReach > 0){
|
if(this.progressToReach > 0){
|
||||||
this.updateStatus(player, amount);
|
this.updateStatus(player, amount);
|
||||||
}
|
}
|
||||||
|
@ -109,10 +109,10 @@ public enum TheAchievements{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatus(EntityPlayer player, int amount){
|
private void updateStatus(PlayerEntity player, int amount){
|
||||||
if(player instanceof EntityPlayerMP){
|
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)){
|
if(manager != null && !manager.hasAchievementUnlocked(this.chieve) && manager.canUnlockAchievement(this.chieve)){
|
||||||
|
|
||||||
JsonSerializableSet data = manager.getProgress(this.chieve);
|
JsonSerializableSet data = manager.getProgress(this.chieve);
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
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.BlockDirectional;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.init.Items;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.math.RayTraceResult;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
|
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -63,14 +63,16 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos);
|
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos);
|
||||||
if (reconstructor != null) {
|
if (reconstructor != null) {
|
||||||
|
@ -105,8 +107,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if (tile instanceof TileEntityAtomicReconstructor) {
|
if (tile instanceof TileEntityAtomicReconstructor) {
|
||||||
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
||||||
|
@ -133,7 +135,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -141,12 +143,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,12 +158,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,12 +207,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
public boolean hasComparatorInputOverride(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos) {
|
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) {
|
||||||
TileEntity t = world.getTileEntity(pos);
|
TileEntity t = world.getTileEntity(pos);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (t instanceof TileEntityAtomicReconstructor) {
|
if (t instanceof TileEntityAtomicReconstructor) {
|
||||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -39,7 +39,7 @@ public class BlockBatteryBox extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class BlockBatteryBox extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityBatteryBox) {
|
if (tile instanceof TileEntityBatteryBox) {
|
||||||
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;
|
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;
|
||||||
|
@ -74,7 +74,7 @@ public class BlockBatteryBox extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class BlockBioReactor extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
if (world.getTileEntity(pos) instanceof TileEntityBioReactor) {
|
if (world.getTileEntity(pos) instanceof TileEntityBioReactor) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -47,12 +47,16 @@ public class BlockBreaker extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
|
return this.isPlacer
|
||||||
|
? new TileEntityPlacer()
|
||||||
|
: new TileEntityBreaker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos);
|
TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos);
|
||||||
if (breaker != null) {
|
if (breaker != null) {
|
||||||
|
@ -69,7 +73,7 @@ public class BlockBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -77,12 +81,12 @@ public class BlockBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,12 +96,12 @@ public class BlockBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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 de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ public class BlockCanolaPress extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class BlockCanolaPress extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (!world.isRemote) {
|
||||||
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
|
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
|
||||||
if (press != null) {
|
if (press != null) {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockCoalGenerator extends BlockContainerBase {
|
public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
|
|
||||||
|
@ -48,12 +44,12 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +59,8 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityCoalGenerator) {
|
if (tile instanceof TileEntityCoalGenerator) {
|
||||||
if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) {
|
if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) {
|
||||||
|
@ -76,7 +72,7 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
|
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
|
||||||
if (press != null) {
|
if (press != null) {
|
||||||
|
@ -88,7 +84,7 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
@ -100,12 +96,12 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +111,12 @@ public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -47,22 +47,22 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (!world.isRemote) {
|
||||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
|
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
|
||||||
if (machine != null) {
|
if (machine != null) {
|
||||||
|
@ -86,7 +86,7 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
int rotation = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if (rotation == 0) {
|
if (rotation == 0) {
|
||||||
|
@ -106,12 +106,12 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,12 +121,12 @@ public class BlockCoffeeMachine extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
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.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockColoredLamp extends BlockBase {
|
public class BlockColoredLamp extends BlockBase {
|
||||||
|
|
||||||
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
||||||
|
@ -54,21 +54,23 @@ public class BlockColoredLamp extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
public Item getItemDropped(BlockState state, Random rand, int par3) {
|
||||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(BlockState state) {
|
||||||
return this.getMetaFromState(state);
|
return this.getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
//Turning On
|
//Turning On
|
||||||
if (hand == EnumHand.MAIN_HAND && stack.isEmpty()) {
|
if (hand == Hand.MAIN_HAND && stack.isEmpty()) {
|
||||||
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
world.setBlockState(pos, (this.isOn
|
||||||
|
? InitBlocks.blockColoredLamp
|
||||||
|
: InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
||||||
world.notifyLightSet(pos);
|
world.notifyLightSet(pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +100,7 @@ public class BlockColoredLamp extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int j = 0; j < ALL_LAMP_TYPES.length; j++) {
|
for (int j = 0; j < ALL_LAMP_TYPES.length; j++) {
|
||||||
list.add(new ItemStack(this, 1, j));
|
list.add(new ItemStack(this, 1, j));
|
||||||
|
@ -106,8 +108,10 @@ public class BlockColoredLamp extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return this.isOn ? 15 : 0;
|
return this.isOn
|
||||||
|
? 15
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -128,12 +132,12 @@ public class BlockColoredLamp extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +156,16 @@ public class BlockColoredLamp extends BlockBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { return StringUtil.BUGGED_ITEM_NAME; }
|
if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) {
|
||||||
if (Util.isClient()) return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" : "");
|
return StringUtil.BUGGED_ITEM_NAME;
|
||||||
else return super.getItemStackDisplayName(stack);
|
}
|
||||||
|
if (Util.isClient()) {
|
||||||
|
return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn
|
||||||
|
? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")"
|
||||||
|
: "");
|
||||||
|
} else {
|
||||||
|
return super.getItemStackDisplayName(stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
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.api.recipe.CompostRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
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.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.entity.Entity;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
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.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -66,32 +65,32 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@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, AABB_LEGS);
|
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
|
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
|
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack stackPlayer = player.getHeldItem(hand);
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
@ -158,8 +157,8 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if (tile instanceof TileEntityCompost) {
|
if (tile instanceof TileEntityCompost) {
|
||||||
ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0);
|
ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0);
|
||||||
|
@ -177,11 +176,11 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
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
|
@Override
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public BlockState getExtendedState(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) {
|
if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) {
|
||||||
TileEntityCompost compost = (TileEntityCompost) te;
|
TileEntityCompost compost = (TileEntityCompost) te;
|
||||||
|
|
|
@ -19,14 +19,14 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraftforge.common.IRarity;
|
import net.minecraftforge.common.IRarity;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockCrystal extends BlockBase {
|
public class BlockCrystal extends BlockBase {
|
||||||
|
|
||||||
|
@ -44,12 +44,12 @@ public class BlockCrystal extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(BlockState state) {
|
||||||
return this.getMetaFromState(state);
|
return this.getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int j = 0; j < ALL_CRYSTALS.length; j++) {
|
for (int j = 0; j < ALL_CRYSTALS.length; j++) {
|
||||||
list.add(new ItemStack(this, 1, j));
|
list.add(new ItemStack(this, 1, j));
|
||||||
|
@ -69,12 +69,12 @@ public class BlockCrystal extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheCrystals.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheCrystals.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ import net.minecraft.block.BlockDirectional;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.IBlockColor;
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -40,7 +40,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
|
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
|
||||||
|
|
||||||
|
@ -58,17 +58,17 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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());
|
return this.getStateFromMeta(side.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +78,12 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,17 +93,17 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public IBlockColor getBlockColor() {
|
public IBlockColor getBlockColor() {
|
||||||
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||||
}
|
}
|
||||||
|
@ -114,23 +114,23 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public IItemColor getItemColor() {
|
public IItemColor getItemColor() {
|
||||||
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||||
return InitItems.itemCrystalShard;
|
return InitItems.itemCrystalShard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(BlockState state) {
|
||||||
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return new ItemStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockDirectional;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -47,8 +47,10 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker) world.getTileEntity(pos);
|
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker) world.getTileEntity(pos);
|
||||||
if (breaker != null) {
|
if (breaker != null) {
|
||||||
|
@ -65,7 +67,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -73,12 +75,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,12 +90,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -46,12 +46,12 @@ public class BlockDisplayStand extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos);
|
TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos);
|
||||||
|
@ -62,7 +62,9 @@ public class BlockDisplayStand extends BlockContainerBase {
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.setCount(1);
|
toPut.setCount(1);
|
||||||
stand.inv.setStackInSlot(0, toPut);
|
stand.inv.setStackInSlot(0, toPut);
|
||||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
if (!player.capabilities.isCreativeMode) {
|
||||||
|
heldItem.shrink(1);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
||||||
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||||
|
@ -89,18 +91,20 @@ public class BlockDisplayStand extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face) {
|
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing face) {
|
||||||
if (face == EnumFacing.DOWN) return BlockFaceShape.SOLID;
|
if (face == EnumFacing.DOWN) {
|
||||||
|
return BlockFaceShape.SOLID;
|
||||||
|
}
|
||||||
return BlockFaceShape.UNDEFINED;
|
return BlockFaceShape.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockDirectional;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -47,8 +47,10 @@ public class BlockDropper extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos);
|
TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos);
|
||||||
if (dropper != null) {
|
if (dropper != null) {
|
||||||
|
@ -65,7 +67,7 @@ public class BlockDropper extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -73,12 +75,12 @@ public class BlockDropper extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,12 +90,12 @@ public class BlockDropper extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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 de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -45,12 +45,12 @@ public class BlockEmpowerer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);
|
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);
|
||||||
|
@ -61,7 +61,9 @@ public class BlockEmpowerer extends BlockContainerBase {
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.setCount(1);
|
toPut.setCount(1);
|
||||||
empowerer.inv.setStackInSlot(0, toPut);
|
empowerer.inv.setStackInSlot(0, toPut);
|
||||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
if (!player.capabilities.isCreativeMode) {
|
||||||
|
heldItem.shrink(1);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
|
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
|
||||||
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||||
|
@ -88,7 +90,7 @@ public class BlockEmpowerer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,13 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -42,11 +42,13 @@ public class BlockEnergizer extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
|
return this.isEnergizer
|
||||||
|
? new TileEntityEnergizer()
|
||||||
|
: new TileEntityEnervator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
if (this.isEnergizer) {
|
if (this.isEnergizer) {
|
||||||
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);
|
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);
|
||||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -47,7 +47,7 @@ public class BlockFarmer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
|
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
|
||||||
if (farmer != null) {
|
if (farmer != null) {
|
||||||
|
@ -64,19 +64,19 @@ public class BlockFarmer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +86,12 @@ public class BlockFarmer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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 de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class BlockFeeder extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
|
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
|
||||||
if (feeder != null) {
|
if (feeder != null) {
|
||||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ public class BlockFermentingBarrel extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class BlockFermentingBarrel extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
|
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
|
||||||
if (press != null) {
|
if (press != null) {
|
||||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class BlockFireworkBox extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (!world.isRemote) {
|
} else if (!world.isRemote) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -36,7 +36,7 @@ public class BlockFishingNet extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,12 +46,12 @@ public class BlockFishingNet extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,14 @@ import net.minecraft.block.BlockDirectional;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -47,12 +47,16 @@ public class BlockFluidCollector extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
return this.isPlacer
|
||||||
|
? new TileEntityFluidPlacer()
|
||||||
|
: new TileEntityFluidCollector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos);
|
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos);
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
|
@ -71,7 +75,7 @@ public class BlockFluidCollector extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -79,12 +83,12 @@ public class BlockFluidCollector extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,12 +98,12 @@ public class BlockFluidCollector extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
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.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
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.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockFurnaceDouble extends BlockContainerBase {
|
public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
|
|
||||||
|
@ -63,8 +59,8 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if (state.getValue(IS_ON)) {
|
if (state.getValue(IS_ON)) {
|
||||||
for (int i = 0; i < 5; i++) {
|
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);
|
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
|
@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.isRemote) {
|
||||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
|
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
|
||||||
if (furnace != null) {
|
if (furnace != null) {
|
||||||
|
@ -85,8 +81,10 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return state.getValue(IS_ON) ? 12 : 0;
|
return state.getValue(IS_ON)
|
||||||
|
? 12
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,23 +93,27 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
boolean isOn = meta >= 4;
|
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);
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
return state.getValue(IS_ON) ? meta + 4 : meta;
|
return state.getValue(IS_ON)
|
||||||
|
? meta + 4
|
||||||
|
: meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,12 +122,12 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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 de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -36,7 +36,7 @@ public class BlockFurnaceSolar extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,12 +46,12 @@ public class BlockFurnaceSolar extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
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.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.ListNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
@ -45,6 +43,8 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockGiantChest extends BlockContainerBase {
|
public class BlockGiantChest extends BlockContainerBase {
|
||||||
|
|
||||||
public final int type;
|
public final int type;
|
||||||
|
@ -73,17 +73,17 @@ public class BlockGiantChest extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
|
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
|
||||||
if (chest != null) {
|
if (chest != null) {
|
||||||
|
@ -101,17 +101,17 @@ public class BlockGiantChest extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (stack.getTagCompound() != null) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityGiantChest) {
|
if (tile instanceof TileEntityGiantChest) {
|
||||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
ListNBT list = stack.getTagCompound().getList("Items", 10);
|
||||||
IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
|
IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
NBTTagCompound compound = list.getCompoundTagAt(i);
|
CompoundNBT compound = list.getCompound(i);
|
||||||
if (compound != null && compound.hasKey("id")) {
|
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
|
@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);
|
super.getDrops(drops, world, pos, state, fortune);
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityGiantChest) {
|
if (tile instanceof TileEntityGiantChest) {
|
||||||
ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
|
ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
|
||||||
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
||||||
if (place >= 0) {
|
if (place >= 0) {
|
||||||
NBTTagList list = new NBTTagList();
|
ListNBT list = new ListNBT();
|
||||||
for (int i = 0; i < slots.getSlots(); i++) {
|
for (int i = 0; i < slots.getSlots(); i++) {
|
||||||
//Destroy the keeper
|
//Destroy the keeper
|
||||||
if (i != place) {
|
if (i != place) {
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
CompoundNBT compound = new CompoundNBT();
|
||||||
if (StackUtil.isValid(slots.getStackInSlot(i))) {
|
if (StackUtil.isValid(slots.getStackInSlot(i))) {
|
||||||
slots.getStackInSlot(i).writeToNBT(compound);
|
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);
|
ItemStack stackInQuestion = drops.get(0);
|
||||||
if (StackUtil.isValid(stackInQuestion)) {
|
if (StackUtil.isValid(stackInQuestion)) {
|
||||||
if (stackInQuestion.getTagCompound() == null) {
|
if (stackInQuestion.getTagCompound() == null) {
|
||||||
stackInQuestion.setTagCompound(new NBTTagCompound());
|
stackInQuestion.setTagCompound(new CompoundNBT());
|
||||||
}
|
}
|
||||||
stackInQuestion.getTagCompound().setTag("Items", list);
|
stackInQuestion.getTagCompound().setTag("Items", list);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,9 @@ public class BlockGiantChest extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
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) {
|
if (type == 2) {
|
||||||
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
|
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
|
||||||
} else if (type == 0) {
|
} else if (type == 0) {
|
||||||
|
@ -181,7 +183,7 @@ public class BlockGiantChest extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getNBTShareTag(ItemStack stack) {
|
public CompoundNBT getNBTShareTag(ItemStack stack) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.IGrowable;
|
import net.minecraft.block.IGrowable;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockGreenhouseGlass extends BlockBase {
|
public class BlockGreenhouseGlass extends BlockBase {
|
||||||
|
|
||||||
|
@ -42,25 +42,25 @@ public class BlockGreenhouseGlass extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightOpacity(IBlockState state) {
|
public int getLightOpacity(BlockState state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
public boolean shouldSideBeRendered(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
IBlockState otherState = world.getBlockState(pos.offset(side));
|
BlockState otherState = world.getBlockState(pos.offset(side));
|
||||||
Block block = otherState.getBlock();
|
Block block = otherState.getBlock();
|
||||||
|
|
||||||
return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side);
|
return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side);
|
||||||
|
@ -78,13 +78,13 @@ public class BlockGreenhouseGlass extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) return;
|
||||||
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
|
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;
|
boolean once = false;
|
||||||
if (trip != null) for (int i = 0; i < 3; i++) {
|
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)) {
|
if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
|
||||||
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
||||||
once = true;
|
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);
|
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
|
||||||
while (true) {
|
while (true) {
|
||||||
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
||||||
if (mut.getY() < 0) return null;
|
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.isOpaqueCube() || state.getBlock() instanceof IGrowable || state.getBlock() == this) {
|
||||||
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
||||||
else return null;
|
else return null;
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 {
|
public class BlockGrinder extends BlockContainerBase {
|
||||||
|
|
||||||
|
@ -50,12 +50,14 @@ public class BlockGrinder extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
|
return this.isDouble
|
||||||
|
? new TileEntityGrinderDouble()
|
||||||
|
: new TileEntityGrinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if (state.getValue(BlockFurnaceDouble.IS_ON)) {
|
if (state.getValue(BlockFurnaceDouble.IS_ON)) {
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
double xRand = rand.nextDouble() / 0.75D - 0.5D;
|
double xRand = rand.nextDouble() / 0.75D - 0.5D;
|
||||||
|
@ -67,11 +69,13 @@ public class BlockGrinder extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
|
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
|
||||||
if (grinder != null) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -79,12 +83,14 @@ public class BlockGrinder extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
return this.getMetaFromState(state) == 1
|
||||||
|
? 12
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(BlockState state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,14 +100,16 @@ public class BlockGrinder extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
boolean isOn = meta == 1;
|
boolean isOn = meta == 1;
|
||||||
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0;
|
return state.getValue(BlockFurnaceDouble.IS_ON)
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
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.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockInputter extends BlockContainerBase {
|
public class BlockInputter extends BlockContainerBase {
|
||||||
|
|
||||||
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
||||||
|
@ -51,15 +51,19 @@ public class BlockInputter extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
|
return this.isAdvanced
|
||||||
|
? new TileEntityInputterAdvanced()
|
||||||
|
: new TileEntityInputter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
|
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
|
||||||
if (inputter != null) {
|
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;
|
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") + ")";
|
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 de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -44,7 +44,7 @@ public class BlockItemRepairer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
|
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
|
||||||
if (repairer != null) {
|
if (repairer != null) {
|
||||||
|
@ -56,8 +56,10 @@ public class BlockItemRepairer extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
return this.getMetaFromState(state) == 1
|
||||||
|
? 12
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
|
||||||
import net.minecraft.block.properties.PropertyDirection;
|
import net.minecraft.block.properties.PropertyDirection;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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.
|
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
|
||||||
public class BlockItemViewerHopping extends BlockItemViewer {
|
public class BlockItemViewerHopping extends BlockItemViewer {
|
||||||
|
@ -46,13 +46,13 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return FULL_BLOCK_AABB;
|
return FULL_BLOCK_AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@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, BASE_AABB);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
||||||
|
@ -66,29 +66,29 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
EnumFacing opp = facing.getOpposite();
|
||||||
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override //was isFullyOpaque, not sure if correct change.
|
@Override //was isFullyOpaque, not sure if correct change.
|
||||||
public boolean isNormalCube(IBlockState state) {
|
public boolean isNormalCube(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,12 +98,12 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(FACING).getIndex();
|
return state.getValue(FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +113,12 @@ public class BlockItemViewerHopping extends BlockItemViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
public BlockState withMirror(BlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(FACING)));
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -41,17 +41,17 @@ public class BlockLampPowerer extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
this.updateLamp(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
public void onBlockAdded(World world, BlockPos pos, BlockState state) {
|
||||||
this.updateLamp(world, pos);
|
this.updateLamp(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ public class BlockLampPowerer extends BlockBase {
|
||||||
|
|
||||||
private void updateLamp(World world, BlockPos pos) {
|
private void updateLamp(World world, BlockPos pos) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
IBlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
||||||
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
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();
|
Block block = state.getBlock();
|
||||||
if (block instanceof BlockColoredLamp) {
|
if (block instanceof BlockColoredLamp) {
|
||||||
boolean isOn = ((BlockColoredLamp) block).isOn;
|
boolean isOn = ((BlockColoredLamp) block).isOn;
|
||||||
|
@ -101,12 +101,12 @@ public class BlockLampPowerer extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,12 +116,12 @@ public class BlockLampPowerer extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.ItemEngineerGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||||
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.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.BlockDirectional;
|
import net.minecraft.block.BlockDirectional;
|
||||||
|
@ -33,16 +27,16 @@ import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
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.Event;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 {
|
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -87,13 +81,13 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) {
|
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
PlayerEntity player = event.getEntityPlayer();
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
ItemStack stack = event.getItemStack();
|
ItemStack stack = event.getItemStack();
|
||||||
BlockPos pos = event.getPos();
|
BlockPos pos = event.getPos();
|
||||||
|
|
||||||
if (player != null && world != null && StackUtil.isValid(stack) && pos != null) {
|
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 (state != null && state.getBlock() instanceof BlockLaserRelay) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
event.setUseBlock(Event.Result.ALLOW);
|
event.setUseBlock(Event.Result.ALLOW);
|
||||||
|
@ -103,7 +97,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
switch (this.getMetaFromState(state)) {
|
switch (this.getMetaFromState(state)) {
|
||||||
case 1:
|
case 1:
|
||||||
return AABB_UP;
|
return AABB_UP;
|
||||||
|
@ -121,17 +115,17 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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());
|
return this.getStateFromMeta(side.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,12 +135,12 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,17 +150,17 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityLaserRelay) {
|
if (tile instanceof TileEntityLaserRelay) {
|
||||||
|
@ -250,8 +244,8 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
if (posHit != null && posHit.getBlockPos() != null && minecraft.world != null) {
|
if (posHit != null && posHit.getBlockPos() != null && minecraft.world != null) {
|
||||||
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
||||||
if (wearing || StackUtil.isValid(stack)) {
|
if (wearing || StackUtil.isValid(stack)) {
|
||||||
|
@ -279,14 +273,14 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
public void breakBlock(World world, BlockPos pos, BlockState state) {
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
|
|
||||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return BlockFaceShape.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
|
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if (factory != null) {
|
if (factory != null) {
|
||||||
int state = factory.isMultiblock();
|
int state = factory.isMultiblock();
|
||||||
|
|
|
@ -17,20 +17,20 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityMiner) {
|
if (tile instanceof TileEntityMiner) {
|
||||||
|
@ -69,12 +69,16 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if (tile instanceof TileEntityMiner) {
|
if (tile instanceof TileEntityMiner) {
|
||||||
TileEntityMiner miner = (TileEntityMiner) tile;
|
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);
|
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.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -38,7 +38,7 @@ public class BlockMisc extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(BlockState state) {
|
||||||
return this.getMetaFromState(state);
|
return this.getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,12 +67,12 @@ public class BlockMisc extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockOilGenerator extends BlockContainerBase {
|
public class BlockOilGenerator extends BlockContainerBase {
|
||||||
|
|
||||||
|
@ -48,12 +44,12 @@ public class BlockOilGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +59,8 @@ public class BlockOilGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityOilGenerator) {
|
if (tile instanceof TileEntityOilGenerator) {
|
||||||
if (((TileEntityOilGenerator) tile).currentBurnTime > 0) {
|
if (((TileEntityOilGenerator) tile).currentBurnTime > 0) {
|
||||||
|
@ -76,7 +72,7 @@ public class BlockOilGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos);
|
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos);
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
|
@ -90,7 +86,7 @@ public class BlockOilGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
@ -102,12 +98,12 @@ public class BlockOilGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +113,12 @@ public class BlockOilGenerator extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.api.tile.IPhantomTile;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
|
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||||
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.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
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.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -57,24 +52,28 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvidePower(IBlockState state) {
|
public boolean canProvidePower(BlockState state) {
|
||||||
return this.type == Type.REDSTONEFACE;
|
return this.type == Type.REDSTONEFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (this.type == Type.REDSTONEFACE) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (this.type == Type.REDSTONEFACE) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -103,8 +102,10 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
||||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
|
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
|
||||||
|
@ -120,8 +121,8 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
if (tile instanceof IPhantomTile) {
|
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);
|
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()) {
|
if (phantom.hasBoundPosition()) {
|
||||||
int distance = MathHelper.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())));
|
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();
|
Block block = state.getBlock();
|
||||||
Item item = Item.getItemFromBlock(block);
|
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);
|
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()) {
|
if (phantom.isBoundThingInRange()) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -36,17 +36,17 @@ public class BlockPhantomBooster extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,11 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 {
|
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityPlayerInterface) {
|
if (tile instanceof TileEntityPlayerInterface) {
|
||||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
||||||
|
@ -67,8 +67,8 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
if (tile instanceof TileEntityPlayerInterface) {
|
if (tile instanceof TileEntityPlayerInterface) {
|
||||||
|
|
|
@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -42,8 +42,10 @@ public class BlockRangedCollector extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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; }
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntityRangedCollector breaker = (TileEntityRangedCollector) world.getTileEntity(pos);
|
TileEntityRangedCollector breaker = (TileEntityRangedCollector) world.getTileEntity(pos);
|
||||||
if (breaker != null) {
|
if (breaker != null) {
|
||||||
|
|
|
@ -17,34 +17,34 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockSlab;
|
import net.minecraft.block.BlockSlab;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockSlabs extends BlockBase {
|
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);
|
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 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) {
|
public BlockSlabs(String name, Block fullBlock) {
|
||||||
this(name, fullBlock.getDefaultState());
|
this(name, fullBlock.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockSlabs(String name, IBlockState fullBlockState) {
|
public BlockSlabs(String name, BlockState fullBlockState) {
|
||||||
super(fullBlockState.getMaterial(), name);
|
super(fullBlockState.getMaterial(), name);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
this.setResistance(10.0F);
|
this.setResistance(10.0F);
|
||||||
|
@ -52,25 +52,31 @@ public class BlockSlabs extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
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() == 1) {
|
||||||
if (facing.ordinal() == 0 || hitY >= 0.5F) { return this.getStateFromMeta(meta + 1); }
|
return this.getStateFromMeta(meta);
|
||||||
|
}
|
||||||
|
if (facing.ordinal() == 0 || hitY >= 0.5F) {
|
||||||
|
return this.getStateFromMeta(meta + 1);
|
||||||
|
}
|
||||||
return this.getStateFromMeta(meta);
|
return this.getStateFromMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
|
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP
|
||||||
|
? AABB_TOP_HALF
|
||||||
|
: AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,13 +90,17 @@ public class BlockSlabs extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0
|
||||||
|
? BlockSlab.EnumBlockHalf.BOTTOM
|
||||||
|
: BlockSlab.EnumBlockHalf.TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? 0 : 1;
|
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM
|
||||||
|
? 0
|
||||||
|
: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,15 +117,15 @@ public class BlockSlabs extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
if (StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
|
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) {
|
if (state.getBlock() == this.block) {
|
||||||
BlockSlabs theBlock = (BlockSlabs) 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) {
|
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);
|
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
||||||
|
|
||||||
if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) {
|
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 {
|
} else {
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
|
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, PlayerEntity player, ItemStack stack) {
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
BlockState state = worldIn.getBlockState(pos);
|
||||||
|
|
||||||
if (state.getBlock() == this.block) {
|
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);
|
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) {
|
private boolean tryPlace(PlayerEntity player, ItemStack stack, Hand hand, World world, BlockPos pos) {
|
||||||
IBlockState iblockstate = world.getBlockState(pos);
|
BlockState iblockstate = world.getBlockState(pos);
|
||||||
|
|
||||||
if (iblockstate.getBlock() == this.block) {
|
if (iblockstate.getBlock() == this.block) {
|
||||||
BlockSlabs theBlock = (BlockSlabs) this.block;
|
BlockSlabs theBlock = (BlockSlabs) this.block;
|
||||||
IBlockState newState = theBlock.fullBlockState;
|
BlockState newState = theBlock.fullBlockState;
|
||||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
||||||
|
|
||||||
if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) {
|
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;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockSmileyCloud extends BlockContainerBase {
|
public class BlockSmileyCloud extends BlockContainerBase {
|
||||||
|
|
||||||
|
@ -47,18 +43,18 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if (world.rand.nextInt(30) == 0) {
|
if (world.rand.nextInt(30) == 0) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
double d = world.rand.nextGaussian() * 0.02D;
|
double d = world.rand.nextGaussian() * 0.02D;
|
||||||
|
@ -70,7 +66,7 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntitySmileyCloud) {
|
if (tile instanceof TileEntitySmileyCloud) {
|
||||||
|
@ -93,19 +89,19 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +111,12 @@ public class BlockSmileyCloud extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.material.Material;
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -33,7 +33,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
//Copied from BlockTorch.
|
//Copied from BlockTorch.
|
||||||
//I have no idea what all of this means.
|
//I have no idea what all of this means.
|
||||||
|
@ -58,7 +58,7 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
switch (state.getValue(BlockTorch.FACING)) {
|
switch (state.getValue(BlockTorch.FACING)) {
|
||||||
case EAST:
|
case EAST:
|
||||||
return TORCH_EAST_AABB;
|
return TORCH_EAST_AABB;
|
||||||
|
@ -75,32 +75,32 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||||
return NULL_AABB;
|
return NULL_AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube(IBlockState state) {
|
public boolean isNormalCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return BlockFaceShape.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canPlaceOn(World worldIn, BlockPos pos) {
|
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);
|
return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (this.canPlaceAt(worldIn, pos, facing)) {
|
||||||
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
|
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,16 +133,16 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
public void onBlockAdded(World worldIn, BlockPos pos, BlockState state) {
|
||||||
this.checkForDrop(worldIn, pos, state);
|
this.checkForDrop(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
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)) {
|
if (!this.checkForDrop(worldIn, pos, state)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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))) {
|
if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -181,8 +181,8 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||||
if (rand.nextBoolean()) {
|
if (rand.nextBoolean()) {
|
||||||
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
|
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
|
||||||
double d0 = pos.getX() + 0.5D;
|
double d0 = pos.getX() + 0.5D;
|
||||||
|
@ -201,8 +201,8 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
IBlockState iblockstate = this.getDefaultState();
|
BlockState iblockstate = this.getDefaultState();
|
||||||
|
|
||||||
switch (meta) {
|
switch (meta) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -231,7 +231,7 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
switch (state.getValue(BlockTorch.FACING)) {
|
switch (state.getValue(BlockTorch.FACING)) {
|
||||||
|
@ -257,12 +257,12 @@ public class BlockTinyTorch extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
public BlockState withMirror(BlockState state, Mirror mirrorIn) {
|
||||||
return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
|
return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
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.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
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.Items;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.*;
|
||||||
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.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 {
|
public class BlockTreasureChest extends BlockBase {
|
||||||
|
|
||||||
|
@ -53,8 +47,8 @@ public class BlockTreasureChest extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
for (float f = 0; f <= 3; f += 0.5) {
|
for (float f = 0; f <= 3; f += 0.5) {
|
||||||
float particleX = rand.nextFloat();
|
float particleX = rand.nextFloat();
|
||||||
|
@ -65,12 +59,12 @@ public class BlockTreasureChest extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
public Item getItemDropped(BlockState state, Random rand, int par3) {
|
||||||
return Items.AIR;
|
return Items.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F);
|
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F);
|
||||||
this.dropItems(world, pos);
|
this.dropItems(world, pos);
|
||||||
|
@ -82,14 +76,14 @@ public class BlockTreasureChest extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +111,12 @@ public class BlockTreasureChest extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,12 +126,12 @@ public class BlockTreasureChest extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.BlockWall;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -26,7 +26,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BlockWallAA extends BlockBase {
|
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));
|
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;
|
int i = 0;
|
||||||
|
|
||||||
if (state.getValue(BlockWall.NORTH)) {
|
if (state.getValue(BlockWall.NORTH)) {
|
||||||
|
@ -65,7 +65,7 @@ public class BlockWallAA extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 flag = this.canConnectTo(worldIn, pos.north());
|
||||||
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
||||||
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
||||||
|
@ -75,7 +75,7 @@ public class BlockWallAA extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,48 +85,48 @@ public class BlockWallAA extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Deprecated
|
@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);
|
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
state = this.getActualState(state, source, pos);
|
||||||
return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
|
return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
blockState = this.getActualState(blockState, worldIn, pos);
|
||||||
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
|
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
list.add(new ItemStack(this, 1, 0));
|
list.add(new ItemStack(this, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
BlockState state = worldIn.getBlockState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD);
|
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState();
|
return this.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -45,15 +45,15 @@ public class BlockWildPlant extends BlockBushBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state) {
|
public boolean canBlockStay(World world, BlockPos pos, BlockState state) {
|
||||||
BlockPos offset = pos.down();
|
BlockPos offset = pos.down();
|
||||||
IBlockState offsetState = world.getBlockState(offset);
|
BlockState offsetState = world.getBlockState(offset);
|
||||||
Block offsetBlock = offsetState.getBlock();
|
Block offsetBlock = offsetState.getBlock();
|
||||||
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion();
|
||||||
return new ItemStack(normal.seedItem);
|
return new ItemStack(normal.seedItem);
|
||||||
}
|
}
|
||||||
|
@ -66,13 +66,13 @@ public class BlockWildPlant extends BlockBushBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
Block normal = state.getValue(TYPE).getNormalVersion();
|
||||||
normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune);
|
normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,12 +94,12 @@ public class BlockWildPlant extends BlockBushBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -47,7 +47,7 @@ public class BlockXPSolidifier extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.isRemote) {
|
||||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos);
|
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos);
|
||||||
if (solidifier != null) {
|
if (solidifier != null) {
|
||||||
|
@ -64,19 +64,19 @@ public class BlockXPSolidifier extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public BlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(BlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +86,12 @@ public class BlockXPSolidifier extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)));
|
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.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public interface IHudDisplay {
|
public interface IHudDisplay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,27 +11,16 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
public class BlockBase extends Block {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockBase(Material material, String name) {
|
public BlockBase(Properties properties, String name) {
|
||||||
super(material);
|
super(properties);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName() {
|
protected String getBaseName() {
|
||||||
|
@ -39,20 +28,10 @@ public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHa
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
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;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
import net.minecraft.block.BushBlock;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import net.minecraft.block.BlockBush;
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel {
|
public class BlockBushBase extends BushBlock {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockBushBase(String name) {
|
public BlockBushBase(Properties properties, String name) {
|
||||||
|
super(properties.sound(SoundType.PLANT));
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.setSoundType(SoundType.PLANT);
|
|
||||||
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName() {
|
protected String getBaseName() {
|
||||||
|
@ -38,20 +29,10 @@ public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRar
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
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;
|
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.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.ContainerBlock;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.fluid.FluidState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagInt;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.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.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
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;
|
private final String name;
|
||||||
|
|
||||||
public BlockContainerBase(Material material, String name) {
|
public BlockContainerBase(Properties properties, String name) {
|
||||||
super(material);
|
super(properties);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.register();
|
this.register();
|
||||||
|
@ -68,23 +60,13 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
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) {
|
private void dropInventory(World world, BlockPos position) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntity aTile = world.getTileEntity(position);
|
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) {
|
private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) {
|
||||||
ItemStack stack = tile.inv.getStackInSlot(i);
|
ItemStack stack = tile.inv.getStackInSlot(i);
|
||||||
if (StackUtil.isValid(stack)) {
|
if (stack.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = 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;
|
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());
|
ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
entityItem.motionX = world.rand.nextGaussian() * factor;
|
entityItem.addVelocity(world.rand.nextGaussian() * factor, world.rand.nextGaussian() * factor + 0.2F, world.rand.nextGaussian() * factor);
|
||||||
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
world.addEntity(entityItem);
|
||||||
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntity(entityItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player) {
|
public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) {
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
@ -132,7 +114,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityBase) {
|
if (tile instanceof TileEntityBase) {
|
||||||
|
@ -157,13 +139,13 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
this.neighborsChangedCustom(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
|
||||||
super.onNeighborChange(world, pos, neighbor);
|
super.onNeighborChange(state, world, pos, neighbor);
|
||||||
if (world instanceof World) {
|
if (world instanceof World) {
|
||||||
this.neighborsChangedCustom((World) world, pos);
|
this.neighborsChangedCustom((World) world, pos);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +160,8 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
boolean wasPowered = base.isRedstonePowered;
|
boolean wasPowered = base.isRedstonePowered;
|
||||||
if (powered && !wasPowered) {
|
if (powered && !wasPowered) {
|
||||||
if (base.respondsToPulses()) {
|
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);
|
base.setRedstonePowered(true);
|
||||||
} else if (!powered && wasPowered) {
|
} 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);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||||
this.updateRedstoneState(world, pos);
|
this.updateRedstoneState(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTag()) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityBase) {
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
CompoundNBT compound = stack.getOrCreateTag().getCompound("Data");
|
||||||
if (compound != null) {
|
|
||||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||||
if (!player.capabilities.isCreativeMode) {
|
if (!player.isCreative()) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
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
|
@Override
|
||||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
public boolean hasComparatorInputOverride(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); }
|
if (tile instanceof TileEntityBase) {
|
||||||
|
return ((TileEntityBase) tile).getComparatorStrength();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO: [port]: come back and fix this
|
||||||
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);
|
|
||||||
|
|
||||||
//Remove unnecessarily saved default values to avoid unstackability
|
// @Override
|
||||||
List<String> keysToRemove = new ArrayList<>();
|
// public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||||
for (String key : data.getKeySet()) {
|
// TileEntity tile = world.getTileEntity(pos);
|
||||||
NBTBase tag = data.getTag(key);
|
// if (tile instanceof TileEntityBase) {
|
||||||
//Remove only ints because they are the most common ones
|
// TileEntityBase base = (TileEntityBase) tile;
|
||||||
//Add else if below here to remove more types
|
// if (!base.stopFromDropping) {
|
||||||
if (tag instanceof NBTTagInt) {
|
// CompoundNBT data = new CompoundNBT();
|
||||||
if (((NBTTagInt) tag).getInt() == 0) {
|
// base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||||
keysToRemove.add(key);
|
//
|
||||||
}
|
// //Remove unnecessarily saved default values to avoid unstackability
|
||||||
}
|
// List<String> keysToRemove = new ArrayList<>();
|
||||||
}
|
// for (String key : data.getKeySet()) {
|
||||||
for (String key : keysToRemove) {
|
// NBTBase tag = data.getTag(key);
|
||||||
data.removeTag(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);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
drops.add(stack);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.getDrops(drops, world, pos, state, fortune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) {
|
||||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
|
return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO: [port]: eval
|
||||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
|
||||||
super.harvestBlock(worldIn, player, pos, state, te, stack);
|
// @Override
|
||||||
worldIn.setBlockToAir(pos);
|
// public EnumBlockRenderType getRenderType(BlockState state) {
|
||||||
}
|
// return EnumBlockRenderType.MODEL;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
return EnumBlockRenderType.MODEL;
|
if (state != newState) {
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
|
||||||
if (this.shouldDropInventory(world, pos)) {
|
if (this.shouldDropInventory(world, pos)) {
|
||||||
this.dropInventory(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) {
|
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 de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import net.minecraft.block.material.Material;
|
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.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -57,9 +55,4 @@ public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBas
|
||||||
public boolean displaceIfPossible(World world, BlockPos pos) {
|
public boolean displaceIfPossible(World world, BlockPos pos) {
|
||||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, 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.
|
* This file ("BlockPlant.java") is part of the Actually Additions mod for Minecraft.
|
||||||
* It is created and owned by Ellpeck and distributed
|
* It is created and owned by Ellpeck and distributed
|
||||||
* under the Actually Additions License to be found at
|
* under the Actually Additions License to be found at
|
||||||
* http://ellpeck.de/actaddlicense
|
* http://ellpeck.de/actaddlicense
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
*
|
*
|
||||||
* © 2015-2017 Ellpeck
|
* © 2015-2017 Ellpeck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.BlockCrops;
|
import net.minecraft.block.BlockCrops;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -31,6 +28,8 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.EnumPlantType;
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel {
|
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
@ -85,12 +84,14 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(BlockState state) {
|
||||||
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
return this.getMetaFromState(state) >= 7
|
||||||
|
? this.returnMeta
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
if (this.getMetaFromState(state) >= 7) {
|
if (this.getMetaFromState(state) >= 7) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
|
|
||||||
|
@ -122,8 +123,10 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(IBlockState state, int fortune, Random 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);
|
return this.getMetaFromState(state) >= 7
|
||||||
|
? random.nextInt(this.addDropAmount) + this.minDropAmount
|
||||||
|
: super.quantityDropped(state, fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -132,8 +135,10 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
public Item getItemDropped(BlockState state, Random rand, int par3) {
|
||||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
return this.getMetaFromState(state) >= 7
|
||||||
|
? this.getCrop()
|
||||||
|
: this.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,11 +11,10 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.ItemUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockStairs;
|
import net.minecraft.block.BlockStairs;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRari
|
||||||
this(block.getDefaultState(), name);
|
this(block.getDefaultState(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockStair(IBlockState state, String name) {
|
public BlockStair(BlockState state, String name) {
|
||||||
super(state);
|
super(state);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity(0);
|
||||||
|
|
|
@ -10,42 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public class ItemBlockBase extends ItemBlock {
|
|
||||||
|
|
||||||
public ItemBlockBase(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(false);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
|
|
||||||
|
public class ItemBlockBase extends BlockItem {
|
||||||
|
public ItemBlockBase(Block block, Item.Properties properties) {
|
||||||
|
super(block, properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,7 +45,9 @@ public enum TheColoredLampColors implements IStringSerializable {
|
||||||
for (int i = 0; i < values().length; i++) {
|
for (int i = 0; i < values().length; i++) {
|
||||||
String aName = values()[i].oreName;
|
String aName = values()[i].oreName;
|
||||||
if (aName != null) {
|
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
|
@Override
|
||||||
public String getName() {
|
public String getString() {
|
||||||
return this.regName;
|
return this.regName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,32 +10,32 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
|
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.Rarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheMiscBlocks implements IStringSerializable {
|
public enum TheMiscBlocks implements IStringSerializable {
|
||||||
|
|
||||||
QUARTZ_PILLAR("black_quartz_pillar", EnumRarity.RARE),
|
QUARTZ_PILLAR("black_quartz_pillar", Rarity.RARE),
|
||||||
QUARTZ_CHISELED("black_quartz_chiseled", EnumRarity.RARE),
|
QUARTZ_CHISELED("black_quartz_chiseled", Rarity.RARE),
|
||||||
QUARTZ("black_quartz", EnumRarity.RARE),
|
QUARTZ("black_quartz", Rarity.RARE),
|
||||||
ORE_QUARTZ("ore_black_quartz", EnumRarity.EPIC),
|
ORE_QUARTZ("ore_black_quartz", Rarity.EPIC),
|
||||||
WOOD_CASING("wood_casing", EnumRarity.COMMON),
|
WOOD_CASING("wood_casing", Rarity.COMMON),
|
||||||
CHARCOAL_BLOCK("charcoal", EnumRarity.COMMON),
|
CHARCOAL_BLOCK("charcoal", Rarity.COMMON),
|
||||||
ENDERPEARL_BLOCK("enderpearl", EnumRarity.RARE),
|
ENDERPEARL_BLOCK("enderpearl", Rarity.RARE),
|
||||||
LAVA_FACTORY_CASE("lava_factory_case", EnumRarity.UNCOMMON),
|
LAVA_FACTORY_CASE("lava_factory_case", Rarity.UNCOMMON),
|
||||||
ENDER_CASING("ender_casing", EnumRarity.EPIC),
|
ENDER_CASING("ender_casing", Rarity.EPIC),
|
||||||
IRON_CASING("iron_casing", EnumRarity.RARE);
|
IRON_CASING("iron_casing", Rarity.RARE);
|
||||||
|
|
||||||
public final String name;
|
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.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getString() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,35 +11,34 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.Rarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheWildPlants implements IStringSerializable {
|
public enum TheWildPlants implements IStringSerializable {
|
||||||
|
|
||||||
CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola),
|
CANOLA("canola", Rarity.RARE, InitBlocks.blockCanola),
|
||||||
FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax),
|
FLAX("flax", Rarity.RARE, InitBlocks.blockFlax),
|
||||||
RICE("rice", EnumRarity.RARE, InitBlocks.blockRice),
|
RICE("rice", Rarity.RARE, InitBlocks.blockRice),
|
||||||
COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee);
|
COFFEE("coffee", Rarity.RARE, InitBlocks.blockCoffee);
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
final EnumRarity rarity;
|
final Rarity rarity;
|
||||||
final Block normal;
|
final Block normal;
|
||||||
|
|
||||||
TheWildPlants(String name, EnumRarity rarity, Block normal) {
|
TheWildPlants(String name, Rarity rarity, Block normal) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!");
|
this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getString() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumRarity getRarity() {
|
public Rarity getRarity() {
|
||||||
return this.rarity;
|
return this.rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,63 +1,65 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
// TODO: [port] removed, not required?
|
||||||
|
//package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
import java.util.HashMap;
|
//
|
||||||
import java.util.List;
|
//import java.util.HashMap;
|
||||||
import java.util.Map;
|
//import java.util.List;
|
||||||
|
//import java.util.Map;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
//
|
||||||
|
//import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
//import org.apache.commons.lang3.tuple.Pair;
|
||||||
import net.minecraft.block.state.IBlockState;
|
//
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
//import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
//import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
//import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
//import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.util.EnumFacing;
|
//import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
//import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
//import net.minecraft.util.EnumFacing;
|
||||||
public class ActualCompostModel implements IBakedModel {
|
//import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
//
|
||||||
public static final Map<Pair<IBlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
//public class ActualCompostModel implements IBakedModel {
|
||||||
|
//
|
||||||
@SuppressWarnings("unchecked")
|
// public static final Map<Pair<BlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
||||||
@Override
|
//
|
||||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
// @SuppressWarnings("unchecked")
|
||||||
if (state instanceof IExtendedBlockState) {
|
// @Override
|
||||||
Pair<IBlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
|
// public List<BakedQuad> getQuads(BlockState state, EnumFacing side, long rand) {
|
||||||
if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
// if (state instanceof IExtendedBlockState) {
|
||||||
IBakedModel model = MODELS.get(data);
|
// Pair<BlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
|
||||||
if (model == null) {
|
// if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
||||||
model = new CompostModel(data.getLeft(), data.getRight());
|
// IBakedModel model = MODELS.get(data);
|
||||||
MODELS.put(data, model);
|
// if (model == null) {
|
||||||
}
|
// model = new CompostModel(data.getLeft(), data.getRight());
|
||||||
return model.getQuads(state, side, rand);
|
// MODELS.put(data, model);
|
||||||
}
|
// }
|
||||||
return CompostModel.compostBase.getQuads(state, side, rand);
|
// return model.getQuads(state, side, rand);
|
||||||
}
|
// }
|
||||||
|
// return CompostModel.compostBase.getQuads(state, side, rand);
|
||||||
@Override
|
// }
|
||||||
public boolean isAmbientOcclusion() {
|
//
|
||||||
return CompostModel.compostBase.isAmbientOcclusion();
|
// @Override
|
||||||
}
|
// public boolean isAmbientOcclusion() {
|
||||||
|
// return CompostModel.compostBase.isAmbientOcclusion();
|
||||||
@Override
|
// }
|
||||||
public boolean isGui3d() {
|
//
|
||||||
return false;
|
// @Override
|
||||||
}
|
// public boolean isGui3d() {
|
||||||
|
// return false;
|
||||||
@Override
|
// }
|
||||||
public boolean isBuiltInRenderer() {
|
//
|
||||||
return false;
|
// @Override
|
||||||
}
|
// public boolean isBuiltInRenderer() {
|
||||||
|
// return false;
|
||||||
@Override
|
// }
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
//
|
||||||
return CompostModel.compostBase.getParticleTexture();
|
// @Override
|
||||||
}
|
// public TextureAtlasSprite getParticleTexture() {
|
||||||
|
// return CompostModel.compostBase.getParticleTexture();
|
||||||
@Override
|
// }
|
||||||
public ItemOverrideList getOverrides() {
|
//
|
||||||
return ItemOverrideList.NONE;
|
// @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;
|
//package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
import java.util.List;
|
//
|
||||||
|
//import java.util.EnumMap;
|
||||||
import javax.annotation.Nullable;
|
//import java.util.List;
|
||||||
import javax.vecmath.Vector3f;
|
//
|
||||||
|
//import javax.annotation.Nullable;
|
||||||
import com.google.common.collect.ImmutableList;
|
//import javax.vecmath.Vector3f;
|
||||||
import com.google.common.collect.ImmutableMap;
|
//
|
||||||
import com.google.common.collect.Maps;
|
//import com.google.common.collect.ImmutableList;
|
||||||
|
//import com.google.common.collect.ImmutableMap;
|
||||||
import net.minecraft.block.state.IBlockState;
|
//import com.google.common.collect.Maps;
|
||||||
import net.minecraft.client.Minecraft;
|
//
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
//import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
//import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
//import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
//import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.util.EnumFacing;
|
//import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
//import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
//import net.minecraft.util.EnumFacing;
|
||||||
public class CompostModel implements IBakedModel {
|
//import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
public static IBakedModel compostBase;
|
//
|
||||||
private final IBakedModel display;
|
//public class CompostModel implements IBakedModel {
|
||||||
private final ImmutableList<BakedQuad> general;
|
// public static IBakedModel compostBase;
|
||||||
private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
|
// private final IBakedModel display;
|
||||||
|
// private final ImmutableList<BakedQuad> general;
|
||||||
public CompostModel(IBlockState flowerState, float height) {
|
// private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
|
||||||
this.display = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(flowerState);
|
//
|
||||||
|
// public CompostModel(BlockState flowerState, float height) {
|
||||||
TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
// this.display = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(flowerState);
|
||||||
|
//
|
||||||
ImmutableList.Builder<BakedQuad> builder;
|
// TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
||||||
EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
//
|
||||||
|
// ImmutableList.Builder<BakedQuad> builder;
|
||||||
for (EnumFacing face : EnumFacing.values()) {
|
// EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
||||||
builder = ImmutableList.builder();
|
//
|
||||||
if (!this.display.isBuiltInRenderer()) {
|
// for (EnumFacing face : EnumFacing.values()) {
|
||||||
for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
|
// builder = ImmutableList.builder();
|
||||||
Transformer transformer = new Transformer(transform, quad.getFormat());
|
// if (!this.display.isBuiltInRenderer()) {
|
||||||
quad.pipe(transformer);
|
// for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
|
||||||
builder.add(transformer.build());
|
// Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||||
}
|
// quad.pipe(transformer);
|
||||||
builder.addAll(compostBase.getQuads(null, face, 0));
|
// builder.add(transformer.build());
|
||||||
}
|
// }
|
||||||
faces.put(face, builder.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)) {
|
// if (!this.display.isBuiltInRenderer()) {
|
||||||
Transformer transformer = new Transformer(transform, quad.getFormat());
|
// builder = ImmutableList.builder();
|
||||||
quad.pipe(transformer);
|
// for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) {
|
||||||
builder.add(transformer.build());
|
// Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||||
}
|
// quad.pipe(transformer);
|
||||||
builder.addAll(compostBase.getQuads(null, null, 0));
|
// builder.add(transformer.build());
|
||||||
this.general = builder.build();
|
// }
|
||||||
} else this.general = ImmutableList.of();
|
// builder.addAll(compostBase.getQuads(null, null, 0));
|
||||||
|
// this.general = builder.build();
|
||||||
this.faces = Maps.immutableEnumMap(faces);
|
// } 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;
|
// @Override
|
||||||
return this.faces.get(side);
|
// 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 isAmbientOcclusion() {
|
||||||
|
// return compostBase.isAmbientOcclusion() && this.display.isAmbientOcclusion();
|
||||||
@Override
|
// }
|
||||||
public boolean isGui3d() {
|
//
|
||||||
return false;
|
// @Override
|
||||||
}
|
// public boolean isGui3d() {
|
||||||
|
// return false;
|
||||||
@Override
|
// }
|
||||||
public boolean isBuiltInRenderer() {
|
//
|
||||||
return false;
|
// @Override
|
||||||
}
|
// public boolean isBuiltInRenderer() {
|
||||||
|
// return false;
|
||||||
@Override
|
// }
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
//
|
||||||
return compostBase.getParticleTexture();
|
// @Override
|
||||||
}
|
// public TextureAtlasSprite getParticleTexture() {
|
||||||
|
// return compostBase.getParticleTexture();
|
||||||
@Override
|
// }
|
||||||
public ItemOverrideList getOverrides() {
|
//
|
||||||
return ItemOverrideList.NONE;
|
// @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;
|
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.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
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 de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
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.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
import java.text.NumberFormat;
|
||||||
public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatteryBox> {
|
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public class RenderBatteryBox extends TileEntityRenderer<TileEntityBatteryBox> {
|
||||||
|
public RenderBatteryBox(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: [port] migrate to matric (see cleanstart)
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f) {
|
public void render(TileEntityBatteryBox tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (!(tile instanceof TileEntityBatteryBox)) { return; }
|
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) {
|
if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) {
|
||||||
GlStateManager.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
RenderSystem.translatef(0.5F, 1F, 0.5F);
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
|
|
||||||
GlStateManager.scale(0.0075F, 0.0075F, 0.0075F);
|
RenderSystem.scalef(0.0075F, 0.0075F, 0.0075F);
|
||||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
RenderSystem.rotatef(180F, 1F, 0F, 0F);
|
||||||
GlStateManager.translate(0F, 0F, -50F);
|
RenderSystem.translatef(0F, 0F, -50F);
|
||||||
|
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
stack.getCapability(CapabilityEnergy.ENERGY).ifPresent(cap -> {
|
||||||
IEnergyStorage cap = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||||
|
|
||||||
String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored());
|
String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored());
|
||||||
float lengthS = -font.getStringWidth(s) / 2F;
|
float lengthS = -font.getStringWidth(s) / 2F;
|
||||||
|
@ -58,29 +62,31 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatter
|
||||||
float lengthS2 = -font.getStringWidth(s2) / 2F;
|
float lengthS2 = -font.getStringWidth(s2) / 2F;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
font.drawString(s, lengthS, 10F, 0xFFFFFF, false);
|
font.drawString(matrixStackIn, s, lengthS, 10F, 0xFFFFFF);
|
||||||
font.drawString(s2, lengthS2, 20F, 0xFFFFFF, false);
|
font.drawString(matrixStackIn, s2, lengthS2, 20F, 0xFFFFFF);
|
||||||
|
|
||||||
GlStateManager.translate(-50F, 0F, 50F);
|
RenderSystem.translatef(-50F, 0F, 50F);
|
||||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
RenderSystem.rotatef(90F, 0F, 1F, 0F);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime() / 800D;
|
double boop = Util.milliTime();
|
||||||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
RenderSystem.translated(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
RenderSystem.rotatef((float) (boop * 40D % 360), 0, 1, 0);
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof BlockItem
|
||||||
GlStateManager.scale(scale, scale, scale);
|
? 0.85F
|
||||||
|
: 0.65F;
|
||||||
|
RenderSystem.scalef(scale, scale, scale);
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
} catch (Exception e) {
|
} 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);
|
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.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand> {
|
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f) {
|
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);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(stack)) {
|
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.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
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);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
|
|
|
@ -23,15 +23,17 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer> {
|
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f) {
|
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);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(stack)) {
|
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.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
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);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
|
|
|
@ -24,20 +24,20 @@ import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
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.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay> {
|
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay> {
|
||||||
|
|
||||||
private static final float[] COLOR = new float[] { 1F, 0F, 0F };
|
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_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_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_INFRARED = new float[]{209F / 255F, 179F / 255F, 239F / 255F};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f) {
|
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;
|
TileEntityLaserRelay relay = tile;
|
||||||
boolean hasInvis = false;
|
boolean hasInvis = false;
|
||||||
|
|
||||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
||||||
|
|
||||||
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
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())) {
|
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName())) {
|
||||||
GlStateManager.pushMatrix();
|
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.translate((float) x + 0.5F, (float) y + yTrans, (float) z + 0.5F);
|
||||||
GlStateManager.scale(0.2F, 0.2F, 0.2F);
|
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;
|
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
||||||
|
|
||||||
if (hasGoggles || !hasInvis || !otherInvis) {
|
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.tile.TileEntityAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
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.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor> {
|
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f) {
|
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);
|
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.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
||||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
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);
|
int meta = state.getBlock().getMetaFromState(state);
|
||||||
if (meta == 0) {
|
if (meta == 0) {
|
||||||
GlStateManager.translate(0F, -0.5F, 0F);
|
GlStateManager.translate(0F, -0.5F, 0F);
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
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.tile.TileEntitySmileyCloud;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.block.BlockHorizontal;
|
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.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud> {
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,13 +42,14 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
||||||
if (theCloud.name != null && !theCloud.name.isEmpty()) {
|
if (theCloud.name != null && !theCloud.name.isEmpty()) {
|
||||||
boolean renderedEaster = false;
|
boolean renderedEaster = false;
|
||||||
|
|
||||||
easterEggs: for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
easterEggs:
|
||||||
|
for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
||||||
for (String triggerName : cloud.getTriggerNames()) {
|
for (String triggerName : cloud.getTriggerNames()) {
|
||||||
if (triggerName != null && theCloud.name != null) {
|
if (triggerName != null && theCloud.name != null) {
|
||||||
if (triggerName.equalsIgnoreCase(theCloud.name)) {
|
if (triggerName.equalsIgnoreCase(theCloud.name)) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
BlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
||||||
if (state.getBlock() == InitBlocks.blockSmileyCloud) {
|
if (state.getBlock() == InitBlocks.blockSmileyCloud) {
|
||||||
switch (state.getValue(BlockHorizontal.FACING)) {
|
switch (state.getValue(BlockHorizontal.FACING)) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
|
@ -80,7 +81,9 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
||||||
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
||||||
if (render != null) {
|
if (render != null) {
|
||||||
GlStateManager.pushMatrix();
|
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.rotate(180F, 1.0F, 0.0F, 1.0F);
|
||||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
||||||
render.render();
|
render.render();
|
||||||
|
@ -90,7 +93,7 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
||||||
}
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
if (theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI) {
|
if (theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI) {
|
||||||
if (mc.player.getDistanceSq(theCloud.getPos()) <= 36) {
|
if (mc.player.getDistanceSq(theCloud.getPos()) <= 36) {
|
||||||
AssetUtil.renderNameTag(theCloud.name, x + 0.5F, y + 1.5F, z + 0.5F);
|
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;
|
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.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
@ -29,10 +26,12 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class BookmarkButton extends GuiButton {
|
public class BookmarkButton extends GuiButton {
|
||||||
|
|
||||||
private final GuiBooklet booklet;
|
private final GuiBooklet booklet;
|
||||||
|
@ -49,7 +48,7 @@ public class BookmarkButton extends GuiButton {
|
||||||
this.assignedPage = null;
|
this.assignedPage = null;
|
||||||
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
||||||
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage);
|
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage);
|
||||||
Minecraft.getMinecraft().displayGuiScreen(gui);
|
Minecraft.getInstance().displayGuiScreen(gui);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.booklet instanceof GuiPage) {
|
if (this.booklet instanceof GuiPage) {
|
||||||
|
@ -73,7 +72,9 @@ public class BookmarkButton extends GuiButton {
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.blendFunc(770, 771);
|
GlStateManager.blendFunc(770, 771);
|
||||||
int renderHeight = 25;
|
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);
|
this.mouseDragged(minecraft, x, y);
|
||||||
|
|
||||||
if (this.assignedPage != null) {
|
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);
|
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.client.renderer.GlStateManager;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 {
|
public class EntryButton extends GuiButton {
|
||||||
|
|
||||||
private final GuiBookletBase gui;
|
private final GuiBookletBase gui;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class BookletChapter implements IBookletChapter {
|
public class BookletChapter implements IBookletChapter {
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ public class BookletChapter implements IBookletChapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getLocalizedName() {
|
public String getLocalizedName() {
|
||||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
|
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getLocalizedNameWithFormatting() {
|
public String getLocalizedNameWithFormatting() {
|
||||||
return this.color + this.getLocalizedName();
|
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.data.PlayerData;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BookletChapterTrials extends BookletChapter {
|
public class BookletChapterTrials extends BookletChapter {
|
||||||
|
|
||||||
|
@ -29,18 +28,20 @@ public class BookletChapterTrials extends BookletChapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getLocalizedName() {
|
public String getLocalizedName() {
|
||||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
|
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getLocalizedNameWithFormatting() {
|
public String getLocalizedNameWithFormatting() {
|
||||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||||
boolean completed = data.completedTrials.contains(this.getIdentifier());
|
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;
|
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.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BookletEntry implements IBookletEntry {
|
public class BookletEntry implements IBookletEntry {
|
||||||
|
|
||||||
|
@ -48,18 +47,22 @@ public class BookletEntry implements IBookletEntry {
|
||||||
this.color = TextFormatting.RESET;
|
this.color = TextFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private static boolean fitsFilter(IBookletPage page, String searchBarText) {
|
private static boolean fitsFilter(IBookletPage page, String searchBarText) {
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
||||||
List<ItemStack> items = new ArrayList<>();
|
List<ItemStack> items = new ArrayList<>();
|
||||||
page.getItemStacksForPage(items);
|
page.getItemStacksForPage(items);
|
||||||
if (!items.isEmpty()) {
|
if (!items.isEmpty()) {
|
||||||
for (ItemStack stack : items) {
|
for (ItemStack stack : items) {
|
||||||
if (StackUtil.isValid(stack)) {
|
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) {
|
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) {
|
for (FluidStack stack : fluids) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
String strg = stack.getLocalizedName();
|
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
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getLocalizedName() {
|
public String getLocalizedName() {
|
||||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
|
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getLocalizedNameWithFormatting() {
|
public String getLocalizedNameWithFormatting() {
|
||||||
return this.color + this.getLocalizedName();
|
return this.color + this.getLocalizedName();
|
||||||
}
|
}
|
||||||
|
@ -107,7 +112,7 @@ public class BookletEntry implements IBookletEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
|
public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
|
||||||
if (searchBarText != null && !searchBarText.isEmpty()) {
|
if (searchBarText != null && !searchBarText.isEmpty()) {
|
||||||
String search = searchBarText.toLowerCase(Locale.ROOT);
|
String search = searchBarText.toLowerCase(Locale.ROOT);
|
||||||
|
@ -138,7 +143,7 @@ public class BookletEntry implements IBookletEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public boolean visibleOnFrontPage() {
|
public boolean visibleOnFrontPage() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 abstract class GuiBooklet extends GuiBookletBase {
|
||||||
|
|
||||||
public static final int BUTTONS_PER_PAGE = 12;
|
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.client.gui.GuiScreen;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 {
|
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.
|
//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.math.MathHelper;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
//TODO Fix achievement button
|
//TODO Fix achievement button
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class GuiMainPage extends GuiBooklet {
|
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" };
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
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 class GuiPage extends GuiBooklet {
|
||||||
|
|
||||||
public final IBookletPage[] pages = new IBookletPage[2];
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public final class BookletUtils {
|
public final class BookletUtils {
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public final class BookletUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) {
|
public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) {
|
||||||
GuiMainPage mainPage = new GuiMainPage(previousScreen);
|
GuiMainPage mainPage = new GuiMainPage(previousScreen);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public final class BookletUtils {
|
||||||
return createPageGui(previousScreen, entry, page);
|
return createPageGui(previousScreen, entry, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static GuiPage createPageGui(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
|
public static GuiPage createPageGui(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
|
||||||
IBookletChapter chapter = page.getChapter();
|
IBookletChapter chapter = page.getChapter();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.client.gui.achievement.GuiAchievements;
|
||||||
import net.minecraft.stats.StatisticsManager;
|
import net.minecraft.stats.StatisticsManager;
|
||||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -27,7 +27,7 @@ import java.io.IOException;
|
||||||
/**
|
/**
|
||||||
* (Partially excerpted from Botania by Vazkii with permission, thanks!)
|
* (Partially excerpted from Botania by Vazkii with permission, thanks!)
|
||||||
*
|
*
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class GuiAAAchievements extends GuiAchievements{
|
public class GuiAAAchievements extends GuiAchievements{
|
||||||
|
|
||||||
public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){
|
public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue