mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-14 12:19:10 +01:00
commit
f858155a30
916 changed files with 16531 additions and 6198 deletions
36
build.gradle
36
build.gradle
|
@ -1,51 +1,48 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'maven'
|
||||
|
||||
version = "1.7.10-r20"
|
||||
version = "1.8.9-r23"
|
||||
group = "de.ellpeck.actuallyadditions"
|
||||
archivesBaseName = "ActuallyAdditions"
|
||||
|
||||
minecraft {
|
||||
version = "1.7.10-10.13.4.1558-1.7.10"
|
||||
version = "1.8.9-11.15.0.1697"
|
||||
runDir = "idea"
|
||||
|
||||
mappings = "stable_20"
|
||||
makeObfSourceJar = false
|
||||
useDepAts = true
|
||||
|
||||
replaceIn "ModUtil.java"
|
||||
replace "@VERSION@", project.version.toString()
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name "Mobius"
|
||||
url "http://mobiusstrip.eu/maven"
|
||||
url "http://chickenbones.net/maven/"
|
||||
}
|
||||
maven {
|
||||
name "ChickenBones"
|
||||
url "http://chickenbones.net/maven/"
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "mcp.mobius.waila:Waila:1.5.10_1.7.10"
|
||||
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev"
|
||||
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.46:dev"
|
||||
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.110:dev"
|
||||
compile "codechicken:CodeChickenLib:1.8-1.1.2.139:dev"
|
||||
compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev"
|
||||
compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev"
|
||||
|
||||
deobfCompile "mezz.jei:jei_1.8.9:2.18.1.88"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
@ -63,7 +60,6 @@ processResources {
|
|||
}
|
||||
}
|
||||
|
||||
// Why is OpenComputers one of the only mods that has a readable build.gradle? (Thank you Sangar!) :D
|
||||
jar {}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Tue Jul 14 22:09:25 CEST 2015
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
ellpeck=ActuallyAdditions:blockMiner@0
|
||||
#Because he's me
|
||||
ellpeck=ActuallyAdditions:itemBooklet@0
|
||||
#Because he submitted tons of ideas for the mod
|
||||
dqmhose=minecraft:torch@0
|
||||
#Because he does all of the textures
|
||||
twoofeight=ActuallyAdditions:blockHeatCollector@0
|
||||
larixine=ActuallyAdditions:blockBlackLotus@0
|
||||
#Because she is awesome and squids are cool
|
||||
larixine=ActuallyAdditions:blockBlackLotus@0
|
||||
#Because he helps me with models and stuff
|
||||
canitzp=ActuallyAdditions:blockCoffeeMachine@0
|
||||
#Because he's an awesome guy and helps with lots of stuff
|
||||
xdjackiexd=ActuallyAdditions:itemDrill@14
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||
|
@ -16,6 +16,6 @@ public interface IEnergyConnection {
|
|||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(ForgeDirection from);
|
||||
boolean canConnectEnergy(EnumFacing from);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
|
@ -26,7 +26,7 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
|||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
@Override
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||
|
@ -40,19 +40,19 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
|||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
@Override
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
@Override
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
int getEnergyStored(EnumFacing from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
@Override
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
int getMaxEnergyStored(EnumFacing from);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
|
@ -23,16 +23,16 @@ public interface IEnergyProvider extends IEnergyConnection {
|
|||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
int getEnergyStored(EnumFacing from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
int getMaxEnergyStored(EnumFacing from);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
|
@ -23,16 +23,16 @@ public interface IEnergyReceiver extends IEnergyConnection {
|
|||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
int getEnergyStored(EnumFacing from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
int getMaxEnergyStored(EnumFacing from);
|
||||
|
||||
}
|
||||
|
|
|
@ -63,15 +63,15 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
|||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
if (container.getTagCompound() == null) {
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energy = container.getTagCompound().getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
container.getTagCompound().setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
@ -79,15 +79,15 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
|||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energy = container.getTagCompound().getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
container.getTagCompound().setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
|||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
return container.getTagCompound().getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package cofh.api.energy;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
|
@ -30,34 +30,34 @@ public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
|||
|
||||
/* IEnergyConnection */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
public boolean canConnectEnergy(EnumFacing from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IEnergyReceiver */
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyProvider */
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyReceiver and IEnergyProvider */
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
public int getEnergyStored(EnumFacing from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
public int getMaxEnergyStored(EnumFacing from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
|
|
|
@ -5,5 +5,4 @@
|
|||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
||||
package cofh.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
|
@ -26,6 +26,10 @@ import java.util.List;
|
|||
|
||||
public class ActuallyAdditionsAPI{
|
||||
|
||||
public static final String MOD_ID = "ActuallyAdditions";
|
||||
public static final String API_ID = MOD_ID+"API";
|
||||
public static final String API_VERSION = "7";
|
||||
|
||||
public static List<CrusherRecipe> crusherRecipes = new ArrayList<CrusherRecipe>();
|
||||
public static List<BallOfFurReturn> ballOfFurReturnItems = new ArrayList<BallOfFurReturn>();
|
||||
public static List<TreasureChestLoot> treasureChestLoot = new ArrayList<TreasureChestLoot>();
|
||||
|
@ -69,7 +73,7 @@ public class ActuallyAdditionsAPI{
|
|||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||
*/
|
||||
public static void addCrusherRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){
|
||||
if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){
|
||||
if(!OreDictionary.getOres(input).isEmpty() && !OreDictionary.getOres(outputOne).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo).isEmpty())){
|
||||
crusherRecipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +111,7 @@ public class ActuallyAdditionsAPI{
|
|||
* @param outputOneAmount The amount of the first output
|
||||
*/
|
||||
public static void addCrusherRecipe(ItemStack input, String outputOne, int outputOneAmount){
|
||||
if(!OreDictionary.getOres(outputOne, false).isEmpty()){
|
||||
if(!OreDictionary.getOres(outputOne).isEmpty()){
|
||||
crusherRecipes.add(new CrusherRecipe(input, outputOne, outputOneAmount));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* This file ("Position.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This utility class describes a position in the world
|
||||
*/
|
||||
public class Position{
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
public Position(int x, int y, int z){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(World world){
|
||||
return world != null ? world.getTileEntity(this.x, this.y, this.z) : null;
|
||||
}
|
||||
|
||||
public Material getMaterial(World world){
|
||||
return world != null ? world.getBlock(this.x, this.y, this.z).getMaterial() : null;
|
||||
}
|
||||
|
||||
public Item getItemBlock(World world){
|
||||
return world != null ? Item.getItemFromBlock(this.getBlock(world)) : null;
|
||||
}
|
||||
|
||||
public Block getBlock(World world){
|
||||
return world != null ? world.getBlock(this.x, this.y, this.z) : null;
|
||||
}
|
||||
|
||||
public int getMetadata(World world){
|
||||
return world != null ? world.getBlockMetadata(this.x, this.y, this.z) : 0;
|
||||
}
|
||||
|
||||
public void setMetadata(World world, int meta, int flag){
|
||||
if(world != null){
|
||||
world.setBlockMetadataWithNotify(this.x, this.y, this.z, meta, flag);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEqual(Position pos){
|
||||
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ();
|
||||
}
|
||||
|
||||
public int getX(){
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY(){
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ(){
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public void setBlock(World world, Block block, int meta, int flag){
|
||||
if(world != null){
|
||||
world.setBlock(this.x, this.y, this.z, block, meta, flag);
|
||||
}
|
||||
}
|
||||
|
||||
public Position copy(){
|
||||
return new Position(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "["+this.x+", "+this.y+", "+this.z+"]";
|
||||
}
|
||||
|
||||
public Vec3 toVec(){
|
||||
return Vec3.createVectorHelper(this.x, this.y, this.z);
|
||||
}
|
||||
}
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BookletPage{
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public interface IAtomicReconstructor{
|
|||
/**
|
||||
* Returns the world of the reconstructor
|
||||
*/
|
||||
World getWorld();
|
||||
World getWorldObject();
|
||||
|
||||
/**
|
||||
* Extracts a specified amount of energy from the Reconstructor's RF storage
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* This is a helper interface for BookletPage
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
package de.ellpeck.actuallyadditions.api.lens;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
/**
|
||||
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
|
||||
|
@ -32,7 +32,7 @@ public abstract class Lens{
|
|||
* @param tile The tile the lens was invoked from
|
||||
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
|
||||
*/
|
||||
public abstract boolean invoke(Position hitBlock, IAtomicReconstructor tile);
|
||||
public abstract boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
/**
|
||||
* Returns the color in an array of 3 float values that are r, g, b
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
@API(owner = "ActuallyAdditions", apiVersion = "3", provides = "ActuallyAdditionsAPI")
|
||||
@API(owner = ActuallyAdditionsAPI.MOD_ID, apiVersion = ActuallyAdditionsAPI.API_VERSION, provides = ActuallyAdditionsAPI.API_ID)
|
||||
package de.ellpeck.actuallyadditions.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
import net.minecraftforge.fml.common.API;
|
|
@ -60,7 +60,7 @@ public class CrusherRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputOne, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputOne);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -84,7 +84,7 @@ public class CrusherRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputTwo, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputTwo);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -108,7 +108,7 @@ public class CrusherRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
|
|
@ -46,7 +46,7 @@ public class LensNoneRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.output, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.output);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -70,7 +70,7 @@ public class LensNoneRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.api.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
/**
|
||||
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector
|
||||
|
@ -30,12 +30,12 @@ public interface IPhantomTile{
|
|||
/**
|
||||
* @return The position this tile is bound to
|
||||
*/
|
||||
Position getBoundPosition();
|
||||
BlockPos getBoundPosition();
|
||||
|
||||
/**
|
||||
* Sets the bound position
|
||||
*/
|
||||
void setBoundPosition(Position pos);
|
||||
void setBoundPosition(BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return The ID of the GUI it opens, -1 if none
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
||||
|
@ -46,6 +41,11 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.*;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -133,10 +133,10 @@ public class ActuallyAdditions{
|
|||
|
||||
@EventHandler
|
||||
public void missingMapping(FMLMissingMappingsEvent event){
|
||||
for(FMLMissingMappingsEvent.MissingMapping mapping : event.get()){
|
||||
for(FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){
|
||||
//Ignore removal of foreign paxels
|
||||
if(mapping.name != null && mapping.name.toLowerCase(Locale.ROOT).startsWith(ModUtil.MOD_ID_LOWER+":")){
|
||||
if(mapping.name.contains("paxel") || mapping.name.contains("itemSpecial")){
|
||||
if(mapping.name.contains("paxel") || mapping.name.contains("itemSpecial") || mapping.name.contains("blockBookStand")){
|
||||
mapping.ignore();
|
||||
ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
|
||||
}
|
||||
|
|
|
@ -10,39 +10,36 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
public BlockAtomicReconstructor(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -52,42 +49,22 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side != meta && (side == 0 || side == 1)){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 0 || side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,12 +73,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(x, y, z);
|
||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(pos);
|
||||
if(reconstructor != null){
|
||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||
if(heldItem != null){
|
||||
|
@ -123,29 +100,21 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i){
|
||||
return new TileEntityAtomicReconstructor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
||||
if(tile instanceof TileEntityAtomicReconstructor){
|
||||
ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
|
||||
String strg;
|
||||
|
@ -157,7 +126,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
|
||||
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
|
||||
}
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,12 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockBlackLotus extends BlockBushBase{
|
||||
|
||||
|
@ -23,15 +18,4 @@ public class BlockBlackLotus extends BlockBushBase{
|
|||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
* This file ("BlockBookletStand.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBookletStand extends BlockContainerBase implements IHudDisplay{
|
||||
|
||||
public BlockBookletStand(String name){
|
||||
super(Material.wood, name);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(4.0F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
|
||||
float f = 1/16F;
|
||||
this.setBlockBounds(f, 0F, f, 1F-f, 1F-4*f, 1F-f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.bookletStandRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK_STAND.ordinal(), world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
|
||||
TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(x, y, z);
|
||||
if(tile != null){
|
||||
//Assign a UUID
|
||||
if(tile.assignedPlayer == null){
|
||||
tile.assignedPlayer = player.getCommandSenderName();
|
||||
tile.markDirty();
|
||||
tile.sendUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i){
|
||||
return new TileEntityBookletStand();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
if(tile instanceof TileEntityBookletStand){
|
||||
EntrySet set = ((TileEntityBookletStand)tile).assignedEntry;
|
||||
|
||||
String strg1;
|
||||
String strg2;
|
||||
if(set.entry == null){
|
||||
strg1 = "No entry saved! Save one if";
|
||||
strg2 = "you are the player who placed it!";
|
||||
}
|
||||
else if(set.chapter == null){
|
||||
strg1 = set.entry.getLocalizedName();
|
||||
strg2 = "Page "+set.pageInIndex;
|
||||
}
|
||||
else{
|
||||
strg1 = set.chapter.getLocalizedName();
|
||||
strg2 = "Page "+set.page.getID();
|
||||
|
||||
AssetUtil.renderStackToGui(set.chapter.getDisplayItemStack() != null ? set.chapter.getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+10, 1F);
|
||||
}
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg1, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+8, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg2, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+18, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,34 +10,29 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBreaker extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
private boolean isPlacer;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
public BlockBreaker(boolean isPlacer, String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -48,75 +43,47 @@ public class BlockBreaker extends BlockContainerBase{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side != meta && (side == 0 || side == 1)){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 0 || side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(x, y, z);
|
||||
TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(pos);
|
||||
if(breaker != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BREAKER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,28 +10,22 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCanolaPress extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockCanolaPress(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -46,38 +40,25 @@ public class BlockCanolaPress extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 1 || side == 0 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(x, y, z);
|
||||
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos);
|
||||
if(press != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,32 +10,32 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCoalGenerator extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
|
||||
|
||||
public BlockCoalGenerator(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -46,6 +46,11 @@ public class BlockCoalGenerator extends BlockContainerBase{
|
|||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityCoalGenerator();
|
||||
|
@ -53,50 +58,36 @@ public class BlockCoalGenerator extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? (side == 0 ? this.bottomIcon : this.topIcon) : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
|
||||
if(meta == 1){
|
||||
for(int i = 0; i < 5; i++){
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(x, y, z);
|
||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(pos);
|
||||
if(press != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,28 +10,28 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCoffeeMachine extends BlockContainerBase{
|
||||
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
|
||||
|
||||
public BlockCoffeeMachine(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -39,24 +39,14 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
|||
this.setResistance(10.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
|
||||
float f = 1/16F;
|
||||
this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f);
|
||||
//TODO Fix bounding box
|
||||
//float f = 1/16F;
|
||||
//this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.coffeeMachineRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,56 +55,50 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
|
||||
if(!world.isRemote){
|
||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(x, y, z);
|
||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos);
|
||||
if(machine != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.coal_block.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta){
|
||||
return new TileEntityCoffeeMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
PosUtil.setMetadata(pos, world, 0, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
PosUtil.setMetadata(pos, world, 3, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
PosUtil.setMetadata(pos, world, 1, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
PosUtil.setMetadata(pos, world, 2, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,24 +10,30 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -36,9 +42,8 @@ import java.util.Random;
|
|||
public class BlockColoredLamp extends BlockBase{
|
||||
|
||||
public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values();
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, allLampTypes.length-1);
|
||||
public boolean isOn;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockColoredLamp(boolean isOn, String name){
|
||||
super(Material.redstoneLight, name);
|
||||
|
@ -49,46 +54,48 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return meta >= allLampTypes.length ? null : textures[meta];
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3){
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){
|
||||
//Turning On
|
||||
if(player.isSneaking()){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, world.getBlockMetadata(x, y, z), 2);
|
||||
PosUtil.setBlock(pos, world, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, PosUtil.getMetadata(pos, world), 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Changing Colors
|
||||
int[] oreIDs = OreDictionary.getOreIDs(player.getCurrentEquippedItem());
|
||||
if(oreIDs.length > 0){
|
||||
for(int oreID : oreIDs){
|
||||
String name = OreDictionary.getOreName(oreID);
|
||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||
if(color != null){
|
||||
if(world.getBlockMetadata(x, y, z) != color.ordinal()){
|
||||
if(!world.isRemote){
|
||||
world.setBlockMetadataWithNotify(x, y, z, color.ordinal(), 2);
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null){
|
||||
//Changing Colors
|
||||
int[] oreIDs = OreDictionary.getOreIDs(stack);
|
||||
if(oreIDs.length > 0){
|
||||
for(int oreID : oreIDs){
|
||||
String name = OreDictionary.getOreName(oreID);
|
||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||
if(color != null){
|
||||
if(PosUtil.getMetadata(pos, world) != color.ordinal()){
|
||||
if(!world.isRemote){
|
||||
PosUtil.setMetadata(pos, world, color.ordinal(), 2);
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,13 +105,13 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int meta){
|
||||
return new ItemStack(InitBlocks.blockColoredLamp, 1, meta);
|
||||
public ItemStack createStackedBlock(IBlockState state){
|
||||
return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z){
|
||||
public Item getItem(World world, BlockPos pos){
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
|
@ -117,16 +124,7 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[allLampTypes.length];
|
||||
for(int i = 0; i < allLampTypes.length; i++){
|
||||
this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allLampTypes[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos){
|
||||
return this.isOn ? 15 : 0;
|
||||
}
|
||||
|
||||
|
@ -137,9 +135,21 @@ public class BlockColoredLamp extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering(){
|
||||
ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length];
|
||||
for(int i = 0; i < allLampTypes.length; i++){
|
||||
String name = this.getBaseName()+allLampTypes[i].name;
|
||||
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
|
||||
}
|
||||
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
|
||||
}
|
||||
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
|
@ -153,7 +163,7 @@ public class BlockColoredLamp extends BlockBase{
|
|||
if(stack.getItemDamage() >= allLampTypes.length){
|
||||
return null;
|
||||
}
|
||||
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.field_150939_a).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : "");
|
||||
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemFertilizer;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemMisc;
|
||||
|
@ -20,23 +17,20 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -53,34 +47,18 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.compostRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list, Entity collidingEntity){
|
||||
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
|
||||
float f = 0.125F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
|
||||
this.setBlockBounds(1.0F-f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F-f, 1.0F, 1.0F, 1.0F);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
|
||||
this.setBlockBoundsForItemRender();
|
||||
}
|
||||
|
||||
|
@ -90,10 +68,10 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
|
||||
if(!world.isRemote){
|
||||
ItemStack stackPlayer = player.getCurrentEquippedItem();
|
||||
TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(x, y, z);
|
||||
TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos);
|
||||
//Add items to be composted
|
||||
if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){
|
||||
if(tile.slots[0] == null){
|
||||
|
@ -129,32 +107,26 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
|||
this.setBlockBounds(f, 0.0F, f, 1.0F-f, 1.0F, 1.0F-f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta){
|
||||
return new TileEntityCompost();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
||||
if(tile instanceof TileEntityCompost){
|
||||
ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0);
|
||||
String strg;
|
||||
|
@ -166,7 +138,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
|||
|
||||
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
|
||||
}
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||
|
@ -19,19 +18,22 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCrystal extends BlockBase{
|
||||
|
||||
public static final TheCrystals[] allCrystals = TheCrystals.values();
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, allCrystals.length-1);
|
||||
|
||||
public BlockCrystal(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -41,26 +43,13 @@ public class BlockCrystal extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta){
|
||||
return meta >= allCrystals.length ? super.getRenderColor(meta) : allCrystals[meta].color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z){
|
||||
return this.getRenderColor(world.getBlockMetadata(x, y, z));
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -71,12 +60,6 @@ public class BlockCrystal extends BlockBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
|
@ -84,7 +67,18 @@ public class BlockCrystal extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allCrystals.length ? EnumRarity.common : allCrystals[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allCrystals.length ? EnumRarity.COMMON : allCrystals[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering(){
|
||||
ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length];
|
||||
for(int i = 0; i < allCrystals.length; i++){
|
||||
String name = this.getBaseName()+allCrystals[i].name;
|
||||
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
|
||||
}
|
||||
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -10,32 +10,28 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDirectionalBreaker extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
public BlockDirectionalBreaker(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -45,75 +41,47 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityDirectionalBreaker();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side != meta && (side == 0 || side == 1)){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 0 || side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker)world.getTileEntity(x, y, z);
|
||||
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker)world.getTileEntity(pos);
|
||||
if(breaker != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DIRECTIONAL_BREAKER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DIRECTIONAL_BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,32 +10,27 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDropper extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
public BlockDropper(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -44,6 +39,10 @@ public class BlockDropper extends BlockContainerBase{
|
|||
this.setResistance(10.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
|
@ -51,69 +50,36 @@ public class BlockDropper extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side != meta && (side == 0 || side == 1)){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 0 || side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(x, y, z);
|
||||
TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(pos);
|
||||
if(dropper != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DROPPER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DROPPER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,30 +10,23 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockEnergizer extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon;
|
||||
private boolean isEnergizer;
|
||||
|
||||
public BlockEnergizer(boolean isEnergizer, String name){
|
||||
|
@ -51,24 +44,18 @@ public class BlockEnergizer extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 1 ? this.topIcon : (side == 0 ? this.blockIcon : this.sideIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
if(this.isEnergizer){
|
||||
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(x, y, z);
|
||||
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(pos);
|
||||
if(energizer != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
else{
|
||||
TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(x, y, z);
|
||||
TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(pos);
|
||||
if(energizer != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -76,22 +63,14 @@ public class BlockEnergizer extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.sideIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Side");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,28 +10,22 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFeeder extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockFeeder(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -46,38 +40,25 @@ public class BlockFeeder extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(x, y, z);
|
||||
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos);
|
||||
if(feeder != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FEEDER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,28 +10,22 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFermentingBarrel extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
public BlockFermentingBarrel(String name){
|
||||
super(Material.wood, name);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
|
@ -46,38 +40,25 @@ public class BlockFermentingBarrel extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return side <= 1 ? this.iconTop : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(x, y, z);
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos);
|
||||
if(press != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.iconTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,21 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFireworkBox extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockFireworkBox(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -44,31 +39,18 @@ public class BlockFireworkBox extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 1 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
return this.tryToggleRedstone(world, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
return this.tryToggleRedstone(world, pos, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,12 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFishingNet extends BlockContainerBase{
|
||||
|
@ -40,35 +34,13 @@ public class BlockFishingNet extends BlockContainerBase{
|
|||
return new TileEntityFishingNet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.fishingNetRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,32 +10,28 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFluidCollector extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
private boolean isPlacer;
|
||||
|
||||
|
@ -48,75 +44,47 @@ public class BlockFluidCollector extends BlockContainerBase{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side != meta && (side == 0 || side == 1)){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 0 || side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(x, y, z);
|
||||
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(pos);
|
||||
if(collector != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,37 +10,34 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFurnaceDouble extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon onIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 7);
|
||||
|
||||
public BlockFurnaceDouble(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -51,6 +48,11 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
|||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityFurnaceDouble();
|
||||
|
@ -58,73 +60,45 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta+2 && meta <= 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
else if(side == meta-2 && meta > 3){
|
||||
return this.onIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
|
||||
if(meta > 3){
|
||||
float f = (float)x+0.5F;
|
||||
float f1 = (float)y+0.0F+rand.nextFloat()*6.0F/16.0F;
|
||||
float f2 = (float)z+0.5F;
|
||||
float f = (float)pos.getX()+0.5F;
|
||||
float f1 = (float)pos.getY()+0.0F+rand.nextFloat()*6.0F/16.0F;
|
||||
float f2 = (float)pos.getZ()+0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = rand.nextFloat()*0.6F-0.3F;
|
||||
|
||||
if(meta == 6){
|
||||
world.spawnParticle("smoke", (double)(f-f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)(f-f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)(f-f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, (double)(f-f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if(meta == 7){
|
||||
world.spawnParticle("smoke", (double)(f+f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)(f+f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)(f+f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, (double)(f+f3), (double)f1, (double)(f2+f4), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if(meta == 4){
|
||||
world.spawnParticle("smoke", (double)(f+f4), (double)f1, (double)(f2-f3), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)(f+f4), (double)f1, (double)(f2-f3), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)(f+f4), (double)f1, (double)(f2-f3), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, (double)(f+f4), (double)f1, (double)(f2-f3), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if(meta == 5){
|
||||
world.spawnParticle("smoke", (double)(f+f4), (double)f1, (double)(f2+f3), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)(f+f4), (double)f1, (double)(f2+f3), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)(f+f4), (double)f1, (double)(f2+f3), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, (double)(f+f4), (double)f1, (double)(f2+f3), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 5; i++){
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(x, y, z);
|
||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(pos);
|
||||
if(furnace != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -132,47 +106,38 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"On");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0;
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos){
|
||||
return PosUtil.getMetadata(pos, world) > 3 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
PosUtil.setMetadata(pos, world, 0, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
PosUtil.setMetadata(pos, world, 3, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
PosUtil.setMetadata(pos, world, 1, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
PosUtil.setMetadata(pos, world, 2, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,12 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFurnaceSolar extends BlockContainerBase{
|
||||
|
@ -32,7 +26,7 @@ public class BlockFurnaceSolar extends BlockContainerBase{
|
|||
this.setHardness(1.5F);
|
||||
this.setResistance(10.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F);
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,35 +34,13 @@ public class BlockFurnaceSolar extends BlockContainerBase{
|
|||
return new TileEntityFurnaceSolar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.furnaceSolarRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.daylight_detector.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,15 +10,10 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockGeneric extends BlockBase{
|
||||
|
||||
|
@ -30,20 +25,8 @@ public class BlockGeneric extends BlockBase{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,14 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
@ -29,18 +25,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockGiantChest extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockGiantChest(String name){
|
||||
super(Material.wood, name);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
|
@ -55,40 +48,26 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return side == 1 ? this.topIcon : (side == 0 ? this.bottomIcon : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(x, y, z);
|
||||
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos);
|
||||
if(chest != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
|
@ -99,14 +78,14 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, pos, state, fortune);
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
int place = ItemUtil.getPlaceAt(slots, new ItemStack(InitItems.itemCrateKeeper), false);
|
||||
|
@ -137,14 +116,14 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
if(!ItemUtil.contains(((TileEntityGiantChest)tile).slots, new ItemStack(InitItems.itemCrateKeeper), false)){
|
||||
this.dropInventory(world, x, y, z);
|
||||
this.dropInventory(world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGreenhouseGlass;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockGreenhouseGlass extends BlockContainerBase{
|
||||
|
||||
|
@ -36,43 +37,24 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumWorldBlockLayer getBlockLayer(){
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta){
|
||||
return world.getBlockMetadata(x, y, z) != world.getBlockMetadata(x-Facing.offsetsXForSide[meta], y-Facing.offsetsYForSide[meta], z-Facing.offsetsZForSide[meta]) || (world.getBlock(x, y, z) != this && super.shouldSideBeRendered(world, x, y, z, meta));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,4 +62,12 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
|
|||
return new TileEntityGreenhouseGlass();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,36 +10,33 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGrinder extends BlockContainerBase{
|
||||
|
||||
private final boolean isDouble;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon onIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
|
||||
|
||||
public BlockGrinder(boolean isDouble, String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -51,6 +48,11 @@ public class BlockGrinder extends BlockContainerBase{
|
|||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder();
|
||||
|
@ -58,40 +60,25 @@ public class BlockGrinder extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1 && meta != 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 1){
|
||||
return this.onIcon;
|
||||
}
|
||||
if(side == 0){
|
||||
return this.bottomIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
|
||||
if(meta == 1){
|
||||
for(int i = 0; i < 5; i++){
|
||||
double xRand = rand.nextDouble()/0.75D-0.5D;
|
||||
double zRand = rand.nextDouble()/0.75D-0.5D;
|
||||
world.spawnParticle("crit", (double)x+0.4F, (double)y+0.8F, (double)z+0.4F, xRand, 0.5D, zRand);
|
||||
world.spawnParticle(EnumParticleTypes.CRIT, (double)pos.getX()+0.4F, (double)pos.getY()+0.8F, (double)pos.getZ()+0.4F, xRand, 0.5D, zRand);
|
||||
}
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
|
||||
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(pos);
|
||||
if(grinder != null){
|
||||
player.openGui(ActuallyAdditions.instance, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -99,27 +86,18 @@ public class BlockGrinder extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockGrinderTop");
|
||||
this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockGrinderOn");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockGrinderBottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0;
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos){
|
||||
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,16 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHeatCollector extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockHeatCollector(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -43,22 +33,8 @@ public class BlockHeatCollector extends BlockContainerBase{
|
|||
return new TileEntityHeatCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return side == 1 ? this.topIcon : (side == 0 ? this.bottomIcon : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Side");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
|
@ -23,12 +22,13 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockInputter extends BlockContainerBase{
|
||||
|
@ -53,17 +53,11 @@ public class BlockInputter extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z);
|
||||
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(pos);
|
||||
if(inputter != null){
|
||||
player.openGui(ActuallyAdditions.instance, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -71,21 +65,15 @@ public class BlockInputter extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
if(!world.isRemote){
|
||||
TileEntity aTile = world.getTileEntity(x, y, z);
|
||||
TileEntity aTile = world.getTileEntity(pos);
|
||||
if(aTile instanceof TileEntityInventoryBase){
|
||||
TileEntityInventoryBase tile = (TileEntityInventoryBase)aTile;
|
||||
this.dropSlotFromInventory(0, tile, world, x, y, z);
|
||||
this.dropSlotFromInventory(0, tile, world, pos);
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,7 +83,7 @@ public class BlockInputter extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -10,31 +10,25 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockItemRepairer extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockItemRepairer(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -50,23 +44,11 @@ public class BlockItemRepairer extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 0){
|
||||
return this.bottomIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(x, y, z);
|
||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos);
|
||||
if(repairer != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -74,26 +56,18 @@ public class BlockItemRepairer extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0;
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos){
|
||||
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,28 +10,24 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockLampPowerer extends BlockBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
public BlockLampPowerer(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -42,59 +38,40 @@ public class BlockLampPowerer extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
|
||||
this.updateLamp(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
|
||||
this.updateLamp(world, x, y, z);
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
|
||||
this.updateLamp(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z){
|
||||
this.updateLamp(world, x, y, z);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
private void updateLamp(World world, int x, int y, int z){
|
||||
private void updateLamp(World world, BlockPos pos){
|
||||
if(!world.isRemote){
|
||||
Position coords = WorldUtil.getCoordsFromSide(ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)), x, y, z, 0);
|
||||
if(coords != null && coords.getBlock(world) instanceof BlockColoredLamp){
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)){
|
||||
if(!((BlockColoredLamp)coords.getBlock(world)).isOn){
|
||||
world.setBlock(coords.getX(), coords.getY(), coords.getZ(), InitBlocks.blockColoredLampOn, world.getBlockMetadata(coords.getX(), coords.getY(), coords.getZ()), 2);
|
||||
BlockPos coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(pos, world)), pos, 0);
|
||||
if(coords != null && PosUtil.getBlock(coords, world) instanceof BlockColoredLamp){
|
||||
if(world.isBlockIndirectlyGettingPowered(pos) > 0){
|
||||
if(!((BlockColoredLamp)PosUtil.getBlock(coords, world)).isOn){
|
||||
PosUtil.setBlock(coords, world, InitBlocks.blockColoredLampOn, PosUtil.getMetadata(coords, world), 2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(((BlockColoredLamp)coords.getBlock(world)).isOn){
|
||||
world.setBlock(coords.getX(), coords.getY(), coords.getZ(), InitBlocks.blockColoredLamp, world.getBlockMetadata(coords.getX(), coords.getY(), coords.getZ()), 2);
|
||||
if(((BlockColoredLamp)PosUtil.getBlock(coords, world)).isOn){
|
||||
PosUtil.setBlock(coords, world, InitBlocks.blockColoredLamp, PosUtil.getMetadata(coords, world), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +80,6 @@ public class BlockLampPowerer extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,20 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -31,6 +31,8 @@ import java.util.List;
|
|||
|
||||
public class BlockLaserRelay extends BlockContainerBase{
|
||||
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||
|
||||
public BlockLaserRelay(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -40,25 +42,14 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axis, list, entity);
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.laserRelayRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,13 +58,13 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata){
|
||||
return side;
|
||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
|
||||
return this.getStateFromMeta(side.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
|
||||
float pixel = 1F/16F;
|
||||
if(meta == 0){
|
||||
|
@ -96,15 +87,9 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.stone.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
|
@ -20,21 +17,18 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockLavaFactoryController(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -48,35 +42,22 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
|
|||
return new TileEntityLavaFactoryController();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 1 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
||||
if(factory != null){
|
||||
int state = factory.isMultiblock();
|
||||
if(state == TileEntityLavaFactoryController.NOT_MULTI){
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
else if(state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA){
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,27 +10,18 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockLeafGenerator extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockLeafGenerator(String name){
|
||||
super(Material.iron, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -44,28 +35,14 @@ public class BlockLeafGenerator extends BlockContainerBase{
|
|||
return new TileEntityLeafGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? (side == 0 ? this.bottomIcon : this.topIcon) : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,36 +10,30 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockMiner(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -48,39 +42,25 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 0 ? this.frontIcon : (side == 1 ? this.topIcon : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityMiner){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.MINER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.MINER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,18 +69,18 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
||||
if(tile instanceof TileEntityMiner){
|
||||
String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+".";
|
||||
minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(info, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,35 +10,30 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMisc extends BlockBase{
|
||||
|
||||
public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] textures;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon ironCasingSeasonalTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon ironCasingSeasonal;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, allMiscBlocks.length-1);
|
||||
|
||||
public BlockMisc(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -48,19 +43,24 @@ public class BlockMisc extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
if(ClientProxy.jingleAllTheWay && side != 0){
|
||||
if(metadata == TheMiscBlocks.IRON_CASING.ordinal()){
|
||||
return side == 1 ? this.ironCasingSeasonalTop : this.ironCasingSeasonal;
|
||||
}
|
||||
}
|
||||
return metadata >= textures.length ? null : textures[metadata];
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering(){
|
||||
ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length];
|
||||
for(int i = 0; i < allMiscBlocks.length; i++){
|
||||
String name = this.getBaseName()+allMiscBlocks[i].name;
|
||||
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
|
||||
}
|
||||
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -71,18 +71,6 @@ public class BlockMisc extends BlockBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[allMiscBlocks.length];
|
||||
for(int i = 0; i < textures.length; i++){
|
||||
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allMiscBlocks[i].name);
|
||||
}
|
||||
|
||||
this.ironCasingSeasonalTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockMiscIronCasingSnowTop");
|
||||
this.ironCasingSeasonal = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockMiscIronCasingSnow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
|
@ -90,7 +78,7 @@ public class BlockMisc extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -10,32 +10,32 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockOilGenerator extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
|
||||
|
||||
public BlockOilGenerator(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -46,6 +46,11 @@ public class BlockOilGenerator extends BlockContainerBase{
|
|||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityOilGenerator();
|
||||
|
@ -53,50 +58,34 @@ public class BlockOilGenerator extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? (side == 0 ? this.bottomIcon : this.topIcon) : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta == 1){
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
if(PosUtil.getMetadata(pos, world) == 1){
|
||||
for(int i = 0; i < 5; i++){
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(x, y, z);
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
|
||||
if(generator != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,41 +10,33 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
||||
|
||||
public Type type;
|
||||
public int range;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSeasonal;
|
||||
|
||||
public BlockPhantom(Type type, String name){
|
||||
super(Material.rock, name);
|
||||
this.type = type;
|
||||
|
@ -62,11 +54,11 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
if(this.type == Type.PLACER || this.type == Type.BREAKER){
|
||||
this.dropInventory(world, x, y, z);
|
||||
this.dropInventory(world, pos);
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,61 +78,47 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return (this.type == Type.FACE && ClientProxy.pumpkinBlurPumpkinBlur && side > 1) ? this.iconSeasonal : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IPhantomTile && ((IPhantomTile)tile).getGuiID() != -1){
|
||||
player.openGui(ActuallyAdditions.instance, ((IPhantomTile)tile).getGuiID(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, ((IPhantomTile)tile).getGuiID(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
|
||||
this.iconSeasonal = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockPhantomfacePumpkin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
||||
if(tile != null){
|
||||
if(tile instanceof IPhantomTile){
|
||||
IPhantomTile phantom = (IPhantomTile)tile;
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
if(phantom.hasBoundPosition()){
|
||||
int distance = (int)Vec3.createVectorHelper(posHit.blockX, posHit.blockY, posHit.blockZ).distanceTo(Vec3.createVectorHelper(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()));
|
||||
Item item = phantom.getBoundPosition().getItemBlock(minecraft.theWorld);
|
||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(phantom.getBoundPosition().getBlock(minecraft.theWorld), 1, phantom.getBoundPosition().getMetadata(minecraft.theWorld)));
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".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);
|
||||
int distance = (int)new Vec3(posHit.getBlockPos()).distanceTo(new Vec3(phantom.getBoundPosition()));
|
||||
Item item = PosUtil.getItemBlock(phantom.getBoundPosition(), minecraft.theWorld);
|
||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(PosUtil.getBlock(phantom.getBoundPosition(), minecraft.theWorld), 1, PosUtil.getMetadata(phantom.getBoundPosition(), minecraft.theWorld)));
|
||||
StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".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()){
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
else{
|
||||
StringUtil.drawSplitString(minecraft.fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||
}
|
||||
}
|
||||
else{
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,12 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockPhantomBooster extends BlockContainerBase{
|
||||
|
@ -37,36 +31,14 @@ public class BlockPhantomBooster extends BlockContainerBase{
|
|||
this.setBlockBounds(3*f, 0F, 3*f, 1-3*f, 1F, 1-3*f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.phantomBoosterRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.lapis_block.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,21 +10,18 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockRangedCollector extends BlockContainerBase{
|
||||
|
@ -43,45 +40,33 @@ public class BlockRangedCollector extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(x, y, z);
|
||||
TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos);
|
||||
if(breaker != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.RANGED_COLLECTOR.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.RANGED_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
if(!world.isRemote){
|
||||
TileEntity aTile = world.getTileEntity(x, y, z);
|
||||
TileEntity aTile = world.getTileEntity(pos);
|
||||
if(aTile instanceof TileEntityRangedCollector){
|
||||
TileEntityRangedCollector tile = (TileEntityRangedCollector)aTile;
|
||||
for(int i = 0; i < TileEntityRangedCollector.WHITELIST_START; i++){
|
||||
this.dropSlotFromInventory(i, tile, world, x, y, z);
|
||||
this.dropSlotFromInventory(i, tile, world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,20 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -36,6 +38,8 @@ public class BlockSlabs extends BlockBase{
|
|||
this(name, fullBlock, 0);
|
||||
}
|
||||
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
|
||||
|
||||
public BlockSlabs(String name, Block fullBlock, int meta){
|
||||
super(fullBlock.getMaterial(), name);
|
||||
this.setHardness(1.5F);
|
||||
|
@ -45,20 +49,14 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.fullBlock.getIcon(side, this.meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axis, list, entity);
|
||||
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,19 +65,19 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float hitX, float hitY, float hitZ, int meta){
|
||||
if(side == 1){
|
||||
return meta;
|
||||
public IBlockState onBlockPlaced(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(side == 0 || hitY >= 0.5F){
|
||||
return meta+1;
|
||||
if(facing.ordinal() == 0 || hitY >= 0.5F){
|
||||
return this.getStateFromMeta(meta+1);
|
||||
}
|
||||
return meta;
|
||||
return this.getStateFromMeta(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
float minY = meta == 1 ? 0.5F : 0.0F;
|
||||
float maxY = meta == 1 ? 1.0F : 0.5F;
|
||||
this.setBlockBounds(0.0F, minY, 0F, 1.0F, maxY, 1.0F);
|
||||
|
@ -90,12 +88,6 @@ public class BlockSlabs extends BlockBase{
|
|||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
|
@ -103,7 +95,7 @@ public class BlockSlabs extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
@ -115,15 +107,15 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
|
||||
if(world.getBlock(x, y, z) == this.field_150939_a && ((side == 1 && world.getBlockMetadata(x, y, z) == 0) || (side == 0 && world.getBlockMetadata(x, y, z) == 1))){
|
||||
if(world.setBlock(x, y, z, ((BlockSlabs)this.field_150939_a).fullBlock, ((BlockSlabs)this.field_150939_a).meta, 3)){
|
||||
world.playSoundEffect(x+0.5F, y+0.5F, z+0.5F, this.field_150939_a.stepSound.getBreakSound(), (this.field_150939_a.stepSound.getVolume()+1.0F)/2.0F, this.field_150939_a.stepSound.getPitch()*0.8F);
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
|
||||
if(PosUtil.getBlock(pos, world) == this.block && ((side.ordinal() == 1 && PosUtil.getMetadata(pos, world) == 0) || (side.ordinal() == 0 && PosUtil.getMetadata(pos, world) == 1))){
|
||||
if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){
|
||||
world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F);
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,36 +10,36 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSmileyCloud extends BlockContainerBase{
|
||||
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
|
||||
|
||||
public BlockSmileyCloud(String name){
|
||||
super(Material.cloth, name);
|
||||
this.setHardness(0.5F);
|
||||
|
@ -47,21 +47,9 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
this.setStepSound(soundTypeCloth);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.smileyCloudRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,23 +59,23 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
if(Util.RANDOM.nextInt(30) == 0){
|
||||
for(int i = 0; i < 2; i++){
|
||||
double d = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d1 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d2 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
world.spawnParticle("heart", x+Util.RANDOM.nextFloat(), y+0.65+Util.RANDOM.nextFloat(), z+Util.RANDOM.nextFloat(), d, d1, d2);
|
||||
world.spawnParticle(EnumParticleTypes.HEART, pos.getX()+Util.RANDOM.nextFloat(), pos.getY()+0.65+Util.RANDOM.nextFloat(), pos.getZ()+Util.RANDOM.nextFloat(), d, d1, d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntitySmileyCloud){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
player.triggerAchievement(TheAchievements.NAME_SMILEY_CLOUD.ach);
|
||||
}
|
||||
|
@ -96,14 +84,14 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axis, list, entity);
|
||||
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
float f = 0.0625F;
|
||||
|
||||
if(meta == 0){
|
||||
|
@ -120,45 +108,39 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.wool.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta){
|
||||
return new TileEntitySmileyCloud();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
PosUtil.setMetadata(pos, world, 0, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
PosUtil.setMetadata(pos, world, 3, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
PosUtil.setMetadata(pos, world, 1, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
PosUtil.setMetadata(pos, world, 2, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,15 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
||||
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -27,22 +26,16 @@ import net.minecraft.item.EnumRarity;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTreasureChest extends BlockBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
|
||||
|
||||
public BlockTreasureChest(String name){
|
||||
super(Material.wood, name);
|
||||
|
@ -54,59 +47,33 @@ public class BlockTreasureChest extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta+2){
|
||||
return this.frontIcon;
|
||||
}
|
||||
if(side == 0){
|
||||
return this.bottomIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 0){
|
||||
return this.bottomIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
for(int i = 0; i < 2; i++){
|
||||
for(float f = 0; f <= 3; f += 0.5){
|
||||
float particleX = rand.nextFloat();
|
||||
float particleZ = rand.nextFloat();
|
||||
world.spawnParticle("bubble", (double)x+particleX, (double)y+f+1, (double)z+particleZ, 0.0D, 0.2D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, (double)pos.getX()+particleX, (double)pos.getY()+f+1, (double)pos.getZ()+particleZ, 0.0D, 0.2D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3){
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
|
||||
this.dropItems(world, x, y, z);
|
||||
world.setBlockToAir(x, y, z);
|
||||
this.dropItems(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach);
|
||||
}
|
||||
|
@ -114,47 +81,38 @@ public class BlockTreasureChest extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(){
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
PosUtil.setMetadata(pos, world, 0, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
PosUtil.setMetadata(pos, world, 3, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
PosUtil.setMetadata(pos, world, 1, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
PosUtil.setMetadata(pos, world, 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z){
|
||||
private void dropItems(World world, BlockPos pos){
|
||||
for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
|
||||
TreasureChestLoot theReturn = (TreasureChestLoot)WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot);
|
||||
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot);
|
||||
ItemStack itemStack = theReturn.returnItem.copy();
|
||||
itemStack.stackSize = MathHelper.getRandomIntegerInRange(Util.RANDOM, theReturn.minAmount, theReturn.maxAmount);
|
||||
|
||||
float dX = Util.RANDOM.nextFloat()*0.8F+0.1F;
|
||||
float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
|
||||
float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, itemStack.copy());
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, itemStack.copy());
|
||||
if(itemStack.hasTagCompound()){
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
@ -169,6 +127,6 @@ public class BlockTreasureChest extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,30 +10,38 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockWildPlant extends BlockBushBase{
|
||||
|
||||
public static final TheWildPlants[] allWildPlants = TheWildPlants.values();
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, allWildPlants.length-1);
|
||||
|
||||
public BlockWildPlant(String name){
|
||||
super(name);
|
||||
|
@ -41,8 +49,14 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) == TheWildPlants.RICE.ordinal() ? world.getBlock(x, y-1, z).getMaterial() == Material.water : world.getBlock(x, y-1, z).canSustainPlant(world, x, y-1, z, ForgeDirection.UP, this);
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
|
||||
BlockPos offset = PosUtil.offset(pos, 0, -1, 0);
|
||||
return PosUtil.getMetadata(pos, world) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,25 +71,19 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getIcon(0, 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(){
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return meta >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[meta].wildVersionOf).seedItem;
|
||||
public Item getItem(World world, BlockPos pos){
|
||||
int metadata = PosUtil.getMetadata(pos, world);
|
||||
return metadata >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -87,14 +95,20 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
||||
protected void registerRendering(){
|
||||
ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length];
|
||||
for(int i = 0; i < allWildPlants.length; i++){
|
||||
String name = this.getBaseName()+allWildPlants[i].name;
|
||||
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
|
||||
}
|
||||
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, x, y, z, 7, fortune);
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
int metadata = state.getBlock().getMetaFromState(state);
|
||||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
@ -105,12 +119,6 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta){
|
||||
return this.field_150939_a.getIcon(0, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return stack.getItemDamage() >= allWildPlants.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allWildPlants[stack.getItemDamage()].name;
|
||||
|
|
|
@ -10,35 +10,31 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockXPSolidifier extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
|
||||
|
||||
public BlockXPSolidifier(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -48,99 +44,71 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return META;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityXPSolidifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == 1 || side == 0){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta+2){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1 || side == 0){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z);
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos);
|
||||
if(solidifier != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
PosUtil.setMetadata(pos, world, 0, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
PosUtil.setMetadata(pos, world, 3, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
PosUtil.setMetadata(pos, world, 1, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
PosUtil.setMetadata(pos, world, 2, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, pos);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityXPSolidifier){
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)tile;
|
||||
if(solidifier.amount > 0){
|
||||
int stacks = solidifier.amount/64;
|
||||
int rest = solidifier.amount%64;
|
||||
for(int i = 0; i < stacks; i++){
|
||||
this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSolidifiedExperience, 64));
|
||||
this.spawnItem(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(InitItems.itemSolidifiedExperience, 64));
|
||||
}
|
||||
this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSolidifiedExperience, rest));
|
||||
this.spawnItem(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(InitItems.itemSolidifiedExperience, rest));
|
||||
solidifier.amount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
private void spawnItem(World world, int x, int y, int z, ItemStack stack){
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class FluidAA extends Fluid{
|
||||
|
||||
public FluidAA(String fluidName){
|
||||
super(fluidName);
|
||||
public FluidAA(String fluidName, String textureName){
|
||||
super(fluidName, new ResourceLocation(ModUtil.MOD_ID_LOWER, "blocks/"+textureName+"Still"), new ResourceLocation(ModUtil.MOD_ID_LOWER, "blocks/"+textureName+"Flowing"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,20 +8,17 @@
|
|||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.api.block;
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Extending this will cause displayHud() to be called when hovering over it in-world
|
||||
*/
|
||||
public interface IHudDisplay{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
|
@ -108,7 +108,6 @@ public class InitBlocks{
|
|||
public static Block blockCrystal;
|
||||
public static Block blockAtomicReconstructor;
|
||||
|
||||
public static Block blockBookletStand;
|
||||
public static Block blockMiner;
|
||||
|
||||
public static Block blockFireworkBox;
|
||||
|
@ -128,7 +127,6 @@ public class InitBlocks{
|
|||
|
||||
blockFireworkBox = new BlockFireworkBox("blockFireworkBox");
|
||||
blockMiner = new BlockMiner("blockMiner");
|
||||
blockBookletStand = new BlockBookletStand("blockBookStand");
|
||||
blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor");
|
||||
blockCrystal = new BlockCrystal("blockCrystal");
|
||||
blockBlackLotus = new BlockBlackLotus("blockBlackLotus");
|
||||
|
@ -162,13 +160,13 @@ public class InitBlocks{
|
|||
blockCoalGenerator = new BlockCoalGenerator("blockCoalGenerator");
|
||||
blockOilGenerator = new BlockOilGenerator("blockOilGenerator");
|
||||
blockFermentingBarrel = new BlockFermentingBarrel("blockFermentingBarrel");
|
||||
blockRice = new BlockPlant("blockRice", 6, 1, 2);
|
||||
blockRice = new BlockPlant("blockRice", 1, 2);
|
||||
CompatUtil.registerMFRPlant(blockRice);
|
||||
blockCanola = new BlockPlant("blockCanola", 4, 5, 5);
|
||||
blockCanola = new BlockPlant("blockCanola", 5, 5);
|
||||
CompatUtil.registerMFRPlant(blockCanola);
|
||||
blockFlax = new BlockPlant("blockFlax", 6, 2, 4);
|
||||
blockFlax = new BlockPlant("blockFlax", 2, 4);
|
||||
CompatUtil.registerMFRPlant(blockFlax);
|
||||
blockCoffee = new BlockPlant("blockCoffee", 6, 2, 2);
|
||||
blockCoffee = new BlockPlant("blockCoffee", 2, 2);
|
||||
CompatUtil.registerMFRPlant(blockCoffee);
|
||||
blockCompost = new BlockCompost("blockCompost");
|
||||
blockMisc = new BlockMisc("blockMisc");
|
||||
|
@ -209,7 +207,7 @@ public class InitBlocks{
|
|||
//Canola Fluid
|
||||
String canolaOil = "canolaoil";
|
||||
if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){
|
||||
fluidCanolaOil = new FluidAA(canolaOil).setRarity(EnumRarity.uncommon);
|
||||
fluidCanolaOil = new FluidAA(canolaOil, "blockCanolaOil").setRarity(EnumRarity.UNCOMMON);
|
||||
FluidRegistry.registerFluid(fluidCanolaOil);
|
||||
}
|
||||
else{
|
||||
|
@ -229,7 +227,7 @@ public class InitBlocks{
|
|||
//Oil Fluid
|
||||
String oil = "oil";
|
||||
if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){
|
||||
fluidOil = new FluidAA(oil).setRarity(EnumRarity.uncommon);
|
||||
fluidOil = new FluidAA(oil, "blockOil").setRarity(EnumRarity.UNCOMMON);
|
||||
FluidRegistry.registerFluid(fluidOil);
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -10,13 +10,18 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockBase extends Block{
|
||||
|
||||
|
@ -30,7 +35,7 @@ public class BlockBase extends Block{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -38,6 +43,12 @@ public class BlockBase extends Block{
|
|||
else{
|
||||
this.setCreativeTab(null);
|
||||
}
|
||||
|
||||
this.registerRendering();
|
||||
}
|
||||
|
||||
protected void registerRendering(){
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
|
@ -53,6 +64,25 @@ public class BlockBase extends Block{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState(){
|
||||
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta){
|
||||
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state){
|
||||
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
|
||||
}
|
||||
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,31 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockBushBase extends BlockBush{
|
||||
|
||||
private String name;
|
||||
|
||||
public BlockBushBase(String name){
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.name = name;
|
||||
this.setStepSound(soundTypeGrass);
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -37,6 +42,12 @@ public class BlockBushBase extends BlockBush{
|
|||
else{
|
||||
this.setCreativeTab(null);
|
||||
}
|
||||
|
||||
this.registerRendering();
|
||||
}
|
||||
|
||||
protected void registerRendering(){
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
|
@ -52,6 +63,25 @@ public class BlockBushBase extends BlockBush{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState(){
|
||||
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta){
|
||||
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state){
|
||||
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
|
||||
}
|
||||
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
|
@ -19,6 +19,9 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockRedstoneTorch;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -28,8 +31,12 @@ import net.minecraft.item.EnumRarity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
@ -46,7 +53,7 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -54,6 +61,12 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
else{
|
||||
this.setCreativeTab(null);
|
||||
}
|
||||
|
||||
this.registerRendering();
|
||||
}
|
||||
|
||||
protected void registerRendering(){
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
|
@ -69,30 +82,30 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
public void dropInventory(World world, int x, int y, int z){
|
||||
public void dropInventory(World world, BlockPos position){
|
||||
if(!world.isRemote){
|
||||
TileEntity aTile = world.getTileEntity(x, y, z);
|
||||
TileEntity aTile = world.getTileEntity(position);
|
||||
if(aTile instanceof TileEntityInventoryBase){
|
||||
TileEntityInventoryBase tile = (TileEntityInventoryBase)aTile;
|
||||
if(tile.getSizeInventory() > 0){
|
||||
for(int i = 0; i < tile.getSizeInventory(); i++){
|
||||
this.dropSlotFromInventory(i, tile, world, x, y, z);
|
||||
this.dropSlotFromInventory(i, tile, world, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, int x, int y, int z){
|
||||
public void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos){
|
||||
ItemStack stack = tile.getStackInSlot(i);
|
||||
if(stack != null && stack.stackSize > 0){
|
||||
float dX = Util.RANDOM.nextFloat()*0.8F+0.1F;
|
||||
float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
|
||||
float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, stack.copy());
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, stack.copy());
|
||||
if(stack.hasTagCompound()){
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
|
||||
}
|
||||
|
@ -102,23 +115,22 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
entityItem.motionZ = Util.RANDOM.nextGaussian()*factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
tile.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
|
||||
this.updateRedstoneState(world, x, y, z);
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
|
||||
this.updateRedstoneState(world, pos);
|
||||
}
|
||||
|
||||
public void updateRedstoneState(World world, int x, int y, int z){
|
||||
public void updateRedstoneState(World world, BlockPos pos){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityBase){
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0;
|
||||
boolean wasPowered = ((TileEntityBase)tile).isRedstonePowered;
|
||||
if(powered && !wasPowered){
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
}
|
||||
((TileEntityBase)tile).setRedstonePowered(true);
|
||||
}
|
||||
|
@ -130,9 +142,9 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random){
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
((IRedstoneToggle)tile).activateOnPulse();
|
||||
}
|
||||
|
@ -140,22 +152,25 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
((IEnergySaver)tile).setEnergy(stack.getTagCompound().getInteger("Energy"));
|
||||
stack.getTagCompound().removeTag("Energy");
|
||||
}
|
||||
|
||||
if(tile instanceof IFluidSaver){
|
||||
int amount = stack.getTagCompound().getInteger("FluidAmount");
|
||||
stack.getTagCompound().removeTag("FluidAmount");
|
||||
|
||||
if(amount > 0){
|
||||
FluidStack[] fluids = new FluidStack[amount];
|
||||
|
||||
for(int i = 0; i < amount; i++){
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i);
|
||||
stack.getTagCompound().removeTag("Fluid"+i);
|
||||
if(compound != null){
|
||||
fluids[i] = FluidStack.loadFluidStackFromNBT(compound);
|
||||
}
|
||||
|
@ -168,9 +183,9 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player){
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
this.dropBlockAsItem(world, pos, state, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,8 +195,8 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public int getComparatorInputOverride(World world, BlockPos pos){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IInventory){
|
||||
return Container.calcRedstoneFromInventory((IInventory)tile);
|
||||
}
|
||||
|
@ -189,12 +204,12 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null){
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(metadata, Util.RANDOM, fortune), 1, this.damageDropped(metadata));
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(state, Util.RANDOM, fortune), 1, this.damageDropped(state));
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
int energy = ((IEnergySaver)tile).getEnergy();
|
||||
|
@ -232,14 +247,14 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z){
|
||||
this.updateRedstoneState(world, x, y, z);
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
|
||||
this.updateRedstoneState(world, pos);
|
||||
}
|
||||
|
||||
public boolean tryToggleRedstone(World world, int x, int y, int z, EntityPlayer player){
|
||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IRedstoneToggle){
|
||||
if(!world.isRemote){
|
||||
((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
|
||||
|
@ -255,4 +270,27 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState(){
|
||||
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta){
|
||||
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state){
|
||||
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
|
||||
}
|
||||
|
||||
protected PropertyInteger getMetaProperty(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,41 +10,34 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockFluidFlowing extends BlockFluidClassic{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon stillIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon flowingIcon;
|
||||
|
||||
private String name;
|
||||
|
||||
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){
|
||||
super(fluid, material);
|
||||
this.name = unlocalizedName;
|
||||
this.setRenderPass(1);
|
||||
displacements.put(this, false);
|
||||
this.displacements.put(this, false);
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -67,30 +60,16 @@ public class BlockFluidFlowing extends BlockFluidClassic{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z){
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.canDisplace(world, x, y, z);
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos pos){
|
||||
return !PosUtil.getMaterial(pos, world).isLiquid() && super.canDisplace(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z){
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? this.stillIcon : this.flowingIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.stillIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Still");
|
||||
this.flowingIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Flowing");
|
||||
this.definedFluid.setIcons(this.stillIcon, this.flowingIcon);
|
||||
public boolean displaceIfPossible(World world, BlockPos pos){
|
||||
return !PosUtil.getMaterial(pos, world).isLiquid() && super.displaceIfPossible(world, pos);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,21 +10,25 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlant extends BlockCrops{
|
||||
|
@ -32,24 +36,40 @@ public class BlockPlant extends BlockCrops{
|
|||
public Item seedItem;
|
||||
public Item returnItem;
|
||||
public int returnMeta;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] textures;
|
||||
private int stages;
|
||||
private String name;
|
||||
private int minDropAmount;
|
||||
private int addDropAmount;
|
||||
|
||||
public BlockPlant(String name, int stages, int minDropAmount, int addDropAmount){
|
||||
public BlockPlant(String name, int minDropAmount, int addDropAmount){
|
||||
this.name = name;
|
||||
this.stages = stages;
|
||||
this.minDropAmount = minDropAmount;
|
||||
this.addDropAmount = addDropAmount;
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){
|
||||
if(getMetaFromState(state) >= 7){
|
||||
if(!world.isRemote){
|
||||
|
||||
List<ItemStack> drops = getDrops(world, pos, state, 0);
|
||||
for(ItemStack stack : drops){
|
||||
if(stack != null && stack.getItem() == this.getSeed()){
|
||||
stack.stackSize--;
|
||||
}
|
||||
EntityItem entity = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, stack);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
|
||||
world.setBlockState(pos, getStateFromMeta(0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -57,6 +77,12 @@ public class BlockPlant extends BlockCrops{
|
|||
else{
|
||||
this.setCreativeTab(null);
|
||||
}
|
||||
|
||||
this.registerRendering();
|
||||
}
|
||||
|
||||
protected void registerRendering(){
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
|
@ -68,68 +94,45 @@ public class BlockPlant extends BlockCrops{
|
|||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z){
|
||||
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
|
||||
return EnumPlantType.Crop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(meta < 7){
|
||||
if(meta == 6){
|
||||
meta = 5;
|
||||
}
|
||||
return this.textures[meta >> 1];
|
||||
}
|
||||
else{
|
||||
return this.textures[this.textures.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item func_149866_i(){
|
||||
public Item getSeed(){
|
||||
return this.seedItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item func_149865_P(){
|
||||
public Item getCrop(){
|
||||
return this.returnItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int par3){
|
||||
return meta >= 7 ? this.func_149865_P() : this.func_149866_i();
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[this.stages];
|
||||
for(int i = 0; i < this.textures.length; i++){
|
||||
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Stage"+(i+1));
|
||||
}
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta >= 7 ? this.returnMeta : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageValue(World world, int x, int y, int z){
|
||||
public int getDamageValue(World world, BlockPos pos){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(int meta, int fortune, Random random){
|
||||
return meta >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(meta, fortune, random);
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random){
|
||||
return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
|
||||
}
|
||||
}
|
|
@ -11,13 +11,15 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockStair extends BlockStairs{
|
||||
|
||||
|
@ -28,7 +30,7 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
|
||||
public BlockStair(Block block, String name, int meta){
|
||||
super(block, meta);
|
||||
super(block.getStateFromMeta(meta));
|
||||
this.name = name;
|
||||
this.setLightOpacity(0);
|
||||
|
||||
|
@ -36,7 +38,7 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -44,6 +46,12 @@ public class BlockStair extends BlockStairs{
|
|||
else{
|
||||
this.setCreativeTab(null);
|
||||
}
|
||||
|
||||
this.registerRendering();
|
||||
}
|
||||
|
||||
protected void registerRendering(){
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
|
@ -59,6 +67,6 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,25 +10,28 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockWallAA extends BlockWall{
|
||||
public class BlockWallAA extends BlockBase{
|
||||
|
||||
private String name;
|
||||
private Block baseBlock;
|
||||
private int meta;
|
||||
|
||||
public BlockWallAA(String name, Block base){
|
||||
|
@ -36,45 +39,14 @@ public class BlockWallAA extends BlockWall{
|
|||
}
|
||||
|
||||
public BlockWallAA(String name, Block base, int meta){
|
||||
super(base);
|
||||
this.baseBlock = base;
|
||||
this.name = name;
|
||||
super(base.getMaterial(), name);
|
||||
this.meta = meta;
|
||||
|
||||
this.register();
|
||||
}
|
||||
this.setHardness(1.5F);
|
||||
this.setResistance(10F);
|
||||
this.setStepSound(base.stepSound);
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
}
|
||||
else{
|
||||
this.setCreativeTab(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
protected Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.baseBlock.getIcon(side, this.meta);
|
||||
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));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -85,7 +57,99 @@ public class BlockWallAA extends BlockWall{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
public int damageDropped(IBlockState state){
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){
|
||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
||||
boolean flag2 = this.canConnectTo(worldIn, pos.west());
|
||||
boolean flag3 = this.canConnectTo(worldIn, pos.east());
|
||||
float f = 0.25F;
|
||||
float f1 = 0.75F;
|
||||
float f2 = 0.25F;
|
||||
float f3 = 0.75F;
|
||||
float f4 = 1.0F;
|
||||
|
||||
if(flag){
|
||||
f2 = 0.0F;
|
||||
}
|
||||
if(flag1){
|
||||
f3 = 1.0F;
|
||||
}
|
||||
if(flag2){
|
||||
f = 0.0F;
|
||||
}
|
||||
if(flag3){
|
||||
f1 = 1.0F;
|
||||
}
|
||||
|
||||
if(flag && flag1 && !flag2 && !flag3){
|
||||
f4 = 0.8125F;
|
||||
f = 0.3125F;
|
||||
f1 = 0.6875F;
|
||||
}
|
||||
else if(!flag && !flag1 && flag2 && flag3){
|
||||
f4 = 0.8125F;
|
||||
f2 = 0.3125F;
|
||||
f3 = 0.6875F;
|
||||
}
|
||||
|
||||
this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){
|
||||
this.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
this.maxY = 1.5D;
|
||||
return super.getCollisionBoundingBox(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
|
||||
Block block = worldIn.getBlockState(pos).getBlock();
|
||||
return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
|
||||
return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
|
||||
return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState(){
|
||||
return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta){
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,26 +36,26 @@ public class ItemBlockBase extends ItemBlock{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
if(this.field_150939_a instanceof BlockBase){
|
||||
return ((BlockBase)this.field_150939_a).getRarity(stack);
|
||||
if(this.block instanceof BlockBase){
|
||||
return ((BlockBase)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockContainerBase){
|
||||
return ((BlockContainerBase)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockContainerBase){
|
||||
return ((BlockContainerBase)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockFluidFlowing){
|
||||
return ((BlockFluidFlowing)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockFluidFlowing){
|
||||
return ((BlockFluidFlowing)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockPlant){
|
||||
return ((BlockPlant)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockPlant){
|
||||
return ((BlockPlant)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockStair){
|
||||
return ((BlockStair)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockStair){
|
||||
return ((BlockStair)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockWallAA){
|
||||
return ((BlockWallAA)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockWallAA){
|
||||
return ((BlockWallAA)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockBushBase){
|
||||
return ((BlockBushBase)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockBushBase){
|
||||
return ((BlockBushBase)this.block).getRarity(stack);
|
||||
}
|
||||
else{
|
||||
return Util.FALLBACK_RARITY;
|
||||
|
|
|
@ -14,16 +14,16 @@ import net.minecraft.item.EnumRarity;
|
|||
|
||||
public enum TheMiscBlocks{
|
||||
|
||||
QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare),
|
||||
QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare),
|
||||
QUARTZ("BlackQuartz", EnumRarity.rare),
|
||||
ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic),
|
||||
WOOD_CASING("WoodCasing", EnumRarity.common),
|
||||
CHARCOAL_BLOCK("Charcoal", EnumRarity.common),
|
||||
ENDERPEARL_BLOCK("Enderpearl", EnumRarity.rare),
|
||||
LAVA_FACTORY_CASE("LavaFactoryCase", EnumRarity.uncommon),
|
||||
ENDER_CASING("EnderCasing", EnumRarity.epic),
|
||||
IRON_CASING("IronCasing", EnumRarity.rare);
|
||||
QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.RARE),
|
||||
QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.RARE),
|
||||
QUARTZ("BlackQuartz", EnumRarity.RARE),
|
||||
ORE_QUARTZ("OreBlackQuartz", EnumRarity.EPIC),
|
||||
WOOD_CASING("WoodCasing", EnumRarity.COMMON),
|
||||
CHARCOAL_BLOCK("Charcoal", EnumRarity.COMMON),
|
||||
ENDERPEARL_BLOCK("Enderpearl", EnumRarity.RARE),
|
||||
LAVA_FACTORY_CASE("LavaFactoryCase", EnumRarity.UNCOMMON),
|
||||
ENDER_CASING("EnderCasing", EnumRarity.EPIC),
|
||||
IRON_CASING("IronCasing", EnumRarity.RARE);
|
||||
|
||||
public final String name;
|
||||
public final EnumRarity rarity;
|
||||
|
|
|
@ -16,10 +16,10 @@ import net.minecraft.item.EnumRarity;
|
|||
|
||||
public enum TheWildPlants{
|
||||
|
||||
CANOLA("Canola", EnumRarity.rare, InitBlocks.blockCanola),
|
||||
FLAX("Flax", EnumRarity.rare, InitBlocks.blockFlax),
|
||||
RICE("Rice", EnumRarity.rare, InitBlocks.blockRice),
|
||||
COFFEE("Coffee", EnumRarity.rare, InitBlocks.blockCoffee);
|
||||
CANOLA("Canola", EnumRarity.RARE, InitBlocks.blockCanola),
|
||||
FLAX("Flax", EnumRarity.RARE, InitBlocks.blockFlax),
|
||||
RICE("Rice", EnumRarity.RARE, InitBlocks.blockRice),
|
||||
COFFEE("Coffee", EnumRarity.RARE, InitBlocks.blockCoffee);
|
||||
|
||||
public final String name;
|
||||
public final EnumRarity rarity;
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* This file ("RenderInventory.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderInventory implements ISimpleBlockRenderingHandler{
|
||||
|
||||
private RenderTileEntity tileRender;
|
||||
private int renderID;
|
||||
|
||||
public RenderInventory(RenderTileEntity tileRender, int renderID){
|
||||
this.tileRender = tileRender;
|
||||
this.renderID = renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer){
|
||||
GL11.glPushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.tileRender.resLoc);
|
||||
GL11.glTranslatef(0F, 1F, 0F);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
this.tileRender.theModel.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId(){
|
||||
return this.renderID;
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* This file ("RenderLaserRelay.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class RenderLaserRelay extends RenderTileEntity{
|
||||
|
||||
public RenderLaserRelay(ModelBaseAA model){
|
||||
super(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
this.bindTexture(resLoc);
|
||||
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
if(meta == 0){
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -2F, 0F);
|
||||
}
|
||||
else if(meta == 3){
|
||||
GL11.glRotatef(-90, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -1F, 1F);
|
||||
}
|
||||
else if(meta == 2){
|
||||
GL11.glRotatef(90, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -1F, -1F);
|
||||
}
|
||||
else if(meta == 4){
|
||||
GL11.glRotatef(90, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(1F, -1F, 0F);
|
||||
}
|
||||
else if(meta == 5){
|
||||
GL11.glRotatef(90, 0F, 0F, -1F);
|
||||
GL11.glTranslatef(-1F, -1F, 0F);
|
||||
}
|
||||
|
||||
GL11.glScalef(0.85F, 0.85F, 0.85F);
|
||||
GL11.glTranslatef(0F, 0.2657F, 0F);
|
||||
theModel.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -10,66 +10,57 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
//TODO Fix Reconstructor Lens rendering
|
||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer{
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
if(!(tile instanceof TileEntityAtomicReconstructor)){
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
|
||||
/*if(!(tile instanceof TileEntityAtomicReconstructor)){
|
||||
return;
|
||||
}
|
||||
ItemStack stack = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ILensItem){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
|
||||
if(meta == 0){
|
||||
GL11.glTranslatef(0F, -0.5F, 0F);
|
||||
GL11.glTranslatef(-0.25F, 0F, -0.25F);
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(0F, -0.5F, 0F);
|
||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||
}
|
||||
if(meta == 1){
|
||||
GL11.glTranslatef(0F, -1.5F-0.5F/16F, 0F);
|
||||
GL11.glTranslatef(-0.25F, 0F, -0.25F);
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(0F, -1.5F-0.5F/16F, 0F);
|
||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||
}
|
||||
if(meta == 2){
|
||||
GL11.glTranslatef(0F, -1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
GL11.glTranslatef(-0.25F, -0.25F, 0F);
|
||||
GlStateManager.translate(0F, -1F, 0F);
|
||||
GlStateManager.translate(0F, 0F, -0.5F);
|
||||
}
|
||||
if(meta == 3){
|
||||
GL11.glTranslatef(0F, -1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.5F+0.5F/16F);
|
||||
GL11.glTranslatef(-0.25F, -0.25F, 0F);
|
||||
GlStateManager.translate(0F, -1F, 0F);
|
||||
GlStateManager.translate(0F, 0F, 0.5F+0.5F/16F);
|
||||
}
|
||||
if(meta == 4){
|
||||
GL11.glTranslatef(0F, -1F, 0F);
|
||||
GL11.glTranslatef(0.5F+0.5F/16F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.25F, 0.25F);
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1F, 0F);
|
||||
GlStateManager.translate(0.5F+0.5F/16F, 0F, 0F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
}
|
||||
if(meta == 5){
|
||||
GL11.glTranslatef(0F, -1F, 0F);
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.25F, 0.25F);
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1F, 0F);
|
||||
GlStateManager.translate(-0.5F, 0F, 0F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
AssetUtil.renderItemInWorld(stack, 0);
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
AssetUtil.renderItemInWorld(stack);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,40 +10,25 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderSmileyCloud extends RenderTileEntity{
|
||||
//TODO Fix Smiley Cloud
|
||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||
|
||||
private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png");
|
||||
|
||||
public RenderSmileyCloud(ModelBaseAA model){
|
||||
super(model);
|
||||
}
|
||||
//private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
if(!(tile instanceof TileEntitySmileyCloud)){
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){
|
||||
/*if(!(tile instanceof TileEntitySmileyCloud)){
|
||||
return;
|
||||
}
|
||||
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
{
|
||||
if(theCloud.flyHeight == 0){
|
||||
theCloud.flyHeight = tile.getWorldObj().rand.nextInt(30)+30;
|
||||
theCloud.flyHeight = tile.getWorld().rand.nextInt(30)+30;
|
||||
}
|
||||
int bobHeight = theCloud.flyHeight;
|
||||
double theTime = Minecraft.getSystemTime();
|
||||
|
@ -54,28 +39,28 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
}
|
||||
|
||||
if(time-(bobHeight/2) >= theCloud.lastFlyHeight){
|
||||
GL11.glTranslated(0, (time-theCloud.lastFlyHeight)/300, 0);
|
||||
GlStateManager.translate(0, (time-theCloud.lastFlyHeight)/300, 0);
|
||||
}
|
||||
else{
|
||||
GL11.glTranslated(0, -(time-theCloud.lastFlyHeight)/300+(double)bobHeight/300, 0);
|
||||
GlStateManager.translate(0, -(time-theCloud.lastFlyHeight)/300+(double)bobHeight/300, 0);
|
||||
}
|
||||
|
||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -2F, 0.0F);
|
||||
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.translate(0.0F, -2F, 0.0F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
{
|
||||
if(theModel.doesRotate()){
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
|
||||
if(meta == 0){
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
}
|
||||
if(meta == 1){
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
}
|
||||
if(meta == 3){
|
||||
GL11.glRotatef(270F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,49 +89,51 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
}
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
|
||||
GL11.glPushMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
{
|
||||
GL11.glTranslatef(0F, 0.1F, 0F);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, 0.1F, 0F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F*f;
|
||||
GL11.glScalef(-f1, -f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0.0F, 0F/f1, 0.0F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GlStateManager.scale(-f1, -f1, f1);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.translate(0.0F, 0F/f1, 0.0F);
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
//TODO Fix nameplate with Smiley Cloud
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
GlStateManager.glDisable(GlStateManager.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
int i = Minecraft.getMinecraft().fontRenderer.getStringWidth(theCloud.name)/2;
|
||||
int i = Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2;
|
||||
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
|
||||
tessellator.addVertex(-i-1, -1.0D, 0.0D);
|
||||
tessellator.addVertex(-i-1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i+1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i+1, -1.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
GlStateManager.glEnable(GlStateManager.GL_TEXTURE_2D);
|
||||
GlStateManager.depthMask(true);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(theCloud.name, -Minecraft.getMinecraft().fontRenderer.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString(theCloud.name, -Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glScalef(1F/-f1, 1F/-f1, 1F/f1);
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.scale(1F/-f1, 1F/-f1, 1F/f1);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* This file ("RenderTileEntity.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderTileEntity extends TileEntitySpecialRenderer{
|
||||
|
||||
public ModelBaseAA theModel;
|
||||
public ResourceLocation resLoc;
|
||||
|
||||
public RenderTileEntity(ModelBaseAA model){
|
||||
this.theModel = model;
|
||||
this.resLoc = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/"+this.theModel.getName()+".png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
this.bindTexture(resLoc);
|
||||
|
||||
if(theModel.doesRotate()){
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
if(meta == 0){
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
}
|
||||
if(meta == 1){
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
}
|
||||
if(meta == 3){
|
||||
GL11.glRotatef(270F, 0F, 1F, 0F);
|
||||
}
|
||||
}
|
||||
|
||||
theModel.render(0.0625F);
|
||||
theModel.renderExtra(0.0625F, tile);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelBaseAA.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ModelBaseAA extends ModelBase{
|
||||
|
||||
public void render(float f){
|
||||
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return null;
|
||||
}
|
||||
|
||||
public void renderExtra(float f, TileEntity tile){
|
||||
|
||||
}
|
||||
|
||||
public boolean doesRotate(){
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelBookletStand.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelBookletStand extends ModelBaseAA{
|
||||
|
||||
ModelRenderer body1;
|
||||
ModelRenderer bottom1;
|
||||
ModelRenderer bottom2;
|
||||
ModelRenderer body2;
|
||||
ModelRenderer body3;
|
||||
ModelRenderer book1;
|
||||
ModelRenderer book2;
|
||||
ModelRenderer book3;
|
||||
ModelRenderer book4;
|
||||
|
||||
public ModelBookletStand(){
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
body1 = new ModelRenderer(this, 0, 0);
|
||||
body1.addBox(0F, 0F, 0F, 14, 8, 1);
|
||||
body1.setRotationPoint(-7F, 17F, 1F);
|
||||
body1.setTextureSize(64, 64);
|
||||
body1.mirror = true;
|
||||
setRotation(body1, -0.7853982F, 0F, 0F);
|
||||
bottom1 = new ModelRenderer(this, 25, 6);
|
||||
bottom1.addBox(0F, 0F, 0F, 1, 1, 8);
|
||||
bottom1.setRotationPoint(-5F, 23F, -5F);
|
||||
bottom1.setTextureSize(64, 64);
|
||||
bottom1.mirror = true;
|
||||
setRotation(bottom1, 0F, 0F, 0F);
|
||||
bottom2 = new ModelRenderer(this, 25, 6);
|
||||
bottom2.addBox(0F, 0F, 0F, 1, 1, 8);
|
||||
bottom2.setRotationPoint(4F, 23F, -5F);
|
||||
bottom2.setTextureSize(64, 64);
|
||||
bottom2.mirror = true;
|
||||
setRotation(bottom2, 0F, 0F, 0F);
|
||||
body2 = new ModelRenderer(this, 0, 10);
|
||||
body2.addBox(0F, 0F, 0F, 14, 1, 2);
|
||||
body2.setRotationPoint(-7F, 20.91F, -5F);
|
||||
body2.setTextureSize(64, 64);
|
||||
body2.mirror = true;
|
||||
setRotation(body2, -0.7853982F, 0F, 0F);
|
||||
body3 = new ModelRenderer(this, 0, 14);
|
||||
body3.addBox(0F, 0F, 0F, 10, 3, 1);
|
||||
body3.setRotationPoint(-5F, 20F, -1F);
|
||||
body3.setTextureSize(64, 64);
|
||||
body3.mirror = true;
|
||||
setRotation(body3, 0F, 0F, 0F);
|
||||
book1 = new ModelRenderer(this, 36, 0);
|
||||
book1.addBox(0F, 0F, 0F, 8, 10, 0);
|
||||
book1.setRotationPoint(0F, 15F, 3.1F);
|
||||
book1.setTextureSize(64, 64);
|
||||
book1.mirror = true;
|
||||
setRotation(book1, -0.837758F, 0.0872665F, 0F);
|
||||
book2 = new ModelRenderer(this, 36, 0);
|
||||
book2.addBox(0F, 0F, 0F, 8, 10, 0);
|
||||
book2.setRotationPoint(-8F, 15F, 3.1F);
|
||||
book2.setTextureSize(64, 64);
|
||||
book2.mirror = true;
|
||||
setRotation(book2, -0.837758F, 0F, 0F);
|
||||
book3 = new ModelRenderer(this, 0, 19);
|
||||
book3.addBox(0F, 0F, 0F, 7, 8, 1);
|
||||
book3.setRotationPoint(7F, 16F, 1.2F);
|
||||
book3.setTextureSize(64, 64);
|
||||
book3.mirror = true;
|
||||
setRotation(book3, 0.837758F, -3.054326F, 0F);
|
||||
book4 = new ModelRenderer(this, 0, 19);
|
||||
book4.addBox(0F, 0F, 0F, 7, 8, 1);
|
||||
book4.setRotationPoint(-7F, 15.3F, 1.2F);
|
||||
book4.setTextureSize(64, 64);
|
||||
book4.mirror = true;
|
||||
setRotation(book4, -0.837758F, 0F, 0F);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
body1.render(f);
|
||||
bottom1.render(f);
|
||||
bottom2.render(f);
|
||||
body2.render(f);
|
||||
body3.render(f);
|
||||
book1.render(f);
|
||||
book2.render(f);
|
||||
book3.render(f);
|
||||
book4.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelBookletStand";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesRotate(){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelCoffeeMachine.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
/**
|
||||
* Made by Canitzp.
|
||||
* Thanks.
|
||||
*/
|
||||
public class ModelCoffeeMachine extends ModelBaseAA{
|
||||
|
||||
ModelRenderer p1;
|
||||
ModelRenderer p2;
|
||||
ModelRenderer p3;
|
||||
ModelRenderer p4;
|
||||
ModelRenderer p5;
|
||||
ModelRenderer p6;
|
||||
ModelRenderer p7;
|
||||
ModelRenderer p8;
|
||||
ModelRenderer p9;
|
||||
ModelRenderer p10;
|
||||
ModelRenderer p11;
|
||||
ModelRenderer p12;
|
||||
ModelRenderer p13;
|
||||
|
||||
public ModelCoffeeMachine(){
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
p1 = new ModelRenderer(this, 0, 0);
|
||||
p1.addBox(0F, 0F, 0F, 10, 1, 14);
|
||||
p1.setRotationPoint(-5F, 23F, -7F);
|
||||
p1.setTextureSize(128, 128);
|
||||
p1.mirror = true;
|
||||
setRotation(p1, 0F, 0F, 0F);
|
||||
p2 = new ModelRenderer(this, 49, 0);
|
||||
p2.addBox(0F, 0F, 0F, 10, 8, 6);
|
||||
p2.setRotationPoint(-5F, 15F, 1F);
|
||||
p2.setTextureSize(128, 128);
|
||||
p2.mirror = true;
|
||||
setRotation(p2, 0F, 0F, 0F);
|
||||
p3 = new ModelRenderer(this, 0, 16);
|
||||
p3.addBox(0F, 0F, 0F, 10, 2, 11);
|
||||
p3.setRotationPoint(-5F, 13F, -4F);
|
||||
p3.setTextureSize(128, 128);
|
||||
p3.mirror = true;
|
||||
setRotation(p3, 0F, 0F, 0F);
|
||||
p4 = new ModelRenderer(this, 43, 16);
|
||||
p4.addBox(0F, 0F, 0F, 8, 3, 8);
|
||||
p4.setRotationPoint(-4F, 10F, -1F);
|
||||
p4.setTextureSize(128, 128);
|
||||
p4.mirror = true;
|
||||
setRotation(p4, 0F, 0F, 0F);
|
||||
p5 = new ModelRenderer(this, 0, 30);
|
||||
p5.addBox(0F, 0F, 0F, 2, 1, 2);
|
||||
p5.setRotationPoint(-1F, 15F, -3.5F);
|
||||
p5.setTextureSize(128, 128);
|
||||
p5.mirror = true;
|
||||
setRotation(p5, 0F, 0F, 0F);
|
||||
p6 = new ModelRenderer(this, 82, 0);
|
||||
p6.addBox(0F, 0F, 0F, 4, 5, 1);
|
||||
p6.setRotationPoint(-2F, 17F, -1F);
|
||||
p6.setTextureSize(128, 128);
|
||||
p6.mirror = true;
|
||||
setRotation(p6, 0F, 0F, 0F);
|
||||
p7 = new ModelRenderer(this, 82, 0);
|
||||
p7.addBox(0F, 0F, 0F, 4, 5, 1);
|
||||
p7.setRotationPoint(-2F, 17F, -6F);
|
||||
p7.setTextureSize(128, 128);
|
||||
p7.mirror = true;
|
||||
setRotation(p7, 0F, 0F, 0F);
|
||||
p8 = new ModelRenderer(this, 82, 0);
|
||||
p8.addBox(0F, 0F, 0F, 4, 5, 1);
|
||||
p8.setRotationPoint(2F, 17F, -1F);
|
||||
p8.setTextureSize(128, 128);
|
||||
p8.mirror = true;
|
||||
setRotation(p8, 0F, 1.570796F, 0F);
|
||||
p9 = new ModelRenderer(this, 82, 0);
|
||||
p9.addBox(0F, 0F, 0F, 4, 5, 1);
|
||||
p9.setRotationPoint(-3F, 17F, -1F);
|
||||
p9.setTextureSize(128, 128);
|
||||
p9.mirror = true;
|
||||
setRotation(p9, 0F, 1.570796F, 0F);
|
||||
p10 = new ModelRenderer(this, 93, 0);
|
||||
p10.addBox(0F, 0F, 0F, 4, 1, 4);
|
||||
p10.setRotationPoint(-2F, 22F, -5F);
|
||||
p10.setTextureSize(128, 128);
|
||||
p10.mirror = true;
|
||||
setRotation(p10, 0F, 0F, 0F);
|
||||
p11 = new ModelRenderer(this, 82, 7);
|
||||
p11.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
p11.setRotationPoint(-4F, 18F, -4F);
|
||||
p11.setTextureSize(128, 128);
|
||||
p11.mirror = true;
|
||||
setRotation(p11, 0F, 0F, 0F);
|
||||
p12 = new ModelRenderer(this, 82, 7);
|
||||
p12.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
p12.setRotationPoint(-4F, 21F, -4F);
|
||||
p12.setTextureSize(128, 128);
|
||||
p12.mirror = true;
|
||||
setRotation(p12, 0F, 0F, 0F);
|
||||
p13 = new ModelRenderer(this, 89, 7);
|
||||
p13.addBox(0F, 0F, 0F, 1, 2, 2);
|
||||
p13.setRotationPoint(-5F, 19F, -4F);
|
||||
p13.setTextureSize(128, 128);
|
||||
p13.mirror = true;
|
||||
setRotation(p13, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
p1.render(f);
|
||||
p2.render(f);
|
||||
p3.render(f);
|
||||
p4.render(f);
|
||||
p5.render(f);
|
||||
p6.render(f);
|
||||
p7.render(f);
|
||||
p8.render(f);
|
||||
p9.render(f);
|
||||
p10.render(f);
|
||||
p11.render(f);
|
||||
p12.render(f);
|
||||
p13.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelCoffeeMachine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesRotate(){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -10,17 +10,12 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
||||
public class ModelCompost extends ModelBaseAA{
|
||||
//TODO Fix compost rendering
|
||||
public class ModelCompost extends ModelBase{
|
||||
|
||||
public ModelRenderer floor;
|
||||
/*public ModelRenderer floor;
|
||||
public ModelRenderer wallOne;
|
||||
public ModelRenderer wallTwo;
|
||||
public ModelRenderer wallThree;
|
||||
|
@ -67,16 +62,11 @@ public class ModelCompost extends ModelBaseAA{
|
|||
this.floor.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelCompost";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderExtra(float f, TileEntity tile){
|
||||
//Hehe
|
||||
if("ShadowfactsDev".equals(Minecraft.getMinecraft().thePlayer.getCommandSenderName())){
|
||||
GL11.glTranslatef(0F, 1F, 0F);
|
||||
if("ShadowfactsDev".equals(Minecraft.getMinecraft().thePlayer.getName())){
|
||||
GlStateManager.translate(0F, 1F, 0F);
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityCompost){
|
||||
|
@ -95,5 +85,5 @@ public class ModelCompost extends ModelBaseAA{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelFishingNet.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelFishingNet extends ModelBaseAA{
|
||||
|
||||
public ModelRenderer s1;
|
||||
public ModelRenderer s2;
|
||||
public ModelRenderer s3;
|
||||
public ModelRenderer s4;
|
||||
public ModelRenderer s5;
|
||||
public ModelRenderer s6;
|
||||
public ModelRenderer s7;
|
||||
public ModelRenderer s8;
|
||||
public ModelRenderer s9;
|
||||
public ModelRenderer s10;
|
||||
public ModelRenderer s11;
|
||||
public ModelRenderer s12;
|
||||
public ModelRenderer s13;
|
||||
public ModelRenderer s14;
|
||||
public ModelRenderer s15;
|
||||
public ModelRenderer s16;
|
||||
|
||||
public ModelFishingNet(){
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 64;
|
||||
this.s11 = new ModelRenderer(this, 0, 0);
|
||||
this.s11.mirror = true;
|
||||
this.s11.setRotationPoint(-3.5F, 23.0F, -8.0F);
|
||||
this.s11.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s9 = new ModelRenderer(this, 0, 0);
|
||||
this.s9.mirror = true;
|
||||
this.s9.setRotationPoint(-7.5F, 23.0F, -8.0F);
|
||||
this.s9.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s8 = new ModelRenderer(this, 0, 0);
|
||||
this.s8.setRotationPoint(-8.0F, 23.0F, 6.5F);
|
||||
this.s8.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s3 = new ModelRenderer(this, 0, 0);
|
||||
this.s3.setRotationPoint(-8.0F, 23.0F, -3.5F);
|
||||
this.s3.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s1 = new ModelRenderer(this, 0, 0);
|
||||
this.s1.setRotationPoint(-8.0F, 23.0F, -7.5F);
|
||||
this.s1.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s14 = new ModelRenderer(this, 0, 0);
|
||||
this.s14.mirror = true;
|
||||
this.s14.setRotationPoint(2.5F, 23.0F, -8.0F);
|
||||
this.s14.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s15 = new ModelRenderer(this, 0, 0);
|
||||
this.s15.mirror = true;
|
||||
this.s15.setRotationPoint(4.5F, 23.0F, -8.0F);
|
||||
this.s15.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s4 = new ModelRenderer(this, 0, 0);
|
||||
this.s4.setRotationPoint(-8.0F, 23.0F, -1.5F);
|
||||
this.s4.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s13 = new ModelRenderer(this, 0, 0);
|
||||
this.s13.mirror = true;
|
||||
this.s13.setRotationPoint(0.5F, 23.0F, -8.0F);
|
||||
this.s13.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s5 = new ModelRenderer(this, 0, 0);
|
||||
this.s5.setRotationPoint(-8.0F, 23.0F, 0.5F);
|
||||
this.s5.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s6 = new ModelRenderer(this, 0, 0);
|
||||
this.s6.setRotationPoint(-8.0F, 23.0F, 2.5F);
|
||||
this.s6.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s12 = new ModelRenderer(this, 0, 0);
|
||||
this.s12.mirror = true;
|
||||
this.s12.setRotationPoint(-1.5F, 23.0F, -8.0F);
|
||||
this.s12.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s16 = new ModelRenderer(this, 0, 0);
|
||||
this.s16.mirror = true;
|
||||
this.s16.setRotationPoint(6.5F, 23.0F, -8.0F);
|
||||
this.s16.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
this.s2 = new ModelRenderer(this, 0, 0);
|
||||
this.s2.setRotationPoint(-8.0F, 23.0F, -5.5F);
|
||||
this.s2.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s7 = new ModelRenderer(this, 0, 0);
|
||||
this.s7.setRotationPoint(-8.0F, 23.0F, 4.5F);
|
||||
this.s7.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F);
|
||||
this.s10 = new ModelRenderer(this, 0, 0);
|
||||
this.s10.mirror = true;
|
||||
this.s10.setRotationPoint(-5.5F, 23.0F, -8.0F);
|
||||
this.s10.addBox(0.0F, 0.0F, 0.0F, 1, 1, 16, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
this.s11.render(f);
|
||||
this.s9.render(f);
|
||||
this.s8.render(f);
|
||||
this.s3.render(f);
|
||||
this.s1.render(f);
|
||||
this.s14.render(f);
|
||||
this.s15.render(f);
|
||||
this.s4.render(f);
|
||||
this.s13.render(f);
|
||||
this.s5.render(f);
|
||||
this.s6.render(f);
|
||||
this.s12.render(f);
|
||||
this.s16.render(f);
|
||||
this.s2.render(f);
|
||||
this.s7.render(f);
|
||||
this.s10.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelFishingNet";
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelFurnaceSolar.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelFurnaceSolar extends ModelBaseAA{
|
||||
|
||||
public ModelRenderer s;
|
||||
|
||||
public ModelFurnaceSolar(){
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 32;
|
||||
this.s = new ModelRenderer(this, 0, 0);
|
||||
this.s.setRotationPoint(-8.0F, 21.0F, -8.0F);
|
||||
this.s.addBox(0.0F, 0.0F, 0.0F, 16, 3, 16, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
this.s.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelFurnaceSolar";
|
||||
}
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelLaserRelay.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Made by Canitzp.
|
||||
* Thanks. Seriously. It looks really awesome. I don't think I could do this.
|
||||
*/
|
||||
public class ModelLaserRelay extends ModelBaseAA{
|
||||
|
||||
ModelRenderer bottom;
|
||||
ModelRenderer laserPillar;
|
||||
ModelRenderer laserBase;
|
||||
ModelRenderer covering1;
|
||||
ModelRenderer covering2;
|
||||
ModelRenderer covering3;
|
||||
ModelRenderer covering4;
|
||||
ModelRenderer covering5;
|
||||
ModelRenderer covering6;
|
||||
ModelRenderer covering7;
|
||||
ModelRenderer covering8;
|
||||
ModelRenderer top;
|
||||
ModelRenderer covering9;
|
||||
ModelRenderer covering10;
|
||||
ModelRenderer covering11;
|
||||
ModelRenderer covering12;
|
||||
ModelRenderer energyBall;
|
||||
|
||||
public ModelLaserRelay(){
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
bottom = new ModelRenderer(this, 0, 0);
|
||||
bottom.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
bottom.setRotationPoint(-4F, 23F, -4F);
|
||||
bottom.setTextureSize(64, 64);
|
||||
bottom.mirror = true;
|
||||
setRotation(bottom, 0F, 0F, 0F);
|
||||
laserPillar = new ModelRenderer(this, 54, 0);
|
||||
laserPillar.addBox(0F, 0F, 0F, 2, 11, 2);
|
||||
laserPillar.setRotationPoint(-1F, 10F, -1F);
|
||||
laserPillar.setTextureSize(64, 64);
|
||||
laserPillar.mirror = true;
|
||||
setRotation(laserPillar, 0F, 0F, 0F);
|
||||
laserBase = new ModelRenderer(this, 33, 0);
|
||||
laserBase.addBox(0F, 0F, 0F, 5, 2, 5);
|
||||
laserBase.setRotationPoint(-2.5F, 21F, -2.5F);
|
||||
laserBase.setTextureSize(64, 64);
|
||||
laserBase.mirror = true;
|
||||
setRotation(laserBase, 0F, 0F, 0F);
|
||||
covering1 = new ModelRenderer(this, 0, 10);
|
||||
covering1.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering1.setRotationPoint(-4F, 20F, -5F);
|
||||
covering1.setTextureSize(64, 64);
|
||||
covering1.mirror = true;
|
||||
setRotation(covering1, 0F, 0F, 0F);
|
||||
covering2 = new ModelRenderer(this, 0, 10);
|
||||
covering2.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering2.setRotationPoint(-4F, 20F, 4F);
|
||||
covering2.setTextureSize(64, 64);
|
||||
covering2.mirror = true;
|
||||
setRotation(covering2, 0F, 0F, 0F);
|
||||
covering3 = new ModelRenderer(this, 0, 10);
|
||||
covering3.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering3.setRotationPoint(-5F, 20F, 4F);
|
||||
covering3.setTextureSize(64, 64);
|
||||
covering3.mirror = true;
|
||||
setRotation(covering3, 0F, 1.579523F, 0F);
|
||||
covering4 = new ModelRenderer(this, 0, 10);
|
||||
covering4.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering4.setRotationPoint(4F, 20F, 4F);
|
||||
covering4.setTextureSize(64, 64);
|
||||
covering4.mirror = true;
|
||||
setRotation(covering4, 0F, 1.579523F, 0F);
|
||||
covering5 = new ModelRenderer(this, 0, 10);
|
||||
covering5.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering5.setRotationPoint(-4F, 10F, -5F);
|
||||
covering5.setTextureSize(64, 64);
|
||||
covering5.mirror = true;
|
||||
setRotation(covering5, 0F, 0F, 0F);
|
||||
covering6 = new ModelRenderer(this, 0, 10);
|
||||
covering6.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering6.setRotationPoint(-4F, 10F, 4F);
|
||||
covering6.setTextureSize(64, 64);
|
||||
covering6.mirror = true;
|
||||
setRotation(covering6, 0F, 0F, 0F);
|
||||
covering7 = new ModelRenderer(this, 0, 10);
|
||||
covering7.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering7.setRotationPoint(-5F, 10F, 4F);
|
||||
covering7.setTextureSize(64, 64);
|
||||
covering7.mirror = true;
|
||||
setRotation(covering7, 0F, 1.579523F, 0F);
|
||||
covering8 = new ModelRenderer(this, 0, 10);
|
||||
covering8.addBox(0F, 0F, 0F, 8, 3, 1);
|
||||
covering8.setRotationPoint(4F, 10F, 4F);
|
||||
covering8.setTextureSize(64, 64);
|
||||
covering8.mirror = true;
|
||||
setRotation(covering8, 0F, 1.579523F, 0F);
|
||||
top = new ModelRenderer(this, 0, 0);
|
||||
top.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
top.setRotationPoint(-4F, 9F, -4F);
|
||||
top.setTextureSize(64, 64);
|
||||
top.mirror = true;
|
||||
setRotation(top, 0F, 0F, 0F);
|
||||
covering9 = new ModelRenderer(this, 19, 10);
|
||||
covering9.addBox(0F, 0F, 0F, 8, 7, 1);
|
||||
covering9.setRotationPoint(-4F, 13F, 5F);
|
||||
covering9.setTextureSize(64, 64);
|
||||
covering9.mirror = true;
|
||||
setRotation(covering9, 0F, 0F, 0F);
|
||||
covering10 = new ModelRenderer(this, 19, 10);
|
||||
covering10.addBox(0F, 0F, 0F, 8, 7, 1);
|
||||
covering10.setRotationPoint(-4F, 13F, -6F);
|
||||
covering10.setTextureSize(64, 64);
|
||||
covering10.mirror = true;
|
||||
setRotation(covering10, 0F, 0F, 0F);
|
||||
covering11 = new ModelRenderer(this, 19, 10);
|
||||
covering11.addBox(0F, 0F, 0F, 8, 7, 1);
|
||||
covering11.setRotationPoint(-6F, 13F, 4F);
|
||||
covering11.setTextureSize(64, 64);
|
||||
covering11.mirror = true;
|
||||
setRotation(covering11, 0F, 1.579523F, 0F);
|
||||
covering12 = new ModelRenderer(this, 19, 10);
|
||||
covering12.addBox(0F, 0F, 0F, 8, 7, 1);
|
||||
covering12.setRotationPoint(5F, 13F, 4F);
|
||||
covering12.setTextureSize(64, 64);
|
||||
covering12.mirror = true;
|
||||
setRotation(covering12, 0F, 1.579523F, 0F);
|
||||
energyBall = new ModelRenderer(this, 0, 15);
|
||||
energyBall.addBox(0F, 0F, 0F, 3, 3, 3);
|
||||
energyBall.setRotationPoint(-1.5F, 15F, -1.5F);
|
||||
energyBall.setTextureSize(64, 64);
|
||||
energyBall.mirror = true;
|
||||
setRotation(energyBall, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bottom.render(f);
|
||||
laserPillar.render(f);
|
||||
laserBase.render(f);
|
||||
energyBall.render(f);
|
||||
top.render(f);
|
||||
covering1.render(f);
|
||||
covering2.render(f);
|
||||
covering3.render(f);
|
||||
covering4.render(f);
|
||||
covering5.render(f);
|
||||
covering6.render(f);
|
||||
covering7.render(f);
|
||||
covering8.render(f);
|
||||
covering9.render(f);
|
||||
covering10.render(f);
|
||||
covering11.render(f);
|
||||
covering12.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelLaserRelay";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesRotate(){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelPhantomBooster.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelPhantomBooster extends ModelBaseAA{
|
||||
|
||||
ModelRenderer s1;
|
||||
ModelRenderer s2;
|
||||
ModelRenderer s3;
|
||||
ModelRenderer s4;
|
||||
ModelRenderer s5;
|
||||
ModelRenderer s6;
|
||||
ModelRenderer s7;
|
||||
ModelRenderer s8;
|
||||
ModelRenderer s9;
|
||||
ModelRenderer s10;
|
||||
ModelRenderer s11;
|
||||
ModelRenderer s12;
|
||||
ModelRenderer s13;
|
||||
ModelRenderer s14;
|
||||
ModelRenderer s15;
|
||||
|
||||
public ModelPhantomBooster(){
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
s1 = new ModelRenderer(this, 0, 0);
|
||||
s1.addBox(0F, 0F, 0F, 4, 16, 4);
|
||||
s1.setRotationPoint(-2F, 8F, -2F);
|
||||
s1.setTextureSize(128, 128);
|
||||
s1.mirror = true;
|
||||
setRotation(s1, 0F, 0F, 0F);
|
||||
s2 = new ModelRenderer(this, 17, 0);
|
||||
s2.addBox(0F, 0F, 0F, 6, 1, 6);
|
||||
s2.setRotationPoint(-3F, 9F, -3F);
|
||||
s2.setTextureSize(128, 128);
|
||||
s2.mirror = true;
|
||||
setRotation(s2, 0F, 0F, 0F);
|
||||
s3 = new ModelRenderer(this, 17, 0);
|
||||
s3.addBox(0F, 0F, 0F, 6, 1, 6);
|
||||
s3.setRotationPoint(-3F, 22F, -3F);
|
||||
s3.setTextureSize(128, 128);
|
||||
s3.mirror = true;
|
||||
setRotation(s3, 0F, 0F, 0F);
|
||||
s4 = new ModelRenderer(this, 17, 8);
|
||||
s4.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s4.setRotationPoint(-3F, 10F, -4F);
|
||||
s4.setTextureSize(128, 128);
|
||||
s4.mirror = true;
|
||||
setRotation(s4, 0F, 0F, 0F);
|
||||
s5 = new ModelRenderer(this, 17, 8);
|
||||
s5.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s5.setRotationPoint(-3F, 10F, 3F);
|
||||
s5.setTextureSize(128, 128);
|
||||
s5.mirror = true;
|
||||
setRotation(s5, 0F, 0F, 0F);
|
||||
s6 = new ModelRenderer(this, 17, 8);
|
||||
s6.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s6.setRotationPoint(-4F, 10F, 3F);
|
||||
s6.setTextureSize(128, 128);
|
||||
s6.mirror = true;
|
||||
setRotation(s6, 0F, 1.579523F, 0F);
|
||||
s7 = new ModelRenderer(this, 17, 8);
|
||||
s7.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s7.setRotationPoint(3F, 10F, 3F);
|
||||
s7.setTextureSize(128, 128);
|
||||
s7.mirror = true;
|
||||
setRotation(s7, 0F, 1.579523F, 0F);
|
||||
s8 = new ModelRenderer(this, 17, 12);
|
||||
s8.addBox(0F, 0F, 0F, 6, 8, 1);
|
||||
s8.setRotationPoint(-3F, 12F, -5F);
|
||||
s8.setTextureSize(128, 128);
|
||||
s8.mirror = true;
|
||||
setRotation(s8, 0F, 0F, 0F);
|
||||
s9 = new ModelRenderer(this, 17, 12);
|
||||
s9.addBox(0F, 0F, 0F, 6, 8, 1);
|
||||
s9.setRotationPoint(-3F, 12F, 4F);
|
||||
s9.setTextureSize(128, 128);
|
||||
s9.mirror = true;
|
||||
setRotation(s9, 0F, 0F, 0F);
|
||||
s10 = new ModelRenderer(this, 17, 12);
|
||||
s10.addBox(0F, 0F, 0F, 6, 8, 1);
|
||||
s10.setRotationPoint(-5F, 12F, 3F);
|
||||
s10.setTextureSize(128, 128);
|
||||
s10.mirror = true;
|
||||
setRotation(s10, 0F, 1.579523F, 0F);
|
||||
s11 = new ModelRenderer(this, 17, 12);
|
||||
s11.addBox(0F, 0F, 0F, 6, 8, 1);
|
||||
s11.setRotationPoint(4F, 12F, 3F);
|
||||
s11.setTextureSize(128, 128);
|
||||
s11.mirror = true;
|
||||
setRotation(s11, 0F, 1.579523F, 0F);
|
||||
s12 = new ModelRenderer(this, 17, 8);
|
||||
s12.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s12.setRotationPoint(-4F, 20F, 3F);
|
||||
s12.setTextureSize(128, 128);
|
||||
s12.mirror = true;
|
||||
setRotation(s12, 0F, 1.579523F, 0F);
|
||||
s13 = new ModelRenderer(this, 17, 8);
|
||||
s13.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s13.setRotationPoint(-3F, 20F, 3F);
|
||||
s13.setTextureSize(128, 128);
|
||||
s13.mirror = true;
|
||||
setRotation(s13, 0F, 0F, 0F);
|
||||
s14 = new ModelRenderer(this, 17, 8);
|
||||
s14.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s14.setRotationPoint(3F, 20F, 3F);
|
||||
s14.setTextureSize(128, 128);
|
||||
s14.mirror = true;
|
||||
setRotation(s14, 0F, 1.579523F, 0F);
|
||||
s15 = new ModelRenderer(this, 17, 8);
|
||||
s15.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
s15.setRotationPoint(-3F, 20F, -4F);
|
||||
s15.setTextureSize(128, 128);
|
||||
s15.mirror = true;
|
||||
setRotation(s15, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
s1.render(f);
|
||||
s2.render(f);
|
||||
s3.render(f);
|
||||
s4.render(f);
|
||||
s5.render(f);
|
||||
s6.render(f);
|
||||
s7.render(f);
|
||||
s8.render(f);
|
||||
s9.render(f);
|
||||
s10.render(f);
|
||||
s11.render(f);
|
||||
s12.render(f);
|
||||
s13.render(f);
|
||||
s14.render(f);
|
||||
s15.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelPhantomBooster";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesRotate(){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
/*
|
||||
* This file ("ModelSmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelSmileyCloud extends ModelBaseAA{
|
||||
|
||||
ModelRenderer s1;
|
||||
ModelRenderer s2;
|
||||
ModelRenderer s3;
|
||||
ModelRenderer s4;
|
||||
ModelRenderer s5;
|
||||
ModelRenderer s6;
|
||||
ModelRenderer s7;
|
||||
ModelRenderer s8;
|
||||
ModelRenderer s9;
|
||||
ModelRenderer s10;
|
||||
ModelRenderer s11;
|
||||
ModelRenderer s12;
|
||||
ModelRenderer s13;
|
||||
ModelRenderer s14;
|
||||
ModelRenderer s15;
|
||||
ModelRenderer s16;
|
||||
|
||||
public ModelSmileyCloud(){
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
s1 = new ModelRenderer(this, 0, 0);
|
||||
s1.addBox(0F, 0F, 0F, 12, 10, 10);
|
||||
s1.setRotationPoint(-6F, 14F, -4F);
|
||||
s1.setTextureSize(64, 64);
|
||||
s1.mirror = true;
|
||||
setRotation(s1, 0F, 0F, 0F);
|
||||
s2 = new ModelRenderer(this, 45, 0);
|
||||
s2.addBox(0F, 0F, 0F, 1, 8, 8);
|
||||
s2.setRotationPoint(-7F, 15F, -3F);
|
||||
s2.setTextureSize(64, 64);
|
||||
s2.mirror = true;
|
||||
setRotation(s2, 0F, 0F, 0F);
|
||||
s3 = new ModelRenderer(this, 45, 0);
|
||||
s3.addBox(0F, 0F, 0F, 1, 8, 8);
|
||||
s3.setRotationPoint(6F, 15F, -3F);
|
||||
s3.setTextureSize(64, 64);
|
||||
s3.mirror = true;
|
||||
setRotation(s3, 0F, 0F, 0F);
|
||||
s4 = new ModelRenderer(this, 0, 21);
|
||||
s4.addBox(0F, 0F, 0F, 10, 8, 1);
|
||||
s4.setRotationPoint(-5F, 15F, 6F);
|
||||
s4.setTextureSize(64, 64);
|
||||
s4.mirror = true;
|
||||
setRotation(s4, 0F, 0F, 0F);
|
||||
s5 = new ModelRenderer(this, 23, 27);
|
||||
s5.addBox(0F, 0F, 0F, 10, 1, 8);
|
||||
s5.setRotationPoint(-5F, 13F, -3F);
|
||||
s5.setTextureSize(64, 64);
|
||||
s5.mirror = true;
|
||||
setRotation(s5, 0F, 0F, 0F);
|
||||
s6 = new ModelRenderer(this, 23, 21);
|
||||
s6.addBox(0F, 0F, 0F, 6, 1, 4);
|
||||
s6.setRotationPoint(-3F, 12F, -1F);
|
||||
s6.setTextureSize(64, 64);
|
||||
s6.mirror = true;
|
||||
setRotation(s6, 0F, 0F, 0F);
|
||||
s7 = new ModelRenderer(this, 45, 16);
|
||||
s7.addBox(0F, 0F, 0F, 6, 6, 1);
|
||||
s7.setRotationPoint(-3F, 16F, 7F);
|
||||
s7.setTextureSize(64, 64);
|
||||
s7.mirror = true;
|
||||
setRotation(s7, 0F, 0F, 0F);
|
||||
s8 = new ModelRenderer(this, 0, 31);
|
||||
s8.addBox(0F, 0F, 0F, 1, 6, 6);
|
||||
s8.setRotationPoint(-8F, 16F, -2F);
|
||||
s8.setTextureSize(64, 64);
|
||||
s8.mirror = true;
|
||||
setRotation(s8, 0F, 0F, 0F);
|
||||
s9 = new ModelRenderer(this, 0, 31);
|
||||
s9.addBox(0F, 0F, 0F, 1, 6, 6);
|
||||
s9.setRotationPoint(7F, 16F, -2F);
|
||||
s9.setTextureSize(64, 64);
|
||||
s9.mirror = true;
|
||||
setRotation(s9, 0F, 0F, 0F);
|
||||
s10 = new ModelRenderer(this, 15, 37);
|
||||
s10.addBox(0F, 0F, 0F, 6, 1, 1);
|
||||
s10.setRotationPoint(-3F, 20F, -5F);
|
||||
s10.setTextureSize(64, 64);
|
||||
s10.mirror = true;
|
||||
setRotation(s10, 0F, 0F, 0F);
|
||||
s11 = new ModelRenderer(this, 15, 31);
|
||||
s11.addBox(0F, 1F, 0F, 1, 1, 1);
|
||||
s11.setRotationPoint(-4F, 18F, -5F);
|
||||
s11.setTextureSize(64, 64);
|
||||
s11.mirror = true;
|
||||
setRotation(s11, 0F, 0F, 0F);
|
||||
s12 = new ModelRenderer(this, 15, 31);
|
||||
s12.addBox(0F, 1F, 0F, 1, 1, 1);
|
||||
s12.setRotationPoint(3F, 18F, -5F);
|
||||
s12.setTextureSize(64, 64);
|
||||
s12.mirror = true;
|
||||
setRotation(s12, 0F, 0F, 0F);
|
||||
s13 = new ModelRenderer(this, 15, 40);
|
||||
s13.addBox(0F, 0F, 0F, 2, 2, 1);
|
||||
s13.setRotationPoint(-3F, 15F, -4.5F);
|
||||
s13.setTextureSize(64, 64);
|
||||
s13.mirror = true;
|
||||
setRotation(s13, 0F, 0F, 0F);
|
||||
s14 = new ModelRenderer(this, 15, 40);
|
||||
s14.addBox(0F, 0F, 0F, 2, 2, 1);
|
||||
s14.setRotationPoint(1F, 15F, -4.5F);
|
||||
s14.setTextureSize(64, 64);
|
||||
s14.mirror = true;
|
||||
setRotation(s14, 0F, 0F, 0F);
|
||||
s15 = new ModelRenderer(this, 30, 37);
|
||||
s15.addBox(0F, 0F, 0F, 1, 1, 1);
|
||||
s15.setRotationPoint(-2.5F, 15.5F, -4.7F);
|
||||
s15.setTextureSize(64, 64);
|
||||
s15.mirror = true;
|
||||
setRotation(s15, 0F, 0F, 0F);
|
||||
s16 = new ModelRenderer(this, 30, 37);
|
||||
s16.addBox(0F, 0F, 0F, 1, 1, 1);
|
||||
s16.setRotationPoint(1.5F, 15.5F, -4.7F);
|
||||
s16.setTextureSize(64, 64);
|
||||
s16.mirror = true;
|
||||
setRotation(s16, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f){
|
||||
s1.render(f);
|
||||
s2.render(f);
|
||||
s3.render(f);
|
||||
s4.render(f);
|
||||
s5.render(f);
|
||||
s6.render(f);
|
||||
s7.render(f);
|
||||
s8.render(f);
|
||||
s9.render(f);
|
||||
s10.render(f);
|
||||
s11.render(f);
|
||||
s12.render(f);
|
||||
s13.render(f);
|
||||
s14.render(f);
|
||||
s15.render(f);
|
||||
s16.render(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "modelSmileyCloud";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesRotate(){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
|||
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
@ -81,7 +82,7 @@ public class BookletUtils{
|
|||
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12+booklet.getFontRenderer().FONT_HEIGHT, 0);
|
||||
|
||||
String version;
|
||||
String playerName = Minecraft.getMinecraft().thePlayer.getCommandSenderName();
|
||||
String playerName = Minecraft.getMinecraft().thePlayer.getName();
|
||||
if(playerName.equals("dqmhose")){
|
||||
version = "Pants Edition";
|
||||
}
|
||||
|
@ -169,10 +170,10 @@ public class BookletUtils{
|
|||
}
|
||||
//Renders the amount of words and chars the book has
|
||||
else{
|
||||
String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", InitBooklet.wordCount);
|
||||
String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", ClientProxy.bookletWordCount);
|
||||
booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0);
|
||||
|
||||
String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfChars", InitBooklet.charCount);
|
||||
String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfChars", ClientProxy.bookletCharCount);
|
||||
booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0);
|
||||
}
|
||||
}
|
||||
|
@ -184,13 +185,16 @@ public class BookletUtils{
|
|||
public static void doHoverTexts(GuiBooklet booklet, int mouseX, int mouseY){
|
||||
//Update all of the buttons' hovering texts
|
||||
for(Object button : booklet.getButtonList()){
|
||||
if(button instanceof GuiButton && ((GuiButton)button).visible && ((GuiButton)button).func_146115_a()){
|
||||
if(button instanceof GuiButton && ((GuiButton)button).visible && ((GuiButton)button).isMouseOver()){
|
||||
if(button instanceof BookmarkButton){
|
||||
((BookmarkButton)button).drawHover(mouseX, mouseY);
|
||||
}
|
||||
else if(button instanceof TexturedButton){
|
||||
booklet.drawHoveringText(((TexturedButton)button).textList, mouseX, mouseY);
|
||||
}
|
||||
else if(button instanceof IndexButton){
|
||||
((IndexButton)button).drawHover(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +210,8 @@ public class BookletUtils{
|
|||
currentEntry.chapters.clear();
|
||||
|
||||
for(IBookletChapter chapter : currentEntry.allChapters){
|
||||
if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(booklet.searchField.getText().toLowerCase(Locale.ROOT))){
|
||||
String searchFieldText = booklet.searchField.getText().toLowerCase(Locale.ROOT);
|
||||
if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(searchFieldText) || getChapterStacksContainString(searchFieldText, chapter)){
|
||||
currentEntry.chapters.add(chapter);
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +223,20 @@ public class BookletUtils{
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean getChapterStacksContainString(String text, IBookletChapter chapter){
|
||||
for(BookletPage page : chapter.getPages()){
|
||||
ItemStack[] pageStacks = page.getItemStacksForPage();
|
||||
if(pageStacks != null){
|
||||
for(ItemStack stack : pageStacks){
|
||||
if(stack.getDisplayName().toLowerCase(Locale.ROOT).contains(text)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void openIndexEntry(GuiBooklet booklet, IBookletEntry entry, int page, boolean resetTextField){
|
||||
booklet.searchField.setVisible(entry instanceof BookletEntryAllSearch);
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.achievement.GuiAchievements;
|
||||
import net.minecraft.stats.StatFileWriter;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
|
||||
/**
|
||||
* (Partially excerpted from Botania by Vazkii with permission, thanks!)
|
||||
|
@ -24,12 +24,17 @@ public class GuiAAAchievements extends GuiAchievements{
|
|||
|
||||
public GuiAAAchievements(GuiScreen screen, StatFileWriter writer){
|
||||
super(screen, writer);
|
||||
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, InitAchievements.pageNumber, 21);
|
||||
try{
|
||||
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, InitAchievements.pageNumber, 20);
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Something went wrong trying to open the Achievements GUI!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
((GuiButton)buttonList.get(1)).displayString = InitAchievements.theAchievementPage.getName();
|
||||
this.buttonList.get(1).displayString = InitAchievements.theAchievementPage.getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
||||
|
@ -34,14 +32,17 @@ import net.minecraft.client.gui.FontRenderer;
|
|||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -90,8 +91,9 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.saveOnClose = saveOnClose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawHoveringText(List list, int x, int y){
|
||||
super.func_146283_a(list, x, y);
|
||||
super.drawHoveringText(list, x, y);
|
||||
}
|
||||
|
||||
public FontRenderer getFontRenderer(){
|
||||
|
@ -116,10 +118,10 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
//So don't fuck with everything unintentionally
|
||||
//
|
||||
//(This fixes your fuckery)
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.scale(1.0F, 1.0F, 1.0F);
|
||||
|
||||
//Draws the Background
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(ClientProxy.jingleAllTheWay ? resLocChristmas : (ClientProxy.pumpkinBlurPumpkinBlur ? resLocHalloween : (ClientProxy.bulletForMyValentine ? resLocValentine : resLoc)));
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
|
@ -181,7 +183,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
else{
|
||||
if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){
|
||||
if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh")));
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh")));
|
||||
ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH");
|
||||
this.hisNameIsAt = 0;
|
||||
}
|
||||
|
@ -196,7 +198,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3){
|
||||
protected void mouseClicked(int par1, int par2, int par3) throws IOException{
|
||||
this.searchField.mouseClicked(par1, par2, par3);
|
||||
//Left mouse button
|
||||
if(par3 == 0 && this.currentEntrySet.chapter != null){
|
||||
|
@ -283,11 +285,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
|
||||
ArrayList updateHover = new ArrayList();
|
||||
if(UpdateChecker.checkFailed){
|
||||
updateHover.add(IChatComponent.Serializer.func_150699_a(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText());
|
||||
}
|
||||
else if(UpdateChecker.needsUpdateNotify){
|
||||
updateHover.add(IChatComponent.Serializer.func_150699_a(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.func_150699_a(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersion)).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString)).getFormattedText());
|
||||
updateHover.add(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.buttonOptions"));
|
||||
}
|
||||
this.buttonUpdate = new TexturedButton(4, this.guiLeft-11, this.guiTop-11, 245, 0, 11, 11, updateHover);
|
||||
|
@ -327,7 +329,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.buttonList.add(this.bookmarkButtons[i]);
|
||||
}
|
||||
|
||||
this.searchField = new GuiTextField(this.fontRendererObj, guiLeft+148, guiTop+162, 66, 10);
|
||||
this.searchField = new GuiTextField(4500, this.fontRendererObj, guiLeft+148, guiTop+162, 66, 10);
|
||||
this.searchField.setMaxStringLength(30);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
this.searchField.setCanLoseFocus(false);
|
||||
|
@ -356,13 +358,13 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
|
||||
@Override
|
||||
//For scrolling through pages
|
||||
public void handleMouseInput(){
|
||||
public void handleMouseInput() throws IOException{
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if(wheel != 0){
|
||||
if(wheel > 0){
|
||||
if(wheel < 0){
|
||||
BookletUtils.handleNextPage(this);
|
||||
}
|
||||
else if(wheel < 0){
|
||||
else if(wheel > 0){
|
||||
BookletUtils.handlePreviousPage(this);
|
||||
}
|
||||
}
|
||||
|
@ -404,8 +406,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
|
||||
@Override
|
||||
public void renderTooltipAndTransferButton(BookletPage from, ItemStack stack, int x, int y, boolean renderTransferButton, boolean mousePressed){
|
||||
boolean flagBefore = this.mc.fontRenderer.getUnicodeFlag();
|
||||
this.mc.fontRenderer.setUnicodeFlag(false);
|
||||
boolean flagBefore = this.mc.fontRendererObj.getUnicodeFlag();
|
||||
this.mc.fontRendererObj.setUnicodeFlag(false);
|
||||
|
||||
List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
|
@ -426,14 +428,14 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
if(mousePressed){
|
||||
BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
|
||||
BookletUtils.openChapter(this, page.getChapter(), page);
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.drawHoveringText(list, x, y);
|
||||
|
||||
this.mc.fontRenderer.setUnicodeFlag(flagBefore);
|
||||
this.mc.fontRendererObj.setUnicodeFlag(flagBefore);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* This file ("GuiBookletStand.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketBookletStandButton;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiBookletStand extends GuiBooklet{
|
||||
|
||||
private GuiButton buttonSetPage;
|
||||
|
||||
private TileEntityBookletStand theStand;
|
||||
|
||||
public GuiBookletStand(TileEntityBase theStand){
|
||||
super(null, false, false);
|
||||
this.theStand = (TileEntityBookletStand)theStand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button){
|
||||
if(button == this.buttonSetPage){
|
||||
PacketHandler.theNetwork.sendToServer(new PacketBookletStandButton(this.theStand.xCoord, this.theStand.yCoord, this.theStand.zCoord, this.theStand.getWorldObj(), Minecraft.getMinecraft().thePlayer, this.currentEntrySet));
|
||||
}
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
//Remove Bookmark Buttons
|
||||
for(GuiButton bookmarkButton : this.bookmarkButtons){
|
||||
bookmarkButton.visible = false;
|
||||
}
|
||||
|
||||
this.buttonSetPage = new GuiButton(-100, this.guiLeft+this.xSize+10, this.guiTop+10, 100, 20, "Set Page"){
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int x, int y){
|
||||
boolean unicodeBefore = mc.fontRenderer.getUnicodeFlag();
|
||||
mc.fontRenderer.setUnicodeFlag(false);
|
||||
super.drawButton(mc, x, y);
|
||||
mc.fontRenderer.setUnicodeFlag(unicodeBefore);
|
||||
}
|
||||
};
|
||||
this.buttonList.add(this.buttonSetPage);
|
||||
|
||||
this.buttonSetPage.visible = Objects.equals(Minecraft.getMinecraft().thePlayer.getCommandSenderName(), this.theStand.assignedPlayer);
|
||||
|
||||
//Open the pages the book was assigned
|
||||
BookletUtils.openIndexEntry(this, this.theStand.assignedEntry.entry, this.theStand.assignedEntry.pageInIndex, true);
|
||||
BookletUtils.openChapter(this, this.theStand.assignedEntry.chapter, this.theStand.assignedEntry.page);
|
||||
}
|
||||
}
|
|
@ -12,8 +12,6 @@ package de.ellpeck.actuallyadditions.mod.booklet;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||
|
@ -40,9 +38,6 @@ import java.util.ArrayList;
|
|||
|
||||
public class InitBooklet{
|
||||
|
||||
public static int wordCount;
|
||||
public static int charCount;
|
||||
|
||||
public static BookletChapter chapterIntro;
|
||||
|
||||
public static void preInit(){
|
||||
|
@ -58,24 +53,22 @@ public class InitBooklet{
|
|||
|
||||
public static void postInit(){
|
||||
initChapters();
|
||||
countWords();
|
||||
}
|
||||
|
||||
private static void initChapters(){
|
||||
//Getting Started
|
||||
chapterIntro = new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
||||
new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
|
||||
new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setNoText().setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, LensNoneRecipeHandler.mainPageRecipes).setNoText()).setSpecial();
|
||||
new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE));
|
||||
new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, LensNoneRecipeHandler.mainPageRecipes).setNoText()).setSpecial().setIncomplete();
|
||||
new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard());
|
||||
new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(7, ItemCrafting.recipeRing).setNoText(), new PageCrafting(8, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(11, ItemCrafting.recipeDough).setNoText(), new PageCrafting(12, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(13, BlockCrafting.recipeIronCase).setNoText()).setImportant();
|
||||
new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.redstone), new PageTextOnly(1));
|
||||
|
||||
//Miscellaneous
|
||||
new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeColorLens), new PageReconstructor(4, LensNoneRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensNoneRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensNoneRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensNoneRecipeHandler.recipeLeather).setNoText()).setImportant();
|
||||
new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensNoneRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeGreenWall).setNoText());
|
||||
new BookletChapter("bookStand", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBookletStand), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBookStand).setPageStacksWildcard());
|
||||
new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", OreGen.QUARTZ_MIN).addTextReplacement("<highest>", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
|
||||
new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText()).setSpecial();
|
||||
new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial().setIncomplete();
|
||||
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
|
||||
ArrayList<BookletPage> lampPages = new ArrayList<BookletPage>();
|
||||
lampPages.add(new PageTextOnly(lampPages.size()+1));
|
||||
|
@ -95,11 +88,11 @@ public class InitBooklet{
|
|||
new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomLiquiface), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomface.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant();
|
||||
new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText());
|
||||
new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
|
||||
new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setSpecial();
|
||||
new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setSpecial().setIncomplete();
|
||||
new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
|
||||
new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText());
|
||||
new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFeeder), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText());
|
||||
new BookletChapter("compost", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemFertilizer)).addTextReplacement("<num>", TileEntityCompost.AMOUNT), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.recipesMashedFood));
|
||||
new BookletChapter("compost", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemFertilizer)).addTextReplacement("<num>", TileEntityCompost.AMOUNT), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.recipesMashedFood)).setIncomplete();
|
||||
new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, ItemCrafting.recipeCrateKeeper), new PageCrafting(3, ItemCrafting.recipeChestToCrateUpgrade));
|
||||
new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockRangedCollector), new PageTextOnly(1).addTextReplacement("<range>", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText());
|
||||
|
||||
|
@ -132,7 +125,7 @@ public class InitBooklet{
|
|||
}
|
||||
new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant();
|
||||
|
||||
new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "pageJamHouse", 150), new PageTextOnly(3));
|
||||
new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "pageJamHouse", 150), new PageTextOnly(3)).setIncomplete();
|
||||
|
||||
ArrayList<BookletPage> potionRingPages = new ArrayList<BookletPage>();
|
||||
potionRingPages.add(new PageTextOnly(potionRingPages.size()+1));
|
||||
|
@ -149,21 +142,4 @@ public class InitBooklet{
|
|||
new BookletChapter("waterRemovalRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemWaterRemovalRing), new PageCrafting(1, ItemCrafting.recipeWaterRing));
|
||||
new BookletChapter("batteries", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemBatteryTriple), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText());
|
||||
}
|
||||
|
||||
private static void countWords(){
|
||||
for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){
|
||||
for(IBookletChapter chapter : entry.getChapters()){
|
||||
for(BookletPage page : chapter.getPages()){
|
||||
if(page.getText() != null){
|
||||
wordCount += page.getText().split(" ").length;
|
||||
charCount += page.getText().length();
|
||||
}
|
||||
}
|
||||
wordCount += chapter.getLocalizedName().split(" ").length;
|
||||
charCount += chapter.getLocalizedName().length();
|
||||
}
|
||||
wordCount += entry.getLocalizedName().split(" ").length;
|
||||
charCount += entry.getLocalizedName().length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,9 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.KeyUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -57,24 +56,24 @@ public class BookmarkButton extends GuiButton{
|
|||
public void drawButton(Minecraft minecraft, int x, int y){
|
||||
if(this.visible){
|
||||
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
if(k == 0){
|
||||
k = 1;
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
int renderHeight = 25;
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 146+(this.assignedEntry.entry == null ? 0 : 16), 194-renderHeight+k*renderHeight, this.width, renderHeight);
|
||||
this.mouseDragged(minecraft, x, y);
|
||||
|
||||
if(this.assignedEntry.entry != null){
|
||||
GL11.glPushMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
AssetUtil.renderStackToGui(this.assignedEntry.chapter != null && this.assignedEntry.chapter.getDisplayItemStack() != null ? this.assignedEntry.chapter.getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), this.xPosition+2, this.yPosition+1, 0.725F);
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,14 @@ package de.ellpeck.actuallyadditions.mod.booklet.button;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class IndexButton extends GuiButton{
|
||||
|
||||
|
@ -31,30 +34,36 @@ public class IndexButton extends GuiButton{
|
|||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){
|
||||
if(this.visible){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition+this.width && mouseY < this.yPosition+this.height;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition+this.width && mouseY < this.yPosition+this.height;
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||
|
||||
int textOffsetX = 0;
|
||||
if(this.chap != null){
|
||||
if(this.chap.getDisplayItemStack() != null){
|
||||
GL11.glPushMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
AssetUtil.renderStackToGui(this.chap.getDisplayItemStack(), this.xPosition-4, this.yPosition, 0.725F);
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
textOffsetX = 10;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.field_146123_n){
|
||||
GL11.glPushMatrix();
|
||||
AssetUtil.drawHorizontalGradientRect(this.xPosition+textOffsetX-1, this.yPosition+this.height-1, this.xPosition+this.gui.getFontRenderer().getStringWidth(this.displayString)+textOffsetX+1, this.yPosition+this.height, 0x80 << 24 | 22271, 22271);
|
||||
GL11.glPopMatrix();
|
||||
if(this.hovered){
|
||||
GlStateManager.pushMatrix();
|
||||
AssetUtil.drawHorizontalGradientRect(this.xPosition+textOffsetX-1, this.yPosition+this.height-1, this.xPosition+this.gui.getFontRenderer().getStringWidth(this.displayString)+textOffsetX+1, this.yPosition+this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
this.gui.getFontRenderer().drawString(this.displayString, this.xPosition+textOffsetX, this.yPosition+(this.height-8)/2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawHover(int mouseX, int mouseY){
|
||||
if(this.chap instanceof BookletChapter && ((BookletChapter)this.chap).isIncomplete){
|
||||
this.gui.drawHoveringText(this.gui.getFontRenderer().listFormattedStringToWidth(EnumChatFormatting.RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".unavailable"), 250), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.button;
|
|||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -47,16 +46,16 @@ public class TexturedButton extends GuiButton{
|
|||
public void drawButton(Minecraft minecraft, int x, int y){
|
||||
if(this.visible){
|
||||
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
if(k == 0){
|
||||
k = 1;
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, this.texturePosX, this.texturePosY-this.height+k*this.height, this.width, this.height);
|
||||
this.mouseDragged(minecraft, x, y);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue