1.7.10 branch created
This commit is contained in:
parent
15af7b8979
commit
d259dd923a
52
build.gradle
52
build.gradle
|
@ -1,39 +1,45 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
mavenCentral()
|
||||
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:2.2-SNAPSHOT'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
version = "1.10.2-v1.5.1"
|
||||
group= "com.legacy.aether"
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.7.10-v1.0.0"
|
||||
group= "com.legacy.aether" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "aether_legacy"
|
||||
|
||||
sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly.
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = "1.6"
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.10.2-12.18.3.2185"
|
||||
runDir = "run"
|
||||
|
||||
mappings = "snapshot_20161111"
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://dvs1.progwml6.com/files/maven'
|
||||
}
|
||||
version = "1.7.10-10.13.4.1558-1.7.10"
|
||||
runDir = "eclipse"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "mezz.jei:jei_1.10.2:+"
|
||||
// you may put jars on which you depend on in ./libs
|
||||
// or you may define them like so..
|
||||
//compile "some.group:artifact:version:classifier"
|
||||
//compile "some.group:artifact:version"
|
||||
|
||||
// real examples
|
||||
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
||||
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
||||
|
||||
// for more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
}
|
||||
|
||||
processResources
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
#Wed Jul 02 15:54:47 CDT 2014
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
|
||||
|
|
|
@ -1,79 +1,76 @@
|
|||
package com.legacy.aether;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.entities.AetherEntities;
|
||||
import com.legacy.aether.entities.EntitiesAether;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.networking.AetherNetworkingManager;
|
||||
import com.legacy.aether.player.capability.PlayerAetherManager;
|
||||
import com.legacy.aether.network.AetherNetwork;
|
||||
import com.legacy.aether.player.PlayerAetherEvents;
|
||||
import com.legacy.aether.player.perks.AetherRankings;
|
||||
import com.legacy.aether.registry.AetherRegistries;
|
||||
import com.legacy.aether.registry.achievements.AchievementsAether;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
import com.legacy.aether.registry.sounds.SoundsAether;
|
||||
import com.legacy.aether.tile_entities.AetherTileEntities;
|
||||
import com.legacy.aether.tileentity.AetherTileEntities;
|
||||
import com.legacy.aether.world.AetherWorld;
|
||||
|
||||
@Mod(name = "Aether Legacy", modid = Aether.modid, version = "1.10.2-v1.6", acceptedMinecraftVersions = "1.10.2")
|
||||
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.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(modid = Aether.MOD_ID, version = "v1.0.0")
|
||||
public class Aether
|
||||
{
|
||||
|
||||
public static final String modid = "aether_legacy";
|
||||
public static final String MOD_ID = "aether_legacy";
|
||||
|
||||
@Instance(Aether.modid)
|
||||
@Instance(Aether.MOD_ID)
|
||||
public static Aether instance;
|
||||
|
||||
@SidedProxy(modId = Aether.modid, clientSide = "com.legacy.aether.client.ClientProxy", serverSide = "com.legacy.aether.CommonProxy")
|
||||
@SidedProxy(clientSide = "com.legacy.aether.client.ClientProxy", serverSide = "com.legacy.aether.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@EventHandler
|
||||
public void preInitialization(FMLPreInitializationEvent event)
|
||||
{
|
||||
AetherConfig.init(event.getModConfigurationDirectory());
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
AetherRankings.initialization();
|
||||
AetherNetwork.preInitialization();
|
||||
AetherConfig.init(event.getModConfigurationDirectory());
|
||||
}
|
||||
|
||||
AetherNetworkingManager.preInitialization();
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
BlocksAether.initialization();
|
||||
ItemsAether.initialization();
|
||||
AetherRegistries.register();
|
||||
EntitiesAether.initialization();
|
||||
AetherCreativeTabs.initialization();
|
||||
AetherTileEntities.initialization();
|
||||
AetherWorld.initialization();
|
||||
AchievementsAether.initialization();
|
||||
|
||||
proxy.preInitialization();
|
||||
}
|
||||
proxy.init();
|
||||
|
||||
@EventHandler
|
||||
public void initialization(FMLInitializationEvent event)
|
||||
{
|
||||
PlayerAetherManager.initialization();
|
||||
SoundsAether.initialization();
|
||||
AetherEntities.initialization();
|
||||
BlocksAether.initialization();
|
||||
ItemsAether.initialization();
|
||||
AetherRegistries.initialization();
|
||||
AchievementsAether.initialization();
|
||||
AetherTileEntities.initialization();
|
||||
AetherCreativeTabs.initialization();
|
||||
AetherWorld.initialization();
|
||||
|
||||
proxy.initialization();
|
||||
|
||||
CommonProxy.registerEvent(new AetherEventHandler());
|
||||
}
|
||||
CommonProxy.registerEvent(new PlayerAetherEvents());
|
||||
CommonProxy.registerEvent(new AetherEventHandler());
|
||||
}
|
||||
|
||||
public static ResourceLocation locate(String location)
|
||||
{
|
||||
return new ResourceLocation(modid, location);
|
||||
return new ResourceLocation(MOD_ID, location);
|
||||
}
|
||||
|
||||
public static String find(String location)
|
||||
{
|
||||
return modAddress() + location;
|
||||
}
|
||||
|
||||
public static String modAddress()
|
||||
{
|
||||
return modid + ":";
|
||||
return MOD_ID + ":";
|
||||
}
|
||||
|
||||
public static String doubleDropNotifier()
|
||||
{
|
||||
return "double_drops";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,17 +8,23 @@ import net.minecraftforge.common.config.Configuration;
|
|||
public class AetherConfig
|
||||
{
|
||||
|
||||
private static boolean christmas_content;
|
||||
private static int max_life_shards;
|
||||
|
||||
private static boolean christmas_content, tallgrass;
|
||||
|
||||
private static int aether_biome_id, aether_dimension_id;
|
||||
|
||||
private static boolean disable_trivia;
|
||||
private static boolean disable_trivia, old_mobs;
|
||||
|
||||
private static boolean skyrootBucketOnly;
|
||||
|
||||
private static boolean floating_block_collision;
|
||||
|
||||
private static int travel_dimension;
|
||||
|
||||
public static void init(File location)
|
||||
{
|
||||
File newFile = new File(location + "/aether" + "/Aether_Legacy.cfg");
|
||||
File newFile = new File(location + "/aether" + "/AetherI.cfg");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -34,14 +40,21 @@ public class AetherConfig
|
|||
config.load();
|
||||
|
||||
christmas_content = config.get("Aether World Generation", "Christmas Content", false).getBoolean(false);
|
||||
tallgrass = config.get("Aether World Generation", "Enable Tall Grass", false).getBoolean(false);
|
||||
|
||||
aether_dimension_id = config.get("World Identification", "Aether Dimension ID", 4).getInt(4);
|
||||
aether_biome_id = config.get("World Identification", "Aether Biome ID", 127).getInt(127);
|
||||
|
||||
skyrootBucketOnly = config.get("Misc", "Activate portal with only Skyroot bucket", false).getBoolean(false);
|
||||
travel_dimension = config.get("Misc", "Dimension below aether", 0).getInt(0);
|
||||
floating_block_collision = config.get("Misc", "Floating block collision", true).getBoolean(true);
|
||||
|
||||
disable_trivia = config.get("Trivia", "Disable random trivia", false).getBoolean(false);
|
||||
|
||||
old_mobs = config.get("Misc", "Enable Legacy Visuals", false).getBoolean(false);
|
||||
|
||||
max_life_shards = config.get("Gameplay", "Max Life Shards", 10).getInt(10);
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
@ -55,16 +68,41 @@ public class AetherConfig
|
|||
return AetherConfig.aether_biome_id;
|
||||
}
|
||||
|
||||
public static int getMaxLifeShards()
|
||||
{
|
||||
return AetherConfig.max_life_shards;
|
||||
}
|
||||
|
||||
public static int getTravelDimensionID()
|
||||
{
|
||||
return AetherConfig.travel_dimension;
|
||||
}
|
||||
|
||||
public static boolean shouldFloatWithBlock()
|
||||
{
|
||||
return AetherConfig.floating_block_collision;
|
||||
}
|
||||
|
||||
public static boolean triviaDisabled()
|
||||
{
|
||||
return AetherConfig.disable_trivia;
|
||||
}
|
||||
|
||||
public static boolean oldMobsEnabled()
|
||||
{
|
||||
return AetherConfig.old_mobs;
|
||||
}
|
||||
|
||||
public static boolean shouldLoadHolidayContent()
|
||||
{
|
||||
return AetherConfig.christmas_content;
|
||||
}
|
||||
|
||||
|
||||
public static boolean tallgrassEnabled()
|
||||
{
|
||||
return AetherConfig.tallgrass;
|
||||
}
|
||||
|
||||
public static boolean activateOnlyWithSkyroot()
|
||||
{
|
||||
return AetherConfig.skyrootBucketOnly;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.legacy.aether;
|
||||
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -9,52 +10,54 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.blocks.portal.BlockAetherPortal;
|
||||
import com.legacy.aether.entities.EntitiesAether;
|
||||
import com.legacy.aether.entities.bosses.EntityValkyrie;
|
||||
import com.legacy.aether.entities.passive.mountable.EntityFlyingCow;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.items.dungeon.ItemDungeonKey;
|
||||
import com.legacy.aether.items.util.EnumSkyrootBucketType;
|
||||
import com.legacy.aether.items.weapons.ItemSkyrootSword;
|
||||
import com.legacy.aether.registry.achievements.AchievementsAether;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
|
||||
public class AetherEventHandler
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
public void checkBlockBannedEvent(RightClickBlock event)
|
||||
public void checkBlockBannedEvent(PlayerInteractEvent event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack currentStack = event.getItemStack();
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
|
||||
if (player.dimension == AetherConfig.getAetherDimensionID())
|
||||
{
|
||||
if (currentStack != null && (currentStack.getItem() == Items.FLINT_AND_STEEL || currentStack.getItem() == Item.getItemFromBlock(Blocks.TORCH) || currentStack.getItem() == Items.FIRE_CHARGE))
|
||||
if (currentStack != null)
|
||||
{
|
||||
for (int i = 0; i < 10; ++i)
|
||||
if (currentStack.getItem() == Items.flint_and_steel || currentStack.getItem() == Item.getItemFromBlock(Blocks.torch) || currentStack.getItem() == Items.fire_charge)
|
||||
{
|
||||
event.getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, event.getHitVec().xCoord, event.getHitVec().yCoord, event.getHitVec().zCoord, 0.0D, 0.0D, 0.0D, new int [] {});
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
event.world.spawnParticle("smoke", event.x, event.y, event.z, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
event.setCanceled(true);
|
||||
|
||||
}
|
||||
else if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.BED)
|
||||
else if (event.world.getBlock(event.x, event.y, event.z) == Blocks.bed)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
@ -62,22 +65,67 @@ public class AetherEventHandler
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMilkedCow(EntityInteractSpecific event)
|
||||
public void onEntityInteract(EntityInteractEvent event)
|
||||
{
|
||||
if (event.getTarget() instanceof EntityCow || event.getTarget() instanceof EntityFlyingCow)
|
||||
if (event.target instanceof EntityAgeable)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack heldItem = player.getHeldItem(event.getHand());
|
||||
ItemStack itemstack = event.entityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (heldItem != null && heldItem.getItem() == ItemsAether.skyroot_bucket && EnumSkyrootBucketType.getType(heldItem.getMetadata()) == EnumSkyrootBucketType.Empty)
|
||||
{
|
||||
if (--heldItem.stackSize == 0)
|
||||
if (itemstack != null && itemstack.getItem() == ItemsAether.aether_spawn_egg)
|
||||
{
|
||||
if (!event.entityPlayer.worldObj.isRemote)
|
||||
{
|
||||
player.setHeldItem(event.getHand(), new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta));
|
||||
Class<?> oclass = EntitiesAether.getClassFromID(itemstack.getItemDamage());
|
||||
|
||||
if (oclass != null && oclass.isAssignableFrom(this.getClass()))
|
||||
{
|
||||
EntityAgeable entityageable = ((EntityAgeable)event.target).createChild((EntityAgeable) event.target);
|
||||
|
||||
if (entityageable != null)
|
||||
{
|
||||
entityageable.setGrowingAge(-24000);
|
||||
entityageable.setLocationAndAngles(event.target.posX, event.target.posY, event.target.posZ, 0.0F, 0.0F);
|
||||
event.entityPlayer.worldObj.spawnEntityInWorld(entityageable);
|
||||
|
||||
if (itemstack.hasDisplayName())
|
||||
{
|
||||
entityageable.setCustomNameTag(itemstack.getDisplayName());
|
||||
}
|
||||
|
||||
if (!event.entityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
event.entityPlayer.inventory.setInventorySlotContents(event.entityPlayer.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.target instanceof EntityCow || event.target instanceof EntityFlyingCow)
|
||||
{
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (heldItem != null && heldItem.getItem() == ItemsAether.skyroot_bucket && EnumSkyrootBucketType.getType(heldItem.getItemDamage()) == EnumSkyrootBucketType.Empty)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
|
||||
if (heldItem.stackSize <= 0)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta));
|
||||
}
|
||||
else if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta)))
|
||||
{
|
||||
player.dropItem(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta), false);
|
||||
player.dropPlayerItemWithRandomChoice(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,44 +134,65 @@ public class AetherEventHandler
|
|||
@SubscribeEvent
|
||||
public void onFillBucket(FillBucketEvent event)
|
||||
{
|
||||
ItemStack stack = event.getEmptyBucket();
|
||||
World worldObj = event.world;
|
||||
MovingObjectPosition target = event.target;
|
||||
ItemStack stack = event.current;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
|
||||
if (stack == null)
|
||||
boolean isWater = (!AetherConfig.activateOnlyWithSkyroot() && stack.getItem() == Items.water_bucket) || (stack.getItem() == ItemsAether.skyroot_bucket && stack.getItemDamage() == 1);
|
||||
boolean isLava = stack.getItem() == Items.lava_bucket;
|
||||
|
||||
boolean validDimension = (player.dimension == AetherConfig.getTravelDimensionID() || player.dimension == AetherConfig.getAetherDimensionID());
|
||||
|
||||
if (target != null && target.typeOfHit == MovingObjectType.BLOCK && validDimension)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int i = target.blockX;
|
||||
int j = target.blockY;
|
||||
int k = target.blockZ;
|
||||
|
||||
World worldObj = event.getWorld();
|
||||
RayTraceResult target = event.getTarget();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (target.sideHit == 0)
|
||||
{
|
||||
--j;
|
||||
}
|
||||
|
||||
boolean isWater = (!AetherConfig.activateOnlyWithSkyroot() && stack.getItem() == Items.WATER_BUCKET) || stack.getItem() == ItemsAether.skyroot_bucket && stack.getMetadata() == 1;
|
||||
boolean isLava = stack.getItem() == Items.LAVA_BUCKET;
|
||||
if (target.sideHit == 1)
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
boolean validDimension = (player.dimension == 0 || player.dimension == AetherConfig.getAetherDimensionID());
|
||||
if (target.sideHit == 2)
|
||||
{
|
||||
--k;
|
||||
}
|
||||
|
||||
if (target != null && target.typeOfHit == Type.BLOCK && validDimension)
|
||||
{
|
||||
BlockPos hitPos = target.getBlockPos().offset(target.sideHit);
|
||||
if (target.sideHit == 3)
|
||||
{
|
||||
++k;
|
||||
}
|
||||
|
||||
if (target.sideHit == 4)
|
||||
{
|
||||
--i;
|
||||
}
|
||||
|
||||
if (isWater)
|
||||
{
|
||||
if (((BlockAetherPortal) BlocksAether.aether_portal).trySpawnPortal(worldObj, hitPos))
|
||||
if (((BlockAetherPortal) BlocksAether.aether_portal).trySpawnPortal(worldObj, i, j, k))
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (stack.getItem() == ItemsAether.skyroot_bucket || stack.getItemDamage() == 1)
|
||||
if (stack.getItem() == ItemsAether.skyroot_bucket && stack.getItemDamage() == 1)
|
||||
{
|
||||
event.setFilledBucket(new ItemStack(ItemsAether.skyroot_bucket));
|
||||
event.result = new ItemStack(ItemsAether.skyroot_bucket);
|
||||
}
|
||||
|
||||
if (stack.getItem() == Items.WATER_BUCKET)
|
||||
if (stack.getItem() == Items.water_bucket)
|
||||
{
|
||||
event.setFilledBucket(new ItemStack(Items.BUCKET));
|
||||
event.result = new ItemStack(Items.bucket);
|
||||
}
|
||||
}
|
||||
|
||||
event.setResult(Result.ALLOW);
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,81 +203,59 @@ public class AetherEventHandler
|
|||
return;
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(hitPos))
|
||||
if (worldObj.isAirBlock(i, j, k))
|
||||
{
|
||||
worldObj.setBlockState(hitPos, BlocksAether.aerogel.getDefaultState());
|
||||
worldObj.setBlock(i, j, k, BlocksAether.aerogel);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
event.setFilledBucket(new ItemStack(Items.BUCKET));
|
||||
event.result = new ItemStack(Items.bucket);
|
||||
}
|
||||
}
|
||||
|
||||
event.setResult(Result.ALLOW);
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemPickedUp(EntityItemPickupEvent event)
|
||||
{
|
||||
if (event.getItem().getEntityItem() != null && event.getItem().getEntityItem().getItem() == Item.getItemFromBlock(BlocksAether.aether_log))
|
||||
{
|
||||
event.getEntityPlayer().addStat(AchievementList.MINE_WOOD);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCrafting(ItemCraftedEvent event)
|
||||
{
|
||||
EntityPlayer player = event.player;
|
||||
ItemStack stack = event.crafting;
|
||||
|
||||
if (stack.getItem() == ItemsAether.holystone_pickaxe)
|
||||
if (this.isGravititeTool(event.crafting.getItem()))
|
||||
{
|
||||
player.addStat(AchievementList.BUILD_BETTER_PICKAXE);
|
||||
event.player.triggerAchievement(AchievementsAether.grav_tools);
|
||||
}
|
||||
|
||||
if (stack.getItem() == ItemsAether.skyroot_pickaxe)
|
||||
else if (event.crafting.getItem() == Item.getItemFromBlock(BlocksAether.enchanter))
|
||||
{
|
||||
player.addStat(AchievementList.BUILD_PICKAXE);
|
||||
}
|
||||
|
||||
if (stack.getItem() == ItemsAether.skyroot_sword)
|
||||
{
|
||||
player.addStat(AchievementList.BUILD_SWORD);
|
||||
}
|
||||
|
||||
if (stack.getItem() == Item.getItemFromBlock(BlocksAether.enchanter))
|
||||
{
|
||||
player.addStat(AchievementsAether.enchanter);
|
||||
}
|
||||
|
||||
if (isGravititeTool(stack.getItem()))
|
||||
{
|
||||
player.addStat(AchievementsAether.grav_tools);
|
||||
event.player.triggerAchievement(AchievementsAether.enchanter);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDropLoot(LivingDropsEvent event)
|
||||
{
|
||||
if (event.getSource() instanceof EntityDamageSource)
|
||||
if (event.source instanceof EntityDamageSource)
|
||||
{
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
EntityDamageSource source = (EntityDamageSource) event.getSource();
|
||||
EntityLivingBase entity = event.entityLiving;
|
||||
EntityDamageSource source = (EntityDamageSource) event.source;
|
||||
|
||||
if (source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) source.getEntity();
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
|
||||
if (currentItem != null && currentItem.getItem() instanceof ItemSkyrootSword && !(entity instanceof EntityPlayer) && !(entity instanceof EntityWither))
|
||||
if (currentItem != null && currentItem.getItem() instanceof ItemSkyrootSword && !(entity instanceof EntityPlayer) && !(entity instanceof EntityWither) && !(entity instanceof EntityValkyrie))
|
||||
{
|
||||
for (EntityItem items : event.getDrops())
|
||||
for (EntityItem items : event.drops)
|
||||
{
|
||||
EntityItem item = new EntityItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, items.getEntityItem());
|
||||
entity.worldObj.spawnEntityInWorld(item);
|
||||
ItemStack stack = items.getEntityItem();
|
||||
|
||||
if (!(stack.getItem() instanceof ItemDungeonKey) && stack.getItem() != ItemsAether.victory_medal && stack.getItem() != Items.skull)
|
||||
{
|
||||
EntityItem item = new EntityItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, items.getEntityItem());
|
||||
|
||||
entity.worldObj.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,42 @@
|
|||
package com.legacy.aether;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class CommonProxy
|
||||
public class CommonProxy
|
||||
{
|
||||
|
||||
public void preInitialization() { }
|
||||
public static int berryBushRenderID;
|
||||
|
||||
public void initialization() { }
|
||||
public static int treasureChestRenderID;
|
||||
|
||||
public EntityPlayer getThePlayer() { return null; }
|
||||
public static int aetherFlowerRenderID;
|
||||
|
||||
public void sendMessage(EntityPlayer player, String message) { }
|
||||
public void init()
|
||||
{
|
||||
|
||||
public void spawnBlockBrokenFX(IBlockState state, BlockPos pos) { }
|
||||
}
|
||||
|
||||
public void spawnSmoke(World world, BlockPos pos) {}
|
||||
public void openSunAltar()
|
||||
{
|
||||
|
||||
public void openSunAltar() {}
|
||||
}
|
||||
|
||||
public void sendMessage(EntityPlayer player, String text)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void registerEvent(Object event)
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(event);
|
||||
MinecraftForge.EVENT_BUS.register(event);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +1,45 @@
|
|||
package com.legacy.aether.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
|
||||
import net.minecraftforge.fml.common.registry.PersistentRegistryManager;
|
||||
|
||||
import com.legacy.aether.api.accessories.AetherAccessory;
|
||||
import com.legacy.aether.api.enchantments.AetherEnchantment;
|
||||
import com.legacy.aether.api.enchantments.AetherEnchantmentFuel;
|
||||
import com.legacy.aether.api.freezables.AetherFreezable;
|
||||
import com.legacy.aether.api.freezables.AetherFreezableFuel;
|
||||
import com.legacy.aether.api.moa.AetherMoaType;
|
||||
import com.legacy.aether.api.player.IPlayerAether;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class AetherAPI
|
||||
{
|
||||
|
||||
private final FMLControlledNamespacedRegistry<AetherAccessory> iAccessoryRegistry;
|
||||
private final FMLControlledNamespacedRegistry<AetherEnchantment> iEnchantmentRegistry;
|
||||
private final FMLControlledNamespacedRegistry<AetherEnchantmentFuel> iEnchantmentFuelRegistry;
|
||||
private final FMLControlledNamespacedRegistry<AetherFreezable> iFreezableRegistry;
|
||||
private final FMLControlledNamespacedRegistry<AetherFreezableFuel> iFreezableFuelRegistry;
|
||||
private final FMLControlledNamespacedRegistry<AetherMoaType> iMoaTypeRegistry;
|
||||
private static final HashMap<ResourceLocation, AetherAccessory> iAccessoryRegistry = new HashMap<ResourceLocation, AetherAccessory>(4096);
|
||||
private static final HashMap<ResourceLocation, AetherEnchantment> iEnchantmentRegistry = new HashMap<ResourceLocation, AetherEnchantment>(4096);
|
||||
private static final HashMap<ResourceLocation, AetherEnchantmentFuel> iEnchantmentFuelRegistry = new HashMap<ResourceLocation, AetherEnchantmentFuel>(4096);
|
||||
private static final HashMap<ResourceLocation, AetherFreezable> iFreezableRegistry = new HashMap<ResourceLocation, AetherFreezable>(4096);
|
||||
private static final HashMap<ResourceLocation, AetherFreezableFuel> iFreezableFuelRegistry = new HashMap<ResourceLocation, AetherFreezableFuel>(4096);
|
||||
private static final HashMap<ResourceLocation, AetherMoaType> iMoaTypeRegistry = new HashMap<ResourceLocation, AetherMoaType>(4096);
|
||||
|
||||
private static final int MAX_REGISTRY_ID = Short.MAX_VALUE - 1;
|
||||
|
||||
private static final AetherAPI instance = new AetherAPI();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public AetherAPI()
|
||||
{
|
||||
this.iAccessoryRegistry = PersistentRegistryManager.createRegistry(new ResourceLocation("aetherAPI:accessories"), AetherAccessory.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
|
||||
this.iEnchantmentRegistry = PersistentRegistryManager.createRegistry(new ResourceLocation("aetherAPI:enchantments"), AetherEnchantment.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
|
||||
this.iEnchantmentFuelRegistry = PersistentRegistryManager.createRegistry(new ResourceLocation("aetherAPI:enchantment_fuels"), AetherEnchantmentFuel.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
|
||||
this.iFreezableRegistry = PersistentRegistryManager.createRegistry(new ResourceLocation("aetherAPI:freezables"), AetherFreezable.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
|
||||
this.iFreezableFuelRegistry = PersistentRegistryManager.createRegistry(new ResourceLocation("aetherAPI:freezable_fuels"), AetherFreezableFuel.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
|
||||
this.iMoaTypeRegistry = PersistentRegistryManager.createRegistry(new ResourceLocation("aetherAPI:moa_types"), AetherMoaType.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
|
||||
}
|
||||
public static final IPlayerAether get(EntityPlayer playerIn)
|
||||
{
|
||||
return (IPlayerAether) playerIn.getExtendedProperties("aether_legacy:player_aether");
|
||||
}
|
||||
|
||||
public AetherAccessory register(AetherAccessory type)
|
||||
public AetherAccessory register(AetherAccessory type)
|
||||
{
|
||||
ItemStack stack = type.getAccessoryStack();
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()));
|
||||
|
||||
this.iAccessoryRegistry.register(type.setRegistryName(registryName));
|
||||
iAccessoryRegistry.put(registryName, (AetherAccessory) type.setRegistryName(registryName));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
@ -53,9 +47,9 @@ public class AetherAPI
|
|||
public AetherEnchantment register(AetherEnchantment type)
|
||||
{
|
||||
ItemStack stack = type.getInput();
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()));
|
||||
|
||||
this.iEnchantmentRegistry.register(type.setRegistryName(registryName));
|
||||
iEnchantmentRegistry.put(registryName, (AetherEnchantment) type.setRegistryName(registryName));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
@ -63,9 +57,9 @@ public class AetherAPI
|
|||
public AetherEnchantmentFuel register(AetherEnchantmentFuel type)
|
||||
{
|
||||
ItemStack stack = type.getFuelStack();
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()));
|
||||
|
||||
this.iEnchantmentFuelRegistry.register(type.setRegistryName(registryName));
|
||||
iEnchantmentFuelRegistry.put(registryName, (AetherEnchantmentFuel) type.setRegistryName(registryName));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
@ -73,9 +67,9 @@ public class AetherAPI
|
|||
public AetherFreezable register(AetherFreezable type)
|
||||
{
|
||||
ItemStack stack = type.getInput();
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()));
|
||||
|
||||
this.iFreezableRegistry.register(type.setRegistryName(registryName));
|
||||
iFreezableRegistry.put(registryName, (AetherFreezable) type.setRegistryName(registryName));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
@ -83,128 +77,113 @@ public class AetherAPI
|
|||
public AetherFreezableFuel register(AetherFreezableFuel type)
|
||||
{
|
||||
ItemStack stack = type.getFuelStack();
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()));
|
||||
|
||||
this.iFreezableFuelRegistry.register(type.setRegistryName(registryName));
|
||||
iFreezableFuelRegistry.put(registryName, (AetherFreezableFuel) type.setRegistryName(registryName));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public AetherMoaType register(String modId, String name, AetherMoaType type)
|
||||
{
|
||||
this.iMoaTypeRegistry.register(type.setRegistryName(modId, name));
|
||||
iMoaTypeRegistry.put(new ResourceLocation(modId, name), (AetherMoaType) type.setRegistryName(modId, name));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public AetherMoaType register(ResourceLocation registryName, AetherMoaType type)
|
||||
{
|
||||
this.iMoaTypeRegistry.register(type.setRegistryName(registryName));
|
||||
iMoaTypeRegistry.put(registryName, (AetherMoaType) type.setRegistryName(registryName));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isAccessory(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iAccessoryRegistry.containsKey(registryName);
|
||||
return iAccessoryRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public AetherAccessory getAccessory(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iAccessoryRegistry.getObject(registryName);
|
||||
return iAccessoryRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public boolean hasEnchantment(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iEnchantmentRegistry.containsKey(registryName);
|
||||
return iEnchantmentRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public AetherEnchantment getEnchantment(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iEnchantmentRegistry.getObject(registryName);
|
||||
return iEnchantmentRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public boolean isEnchantmentFuel(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iEnchantmentFuelRegistry.containsKey(registryName);
|
||||
return iEnchantmentFuelRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public AetherEnchantmentFuel getEnchantmentFuel(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iEnchantmentFuelRegistry.getObject(registryName);
|
||||
return iEnchantmentFuelRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public boolean hasFreezable(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iFreezableRegistry.containsKey(registryName);
|
||||
return iFreezableRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public AetherFreezable getFreezable(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iFreezableRegistry.getObject(registryName);
|
||||
return iFreezableRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public boolean isFreezableFuel(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iFreezableFuelRegistry.containsKey(registryName);
|
||||
return iFreezableFuelRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public AetherFreezableFuel getFreezableFuel(ItemStack stack)
|
||||
{
|
||||
ResourceLocation registryName = new ResourceLocation(stack.getItem().getRegistryName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getMetadata()));
|
||||
|
||||
return this.iFreezableFuelRegistry.getObject(registryName);
|
||||
return iFreezableFuelRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())));
|
||||
}
|
||||
|
||||
public List<AetherEnchantment> getEnchantmentValues()
|
||||
public List<AetherEnchantment> getEnchantmentValues()
|
||||
{
|
||||
return this.iEnchantmentRegistry.getValues();
|
||||
return new ArrayList<AetherEnchantment>(iEnchantmentRegistry.values());
|
||||
}
|
||||
|
||||
public List<AetherFreezable> getFreezableValues()
|
||||
{
|
||||
return this.iFreezableRegistry.getValues();
|
||||
return new ArrayList<AetherFreezable>(iFreezableRegistry.values());
|
||||
}
|
||||
|
||||
public List<AetherMoaType> getMoaTypeValues()
|
||||
{
|
||||
return new ArrayList<AetherMoaType>(iMoaTypeRegistry.values());
|
||||
}
|
||||
|
||||
public int getMoaTypeId(AetherMoaType type)
|
||||
{
|
||||
return this.iMoaTypeRegistry.getId(type);
|
||||
return this.getMoaTypeValues().indexOf(type);
|
||||
}
|
||||
|
||||
public AetherMoaType getMoaType(int id)
|
||||
{
|
||||
return this.iMoaTypeRegistry.getObjectById(id);
|
||||
return this.getMoaTypeValues().get(id);
|
||||
}
|
||||
|
||||
public AetherMoaType getRandomMoaType()
|
||||
{
|
||||
return this.iMoaTypeRegistry.getRandomObject(new Random());
|
||||
return this.getMoaTypeValues().get(new Random().nextInt(this.getMoaTypeSize()));
|
||||
}
|
||||
|
||||
public int getMoaTypeSize()
|
||||
{
|
||||
return this.iMoaTypeRegistry.getEntries().size();
|
||||
return this.getMoaTypeValues().size();
|
||||
}
|
||||
|
||||
public static AetherAPI getInstance()
|
||||
public static AetherAPI instance()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.legacy.aether.api;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RegistryEntry
|
||||
{
|
||||
|
||||
private ResourceLocation location;
|
||||
|
||||
public RegistryEntry setRegistryName(String modid, String location)
|
||||
{
|
||||
this.location = new ResourceLocation(modid, location);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegistryEntry setRegistryName(String location)
|
||||
{
|
||||
this.location = new ResourceLocation(location);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegistryEntry setRegistryName(ResourceLocation location)
|
||||
{
|
||||
this.location = location;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResourceLocation getRegistryName()
|
||||
{
|
||||
return this.location;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,17 @@
|
|||
package com.legacy.aether.api.accessories;
|
||||
|
||||
import net.minecraft.util.ObjectIntIdentityMap;
|
||||
|
||||
public enum AccessoryType
|
||||
{
|
||||
RING("Ring", 11, 3),
|
||||
PENDANT("Pendant", 16, 7),
|
||||
CAPE("Cape", 15, 5),
|
||||
SHIELD("Shield", 13, 0),
|
||||
GLOVE("Gloves", 10, 0),
|
||||
MISC("Miscellaneous", 10, 0);
|
||||
RING("ring", 11, 3),
|
||||
EXTRA_RING("ring", 11, 3),
|
||||
PENDANT("pendant", 16, 7),
|
||||
CAPE("cape", 15, 5),
|
||||
SHIELD("shield", 13, 0),
|
||||
GLOVES("gloves", 10, 0),
|
||||
MISC("misc", 10, 0),
|
||||
EXTRA_MISC("misc", 10, 0);
|
||||
|
||||
private int maxDamage, damagedReduced;
|
||||
|
||||
|
@ -35,4 +39,21 @@ public enum AccessoryType
|
|||
return this.displayName;
|
||||
}
|
||||
|
||||
public static ObjectIntIdentityMap createCompleteList()
|
||||
{
|
||||
ObjectIntIdentityMap identityMap = new ObjectIntIdentityMap();
|
||||
|
||||
identityMap.func_148746_a(PENDANT, 0);
|
||||
identityMap.func_148746_a(CAPE, 1);
|
||||
identityMap.func_148746_a(SHIELD, 2);
|
||||
identityMap.func_148746_a(MISC, 3);
|
||||
identityMap.func_148746_a(RING, 4);
|
||||
identityMap.func_148746_a(EXTRA_RING, 5);
|
||||
identityMap.func_148746_a(GLOVES, 6);
|
||||
identityMap.func_148746_a(EXTRA_MISC, 7);
|
||||
|
||||
return identityMap;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,20 @@
|
|||
package com.legacy.aether.api.accessories;
|
||||
|
||||
import com.legacy.aether.api.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AetherAccessory extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherAccessory>
|
||||
public class AetherAccessory extends RegistryEntry
|
||||
{
|
||||
|
||||
private ItemStack accessoryStack;
|
||||
|
||||
private AccessoryType accessoryType;
|
||||
|
||||
private AccessoryType extraType;
|
||||
|
||||
public AetherAccessory(Block item, AccessoryType type)
|
||||
{
|
||||
this(new ItemStack(item), type);
|
||||
|
@ -25,6 +29,9 @@ public class AetherAccessory extends net.minecraftforge.fml.common.registry.IFor
|
|||
{
|
||||
this.accessoryType = type;
|
||||
this.accessoryStack = stack;
|
||||
this.extraType = type == AccessoryType.RING ? AccessoryType.EXTRA_RING : type == AccessoryType.MISC ? AccessoryType.EXTRA_MISC : null;
|
||||
|
||||
this.setRegistryName(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()));
|
||||
}
|
||||
|
||||
public AccessoryType getAccessoryType()
|
||||
|
@ -32,6 +39,11 @@ public class AetherAccessory extends net.minecraftforge.fml.common.registry.IFor
|
|||
return this.accessoryType;
|
||||
}
|
||||
|
||||
public AccessoryType getExtraType()
|
||||
{
|
||||
return this.extraType;
|
||||
}
|
||||
|
||||
public ItemStack getAccessoryStack()
|
||||
{
|
||||
return this.accessoryStack;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.legacy.aether.api.enchantments;
|
||||
|
||||
import com.legacy.aether.api.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AetherEnchantment extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherEnchantment>
|
||||
public class AetherEnchantment extends RegistryEntry
|
||||
{
|
||||
|
||||
public int timeRequired;
|
||||
|
@ -61,6 +63,8 @@ public class AetherEnchantment extends net.minecraftforge.fml.common.registry.IF
|
|||
this.input = input;
|
||||
this.output = output;
|
||||
this.timeRequired = timeRequired;
|
||||
|
||||
this.setRegistryName(input.getItem().getUnlocalizedName().toString() + "_meta_" + (input.isItemStackDamageable() ? 0 : input.getItemDamage()));
|
||||
}
|
||||
|
||||
public int getTimeRequired()
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.legacy.aether.api.enchantments;
|
||||
|
||||
import com.legacy.aether.api.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AetherEnchantmentFuel extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherEnchantmentFuel>
|
||||
public class AetherEnchantmentFuel extends RegistryEntry
|
||||
{
|
||||
|
||||
public int timeGiven;
|
||||
|
@ -25,6 +27,8 @@ public class AetherEnchantmentFuel extends net.minecraftforge.fml.common.registr
|
|||
{
|
||||
this.timeGiven = timeGiven;
|
||||
this.fuelStack = fuelStack;
|
||||
|
||||
this.setRegistryName(fuelStack.getItem().getUnlocalizedName().toString() + "_meta_" + (fuelStack.isItemStackDamageable() ? 0 : fuelStack.getItemDamage()));
|
||||
}
|
||||
|
||||
public int getTimeGiven()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.legacy.aether.api.events.accessories;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import com.legacy.aether.api.accessories.AetherAccessory;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class AetherAccessoryEvent extends Event
|
||||
{
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.legacy.aether.api.events.accessories;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
import com.legacy.aether.api.accessories.AetherAccessory;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ValidAccessoryEvent extends AetherAccessoryEvent
|
||||
{
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.legacy.aether.api.events.enchantments;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import com.legacy.aether.api.enchantments.AetherEnchantment;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class AetherEnchantmentEvent extends Event
|
||||
{
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.legacy.aether.api.events.freezables;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import com.legacy.aether.api.freezables.AetherFreezable;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class AetherFreezableEvent extends Event
|
||||
{
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.legacy.aether.api.events.moas;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import com.legacy.aether.api.moa.AetherMoaType;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class MoaEvent extends Event
|
||||
{
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.legacy.aether.api.freezables;
|
||||
|
||||
import com.legacy.aether.api.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AetherFreezable extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherFreezable>
|
||||
public class AetherFreezable extends RegistryEntry
|
||||
{
|
||||
|
||||
public int timeRequired;
|
||||
|
@ -56,6 +58,8 @@ public class AetherFreezable extends net.minecraftforge.fml.common.registry.IFor
|
|||
this.input = input;
|
||||
this.output = output;
|
||||
this.timeRequired = timeRequired;
|
||||
|
||||
this.setRegistryName(input.getItem().getUnlocalizedName().toString() + "_meta_" + (input.isItemStackDamageable() ? 0 : input.getItemDamage()));
|
||||
}
|
||||
|
||||
public int getTimeRequired()
|
||||
|
|
|
@ -4,7 +4,9 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AetherFreezableFuel extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherFreezableFuel>
|
||||
import com.legacy.aether.api.RegistryEntry;
|
||||
|
||||
public class AetherFreezableFuel extends RegistryEntry
|
||||
{
|
||||
|
||||
public int timeGiven;
|
||||
|
@ -25,6 +27,8 @@ public class AetherFreezableFuel extends net.minecraftforge.fml.common.registry.
|
|||
{
|
||||
this.timeGiven = timeGiven;
|
||||
this.fuelStack = fuelStack;
|
||||
|
||||
this.setRegistryName(fuelStack.getItem().getUnlocalizedName().toString() + "_meta_" + (fuelStack.isItemStackDamageable() ? 0 : fuelStack.getItemDamage()));
|
||||
}
|
||||
|
||||
public int getTimeGiven()
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.legacy.aether.api.moa;
|
||||
|
||||
import com.legacy.aether.api.RegistryEntry;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class AetherMoaType extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherMoaType>
|
||||
public class AetherMoaType extends RegistryEntry
|
||||
{
|
||||
|
||||
private MoaProperties properties;
|
||||
|
@ -17,7 +19,7 @@ public class AetherMoaType extends net.minecraftforge.fml.common.registry.IForge
|
|||
this.hexColor = hexColor;
|
||||
this.properties = properties;
|
||||
|
||||
this.creativeTab = CreativeTabs.MISC;
|
||||
this.creativeTab = CreativeTabs.tabMisc;
|
||||
}
|
||||
|
||||
public AetherMoaType(int hexColor, MoaProperties properties, CreativeTabs creativeTab)
|
||||
|
@ -27,11 +29,11 @@ public class AetherMoaType extends net.minecraftforge.fml.common.registry.IForge
|
|||
this.creativeTab = creativeTab;
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture(boolean saddled)
|
||||
public ResourceLocation getTexture(boolean saddled, boolean isBeingRidden)
|
||||
{
|
||||
if (this.properties.hasCustomTexture())
|
||||
{
|
||||
return this.properties.getCustomTexture(saddled);
|
||||
return this.properties.getCustomTexture(saddled, isBeingRidden);
|
||||
}
|
||||
|
||||
return new ResourceLocation("aether_legacy", "textures/entities/moa/" + ("moa_") + this.getRegistryName().getResourcePath().toLowerCase() + ".png");
|
||||
|
|
|
@ -5,22 +5,21 @@ import net.minecraft.util.ResourceLocation;
|
|||
public class MoaProperties
|
||||
{
|
||||
|
||||
private int maxJumps, moaChances;
|
||||
private int maxJumps;
|
||||
|
||||
private float moaSpeed;
|
||||
|
||||
private ResourceLocation location = null;
|
||||
|
||||
public MoaProperties(int maxJumps, int moaChances, float moaSpeed)
|
||||
public MoaProperties(int maxJumps, float moaSpeed)
|
||||
{
|
||||
this.maxJumps = maxJumps;
|
||||
this.moaChances = moaChances;
|
||||
this.moaSpeed = moaSpeed;
|
||||
}
|
||||
|
||||
public MoaProperties(int maxJumps, int moaChances, float moaSpeed, ResourceLocation location)
|
||||
public MoaProperties(int maxJumps, float moaSpeed, ResourceLocation location)
|
||||
{
|
||||
this(maxJumps, moaChances, moaSpeed);
|
||||
this(maxJumps, moaSpeed);
|
||||
|
||||
this.location = location;
|
||||
}
|
||||
|
@ -30,11 +29,6 @@ public class MoaProperties
|
|||
return this.maxJumps;
|
||||
}
|
||||
|
||||
public int getMoaChances()
|
||||
{
|
||||
return this.moaChances;
|
||||
}
|
||||
|
||||
public float getMoaSpeed()
|
||||
{
|
||||
return this.moaSpeed;
|
||||
|
@ -45,7 +39,7 @@ public class MoaProperties
|
|||
return this.location != null;
|
||||
}
|
||||
|
||||
public ResourceLocation getCustomTexture(boolean isSaddled)
|
||||
public ResourceLocation getCustomTexture(boolean isSaddled, boolean isBeingRidden)
|
||||
{
|
||||
return this.location;
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
/**
|
||||
* @author 115kino
|
||||
*/
|
||||
@API(owner = "aether_legacy", provides = "AetherAPI", apiVersion = "v1.0.0")
|
||||
package com.legacy.aether.api;
|
||||
import net.minecraftforge.fml.common.API;
|
|
@ -0,0 +1,63 @@
|
|||
package com.legacy.aether.api.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
|
||||
import com.legacy.aether.api.player.util.IAccessoryInventory;
|
||||
import com.legacy.aether.api.player.util.IAetherAbility;
|
||||
import com.legacy.aether.api.player.util.IAetherBoss;
|
||||
|
||||
public interface IPlayerAether extends IExtendedEntityProperties
|
||||
{
|
||||
|
||||
public void onUpdate();
|
||||
|
||||
public void setInPortal();
|
||||
|
||||
public void setFocusedBoss(IAetherBoss boss);
|
||||
|
||||
public IAetherBoss getFocusedBoss();
|
||||
|
||||
public void setAccessoryInventory(IAccessoryInventory inventory);
|
||||
|
||||
public IAccessoryInventory getAccessoryInventory();
|
||||
|
||||
public ArrayList<IAetherAbility> getAbilities();
|
||||
|
||||
public EntityLivingBase getEntity();
|
||||
|
||||
public void inflictPoison(int ticks);
|
||||
|
||||
public boolean isPoisoned();
|
||||
|
||||
public void inflictCure(int ticks);
|
||||
|
||||
public boolean isCured();
|
||||
|
||||
public boolean setHammerCooldown(int cooldown, String hammerName);
|
||||
|
||||
public String getHammerName();
|
||||
|
||||
public int getHammerCooldown();
|
||||
|
||||
public int getHammerMaxCooldown();
|
||||
|
||||
public void setJumping(boolean isJumping);
|
||||
|
||||
public boolean isJumping();
|
||||
|
||||
public void setMountSneaking(boolean isSneaking);
|
||||
|
||||
public boolean isMountSneaking();
|
||||
|
||||
public void updateShardCount(int amount);
|
||||
|
||||
public int getShardsUsed();
|
||||
|
||||
public int getMaxShardCount();
|
||||
|
||||
public boolean isDonator();
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.legacy.aether.api.player.util;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.legacy.aether.api.accessories.AccessoryType;
|
||||
|
||||
public interface IAccessoryInventory extends IInventory
|
||||
{
|
||||
|
||||
public void dropAccessories();
|
||||
|
||||
public void damageAccessory(int damage, AccessoryType type);
|
||||
|
||||
public void damageWornStack(int damage, ItemStack stack);
|
||||
|
||||
public void setAccessorySlot(AccessoryType type, ItemStack stack);
|
||||
|
||||
public ItemStack getStackInSlot(AccessoryType type);
|
||||
|
||||
public ItemStack removeStackFromAccessorySlot(AccessoryType type);
|
||||
|
||||
public boolean setAccessorySlot(ItemStack stack);
|
||||
|
||||
public boolean wearingAccessory(ItemStack stack);
|
||||
|
||||
public boolean wearingArmor(ItemStack stack);
|
||||
|
||||
public NBTTagList writeToNBT(NBTTagCompound compound);
|
||||
|
||||
public void readFromNBT(NBTTagList list);
|
||||
|
||||
public void writeData(ByteBuf buf);
|
||||
|
||||
public void readData(ByteBuf buf);
|
||||
|
||||
public boolean isWearingZaniteSet();
|
||||
|
||||
public boolean isWearingGravititeSet();
|
||||
|
||||
public boolean isWearingNeptuneSet();
|
||||
|
||||
public boolean isWearingPhoenixSet();
|
||||
|
||||
public boolean isWearingObsidianSet();
|
||||
|
||||
public boolean isWearingValkyrieSet();
|
||||
|
||||
public List<ItemStack> getAccessories();
|
||||
|
||||
public int getAccessoryCount(ItemStack stack);
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.legacy.aether.api.player.util;
|
||||
|
||||
public interface IAetherAbility
|
||||
{
|
||||
|
||||
public void onUpdate();
|
||||
|
||||
public boolean shouldExecute();
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.legacy.aether.api.player.util;
|
||||
|
||||
public interface IAetherBoss
|
||||
{
|
||||
|
||||
public String getBossName();
|
||||
|
||||
public float getBossHealth();
|
||||
|
||||
public float getMaxBossHealth();
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.legacy.aether.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockAether extends Block
|
||||
{
|
||||
|
||||
public BlockAether(Material material, String texture)
|
||||
{
|
||||
super(material);
|
||||
|
||||
this.setBlockTextureName(texture);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,23 +2,14 @@ package com.legacy.aether.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import com.legacy.aether.blocks.natural.BlockAetherFlower;
|
||||
|
||||
public class BlockAetherSapling extends BlockAetherFlower
|
||||
public class BlockAetherSapling extends BlockAetherFlower implements IGrowable
|
||||
{
|
||||
|
||||
public WorldGenerator treeGenObject = null;
|
||||
|
@ -26,54 +17,56 @@ public class BlockAetherSapling extends BlockAetherFlower
|
|||
public BlockAetherSapling(WorldGenerator treeGen)
|
||||
{
|
||||
super();
|
||||
|
||||
float f = 0.4F;
|
||||
this.FLOWER_AABB = new AxisAlignedBB(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
this.treeGenObject = treeGen;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.updateTick(world, pos, state, random);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (world.getLight(pos.up()) >= 9 && random.nextInt(30) == 0)
|
||||
super.updateTick(world, x, y, z, random);
|
||||
|
||||
if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(30) == 0)
|
||||
{
|
||||
this.growTree(world, pos, random);
|
||||
this.growTree(world, x, y, z, random);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (heldItem != null && heldItem.getItem() == Items.DYE && heldItem.getMetadata() == 15)
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
worldIn.playEvent(2005, pos, 0);
|
||||
}
|
||||
|
||||
if (worldIn.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
this.growTree(worldIn, pos, worldIn.rand);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void growTree(World world, BlockPos pos, Random rand)
|
||||
public void growTree(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
|
||||
if (!this.treeGenObject.generate(world, world.rand, pos))
|
||||
if (!this.treeGenObject.generate(world, world.rand, x, y, z))
|
||||
{
|
||||
world.setBlockState(pos, this.getDefaultState());
|
||||
world.setBlock(x, y, z, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149851_a(World worldIn, int x, int y, int z, boolean isClient)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149852_a(World worldIn, Random rand, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149853_b(World worldIn, Random rand, int x, int y, int z)
|
||||
{
|
||||
if (worldIn.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
this.growTree(worldIn, x, y, z, rand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.legacy.aether.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockIcestone extends Block
|
||||
{
|
||||
|
||||
public BlockIcestone()
|
||||
{
|
||||
super(Material.ice);
|
||||
|
||||
this.setHardness(3F);
|
||||
this.setTickRandomly(true);
|
||||
this.setStepSound(soundTypeGlass);
|
||||
this.setHarvestLevel("pickaxe", 1);
|
||||
this.setBlockTextureName("aether_legacy:icestone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, int xIn, int yIn, int zIn)
|
||||
{
|
||||
for (int x = xIn - 3; x <= (xIn + 3); ++x)
|
||||
{
|
||||
for (int y = yIn - 3; y <= (yIn + 3); ++y)
|
||||
{
|
||||
for (int z = zIn - 3; z <= (zIn + 3); ++z)
|
||||
{
|
||||
Block block = worldIn.getBlock(x, y, z);
|
||||
|
||||
if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
{
|
||||
worldIn.setBlock(x, y, z, Blocks.ice);
|
||||
}
|
||||
else if (block == Blocks.lava || block == Blocks.flowing_lava)
|
||||
{
|
||||
worldIn.setBlock(x, y, z, Blocks.obsidian);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package com.legacy.aether.blocks;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
public class BlockSunAltar extends Block
|
||||
{
|
||||
|
||||
public BlockSunAltar()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
|
||||
this.setHardness(2.5F);
|
||||
this.setSoundType(SoundType.METAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
|
||||
if (server != null && ((server.isDedicatedServer() && server.getPlayerList().canSendCommands(player.getGameProfile()) && player.capabilities.isCreativeMode) || !server.isDedicatedServer()))
|
||||
{
|
||||
Aether.proxy.openSunAltar();
|
||||
}
|
||||
else if (world.isRemote)
|
||||
{
|
||||
if (player instanceof EntityPlayerSP && ((EntityPlayerSP)player).getPermissionLevel() > 0 && player.capabilities.isCreativeMode)
|
||||
{
|
||||
Aether.proxy.openSunAltar();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +1,15 @@
|
|||
package com.legacy.aether.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.container.BlockEnchanter;
|
||||
import com.legacy.aether.blocks.container.BlockFreezer;
|
||||
import com.legacy.aether.blocks.container.BlockIncubator;
|
||||
import com.legacy.aether.blocks.container.BlockSunAltar;
|
||||
import com.legacy.aether.blocks.decorative.BlockAerogel;
|
||||
import com.legacy.aether.blocks.decorative.BlockAerogelSlab;
|
||||
import com.legacy.aether.blocks.decorative.BlockAerogelStairs;
|
||||
import com.legacy.aether.blocks.decorative.BlockAerogelWall;
|
||||
import com.legacy.aether.blocks.decorative.BlockAetherFence;
|
||||
import com.legacy.aether.blocks.decorative.BlockAetherFenceGate;
|
||||
import com.legacy.aether.blocks.decorative.BlockAetherSlab;
|
||||
|
@ -25,7 +19,7 @@ import com.legacy.aether.blocks.decorative.BlockAmbrosiumTorch;
|
|||
import com.legacy.aether.blocks.decorative.BlockPresent;
|
||||
import com.legacy.aether.blocks.decorative.BlockQuicksoilGlass;
|
||||
import com.legacy.aether.blocks.decorative.BlockSkyrootBookshelf;
|
||||
import com.legacy.aether.blocks.decorative.BlockSkyrootPlank;
|
||||
import com.legacy.aether.blocks.decorative.BlockSkyrootPlanks;
|
||||
import com.legacy.aether.blocks.decorative.BlockZanite;
|
||||
import com.legacy.aether.blocks.dungeon.BlockDungeonBase;
|
||||
import com.legacy.aether.blocks.dungeon.BlockDungeonTrap;
|
||||
|
@ -38,25 +32,22 @@ import com.legacy.aether.blocks.natural.BlockAetherFlower;
|
|||
import com.legacy.aether.blocks.natural.BlockAetherGrass;
|
||||
import com.legacy.aether.blocks.natural.BlockAetherLeaves;
|
||||
import com.legacy.aether.blocks.natural.BlockAetherLog;
|
||||
import com.legacy.aether.blocks.natural.BlockAetherOre;
|
||||
import com.legacy.aether.blocks.natural.BlockBerryBush;
|
||||
import com.legacy.aether.blocks.natural.BlockBerryBushStem;
|
||||
import com.legacy.aether.blocks.natural.BlockCrystalLeaves;
|
||||
import com.legacy.aether.blocks.natural.BlockHolidayLeaves;
|
||||
import com.legacy.aether.blocks.natural.BlockEnchantedAetherGrass;
|
||||
import com.legacy.aether.blocks.natural.BlockHolystone;
|
||||
import com.legacy.aether.blocks.natural.BlockIcestone;
|
||||
import com.legacy.aether.blocks.natural.BlockQuicksoil;
|
||||
import com.legacy.aether.blocks.natural.enchanted.BlockEnchantedAetherGrass;
|
||||
import com.legacy.aether.blocks.natural.enchanted.BlockEnchantedGravitite;
|
||||
import com.legacy.aether.blocks.natural.ore.BlockAmbrosiumOre;
|
||||
import com.legacy.aether.blocks.natural.ore.BlockGravititeOre;
|
||||
import com.legacy.aether.blocks.natural.ore.BlockZaniteOre;
|
||||
import com.legacy.aether.blocks.portal.BlockAetherPortal;
|
||||
import com.legacy.aether.blocks.util.BlockFloating;
|
||||
import com.legacy.aether.items.block.ItemAetherSlab;
|
||||
import com.legacy.aether.items.block.ItemSubtype;
|
||||
import com.legacy.aether.items.block.ItemBlockMetadata;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
import com.legacy.aether.world.biome.decoration.AetherGenOakTree;
|
||||
import com.legacy.aether.world.biome.decoration.AetherGenSkyrootTree;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlocksAether
|
||||
{
|
||||
|
||||
|
@ -68,7 +59,7 @@ public class BlocksAether
|
|||
|
||||
public static Block ambrosium_ore, zanite_ore, gravitite_ore;
|
||||
|
||||
public static Block aether_leaves, aether_log, skyroot_plank;
|
||||
public static Block skyroot_leaves, golden_oak_leaves, skyroot_log, golden_oak_log, skyroot_planks;
|
||||
|
||||
public static Block quicksoil_glass, aerogel;
|
||||
|
||||
|
@ -84,27 +75,35 @@ public class BlocksAether
|
|||
|
||||
public static Block chest_mimic, treasure_chest;
|
||||
|
||||
public static Block dungeon_trap, dungeon_block, locked_dungeon_block;
|
||||
public static Block carved_stone, angelic_stone, hellfire_stone;
|
||||
|
||||
public static Block sentry_stone, light_angelic_stone, light_hellfire_stone;
|
||||
|
||||
public static Block locked_carved_stone, locked_angelic_stone, locked_hellfire_stone;
|
||||
|
||||
public static Block locked_sentry_stone, locked_light_angelic_stone, locked_light_hellfire_stone;
|
||||
|
||||
public static Block carved_trap, angelic_trap, hellfire_trap;
|
||||
|
||||
public static Block purple_flower, white_flower;
|
||||
|
||||
public static Block skyroot_sapling, golden_oak_sapling;
|
||||
|
||||
public static Block crystal_leaves;
|
||||
public static Block crystal_leaves, crystal_fruit_leaves;
|
||||
|
||||
public static Block pillar, pillar_top;
|
||||
|
||||
public static Block skyroot_fence, skyroot_fence_gate;
|
||||
|
||||
public static Block carved_stairs, angelic_stairs, hellfire_stairs, skyroot_stairs, mossy_holystone_stairs, holystone_stairs, holystone_brick_stairs, aerogel_stairs;
|
||||
public static Block carved_stairs, angelic_stairs, hellfire_stairs, skyroot_stairs, mossy_holystone_stairs, holystone_stairs, holystone_brick_stairs;
|
||||
|
||||
public static Block carved_slab, angelic_slab, hellfire_slab, skyroot_slab, holystone_slab, holystone_brick_slab, mossy_holystone_slab, aerogel_slab;
|
||||
public static Block carved_slab, angelic_slab, hellfire_slab, skyroot_slab, holystone_slab, holystone_brick_slab, mossy_holystone_slab;
|
||||
|
||||
public static Block carved_double_slab, angelic_double_slab, hellfire_double_slab, skyroot_double_slab, holystone_double_slab, holystone_brick_double_slab, mossy_holystone_double_slab, aerogel_double_slab;
|
||||
public static Block carved_double_slab, angelic_double_slab, hellfire_double_slab, skyroot_double_slab, holystone_double_slab, holystone_brick_double_slab, mossy_holystone_double_slab;
|
||||
|
||||
public static Block holystone_wall, mossy_holystone_wall, holystone_brick_wall, carved_wall, angelic_wall, hellfire_wall, aerogel_wall;
|
||||
public static Block holystone_wall, mossy_holystone_wall, holystone_brick_wall, carved_wall, angelic_wall, hellfire_wall;
|
||||
|
||||
public static Block holiday_leaves, present;
|
||||
public static Block holiday_leaves, decorated_holiday_leaves, present;
|
||||
|
||||
public static Block sun_altar;
|
||||
|
||||
|
@ -112,130 +111,128 @@ public class BlocksAether
|
|||
|
||||
public static void initialization()
|
||||
{
|
||||
aether_grass = register("aether_grass", new BlockAetherGrass());
|
||||
aether_grass = registerMeta("aether_grass", new BlockAetherGrass());
|
||||
enchanted_aether_grass = register("enchanted_aether_grass", new BlockEnchantedAetherGrass());
|
||||
aether_dirt = register("aether_dirt", new BlockAetherDirt());
|
||||
holystone = register("holystone", new BlockHolystone());
|
||||
mossy_holystone = register("mossy_holystone", new BlockHolystone());
|
||||
holystone_brick = register("holystone_brick", new Block(Material.ROCK).setHardness(0.5F).setResistance(10.0F));
|
||||
aether_dirt = registerMeta("aether_dirt", new BlockAetherDirt());
|
||||
holystone = registerMeta("holystone", new BlockHolystone());
|
||||
mossy_holystone = registerMeta("mossy_holystone", new BlockHolystone().setBlockTextureName(Aether.find("mossy_holystone")));
|
||||
holystone_brick = register("holystone_brick", new BlockAether(Material.rock, Aether.find("holystone_brick")).setHardness(0.5F).setResistance(10.0F));
|
||||
aercloud = registerMeta("aercloud", new BlockAercloud());
|
||||
quicksoil = register("quicksoil", new BlockQuicksoil());
|
||||
icestone = register("icestone", new BlockIcestone());
|
||||
ambrosium_ore = register("ambrosium_ore", new BlockAmbrosiumOre());
|
||||
zanite_ore = register("zanite_ore", new BlockZaniteOre());
|
||||
gravitite_ore = register("gravitite_ore", new BlockGravititeOre());
|
||||
aether_leaves = registerMeta("aether_leaves", new BlockAetherLeaves());
|
||||
aether_log = registerMeta("aether_log", new BlockAetherLog());
|
||||
skyroot_plank = register("skyroot_plank", new BlockSkyrootPlank());
|
||||
quicksoil_glass = register("quicksoil_glass", new BlockQuicksoilGlass());
|
||||
aerogel = register("aerogel", new BlockAerogel());
|
||||
enchanted_gravitite = register("enchanted_gravitite", new BlockEnchantedGravitite());
|
||||
quicksoil = registerMeta("quicksoil", new BlockQuicksoil());
|
||||
icestone = register("icestone", new BlockIcestone());
|
||||
ambrosium_ore = register("ambrosium_ore", new BlockAetherOre(0).setBlockTextureName(Aether.find("ambrosium_ore")));
|
||||
zanite_ore = register("zanite_ore", new BlockAetherOre(1).setBlockTextureName(Aether.find("zanite_ore")));
|
||||
gravitite_ore = register("gravitite_ore", new BlockFloating(Material.rock, false).setHardness(5.0F).setBlockTextureName(Aether.find("gravitite_ore")));
|
||||
enchanted_gravitite = register("enchanted_gravitite", new BlockFloating(Material.rock, true).setHardness(5.0F).setBlockTextureName(Aether.find("enchanted_gravitite")));
|
||||
zanite_block = register("zanite_block", new BlockZanite());
|
||||
berry_bush = register("berry_bush", new BlockBerryBush());
|
||||
skyroot_leaves = register("skyroot_leaves", new BlockAetherLeaves().setBlockTextureName(Aether.find("skyroot_leaves")));
|
||||
golden_oak_leaves = register("golden_oak_leaves", new BlockAetherLeaves().setBlockTextureName(Aether.find("golden_oak_leaves")));
|
||||
crystal_leaves = register("crystal_leaves", new BlockAetherLeaves().setBlockTextureName(Aether.find("crystal_leaves")));
|
||||
crystal_fruit_leaves = register("crystal_fruit_leaves", new BlockAetherLeaves().setBlockTextureName(Aether.find("crystal_fruit_leaves")));
|
||||
holiday_leaves = register("holiday_leaves", new BlockAetherLeaves().setBlockTextureName(Aether.find("holiday_leaves")));
|
||||
decorated_holiday_leaves = register("decorated_holiday_leaves", new BlockAetherLeaves().setBlockTextureName(Aether.find("decorated_holiday_leaves")));
|
||||
present = register("present", new BlockPresent());
|
||||
skyroot_log = registerMeta("skyroot_log", new BlockAetherLog().setBlockTextureName(Aether.find("skyroot_log")));
|
||||
golden_oak_log = registerMeta("golden_oak_log", new BlockAetherLog().setBlockTextureName(Aether.find("golden_oak_log")));
|
||||
skyroot_planks = register("skyroot_planks", new BlockSkyrootPlanks());
|
||||
quicksoil_glass = register("quicksoil_glass", new BlockQuicksoilGlass());
|
||||
ambrosium_torch = register("ambrosium_torch", new BlockAmbrosiumTorch().setBlockTextureName(Aether.find("ambrosium_torch")));
|
||||
berry_bush_stem = register("berry_bush_stem", new BlockBerryBushStem());
|
||||
enchanter = register("enchanter", new BlockEnchanter());
|
||||
freezer = register("freezer", new BlockFreezer());
|
||||
incubator = register("incubator", new BlockIncubator());
|
||||
dungeon_block = registerMeta("dungeon_block", new BlockDungeonBase(false));
|
||||
locked_dungeon_block = registerMeta("locked_dungeon_block", new BlockDungeonBase(true).setResistance(2500F));
|
||||
dungeon_trap = registerMeta("dungeon_trap", new BlockDungeonTrap());
|
||||
aether_portal = register("aether_portal", new BlockAetherPortal()).setCreativeTab(null);
|
||||
ambrosium_torch = register("ambrosium_torch", new BlockAmbrosiumTorch());
|
||||
berry_bush = register("berry_bush", new BlockBerryBush());
|
||||
purple_flower = register("purple_flower", new BlockAetherFlower().setBlockTextureName(Aether.find("purple_flower")));
|
||||
white_flower = register("white_flower", new BlockAetherFlower().setBlockTextureName(Aether.find("white_flower")));
|
||||
skyroot_sapling = register("skyroot_sapling", new BlockAetherSapling(new AetherGenSkyrootTree(false)).setBlockTextureName(Aether.find("skyroot_sapling")));
|
||||
golden_oak_sapling = register("golden_oak_sapling", new BlockAetherSapling(new AetherGenOakTree()).setBlockTextureName(Aether.find("golden_oak_sapling")));
|
||||
enchanter = registerMeta("enchanter", new BlockEnchanter());
|
||||
freezer = registerMeta("freezer", new BlockFreezer());
|
||||
incubator = registerMeta("incubator", new BlockIncubator());
|
||||
sun_altar = register("sun_altar", new BlockSunAltar());
|
||||
chest_mimic = register("chest_mimic", new BlockMimicChest());
|
||||
treasure_chest = register("treasure_chest", new BlockTreasureChest());
|
||||
purple_flower = register("purple_flower", new BlockAetherFlower());
|
||||
white_flower = register("white_flower", new BlockAetherFlower());
|
||||
skyroot_sapling = register("skyroot_sapling", new BlockAetherSapling(new AetherGenSkyrootTree(true)));
|
||||
golden_oak_sapling = register("golden_oak_sapling", new BlockAetherSapling(new AetherGenOakTree()));
|
||||
crystal_leaves = registerMeta("crystal_leaves", new BlockCrystalLeaves());
|
||||
holiday_leaves = registerMeta("holiday_leaves", new BlockHolidayLeaves());
|
||||
present = register("present", new BlockPresent());
|
||||
pillar = register("pillar", new BlockPillar());
|
||||
pillar_top = register("pillar_top", new BlockPillar());
|
||||
|
||||
aether_portal = register("aether_portal", new BlockAetherPortal()).setCreativeTab(null);
|
||||
pillar = register("pillar", new BlockPillar("pillar_top", "pillar_side"));
|
||||
pillar_top = register("pillar_top", new BlockPillar("pillar_top", "pillar_carved"));
|
||||
carved_stone = register("carved_stone", new BlockDungeonBase(false).setBlockTextureName(Aether.find("carved_stone")));
|
||||
sentry_stone = register("sentry_stone", new BlockDungeonBase(true).setBlockTextureName(Aether.find("sentry_stone")));
|
||||
angelic_stone = register("angelic_stone", new BlockDungeonBase(false).setBlockTextureName(Aether.find("angelic_stone")));
|
||||
light_angelic_stone = register("light_angelic_stone", new BlockDungeonBase(true).setBlockTextureName(Aether.find("light_angelic_stone")));
|
||||
hellfire_stone = register("hellfire_stone", new BlockDungeonBase(false).setBlockTextureName(Aether.find("hellfire_stone")));
|
||||
light_hellfire_stone = register("light_hellfire_stone", new BlockDungeonBase(true).setBlockTextureName(Aether.find("light_hellfire_stone")));
|
||||
locked_carved_stone = register("locked_carved_stone", new BlockDungeonBase(carved_stone, false).setBlockTextureName(Aether.find("carved_stone"))).setCreativeTab(null);
|
||||
locked_sentry_stone = register("locked_sentry_stone", new BlockDungeonBase(sentry_stone, true).setBlockTextureName(Aether.find("sentry_stone"))).setCreativeTab(null);
|
||||
locked_angelic_stone = register("locked_angelic_stone", new BlockDungeonBase(angelic_stone, false).setBlockTextureName(Aether.find("angelic_stone"))).setCreativeTab(null);
|
||||
locked_light_angelic_stone = register("locked_light_angelic_stone", new BlockDungeonBase(light_angelic_stone, true).setBlockTextureName(Aether.find("light_angelic_stone"))).setCreativeTab(null);
|
||||
locked_hellfire_stone = register("locked_hellfire_stone", new BlockDungeonBase(hellfire_stone, false).setBlockTextureName(Aether.find("hellfire_stone"))).setCreativeTab(null);
|
||||
locked_light_hellfire_stone = register("locked_light_hellfire_stone", new BlockDungeonBase(light_hellfire_stone, true).setBlockTextureName(Aether.find("light_hellfire_stone"))).setCreativeTab(null);
|
||||
carved_trap = register("carved_trap", new BlockDungeonTrap(carved_stone).setBlockTextureName(Aether.find("carved_stone"))).setCreativeTab(null);
|
||||
angelic_trap = register("angelic_trap", new BlockDungeonTrap(angelic_stone).setBlockTextureName(Aether.find("angelic_stone"))).setCreativeTab(null);
|
||||
hellfire_trap = register("hellfire_trap", new BlockDungeonTrap(hellfire_stone).setBlockTextureName(Aether.find("hellfire_stone"))).setCreativeTab(null);
|
||||
skyroot_fence = register("skyroot_fence", new BlockAetherFence());
|
||||
|
||||
skyroot_fence_gate = register("skyroot_fence_gate", new BlockAetherFenceGate());
|
||||
|
||||
carved_wall = register("carved_wall", new BlockAetherWall(dungeon_block.getDefaultState()));
|
||||
angelic_wall = register("angelic_wall", new BlockAetherWall(dungeon_block.getDefaultState()));
|
||||
hellfire_wall = register("hellfire_wall", new BlockAetherWall(dungeon_block.getDefaultState()));
|
||||
holystone_wall = register("holystone_wall", new BlockAetherWall(holystone.getDefaultState()));
|
||||
holystone_brick_wall = register("holystone_brick_wall", new BlockAetherWall(holystone_brick.getDefaultState()));
|
||||
mossy_holystone_wall = register("mossy_holystone_wall", new BlockAetherWall(mossy_holystone.getDefaultState()));
|
||||
aerogel_wall = register("aerogel_wall", new BlockAerogelWall(aerogel.getDefaultState()));
|
||||
|
||||
carved_stairs = register("carved_stairs", new BlockAetherStairs(dungeon_block.getDefaultState()));
|
||||
angelic_stairs = register("angelic_stairs", new BlockAetherStairs(dungeon_block.getDefaultState()));
|
||||
hellfire_stairs = register("hellfire_stairs", new BlockAetherStairs(dungeon_block.getDefaultState()));
|
||||
skyroot_stairs = register("skyroot_stairs", new BlockAetherStairs(skyroot_plank.getDefaultState()));
|
||||
mossy_holystone_stairs = register("mossy_holystone_stairs", new BlockAetherStairs(mossy_holystone.getDefaultState()));
|
||||
holystone_stairs = register("holystone_stairs", new BlockAetherStairs(holystone.getDefaultState()));
|
||||
holystone_brick_stairs = register("holystone_brick_stairs", new BlockAetherStairs(holystone_brick.getDefaultState()));
|
||||
aerogel_stairs = register("aerogel_stairs", new BlockAerogelStairs(aerogel.getDefaultState()));
|
||||
|
||||
skyroot_double_slab = register("skyroot_double_slab", new BlockAetherSlab("skyroot_double_slab", true, Material.WOOD).setHardness(2.0F).setResistance(5.0F)).setCreativeTab(null);
|
||||
carved_double_slab = register("carved_double_slab", new BlockAetherSlab("carved_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
angelic_double_slab = register("angelic_double_slab", new BlockAetherSlab("angelic_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
hellfire_double_slab = register("hellfire_double_slab", new BlockAetherSlab("hellfire_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
holystone_double_slab = register("holystone_double_slab", new BlockAetherSlab("holystone_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
mossy_holystone_double_slab = register("mossy_holystone_double_slab", new BlockAetherSlab("mossy_holystone_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
holystone_brick_double_slab = register("holystone_brick_double_slab", new BlockAetherSlab("holystone_brick_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
aerogel_double_slab = register("aerogel_double_slab", new BlockAerogelSlab("aerogel_double_slab", true, Material.IRON).setHardness(2.0F).setResistance(999F)).setCreativeTab(null);
|
||||
|
||||
skyroot_slab = registerSlab("skyroot_slab", new BlockAetherSlab("skyroot_slab", false, Material.WOOD).setHardness(2.0F).setResistance(5.0F), skyroot_double_slab);
|
||||
carved_slab = registerSlab("carved_slab", new BlockAetherSlab("carved_slab", false, Material.ROCK).setHardness(0.5F).setResistance(10.0F), carved_double_slab);
|
||||
angelic_slab = registerSlab("angelic_slab", new BlockAetherSlab("angelic_slab", false, Material.ROCK).setHardness(0.5F).setResistance(10.0F), angelic_double_slab);
|
||||
hellfire_slab = registerSlab("hellfire_slab", new BlockAetherSlab("hellfire_slab", false, Material.ROCK).setHardness(0.5F).setResistance(10.0F), hellfire_double_slab);
|
||||
holystone_slab = registerSlab("holystone_slab", new BlockAetherSlab("holystone_slab", false, Material.ROCK).setHardness(0.5F).setResistance(10.0F), holystone_double_slab);
|
||||
mossy_holystone_slab = registerSlab("mossy_holystone_slab", new BlockAetherSlab("mossy_holystone_slab", false, Material.ROCK).setHardness(0.5F).setResistance(10.0F), mossy_holystone_double_slab);
|
||||
holystone_brick_slab = registerSlab("holystone_brick_slab", new BlockAetherSlab("holystone_brick_slab", false, Material.ROCK).setHardness(0.5F).setResistance(10.0F), holystone_brick_double_slab);
|
||||
aerogel_slab = registerSlab("aerogel_slab", new BlockAerogelSlab("aerogel_slab", false, Material.IRON).setHardness(0.5F).setResistance(999F), aerogel_double_slab);
|
||||
|
||||
sun_altar = register("sun_altar", new BlockSunAltar());
|
||||
|
||||
carved_wall = register("carved_wall", new BlockAetherWall(carved_stone));
|
||||
angelic_wall = register("angelic_wall", new BlockAetherWall(angelic_stone));
|
||||
hellfire_wall = register("hellfire_wall", new BlockAetherWall(hellfire_stone));
|
||||
holystone_wall = register("holystone_wall", new BlockAetherWall(holystone));
|
||||
holystone_brick_wall = register("holystone_brick_wall", new BlockAetherWall(holystone_brick));
|
||||
mossy_holystone_wall = register("mossy_holystone_wall", new BlockAetherWall(mossy_holystone));
|
||||
carved_stairs = register("carved_stairs", new BlockAetherStairs(carved_stone));
|
||||
angelic_stairs = register("angelic_stairs", new BlockAetherStairs(angelic_stone));
|
||||
hellfire_stairs = register("hellfire_stairs", new BlockAetherStairs(hellfire_stone));
|
||||
skyroot_stairs = register("skyroot_stairs", new BlockAetherStairs(skyroot_planks));
|
||||
holystone_stairs = register("holystone_stairs", new BlockAetherStairs(holystone));
|
||||
holystone_brick_stairs = register("holystone_brick_stairs", new BlockAetherStairs(holystone_brick));
|
||||
mossy_holystone_stairs = register("mossy_holystone_stairs", new BlockAetherStairs(mossy_holystone));
|
||||
skyroot_double_slab = register("skyroot_double_slab", new BlockAetherSlab("skyroot_double_slab", true, Material.wood).setBlockTextureName(Aether.find("skyroot_planks")).setHardness(2.0F).setResistance(5.0F)).setCreativeTab(null);
|
||||
carved_double_slab = register("carved_double_slab", new BlockAetherSlab("carved_double_slab", true, Material.rock).setBlockTextureName(Aether.find("carved_stone")).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
angelic_double_slab = register("angelic_double_slab", new BlockAetherSlab("angelic_double_slab", true, Material.rock).setBlockTextureName(Aether.find("angelic_stone")).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
hellfire_double_slab = register("hellfire_double_slab", new BlockAetherSlab("hellfire_double_slab", true, Material.rock).setBlockTextureName(Aether.find("hellfire_stone")).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
holystone_double_slab = register("holystone_double_slab", new BlockAetherSlab("holystone_double_slab", true, Material.rock).setBlockTextureName(Aether.find("holystone")).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
mossy_holystone_double_slab = register("mossy_holystone_double_slab", new BlockAetherSlab("mossy_holystone_double_slab", true, Material.rock).setBlockTextureName(Aether.find("mossy_holystone")).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
holystone_brick_double_slab = register("holystone_brick_double_slab", new BlockAetherSlab("holystone_brick_double_slab", true, Material.rock).setBlockTextureName(Aether.find("holystone_brick")).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
|
||||
skyroot_slab = registerSlab("skyroot_slab", new BlockAetherSlab("skyroot_slab", false, Material.wood).setBlockTextureName(Aether.find("skyroot_planks")).setHardness(2.0F).setResistance(5.0F), skyroot_double_slab);
|
||||
carved_slab = registerSlab("carved_slab", new BlockAetherSlab("carved_slab", false, Material.rock).setBlockTextureName(Aether.find("carved_stone")).setHardness(0.5F).setResistance(10.0F), carved_double_slab);
|
||||
angelic_slab = registerSlab("angelic_slab", new BlockAetherSlab("angelic_slab", false, Material.rock).setBlockTextureName(Aether.find("angelic_stone")).setHardness(0.5F).setResistance(10.0F), angelic_double_slab);
|
||||
hellfire_slab = registerSlab("hellfire_slab", new BlockAetherSlab("hellfire_slab", false, Material.rock).setBlockTextureName(Aether.find("hellfire_stone")).setHardness(0.5F).setResistance(10.0F), hellfire_double_slab);
|
||||
holystone_slab = registerSlab("holystone_slab", new BlockAetherSlab("holystone_slab", false, Material.rock).setBlockTextureName(Aether.find("holystone")).setHardness(0.5F).setResistance(10.0F), holystone_double_slab);
|
||||
mossy_holystone_slab = registerSlab("mossy_holystone_slab", new BlockAetherSlab("mossy_holystone_slab", false, Material.rock).setBlockTextureName(Aether.find("mossy_holystone")).setHardness(0.5F).setResistance(10.0F), mossy_holystone_double_slab);
|
||||
holystone_brick_slab = registerSlab("holystone_brick_slab", new BlockAetherSlab("holystone_brick_slab", false, Material.rock).setBlockTextureName(Aether.find("holystone_brick")).setHardness(0.5F).setResistance(10.0F), holystone_brick_double_slab);
|
||||
skyroot_bookshelf = register("skyroot_bookshelf", new BlockSkyrootBookshelf());
|
||||
}
|
||||
|
||||
public static boolean isGood(Block block)
|
||||
{
|
||||
return block == Blocks.air || block == aercloud;
|
||||
}
|
||||
|
||||
public static Block registerSlab(String name, Block slab1, Block slab2)
|
||||
{
|
||||
slab1.setBlockName(name);
|
||||
slab1.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
|
||||
GameRegistry.register(slab1.setRegistryName(Aether.locate(name)));
|
||||
GameRegistry.register(new ItemAetherSlab(slab1, (BlockSlab) slab1, (BlockSlab) slab2).setRegistryName(Aether.locate(name)));
|
||||
GameRegistry.registerBlock(slab1, ItemAetherSlab.class, name, (BlockAetherSlab) slab1, (BlockAetherSlab) slab2, false);
|
||||
|
||||
return slab1;
|
||||
}
|
||||
|
||||
public static Block register(String name, Block block)
|
||||
{
|
||||
block.setUnlocalizedName(name);
|
||||
block.setBlockName(name);
|
||||
block.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
|
||||
GameRegistry.register(block.setRegistryName(Aether.locate(name)));
|
||||
GameRegistry.register(new ItemBlock(block).setRegistryName(Aether.locate(name)));
|
||||
GameRegistry.registerBlock(block, name);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
public static Block registerMeta(String name, Block block)
|
||||
{
|
||||
GameRegistry.register(block.setRegistryName(Aether.locate(name)));
|
||||
GameRegistry.register(new ItemSubtype(block).setRegistryName(Aether.locate(name)));
|
||||
block.setBlockName(name);
|
||||
block.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
|
||||
GameRegistry.registerBlock(block, ItemBlockMetadata.class, name);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
public static boolean isGood(IBlockState state)
|
||||
{
|
||||
Block block = state.getBlock();
|
||||
return block == Blocks.AIR || block == aercloud;
|
||||
}
|
||||
|
||||
public static boolean isEarth(IBlockState state)
|
||||
{
|
||||
Block block = state.getBlock();
|
||||
return block == aether_dirt || block == aether_grass || block == holystone || block == mossy_holystone;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,36 +2,27 @@ package com.legacy.aether.blocks.container;
|
|||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.tile_entities.util.AetherTileEntity;
|
||||
import com.legacy.aether.tileentity.util.AetherTileEntity;
|
||||
|
||||
public abstract class BlockAetherContainer extends BlockContainer
|
||||
{
|
||||
|
||||
public static final PropertyBool powered = PropertyBool.create("powered");
|
||||
|
||||
public BlockAetherContainer(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
|
||||
this.setDefaultState(this.getDefaultState().withProperty(powered, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
public void onBlockPlacedBy(World worldIn, int x, int y, int z, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if (stack.hasDisplayName())
|
||||
if (stack.hasDisplayName())
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
TileEntity tileentity = worldIn.getTileEntity(x, y, z);
|
||||
|
||||
if (tileentity instanceof AetherTileEntity)
|
||||
{
|
||||
|
@ -40,36 +31,17 @@ public abstract class BlockAetherContainer extends BlockContainer
|
|||
}
|
||||
}
|
||||
|
||||
public static void setState(World worldIn, BlockPos pos, boolean isActive)
|
||||
public static void setState(World worldIn, int x, int y, int z, boolean isActive)
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
TileEntity tileentity = worldIn.getTileEntity(x, y, z);
|
||||
|
||||
worldIn.setBlockState(pos, iblockstate.withProperty(powered, isActive), 3);
|
||||
worldIn.setBlockMetadataWithNotify(x, y, z, isActive ? 1 : 0, 3);
|
||||
|
||||
if (tileentity != null)
|
||||
{
|
||||
tileentity.validate();
|
||||
worldIn.setTileEntity(pos, tileentity);
|
||||
worldIn.setTileEntity(x, y, z, tileentity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(powered, meta == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return state.getValue(powered) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {powered});
|
||||
}
|
||||
|
||||
}
|
|
@ -2,39 +2,75 @@ package com.legacy.aether.blocks.container;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.networking.AetherGuiHandler;
|
||||
import com.legacy.aether.tile_entities.TileEntityEnchanter;
|
||||
import com.legacy.aether.network.AetherGuiHandler;
|
||||
import com.legacy.aether.tileentity.TileEntityEnchanter;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockEnchanter extends BlockAetherContainer
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconBottom;
|
||||
|
||||
public BlockEnchanter()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
super(Material.rock);
|
||||
|
||||
this.setHardness(2.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon(Aether.find("enchanter_side"));
|
||||
this.blockIconTop = registry.registerIcon(Aether.find("enchanter_bottom"));
|
||||
this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
return this.blockIconBottom;
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
|
@ -42,57 +78,83 @@ public class BlockEnchanter extends BlockAetherContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
public Item getItemDropped(int meta, Random rand, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(BlocksAether.enchanter);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if(state.getValue(powered).booleanValue())
|
||||
if(world.getBlockMetadata(x, y, z) == 1)
|
||||
{
|
||||
float f = (float)pos.getX() + 0.5F;
|
||||
float f1 = (float)pos.getY() + 1.0F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float)pos.getZ() + 0.5F;
|
||||
float f = (float)x + 0.5F;
|
||||
float f1 = (float)y + 1.0F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float)z + 0.5F;
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
if (random.nextDouble() < 0.1D)
|
||||
{
|
||||
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
|
||||
}
|
||||
world.spawnParticle("smoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
player.openGui(Aether.instance, AetherGuiHandler.enchanter, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(Aether.instance, AetherGuiHandler.enchanter, world, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
TileEntity tileentity = worldIn.getTileEntity(x, y, z);
|
||||
|
||||
if (tileentity instanceof TileEntityEnchanter)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityEnchanter)tileentity);
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
TileEntityEnchanter tile = (TileEntityEnchanter) tileentity;
|
||||
|
||||
for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = worldIn.rand.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(worldIn, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double)((float)worldIn.rand.nextGaussian() * f3);
|
||||
entityitem.motionY = (double)((float)worldIn.rand.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double)((float)worldIn.rand.nextGaussian() * f3);
|
||||
worldIn.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.func_147453_f(x, y, z, this);
|
||||
}
|
||||
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
super.breakBlock(worldIn, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,39 +2,75 @@ package com.legacy.aether.blocks.container;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.networking.AetherGuiHandler;
|
||||
import com.legacy.aether.tile_entities.TileEntityFreezer;
|
||||
import com.legacy.aether.network.AetherGuiHandler;
|
||||
import com.legacy.aether.tileentity.TileEntityFreezer;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFreezer extends BlockAetherContainer
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconBottom;
|
||||
|
||||
public BlockFreezer()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
super(Material.rock);
|
||||
|
||||
this.setHardness(2.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon(Aether.find("freezer_side"));
|
||||
this.blockIconTop = registry.registerIcon(Aether.find("freezer_top"));
|
||||
this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
return this.blockIconBottom;
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
|
@ -42,61 +78,83 @@ public class BlockFreezer extends BlockAetherContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
public Item getItemDropped(int meta, Random rand, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(BlocksAether.freezer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(state.getValue(powered).booleanValue())
|
||||
{
|
||||
float f = (float)pos.getX() + 0.5F;
|
||||
float f1 = (float)pos.getY() + 1.0F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float)pos.getZ() + 0.5F;
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
world.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (random.nextDouble() < 0.1D)
|
||||
{
|
||||
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 3.0F, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
player.openGui(Aether.instance, AetherGuiHandler.freezer, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(Aether.instance, AetherGuiHandler.freezer, world, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if(world.getBlockMetadata(x, y, z) == 1)
|
||||
{
|
||||
float f = (float)x + 0.5F;
|
||||
float f1 = (float)y + 1.0F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float)z + 0.5F;
|
||||
|
||||
world.spawnParticle("smoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("snowshovel", f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
TileEntity tileentity = worldIn.getTileEntity(x, y, z);
|
||||
|
||||
if (tileentity instanceof TileEntityFreezer)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityFreezer)tileentity);
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
TileEntityFreezer tile = (TileEntityFreezer) tileentity;
|
||||
|
||||
for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = worldIn.rand.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(worldIn, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double)((float)worldIn.rand.nextGaussian() * f3);
|
||||
entityitem.motionY = (double)((float)worldIn.rand.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double)((float)worldIn.rand.nextGaussian() * f3);
|
||||
worldIn.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.func_147453_f(x, y, z, this);
|
||||
}
|
||||
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
super.breakBlock(worldIn, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,39 +2,75 @@ package com.legacy.aether.blocks.container;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.networking.AetherGuiHandler;
|
||||
import com.legacy.aether.tile_entities.TileEntityIncubator;
|
||||
import com.legacy.aether.network.AetherGuiHandler;
|
||||
import com.legacy.aether.tileentity.TileEntityIncubator;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockIncubator extends BlockAetherContainer
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconBottom;
|
||||
|
||||
public BlockIncubator()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
super(Material.rock);
|
||||
|
||||
this.setHardness(2.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon(Aether.find("incubator_side"));
|
||||
this.blockIconTop = registry.registerIcon(Aether.find("incubator_top"));
|
||||
this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
return this.blockIconBottom;
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
|
@ -42,57 +78,83 @@ public class BlockIncubator extends BlockAetherContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
public Item getItemDropped(int meta, Random rand, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(BlocksAether.incubator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
player.openGui(Aether.instance, AetherGuiHandler.incubator, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
if(world.getBlockMetadata(x, y, z) == 1)
|
||||
{
|
||||
float f = (float)x + 0.5F;
|
||||
float f1 = (float)y + 1.0F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float)z + 0.5F;
|
||||
|
||||
world.spawnParticle("smoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
player.openGui(Aether.instance, AetherGuiHandler.incubator, world, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
|
||||
public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
if(state.getValue(powered).booleanValue())
|
||||
{
|
||||
float f = (float)pos.getX() + 0.5F;
|
||||
float f1 = (float)pos.getY() + 1.0F + (random.nextFloat() * 60F) / 16F;
|
||||
float f2 = (float)pos.getZ() + 0.5F;
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, f, f1, f2, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
if (random.nextDouble() < 0.1D)
|
||||
{
|
||||
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
TileEntity tileentity = worldIn.getTileEntity(x, y, z);
|
||||
|
||||
if (tileentity instanceof TileEntityIncubator)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityIncubator)tileentity);
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
TileEntityIncubator tile = (TileEntityIncubator) tileentity;
|
||||
|
||||
for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = worldIn.rand.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(worldIn, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double)((float)worldIn.rand.nextGaussian() * f3);
|
||||
entityitem.motionY = (double)((float)worldIn.rand.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double)((float)worldIn.rand.nextGaussian() * f3);
|
||||
worldIn.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.func_147453_f(x, y, z, this);
|
||||
}
|
||||
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
super.breakBlock(worldIn, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.legacy.aether.blocks.container;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSunAltar extends Block
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
public BlockSunAltar()
|
||||
{
|
||||
super(Material.rock);
|
||||
|
||||
this.setHardness(2.5F);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon(Aether.find("sun_altar_side"));
|
||||
this.blockIconTop = registry.registerIcon(Aether.find("sun_altar_top"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.hellfire_stone.getBlockTextureFromSide(side) : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
return BlocksAether.hellfire_stone.getBlockTextureFromSide(side);
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
|
||||
if (server != null && ((server.isDedicatedServer() && server.getConfigurationManager().func_152596_g(player.getGameProfile()) && player.capabilities.isCreativeMode) || !server.isDedicatedServer()))
|
||||
{
|
||||
Aether.proxy.openSunAltar();
|
||||
}
|
||||
else if (world.isRemote)
|
||||
{
|
||||
if (player instanceof EntityPlayerSP && player.capabilities.isCreativeMode)
|
||||
{
|
||||
Aether.proxy.openSunAltar();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,30 +1,38 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.BlockBreakable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAerogel extends BlockBreakable
|
||||
{
|
||||
|
||||
public BlockAerogel()
|
||||
{
|
||||
super(Material.ROCK, false);
|
||||
super(Aether.find("aerogel"), Material.rock, false);
|
||||
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(2000F);
|
||||
this.setLightOpacity(3);
|
||||
this.setSoundType(SoundType.METAL);
|
||||
this.setResistance(2000F);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAerogelSlab extends BlockAetherSlab
|
||||
{
|
||||
public BlockAerogelSlab(String name, boolean double_slab, Material materialIn)
|
||||
{
|
||||
super(name, double_slab, materialIn);
|
||||
|
||||
this.setLightOpacity(3);
|
||||
|
||||
this.setDefaultState(double_slab ? this.getDefaultState() : this.getDefaultState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
|
||||
this.setSoundType(materialIn == Material.WOOD ? SoundType.WOOD : SoundType.STONE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IBlockState iblockstate = world.getBlockState(pos.offset(side));
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
return block != this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAerogelStairs extends BlockAetherStairs
|
||||
{
|
||||
|
||||
public BlockAerogelStairs(IBlockState state)
|
||||
{
|
||||
super(state);
|
||||
|
||||
this.setLightOpacity(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IBlockState iblockstate = world.getBlockState(pos.offset(side));
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
return block != this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAerogelWall extends BlockAetherWall
|
||||
{
|
||||
public BlockAerogelWall(IBlockState state)
|
||||
{
|
||||
super(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IBlockState neighborState = world.getBlockState(pos.offset(side));
|
||||
Block block = neighborState.getBlock();
|
||||
|
||||
return block != this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,38 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
public class BlockAetherFence extends BlockFence
|
||||
{
|
||||
|
||||
public BlockAetherFence()
|
||||
{
|
||||
super(Material.WOOD, Material.WOOD.getMaterialMapColor());
|
||||
super(Aether.find("skyroot_planks"), Material.wood);
|
||||
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
this.setStepSound(soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceTorchOnTop(World world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectFenceTo(IBlockAccess p_149826_1_, int p_149826_2_, int p_149826_3_, int p_149826_4_)
|
||||
{
|
||||
Block block = p_149826_1_.getBlock(p_149826_2_, p_149826_3_, p_149826_4_);
|
||||
return block != this && block != Blocks.fence_gate && block != BlocksAether.skyroot_fence_gate ? (block.getMaterial().isOpaque() && block.renderAsNormalBlock() ? block.getMaterial() != Material.gourd : false) : true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,26 +1,32 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.BlockPlanks.EnumType;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAetherFenceGate extends BlockFenceGate
|
||||
{
|
||||
|
||||
public BlockAetherFenceGate()
|
||||
{
|
||||
super(EnumType.OAK);
|
||||
super();
|
||||
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
this.setStepSound(soundTypeWood);
|
||||
this.setBlockTextureName(Aether.find("skyroot_planks"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapColor getMapColor(IBlockState state)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_)
|
||||
{
|
||||
return MapColor.WOOD;
|
||||
return BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_);
|
||||
}
|
||||
|
||||
}
|
|
@ -4,16 +4,8 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
@ -23,22 +15,19 @@ public class BlockAetherSlab extends BlockSlab
|
|||
|
||||
private String name;
|
||||
|
||||
private boolean double_slab;
|
||||
|
||||
public BlockAetherSlab(String name, boolean double_slab, Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
super(double_slab, materialIn);
|
||||
this.name = name;
|
||||
this.double_slab = double_slab;
|
||||
|
||||
this.setDefaultState(double_slab ? this.getDefaultState() : this.getDefaultState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
|
||||
this.setSoundType(materialIn == Material.WOOD ? SoundType.WOOD : SoundType.STONE);
|
||||
this.setLightOpacity(0);
|
||||
this.setStepSound(materialIn == Material.wood ? soundTypeWood : soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
|
||||
{
|
||||
return new ItemStack(this.getDroppedSlab(), 1, 0);
|
||||
return Item.getItemFromBlock(this.getDroppedSlab());
|
||||
}
|
||||
|
||||
public Block getDroppedSlab()
|
||||
|
@ -54,80 +43,21 @@ public class BlockAetherSlab extends BlockSlab
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
public Item getItemDropped(int meta, Random rand, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(this.getDroppedSlab());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDouble()
|
||||
{
|
||||
return this.double_slab && this.name.contains("double");
|
||||
}
|
||||
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
|
||||
return this.isDouble() ? iblockstate : (facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double)hitY <= 0.5D) ? iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM) : iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.TOP));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
if (!this.isDouble())
|
||||
{
|
||||
return this.getDefaultState().withProperty(HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
||||
}
|
||||
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
if (!this.isDouble())
|
||||
{
|
||||
if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.BOTTOM)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return this.isDouble() ? new BlockStateContainer(this, new IProperty[0]): new BlockStateContainer(this, new IProperty[] {HALF});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(int meta)
|
||||
public String func_150002_b(int meta)
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProperty<?> getVariantProperty()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparable<?> getTypeForItem(ItemStack stack)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public class BlockAetherStairs extends BlockStairs
|
||||
{
|
||||
|
||||
public BlockAetherStairs(IBlockState modelState)
|
||||
public BlockAetherStairs(Block block)
|
||||
{
|
||||
super(modelState);
|
||||
super(block, 0);
|
||||
|
||||
this.setLightOpacity(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,169 +1,47 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BlockAetherWall extends Block
|
||||
public class BlockAetherWall extends BlockWall
|
||||
{
|
||||
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
private Block block;
|
||||
|
||||
protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] {new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
|
||||
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] {AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)};
|
||||
|
||||
public BlockAetherWall(IBlockState modelBlock)
|
||||
public BlockAetherWall(Block block)
|
||||
{
|
||||
super(modelBlock.getMaterial());
|
||||
this.setHardness(modelBlock.getBlockHardness(null, null));
|
||||
this.setResistance(modelBlock.getBlock().getBlockHardness(modelBlock, null, null) / 3.0F);
|
||||
this.setSoundType(modelBlock.getBlock().getSoundType());
|
||||
this.setDefaultState(this.getDefaultState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
super(block);
|
||||
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
state = this.getActualState(state, source, pos);
|
||||
return AABB_BY_INDEX[getAABBIndex(state)];
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
||||
{
|
||||
blockState = this.getActualState(blockState, worldIn, pos);
|
||||
return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
|
||||
}
|
||||
|
||||
private static int getAABBIndex(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (((Boolean)state.getValue(NORTH)).booleanValue())
|
||||
{
|
||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (((Boolean)state.getValue(EAST)).booleanValue())
|
||||
{
|
||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (((Boolean)state.getValue(SOUTH)).booleanValue())
|
||||
{
|
||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (((Boolean)state.getValue(WEST)).booleanValue())
|
||||
{
|
||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
return block instanceof BlockAetherWall ? true : block == Blocks.BARRIER ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial(iblockstate).isOpaque() && iblockstate.isFullCube() ? block.getMaterial(iblockstate) != Material.GOURD : false) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? super.shouldSideBeRendered(blockState, blockAccess, pos, side) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
public boolean canPlaceTorchOnTop(World world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
if (side == EnumFacing.UP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_)
|
||||
{
|
||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
||||
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
||||
boolean flag3 = this.canConnectTo(worldIn, pos.west());
|
||||
boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
|
||||
return state.withProperty(UP, Boolean.valueOf(!flag4 || !worldIn.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(flag)).withProperty(EAST, Boolean.valueOf(flag1)).withProperty(SOUTH, Boolean.valueOf(flag2)).withProperty(WEST, Boolean.valueOf(flag3));
|
||||
return this.block.getBlockTextureFromSide(p_149691_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.SoundType;
|
||||
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockAmbrosiumTorch extends BlockTorch
|
||||
{
|
||||
|
@ -11,10 +8,10 @@ public class BlockAmbrosiumTorch extends BlockTorch
|
|||
public BlockAmbrosiumTorch()
|
||||
{
|
||||
super();
|
||||
|
||||
this.setTickRandomly(true);
|
||||
this.setLightLevel(0.9375F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setStepSound(soundTypeWood);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,39 +1,70 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.entities.block.EntityTNTPresent;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPresent extends Block
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
public BlockPresent()
|
||||
{
|
||||
super(Material.GRASS);
|
||||
super(Material.grass);
|
||||
|
||||
this.setHardness(0.6F);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setBlockTextureName(Aether.find("present_side"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
int randomNumber = (int) (((9 - 6 + 1) * RANDOM.nextDouble()) + 6);
|
||||
int crateType = RANDOM.nextInt(4);
|
||||
super.registerBlockIcons(registry);
|
||||
|
||||
this.blockIconTop = registry.registerIcon(Aether.find("present_top"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return (side == 1 || side == 0) ? this.blockIconTop : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1 || side == 0)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
int randomNumber = (int) (((9 - 6 + 1) * world.rand.nextDouble()) + 6);
|
||||
int crateType = world.rand.nextInt(4);
|
||||
|
||||
if (crateType == 0)
|
||||
{
|
||||
|
@ -41,34 +72,34 @@ public class BlockPresent extends Block
|
|||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityXPOrb(world, pos.getX(), pos.getY(), pos.getZ(), size));
|
||||
world.spawnEntityInWorld(new EntityXPOrb(world, x, y, z, size));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (crateType == 1)
|
||||
{
|
||||
if (RANDOM.nextInt(9) == 0)
|
||||
if (world.rand.nextInt(9) == 0)
|
||||
{
|
||||
spawnAsEntity(world, pos, new ItemStack(ItemsAether.candy_cane_sword));
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.candy_cane_sword));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int size = 1; size <= randomNumber; ++size)
|
||||
{
|
||||
spawnAsEntity(world, pos, new ItemStack(ItemsAether.ginger_bread_man));
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.gingerbread_man));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityTNTPresent present = new EntityTNTPresent(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
EntityTNTPresent present = new EntityTNTPresent(world, x, y, z);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(present);
|
||||
}
|
||||
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.playSoundAtEntity(present, "game.tnt.primed", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,25 +3,26 @@ package com.legacy.aether.blocks.decorative;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockBreakable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuicksoilGlass extends BlockBreakable
|
||||
{
|
||||
|
||||
public BlockQuicksoilGlass()
|
||||
{
|
||||
super(Material.GLASS, false);
|
||||
super(Aether.find("quicksoil_glass"), Material.glass, false);
|
||||
|
||||
this.slipperiness = 1.1F;
|
||||
|
||||
this.setLightLevel(0.7375F);
|
||||
this.setHardness(0.2F);
|
||||
this.setLightOpacity(0);
|
||||
this.setSoundType(SoundType.GLASS);
|
||||
this.setLightLevel(0.7375F);
|
||||
this.setStepSound(soundTypeGlass);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,9 +33,15 @@ public class BlockQuicksoilGlass extends BlockBreakable
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,44 +3,54 @@ package com.legacy.aether.blocks.decorative;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSkyrootBookshelf extends Block
|
||||
{
|
||||
|
||||
public BlockSkyrootBookshelf()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.wood);
|
||||
|
||||
this.setHardness(2F);
|
||||
this.setResistance(5F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
this.setStepSound(soundTypeWood);
|
||||
this.setBlockTextureName(Aether.find("skyroot_bookshelf"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_)
|
||||
{
|
||||
return p_149691_1_ != 1 && p_149691_1_ != 0 ? super.getIcon(p_149691_1_, p_149691_2_) : BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnchantPowerBonus(World world, BlockPos pos)
|
||||
public float getEnchantPowerBonus(World world, int x, int y, int z)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int fortune)
|
||||
{
|
||||
return Items.BOOK;
|
||||
return Items.book;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockSkyrootPlank extends Block
|
||||
{
|
||||
|
||||
public BlockSkyrootPlank()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
|
||||
this.setHardness(2F);
|
||||
this.setResistance(5F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
|
||||
public class BlockSkyrootPlanks extends Block
|
||||
{
|
||||
|
||||
public BlockSkyrootPlanks()
|
||||
{
|
||||
super(Material.wood);
|
||||
|
||||
this.setHardness(2F);
|
||||
this.setResistance(5F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
this.setBlockTextureName(Aether.find("skyroot_planks"));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +1,26 @@
|
|||
package com.legacy.aether.blocks.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
|
||||
public class BlockZanite extends Block
|
||||
{
|
||||
|
||||
public BlockZanite()
|
||||
{
|
||||
super(Material.IRON);
|
||||
super(Material.iron);
|
||||
|
||||
this.setHardness(3F);
|
||||
this.setSoundType(SoundType.METAL);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
this.setHarvestLevel("pickaxe", 1);
|
||||
this.setBlockTextureName(Aether.find("zanite_block"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon)
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,119 +1,75 @@
|
|||
package com.legacy.aether.blocks.dungeon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
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;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.blocks.util.EnumStoneType;
|
||||
import com.legacy.aether.blocks.util.IAetherMeta;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockDungeonBase extends Block implements IAetherMeta
|
||||
public class BlockDungeonBase extends Block
|
||||
{
|
||||
|
||||
public static final PropertyEnum<EnumStoneType> dungeon_stone = PropertyEnum.create("aether_legacy_dungeon_stone", EnumStoneType.class);
|
||||
private Block pickBlock;
|
||||
|
||||
public BlockDungeonBase(boolean isLocked)
|
||||
private boolean isLit;
|
||||
|
||||
public BlockDungeonBase(boolean isLit)
|
||||
{
|
||||
super(Material.ROCK);
|
||||
this(null, isLit);
|
||||
}
|
||||
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setHardness(isLocked ? -1F : 0.5F);
|
||||
this.setCreativeTab(isLocked ? null : AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(dungeon_stone, EnumStoneType.Carved));
|
||||
public BlockDungeonBase(Block pickBlock, boolean isLit)
|
||||
{
|
||||
super(Material.rock);
|
||||
|
||||
if (pickBlock != null)
|
||||
{
|
||||
this.pickBlock = pickBlock;
|
||||
this.setResistance(6000000.0F);
|
||||
}
|
||||
|
||||
this.isLit = isLit;
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(this.pickBlock != null ? -1F : 0.5F);
|
||||
this.setCreativeTab(this.pickBlock != null ? null : AetherCreativeTabs.blocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int meta = this.getMetaFromState(state);
|
||||
|
||||
if (state.getBlock() != this)
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if (block != this)
|
||||
{
|
||||
return state.getLightValue(world, pos);
|
||||
return block.getLightValue(world, x, y, z);
|
||||
}
|
||||
|
||||
if (meta == 1 || meta == 3 || meta == 5)
|
||||
if (this.isLit)
|
||||
{
|
||||
return (int)(15.0F * 0.75f);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return super.getLightValue(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState stateIn, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
Block newBlock = BlocksAether.dungeon_block.getDefaultState().withProperty(dungeon_stone, ((EnumStoneType)state.getValue(dungeon_stone))).getBlock();
|
||||
|
||||
if (block == BlocksAether.locked_dungeon_block || block == BlocksAether.dungeon_trap)
|
||||
if (this.pickBlock != null)
|
||||
{
|
||||
return new ItemStack(newBlock, 1, damageDropped(state));
|
||||
return new ItemStack(this.pickBlock);
|
||||
}
|
||||
|
||||
return new ItemStack(newBlock, 1, damageDropped(state));
|
||||
return super.getPickBlock(target, world, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaName(ItemStack stack)
|
||||
public Block getUnlockedBlock()
|
||||
{
|
||||
return ((EnumStoneType)this.getStateFromMeta(stack.getItemDamage()).getValue(dungeon_stone)).getName();
|
||||
return this.pickBlock == null ? this : this.pickBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return ((EnumStoneType)state.getValue(dungeon_stone)).getMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int j = 0; j < EnumStoneType.values().length; ++j)
|
||||
{
|
||||
EnumStoneType enumdyecolor = EnumStoneType.values()[j];
|
||||
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(dungeon_stone, EnumStoneType.getType(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((EnumStoneType)state.getValue(dungeon_stone)).getMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {dungeon_stone});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +1,67 @@
|
|||
package com.legacy.aether.blocks.dungeon;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.blocks.util.EnumStoneType;
|
||||
import com.legacy.aether.entities.bosses.EntityFireMinion;
|
||||
import com.legacy.aether.entities.bosses.EntityValkyrie;
|
||||
import com.legacy.aether.entities.hostile.EntitySentry;
|
||||
|
||||
public class BlockDungeonTrap extends BlockDungeonBase
|
||||
public class BlockDungeonTrap extends Block
|
||||
{
|
||||
|
||||
public BlockDungeonTrap()
|
||||
private Block pickBlock;
|
||||
|
||||
public BlockDungeonTrap(Block pickBlock)
|
||||
{
|
||||
super(true);
|
||||
super(Material.rock);
|
||||
|
||||
this.pickBlock = pickBlock;
|
||||
this.setBlockUnbreakable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalk(World world, BlockPos pos, Entity entityIn)
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity entityIn)
|
||||
{
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
EnumStoneType type = (EnumStoneType) state.getValue(dungeon_stone);
|
||||
|
||||
if (entityIn instanceof EntityPlayer)
|
||||
{
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
|
||||
world.setBlockState(pos, BlocksAether.dungeon_block.getDefaultState().withProperty(dungeon_stone, EnumStoneType.getType(block.getMetaFromState(state))));
|
||||
world.setBlock(x, y, z, this.pickBlock);
|
||||
|
||||
if (type == EnumStoneType.Carved || type == EnumStoneType.Sentry)
|
||||
if (this == BlocksAether.carved_trap)
|
||||
{
|
||||
EntitySentry sentry = new EntitySentry(world, pos.getX() + 2D, pos.getY() + 1D, pos.getZ() + 2D);
|
||||
EntitySentry sentry = new EntitySentry(world, x + 2D, y + 1D, z + 2D);
|
||||
|
||||
if (!world.isRemote)
|
||||
world.spawnEntityInWorld(sentry);
|
||||
{
|
||||
world.spawnEntityInWorld(sentry);
|
||||
}
|
||||
}
|
||||
else if (type == EnumStoneType.Angelic || type == EnumStoneType.Light_angelic)
|
||||
else if (this == BlocksAether.angelic_trap)
|
||||
{
|
||||
EntityValkyrie valkyrie = new EntityValkyrie(world);
|
||||
valkyrie.setPosition(pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 0.5D);
|
||||
valkyrie.setPosition(x + 0.5D, y + 1D, z + 0.5D);
|
||||
|
||||
if (!world.isRemote)
|
||||
world.spawnEntityInWorld(valkyrie);
|
||||
{
|
||||
world.spawnEntityInWorld(valkyrie);
|
||||
}
|
||||
}
|
||||
else if (this == BlocksAether.hellfire_trap)
|
||||
{
|
||||
EntityFireMinion minion = new EntityFireMinion(world);
|
||||
minion.setPosition(x + 0.5D, y + 1D, z + 0.5D);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(minion);
|
||||
}
|
||||
}
|
||||
|
||||
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundCategory.PLAYERS, 1.0F, 1.5F);
|
||||
world.playSoundEffect(x, y, z, "random.door_close", 2.0F, world.rand.nextFloat() - world.rand.nextFloat() * 0.2F + 1.2F);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,30 +1,22 @@
|
|||
package com.legacy.aether.blocks.dungeon;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.BlockChest;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.entities.hostile.EntityMimic;
|
||||
import com.legacy.aether.tile_entities.TileEntityChestMimic;
|
||||
import com.legacy.aether.tileentity.TileEntityChestMimic;
|
||||
|
||||
public class BlockMimicChest extends BlockChest
|
||||
{
|
||||
|
||||
public BlockMimicChest()
|
||||
{
|
||||
super(BlockChest.Type.BASIC);
|
||||
super(13);
|
||||
|
||||
this.setHardness(2.0F);
|
||||
}
|
||||
|
@ -36,46 +28,41 @@ public class BlockMimicChest extends BlockChest
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
this.spawnMimic(worldIn, playerIn, pos);
|
||||
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
|
||||
double d1 = (double)i + 0.5D;
|
||||
double d2 = (double)k + 0.5D;
|
||||
|
||||
worldIn.playSound((EntityPlayer)null, d1, (double)j + 0.5D, d2, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F);
|
||||
this.spawnMimic(worldIn, playerIn, x, y, z);
|
||||
|
||||
worldIn.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "random.chestopen", 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
this.spawnMimic(worldIn, player, pos);
|
||||
this.spawnMimic(worldIn, player, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return new ItemStack(Blocks.CHEST);
|
||||
return new ItemStack(Blocks.chest);
|
||||
}
|
||||
|
||||
private void spawnMimic(World world, EntityPlayer player, BlockPos pos)
|
||||
private void spawnMimic(World world, EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
EntityMimic mimic = new EntityMimic(world);
|
||||
mimic.setAttackTarget(player);
|
||||
mimic.setPosition((double)pos.getX() + 0.5D, (double)pos.getY() + 1.5D, (double)pos.getZ() + 0.5D);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
mimic.setAttackTarget(player);
|
||||
}
|
||||
mimic.setPosition((double)x + 0.5D, (double)y + 1.5D, (double)z + 0.5D);
|
||||
world.spawnEntityInWorld(mimic);
|
||||
}
|
||||
|
||||
world.setBlockToAir(pos);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,17 +1,49 @@
|
|||
package com.legacy.aether.blocks.dungeon;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import com.legacy.aether.Aether;
|
||||
|
||||
public class BlockPillar extends Block
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockPillar extends BlockRotatedPillar
|
||||
{
|
||||
|
||||
public BlockPillar()
|
||||
private String topTexture;
|
||||
|
||||
private String sideTexture;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon sideIcon;
|
||||
|
||||
public BlockPillar(String topIcon, String sideTexture)
|
||||
{
|
||||
super(Material.ROCK);
|
||||
this.setSoundType(SoundType.METAL);
|
||||
super(Material.rock);
|
||||
|
||||
this.topTexture = topIcon;
|
||||
this.sideTexture = sideTexture;
|
||||
|
||||
this.setHardness(0.5F);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int meta)
|
||||
{
|
||||
return this.sideIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.field_150164_N = registry.registerIcon(Aether.find(this.topTexture));
|
||||
this.sideIcon = registry.registerIcon(Aether.find(this.sideTexture));
|
||||
}
|
||||
|
||||
}
|
|
@ -2,391 +2,56 @@ package com.legacy.aether.blocks.dungeon;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.block.BlockChest;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.CommonProxy;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.networking.AetherGuiHandler;
|
||||
import com.legacy.aether.tile_entities.TileEntityTreasureChest;
|
||||
import com.legacy.aether.network.AetherGuiHandler;
|
||||
import com.legacy.aether.tileentity.TileEntityTreasureChest;
|
||||
|
||||
public class BlockTreasureChest extends BlockContainer
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockTreasureChest extends BlockChest
|
||||
{
|
||||
|
||||
public static final PropertyDirection FACING = BlockHorizontal.FACING;
|
||||
protected static final AxisAlignedBB NORTH_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0D, 0.9375D, 0.875D, 0.9375D);
|
||||
protected static final AxisAlignedBB SOUTH_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 1.0D);
|
||||
protected static final AxisAlignedBB WEST_CHEST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
|
||||
protected static final AxisAlignedBB EAST_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 1.0D, 0.875D, 0.9375D);
|
||||
protected static final AxisAlignedBB NOT_CONNECTED_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
|
||||
public BlockTreasureChest()
|
||||
{
|
||||
super(56);
|
||||
|
||||
public BlockTreasureChest()
|
||||
this.setBlockUnbreakable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_)
|
||||
{
|
||||
super(Material.ROCK);
|
||||
|
||||
this.setHardness(-1.0F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only,
|
||||
* LIQUID for vanilla liquids, INVISIBLE to skip all rendering
|
||||
*/
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return source.getBlockState(pos.north()).getBlock() == this ? NORTH_CHEST_AABB : (source.getBlockState(pos.south()).getBlock() == this ? SOUTH_CHEST_AABB : (source.getBlockState(pos.west()).getBlock() == this ? WEST_CHEST_AABB : (source.getBlockState(pos.east()).getBlock() == this ? EAST_CHEST_AABB : NOT_CONNECTED_AABB)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the block is set in the Chunk data, but before the Tile Entity is set
|
||||
*/
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
this.checkForSurroundingChests(worldIn, pos, state);
|
||||
|
||||
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(enumfacing);
|
||||
IBlockState iblockstate = worldIn.getBlockState(blockpos);
|
||||
|
||||
if (iblockstate.getBlock() == this)
|
||||
{
|
||||
this.checkForSurroundingChests(worldIn, blockpos, iblockstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||
* IBlockstate
|
||||
*/
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||
*/
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite();
|
||||
state = state.withProperty(FACING, enumfacing);
|
||||
BlockPos blockpos = pos.north();
|
||||
BlockPos blockpos1 = pos.south();
|
||||
BlockPos blockpos2 = pos.west();
|
||||
BlockPos blockpos3 = pos.east();
|
||||
boolean flag = this == worldIn.getBlockState(blockpos).getBlock();
|
||||
boolean flag1 = this == worldIn.getBlockState(blockpos1).getBlock();
|
||||
boolean flag2 = this == worldIn.getBlockState(blockpos2).getBlock();
|
||||
boolean flag3 = this == worldIn.getBlockState(blockpos3).getBlock();
|
||||
|
||||
if (!flag && !flag1 && !flag2 && !flag3)
|
||||
{
|
||||
worldIn.setBlockState(pos, state, 3);
|
||||
}
|
||||
else if (enumfacing.getAxis() != EnumFacing.Axis.X || !flag && !flag1)
|
||||
{
|
||||
if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3))
|
||||
{
|
||||
if (flag2)
|
||||
{
|
||||
worldIn.setBlockState(blockpos2, state, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setBlockState(blockpos3, state, 3);
|
||||
}
|
||||
|
||||
worldIn.setBlockState(pos, state, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
worldIn.setBlockState(blockpos, state, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setBlockState(blockpos1, state, 3);
|
||||
}
|
||||
|
||||
worldIn.setBlockState(pos, state, 3);
|
||||
}
|
||||
|
||||
if (stack.hasDisplayName())
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityTreasureChest)
|
||||
{
|
||||
((TileEntityTreasureChest)tileentity).setCustomName(stack.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IBlockState checkForSurroundingChests(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (worldIn.isRemote)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
else
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos.north());
|
||||
IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
|
||||
IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
|
||||
IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
|
||||
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
|
||||
|
||||
if (iblockstate.getBlock() != this && iblockstate1.getBlock() != this)
|
||||
{
|
||||
boolean flag = iblockstate.isFullBlock();
|
||||
boolean flag1 = iblockstate1.isFullBlock();
|
||||
|
||||
if (iblockstate2.getBlock() == this || iblockstate3.getBlock() == this)
|
||||
{
|
||||
BlockPos blockpos1 = iblockstate2.getBlock() == this ? pos.west() : pos.east();
|
||||
IBlockState iblockstate7 = worldIn.getBlockState(blockpos1.north());
|
||||
IBlockState iblockstate6 = worldIn.getBlockState(blockpos1.south());
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
EnumFacing enumfacing2;
|
||||
|
||||
if (iblockstate2.getBlock() == this)
|
||||
{
|
||||
enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING);
|
||||
}
|
||||
else
|
||||
{
|
||||
enumfacing2 = (EnumFacing)iblockstate3.getValue(FACING);
|
||||
}
|
||||
|
||||
if (enumfacing2 == EnumFacing.NORTH)
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
if ((flag || iblockstate7.isFullBlock()) && !flag1 && !iblockstate6.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
}
|
||||
|
||||
if ((flag1 || iblockstate6.isFullBlock()) && !flag && !iblockstate7.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockPos blockpos = iblockstate.getBlock() == this ? pos.north() : pos.south();
|
||||
IBlockState iblockstate4 = worldIn.getBlockState(blockpos.west());
|
||||
IBlockState iblockstate5 = worldIn.getBlockState(blockpos.east());
|
||||
enumfacing = EnumFacing.EAST;
|
||||
EnumFacing enumfacing1;
|
||||
|
||||
if (iblockstate.getBlock() == this)
|
||||
{
|
||||
enumfacing1 = (EnumFacing)iblockstate.getValue(FACING);
|
||||
}
|
||||
else
|
||||
{
|
||||
enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
|
||||
}
|
||||
|
||||
if (enumfacing1 == EnumFacing.WEST)
|
||||
{
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
|
||||
if ((iblockstate2.isFullBlock() || iblockstate4.isFullBlock()) && !iblockstate3.isFullBlock() && !iblockstate5.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.EAST;
|
||||
}
|
||||
|
||||
if ((iblockstate3.isFullBlock() || iblockstate5.isFullBlock()) && !iblockstate2.isFullBlock() && !iblockstate4.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
}
|
||||
|
||||
state = state.withProperty(FACING, enumfacing);
|
||||
worldIn.setBlockState(pos, state, 3);
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
public IBlockState correctFacing(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
EnumFacing enumfacing = null;
|
||||
|
||||
for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos.offset(enumfacing1));
|
||||
|
||||
if (iblockstate.getBlock() == this)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
if (iblockstate.isFullBlock())
|
||||
{
|
||||
if (enumfacing != null)
|
||||
{
|
||||
enumfacing = null;
|
||||
break;
|
||||
}
|
||||
|
||||
enumfacing = enumfacing1;
|
||||
}
|
||||
}
|
||||
|
||||
if (enumfacing != null)
|
||||
{
|
||||
return state.withProperty(FACING, enumfacing.getOpposite());
|
||||
}
|
||||
else
|
||||
{
|
||||
EnumFacing enumfacing2 = (EnumFacing)state.getValue(FACING);
|
||||
|
||||
if (worldIn.getBlockState(pos.offset(enumfacing2)).isFullBlock())
|
||||
{
|
||||
enumfacing2 = enumfacing2.getOpposite();
|
||||
}
|
||||
|
||||
if (worldIn.getBlockState(pos.offset(enumfacing2)).isFullBlock())
|
||||
{
|
||||
enumfacing2 = enumfacing2.rotateY();
|
||||
}
|
||||
|
||||
if (worldIn.getBlockState(pos.offset(enumfacing2)).isFullBlock())
|
||||
{
|
||||
enumfacing2 = enumfacing2.getOpposite();
|
||||
}
|
||||
|
||||
return state.withProperty(FACING, enumfacing2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
BlockPos blockpos = pos.west();
|
||||
BlockPos blockpos1 = pos.east();
|
||||
BlockPos blockpos2 = pos.north();
|
||||
BlockPos blockpos3 = pos.south();
|
||||
|
||||
if (worldIn.getBlockState(blockpos).getBlock() == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (worldIn.getBlockState(blockpos1).getBlock() == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (worldIn.getBlockState(blockpos2).getBlock() == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (worldIn.getBlockState(blockpos3).getBlock() == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
|
||||
* change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
|
||||
* block, etc.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
|
||||
{
|
||||
super.neighborChanged(state, worldIn, pos, blockIn);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityTreasureChest)
|
||||
{
|
||||
((TileEntityTreasureChest)tileentity).updateContainingBlockInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
|
||||
*/
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof IInventory)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
this.blockIcon = p_149651_1_.registerIcon(Aether.find("carved_stone"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityTreasureChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (worldIn.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityTreasureChest treasurechest = (TileEntityTreasureChest)worldIn.getTileEntity(pos);
|
||||
TileEntityTreasureChest treasurechest = (TileEntityTreasureChest)worldIn.getTileEntity(x, y, z);
|
||||
|
||||
ItemStack guiID = heldItem;
|
||||
ItemStack guiID = playerIn.getCurrentEquippedItem();
|
||||
|
||||
if (treasurechest.isLocked())
|
||||
{
|
||||
|
@ -401,95 +66,22 @@ public class BlockTreasureChest extends BlockContainer
|
|||
}
|
||||
else
|
||||
{
|
||||
playerIn.openGui(Aether.instance, AetherGuiHandler.treasure_chest, worldIn, pos.getX(), pos.getY(), pos.getZ());
|
||||
playerIn.openGui(Aether.instance, AetherGuiHandler.treasure_chest, worldIn, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityTreasureChest();
|
||||
}
|
||||
|
||||
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
if (!blockState.canProvidePower())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
TileEntity tileentity = blockAccess.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityTreasureChest)
|
||||
{
|
||||
i = ((TileEntityTreasureChest)tileentity).numPlayersUsing;
|
||||
}
|
||||
|
||||
return MathHelper.clamp_int(i, 0, 15);
|
||||
}
|
||||
}
|
||||
|
||||
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.UP ? blockState.getWeakPower(blockAccess, pos, side) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
EnumFacing enumfacing = EnumFacing.getFront(meta);
|
||||
|
||||
if (enumfacing.getAxis() == EnumFacing.Axis.Y)
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
return this.getDefaultState().withProperty(FACING, enumfacing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((EnumFacing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
|
||||
* blockstate.
|
||||
*/
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot)
|
||||
{
|
||||
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
|
||||
* blockstate.
|
||||
*/
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
|
||||
{
|
||||
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.treasureChestRenderID;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,74 +3,57 @@ package com.legacy.aether.blocks.natural;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.blocks.util.EnumCloudType;
|
||||
import com.legacy.aether.blocks.util.IAetherMeta;
|
||||
import com.legacy.aether.items.block.IColoredBlock;
|
||||
import com.legacy.aether.items.block.INamedBlock;
|
||||
import com.legacy.aether.registry.achievements.AchievementsAether;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockAercloud extends Block implements IAetherMeta
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAercloud extends Block implements IColoredBlock, INamedBlock
|
||||
{
|
||||
|
||||
public static final PropertyEnum<EnumCloudType> cloud_type = PropertyEnum.create("aether_aercloud", EnumCloudType.class);
|
||||
|
||||
public BlockAercloud()
|
||||
public BlockAercloud()
|
||||
{
|
||||
super(Material.ICE);
|
||||
super(Material.ice);
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setSoundType(SoundType.CLOTH);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(cloud_type, EnumCloudType.Cold));
|
||||
this.setStepSound(soundTypeCloth);
|
||||
this.setBlockTextureName("aether_legacy:aercloud");
|
||||
}
|
||||
|
||||
public static int getHexColor(ItemStack stack)
|
||||
{
|
||||
if (stack.getMetadata() == 1)
|
||||
{
|
||||
return 0xCCFFFF;
|
||||
}
|
||||
else if (stack.getMetadata() == 2)
|
||||
{
|
||||
return 0xFFFF80;
|
||||
}
|
||||
|
||||
return 16777215; //Default color
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)
|
||||
{
|
||||
p_149666_3_.add(new ItemStack(this, 1, 0));
|
||||
p_149666_3_.add(new ItemStack(this, 1, 1));
|
||||
p_149666_3_.add(new ItemStack(this, 1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
entity.fallDistance = 0;
|
||||
|
||||
if (((EnumCloudType)state.getValue(cloud_type)).equals(EnumCloudType.Blue))
|
||||
if (world.getBlockMetadata(x, y, z) == 1)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
|
||||
player.addStat(AchievementsAether.blue_cloud);
|
||||
player.triggerAchievement(AchievementsAether.blue_cloud);
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
|
@ -91,94 +74,103 @@ public class BlockAercloud extends Block implements IAetherMeta
|
|||
|
||||
if (world.isRemote)
|
||||
{
|
||||
for (int count = 0; count < 50; count++)
|
||||
if (!(entity instanceof net.minecraft.client.particle.EntityFX))
|
||||
{
|
||||
double xOffset = pos.getX() + world.rand.nextDouble();
|
||||
double yOffset = pos.getY() + world.rand.nextDouble();
|
||||
double zOffset = pos.getZ() + world.rand.nextDouble();
|
||||
for (int count = 0; count < 50; count++)
|
||||
{
|
||||
double xOffset = x + world.rand.nextDouble();
|
||||
double yOffset = y + world.rand.nextDouble();
|
||||
double zOffset = z + world.rand.nextDouble();
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.WATER_SPLASH, xOffset, yOffset, zOffset, 0, 0, 0);
|
||||
world.spawnParticle("splash", xOffset, yOffset, zOffset, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (entity.motionY < 0)
|
||||
{
|
||||
if (((EnumCloudType)state.getValue(cloud_type)).equals(EnumCloudType.Pink))
|
||||
{
|
||||
if (entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase)
|
||||
{
|
||||
((EntityLivingBase)entity).heal(1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.motionY < 0)
|
||||
{
|
||||
entity.motionY *= 0.005D;
|
||||
}
|
||||
entity.motionY *= 0.005D;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaName(ItemStack stack)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta)
|
||||
{
|
||||
if (meta == 1)
|
||||
{
|
||||
return 0xCCFFFF;
|
||||
}
|
||||
else if (meta == 2)
|
||||
{
|
||||
return 0xFFFF80;
|
||||
}
|
||||
|
||||
return this.getBlockColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return this.getRenderColor(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
return ((EnumCloudType)this.getStateFromMeta(stack.getItemDamage()).getValue(cloud_type)).getName();
|
||||
return stack.getItemDamage() == 1 ? "blue_aercloud" : stack.getItemDamage() == 2 ? "golden_aercloud" : "cold_aercloud";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return ((EnumCloudType)state.getValue(cloud_type)).getMeta();
|
||||
}
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
if (stack.getItemDamage() == 1)
|
||||
{
|
||||
return 0xCCFFFF;
|
||||
}
|
||||
else if (stack.getItemDamage() == 2)
|
||||
{
|
||||
return 0xFFFF80;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int j = 0; j < EnumCloudType.values().length; ++j)
|
||||
{
|
||||
EnumCloudType cloud_type = EnumCloudType.values()[j];
|
||||
|
||||
if (cloud_type != EnumCloudType.Pink)
|
||||
{
|
||||
list.add(new ItemStack(itemIn, 1, cloud_type.getMeta()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(cloud_type, EnumCloudType.getType(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((EnumCloudType)state.getValue(cloud_type)).getMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {cloud_type});
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess worldIn, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (worldIn.getBlockState(pos.offset(side)) != iblockstate)
|
||||
if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -188,25 +180,13 @@ public class BlockAercloud extends Block implements IAetherMeta
|
|||
return false;
|
||||
}
|
||||
|
||||
return !worldIn.getBlockState(pos.offset(side)).doesSideBlockRendering(worldIn, pos.offset(side), side.getOpposite());
|
||||
return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World worldIn, BlockPos pos)
|
||||
{
|
||||
return ((EnumCloudType)state.getValue(cloud_type)).getMeta() != 1 ? new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.01D, 1.0D) : NULL_AABB;
|
||||
return world.getBlockMetadata(x, y, z) != 1 ? AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0D, y + 0.01D, z + 1.0D) : AxisAlignedBB.getBoundingBox(x, y, z, x, y, z);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,73 +1,35 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import com.legacy.aether.items.util.DoubleDropHelper;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.items.util.DoubleDropHelper;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockAetherDirt extends Block
|
||||
public class BlockAetherDirt extends Block
|
||||
{
|
||||
|
||||
public static final PropertyBool double_drop = PropertyBool.create(Aether.doubleDropNotifier());
|
||||
|
||||
public BlockAetherDirt()
|
||||
{
|
||||
super(Material.GROUND);
|
||||
super(Material.ground);
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setSoundType(SoundType.GROUND);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(double_drop, Boolean.TRUE));
|
||||
this.setHarvestLevel("shovel", 0);
|
||||
this.setStepSound(soundTypeGravel);
|
||||
this.setBlockTextureName("aether_legacy:aether_dirt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
world.setBlockState(pos, state.withProperty(double_drop, Boolean.FALSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if (!((Boolean)state.getValue(double_drop)).booleanValue())
|
||||
{
|
||||
meta |= 1;
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(double_drop, Boolean.valueOf(meta == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
DoubleDropHelper.dropBlock(player, state, pos, double_drop);
|
||||
DoubleDropHelper.dropBlock(player, x, y, z, this, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {double_drop});
|
||||
}
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,54 +2,43 @@ package com.legacy.aether.blocks.natural;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.CommonProxy;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
public class BlockAetherFlower extends BlockBush
|
||||
{
|
||||
|
||||
public AxisAlignedBB FLOWER_AABB = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D);
|
||||
public AxisAlignedBB FLOWER_AABB = AxisAlignedBB.getBoundingBox(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D);
|
||||
|
||||
public BlockAetherFlower()
|
||||
{
|
||||
this.setHardness(0.0F);
|
||||
this.setTickRandomly(true);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
this.FLOWER_AABB = new AxisAlignedBB(0.5F - 0.2F, 0.0F, 0.5F - 0.2F, 0.5F + 0.2F, 0.2F * 3.0F, 0.5F + 0.2F);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setBlockBounds(0.5F - 0.2F, 0.0F, 0.5F - 0.2F, 0.5F + 0.2F, 0.2F * 3.0F, 0.5F + 0.2F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return FLOWER_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos)
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z)
|
||||
{
|
||||
IBlockState soil = world.getBlockState(pos.down());
|
||||
return soil.getBlock() == BlocksAether.aether_grass || soil.getBlock() == BlocksAether.aether_dirt || soil.getBlock() == BlocksAether.enchanted_aether_grass || super.canPlaceBlockAt(world, pos);
|
||||
Block soil = world.getBlock(x, y - 1, z);
|
||||
return soil == BlocksAether.aether_grass || soil == BlocksAether.aether_dirt || soil == BlocksAether.enchanted_aether_grass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state)
|
||||
public boolean canBlockStay(World world, int x, int y, int z)
|
||||
{
|
||||
Block soil = world.getBlockState(pos.down()).getBlock();
|
||||
return (world.getLight(pos) >= 8 || world.canBlockSeeSky(pos)) && (soil != null && this.canPlaceBlockAt(world, pos));
|
||||
Block soil = world.getBlock(x, y - 1, z);
|
||||
return (soil != null && this.canPlaceBlockAt(world, x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.aetherFlowerRenderID;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,133 +3,62 @@ package com.legacy.aether.blocks.natural;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.items.util.DoubleDropHelper;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
import com.legacy.aether.world.AetherWorld;
|
||||
|
||||
public class BlockAetherGrass extends Block
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAetherGrass extends Block implements IGrowable
|
||||
{
|
||||
|
||||
public static final PropertyBool double_drop = PropertyBool.create(Aether.doubleDropNotifier());
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
public BlockAetherGrass()
|
||||
{
|
||||
super(Material.GRASS);
|
||||
super(Material.grass);
|
||||
|
||||
this.setTickRandomly(true);
|
||||
this.setHardness(0.2F);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(double_drop, Boolean.TRUE));
|
||||
this.setTickRandomly(true);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setHarvestLevel("shovel", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
|
||||
public void updateTick(World worldIn, int x, int y, int z, Random rand)
|
||||
{
|
||||
EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
|
||||
|
||||
switch (plantType)
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
case Plains: return true;
|
||||
case Beach:
|
||||
boolean hasWater = (world.getBlockState(pos.east()).getMaterial() == Material.WATER ||
|
||||
world.getBlockState(pos.west()).getMaterial() == Material.WATER ||
|
||||
world.getBlockState(pos.north()).getMaterial() == Material.WATER ||
|
||||
world.getBlockState(pos.south()).getMaterial() == Material.WATER);
|
||||
return hasWater;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return super.canSustainPlant(state, world, pos, direction, plantable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
world.setBlockState(pos, state.withProperty(double_drop, Boolean.FALSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if (!((Boolean)state.getValue(double_drop)).booleanValue())
|
||||
{
|
||||
meta |= 1;
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(double_drop, Boolean.valueOf(meta == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
|
||||
{
|
||||
DoubleDropHelper.dropBlock(player, state, pos, double_drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {double_drop});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getLightOpacity(world, pos) > 2)
|
||||
if (worldIn.getBlockLightValue(x, y + 1, z) < 4 && worldIn.getBlockLightOpacity(x, y + 1, z) > 2)
|
||||
{
|
||||
boolean shouldContainDoubleDrop = ((boolean)state.getValue(BlockAetherDirt.double_drop));
|
||||
world.setBlockState(pos, BlocksAether.aether_dirt.getDefaultState().withProperty(double_drop, shouldContainDoubleDrop));
|
||||
worldIn.setBlock(x, y, z, BlocksAether.aether_dirt);
|
||||
}
|
||||
else
|
||||
else if (worldIn.getBlockLightValue(x, y + 1, z) >= 9)
|
||||
{
|
||||
if (world.getLightFromNeighbors(pos.up()) >= 9)
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
int i1 = x + rand.nextInt(3) - 1;
|
||||
int j1 = y + rand.nextInt(5) - 3;
|
||||
int k1 = z + rand.nextInt(3) - 1;
|
||||
|
||||
if (worldIn.getBlock(i1, j1, k1) == BlocksAether.aether_dirt && worldIn.getBlockMetadata(i1, j1, k1) == 0 && worldIn.getBlockLightValue(i1, j1 + 1, k1) >= 4 && worldIn.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
{
|
||||
BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);
|
||||
IBlockState iblockstate = world.getBlockState(blockpos.up());
|
||||
IBlockState iblockstate1 = world.getBlockState(blockpos);
|
||||
|
||||
if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !world.isBlockLoaded(blockpos))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (iblockstate1.getBlock() == BlocksAether.aether_dirt && world.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(world, blockpos.up()) <= 2)
|
||||
{
|
||||
boolean shouldContainDoubleDrop = ((boolean)iblockstate1.getValue(BlockAetherDirt.double_drop));
|
||||
world.setBlockState(blockpos, BlocksAether.aether_grass.getDefaultState().withProperty(double_drop, shouldContainDoubleDrop));
|
||||
return;
|
||||
}
|
||||
worldIn.setBlock(i1, j1, k1, BlocksAether.aether_grass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,9 +66,126 @@ public class BlockAetherGrass extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(BlocksAether.aether_dirt);
|
||||
return Item.getItemFromBlock(BlocksAether.aether_dirt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
DoubleDropHelper.dropBlock(player, x, y, z, this, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon("aether_legacy:aether_grass_side");
|
||||
this.blockIconTop = registry.registerIcon("aether_legacy:aether_grass_top");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.aether_dirt.getBlockTextureFromSide(side) : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
return BlocksAether.aether_dirt.getBlockTextureFromSide(side);
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable)
|
||||
{
|
||||
EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z);
|
||||
|
||||
return plantType == EnumPlantType.Plains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_)
|
||||
{
|
||||
int l = 0;
|
||||
|
||||
while (l < 128)
|
||||
{
|
||||
int i1 = p_149853_3_;
|
||||
int j1 = p_149853_4_ + 1;
|
||||
int k1 = p_149853_5_;
|
||||
int l1 = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (l1 < l / 16)
|
||||
{
|
||||
i1 += p_149853_2_.nextInt(3) - 1;
|
||||
j1 += (p_149853_2_.nextInt(3) - 1) * p_149853_2_.nextInt(3) / 2;
|
||||
k1 += p_149853_2_.nextInt(3) - 1;
|
||||
|
||||
if (p_149853_1_.getBlock(i1, j1 - 1, k1) == BlocksAether.aether_grass && !p_149853_1_.getBlock(i1, j1, k1).isNormalCube())
|
||||
{
|
||||
++l1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (p_149853_1_.isAirBlock(i1, j1, k1))
|
||||
{
|
||||
if (p_149853_2_.nextInt(8) != 0)
|
||||
{
|
||||
if (Blocks.tallgrass.canBlockStay(p_149853_1_, i1, j1, k1))
|
||||
{
|
||||
p_149853_1_.setBlock(i1, j1, k1, Blocks.tallgrass, 1, 3);
|
||||
}
|
||||
}
|
||||
else if (p_149853_2_.nextInt(12) == 0)
|
||||
{
|
||||
if (BlocksAether.berry_bush_stem.canBlockStay(p_149853_1_, i1, j1, k1))
|
||||
{
|
||||
p_149853_1_.setBlock(i1, j1, k1, BlocksAether.berry_bush_stem, 0, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AetherWorld.aether_biome.plantFlower(p_149853_1_, p_149853_2_, i1, j1, k1);
|
||||
}
|
||||
}
|
||||
|
||||
++l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,180 +1,169 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockPlanks.EnumType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.blocks.util.EnumLeafType;
|
||||
import com.legacy.aether.blocks.util.IAetherMeta;
|
||||
import com.legacy.aether.entities.particles.ParticleCrystalLeaves;
|
||||
import com.legacy.aether.entities.particles.ParticleGoldenOakLeaves;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
import com.legacy.aether.entities.particles.ParticleHolidayLeaves;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
|
||||
public class BlockAetherLeaves extends BlockLeaves implements IAetherMeta
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAetherLeaves extends BlockLeaves
|
||||
{
|
||||
|
||||
public static final PropertyEnum<EnumLeafType> leaf_type = PropertyEnum.create("aether_leaves", EnumLeafType.class);
|
||||
|
||||
public BlockAetherLeaves()
|
||||
public BlockAetherLeaves()
|
||||
{
|
||||
super();
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setLightOpacity(1);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(leaf_type, EnumLeafType.Green).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaName(ItemStack stack)
|
||||
{
|
||||
return ((EnumLeafType)this.getStateFromMeta(stack.getItemDamage()).getValue(leaf_type)).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
public int getBlockColor()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta)
|
||||
{
|
||||
return this.getStateFromMeta(meta).withProperty(DECAYABLE, false).withProperty(CHECK_DECAY, false);
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(state, world, pos, random);
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().gameSettings.particleSetting != 2)
|
||||
if (net.minecraft.client.Minecraft.getMinecraft().gameSettings.particleSetting == 2)
|
||||
{
|
||||
if (((EnumLeafType)state.getValue(leaf_type)) == EnumLeafType.Golden)
|
||||
{
|
||||
for (int ammount = 0; ammount < 4; ammount++)
|
||||
{
|
||||
double d = pos.getX() + (random.nextFloat() - 0.5D) * 10;
|
||||
double d1 = pos.getY() + (random.nextFloat() - 0.5D) * 10;
|
||||
double d2 = pos.getZ() + (random.nextFloat() - 0.5D) * 10;
|
||||
double d3 = (random.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = (random.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = (random.nextFloat() - 0.5D) * 0.5D;
|
||||
return;
|
||||
}
|
||||
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleGoldenOakLeaves(world, d, d1, d2, d3, d4, d5));
|
||||
}
|
||||
if (this == BlocksAether.golden_oak_leaves)
|
||||
{
|
||||
for (int ammount = 0; ammount < 2; ammount++)
|
||||
{
|
||||
double d = x + (rand.nextFloat() - 0.5D) * 10;
|
||||
double d1 = y + (rand.nextFloat() - 0.5D) * 10;
|
||||
double d2 = z + (rand.nextFloat() - 0.5D) * 10;
|
||||
double d3 = (rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = (rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = (rand.nextFloat() - 0.5D) * 0.5D;
|
||||
|
||||
ParticleGoldenOakLeaves obj = new ParticleGoldenOakLeaves(world, d, d1, d2, d3, d4, d5);
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (this == BlocksAether.holiday_leaves || this == BlocksAether.decorated_holiday_leaves)
|
||||
{
|
||||
if (rand.nextInt(5) == 0)
|
||||
{
|
||||
for (int l = 0; l < 6; ++l)
|
||||
{
|
||||
double d = (double)x + ((double)rand.nextFloat() - 0.5D) * 8.0D;
|
||||
double d1 = (double)y + ((double)rand.nextFloat() - 0.5D) * 8.0D;
|
||||
double d2 = (double)z + ((double)rand.nextFloat() - 0.5D) * 8.0D;
|
||||
double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
|
||||
ParticleHolidayLeaves particle = new ParticleHolidayLeaves(world, d, d1, d2, d3, d4, d5);
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this == BlocksAether.crystal_leaves || this == BlocksAether.crystal_fruit_leaves)
|
||||
{
|
||||
if (rand.nextInt(5) == 0)
|
||||
{
|
||||
for (int l = 0; l < 6; ++l)
|
||||
{
|
||||
double d = (double)x + ((double)rand.nextFloat() - 0.5D) * 6.0D;
|
||||
double d1 = (double)y + ((double)rand.nextFloat() - 0.5D) * 6.0D;
|
||||
double d2 = (double)z + ((double)rand.nextFloat() - 0.5D) * 6.0D;
|
||||
double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
|
||||
ParticleCrystalLeaves particle = new ParticleCrystalLeaves(world, d, d1, d2, d3, d4, d5);
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
for (int j = 0; j < EnumLeafType.values().length; ++j)
|
||||
{
|
||||
EnumLeafType leafType = EnumLeafType.values()[j];
|
||||
return this == BlocksAether.skyroot_leaves ? Item.getItemFromBlock(BlocksAether.skyroot_sapling) : this == BlocksAether.golden_oak_leaves ? Item.getItemFromBlock(BlocksAether.golden_oak_leaves) : null;
|
||||
}
|
||||
|
||||
list.add(new ItemStack(itemIn, 1, leafType.getMeta()));
|
||||
}
|
||||
@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);
|
||||
|
||||
if (this == BlocksAether.crystal_fruit_leaves)
|
||||
{
|
||||
drops.add(new ItemStack(ItemsAether.white_apple));
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(leaf_type, EnumLeafType.getType(meta % 2)).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 8) > 0));
|
||||
}
|
||||
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
i = i | ((EnumLeafType)state.getValue(leaf_type)).getMeta();
|
||||
|
||||
if (!((Boolean)state.getValue(DECAYABLE)).booleanValue())
|
||||
{
|
||||
i |= 4;
|
||||
}
|
||||
|
||||
if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue())
|
||||
{
|
||||
i |= 8;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {leaf_type, DECAYABLE, CHECK_DECAY});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
return ((EnumLeafType)state.getValue(leaf_type)) == EnumLeafType.Green ? Item.getItemFromBlock(BlocksAether.skyroot_sapling) : Item.getItemFromBlock(BlocksAether.golden_oak_sapling);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(new ItemStack(this));
|
||||
|
||||
return list;
|
||||
return super.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumType getWoodType(int meta)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] func_150125_e()
|
||||
{
|
||||
return null;
|
||||
return new String[] { this.getUnlocalizedName() };
|
||||
}
|
||||
|
||||
}
|
|
@ -1,204 +1,101 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.blocks.util.EnumLogType;
|
||||
import com.legacy.aether.blocks.util.IAetherMeta;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.items.tools.ItemAetherTool;
|
||||
import com.legacy.aether.items.tools.ItemGravititeTool;
|
||||
import com.legacy.aether.items.tools.ItemSkyrootTool;
|
||||
import com.legacy.aether.items.tools.ItemValkyrieTool;
|
||||
import com.legacy.aether.items.util.EnumAetherToolType;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockAetherLog extends BlockLog implements IAetherMeta
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAetherLog extends BlockLog
|
||||
{
|
||||
|
||||
public static final PropertyEnum<EnumLogType> wood_type = PropertyEnum.create("aether_logs", EnumLogType.class);
|
||||
|
||||
public static final PropertyBool double_drop = PropertyBool.create(Aether.doubleDropNotifier());
|
||||
|
||||
public BlockAetherLog()
|
||||
{
|
||||
super();
|
||||
|
||||
this.setHardness(2.0F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(wood_type, EnumLogType.Skyroot).withProperty(double_drop, Boolean.TRUE).withProperty(LOG_AXIS, BlockLog.EnumAxis.Y));
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
return this.getStateFromMeta(meta).withProperty(wood_type, EnumLogType.getType(meta)).withProperty(double_drop, Boolean.FALSE).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (worldIn.isAreaLoaded(pos.add(-5, -5, -5), pos.add(5, 5, 5)))
|
||||
{
|
||||
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-4, -4, -4), pos.add(4, 4, 4)))
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(blockpos);
|
||||
|
||||
if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos))
|
||||
{
|
||||
iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stackIn)
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
player.addStat(StatList.getBlockStats(state.getBlock()));
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
|
||||
int size = state.getValue(double_drop).equals(true) ? 2 : 1;
|
||||
int size = meta == 0 ? 2 : 1;
|
||||
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
IBlockState defaults = BlocksAether.aether_log.getDefaultState();
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool)stack.getItem()).toolType == EnumAetherToolType.AXE)
|
||||
if (stack != null && ((stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool)stack.getItem()).toolType == EnumAetherToolType.AXE) || stack.getItem() == Items.diamond_axe))
|
||||
{
|
||||
if (stack.getItem() instanceof ItemGravititeTool || stack.getItem() instanceof ItemValkyrieTool)
|
||||
if (stack.getItem() instanceof ItemGravititeTool || stack.getItem() instanceof ItemValkyrieTool || stack.getItem() == Items.diamond_axe)
|
||||
{
|
||||
if (state.getValue(wood_type) == EnumLogType.Oak)
|
||||
if (this == BlocksAether.golden_oak_log)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(ItemsAether.golden_amber, 1 + RANDOM.nextInt(2)));
|
||||
this.dropBlockAsItem(worldIn, x, y, z, new ItemStack(ItemsAether.golden_amber, 1 + worldIn.rand.nextInt(2)));
|
||||
}
|
||||
|
||||
defaults.getBlock().dropBlockAsItem(worldIn, pos, defaults, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand()));
|
||||
this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));
|
||||
}
|
||||
else if (stack.getItem() instanceof ItemSkyrootTool)
|
||||
{
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
defaults.getBlock().dropBlockAsItem(worldIn, pos, defaults, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand()));
|
||||
this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
defaults.getBlock().dropBlockAsItem(worldIn, pos, defaults, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand()));
|
||||
this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(defaults.getBlock()));
|
||||
super.harvestBlock(worldIn, player, x, y, z, meta);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaName(ItemStack stack)
|
||||
{
|
||||
return ((EnumLogType)this.getStateFromMeta(stack.getItemDamage()).getValue(wood_type)).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return 0;
|
||||
return Item.getItemFromBlock(BlocksAether.skyroot_log);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
list.add(new ItemStack(this, 1, 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
IBlockState iblockstate = this.getDefaultState().withProperty(wood_type, EnumLogType.getType(meta)).withProperty(double_drop, Boolean.valueOf((meta % 4) < 2));
|
||||
this.field_150167_a = new IIcon[1];
|
||||
this.field_150166_b = new IIcon[1];
|
||||
|
||||
switch (meta & 12)
|
||||
for (int i = 0; i < this.field_150167_a.length; ++i)
|
||||
{
|
||||
case 0:
|
||||
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
|
||||
break;
|
||||
case 4:
|
||||
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
|
||||
break;
|
||||
case 8:
|
||||
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
|
||||
break;
|
||||
default:
|
||||
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
|
||||
this.field_150167_a[i] = registry.registerIcon(this.getTextureName() + "_side");
|
||||
this.field_150166_b[i] = registry.registerIcon(this.getTextureName() + "_top");
|
||||
}
|
||||
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int meta = 0;
|
||||
meta = meta | ((EnumLogType)state.getValue(wood_type)).getMeta();
|
||||
|
||||
if (!((Boolean)state.getValue(double_drop)).booleanValue())
|
||||
{
|
||||
meta |= 2;
|
||||
}
|
||||
|
||||
switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
|
||||
{
|
||||
case Y:
|
||||
break;
|
||||
case X:
|
||||
meta |= 4;
|
||||
break;
|
||||
case Z:
|
||||
meta |= 8;
|
||||
break;
|
||||
case NONE:
|
||||
meta |= 12;
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {wood_type, double_drop, LOG_AXIS});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.items.tools.ItemAetherTool;
|
||||
import com.legacy.aether.items.tools.ItemSkyrootTool;
|
||||
import com.legacy.aether.items.util.EnumAetherToolType;
|
||||
|
||||
public class BlockAetherOre extends Block
|
||||
{
|
||||
|
||||
public BlockAetherOre(int level)
|
||||
{
|
||||
super(Material.rock);
|
||||
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHarvestLevel("pickaxe", level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0)
|
||||
{
|
||||
super.harvestBlock(worldIn, player, x, y, z, meta);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ItemSkyrootTool && ((ItemAetherTool)stack.getItem()).toolType == EnumAetherToolType.PICKAXE)
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.harvestBlock(worldIn, player, x, y, z, meta);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return this == BlocksAether.zanite_ore ? ItemsAether.zanite_gemstone : ItemsAether.ambrosium_shard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDroppedWithBonus(int fortune, Random random)
|
||||
{
|
||||
if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, random, fortune))
|
||||
{
|
||||
int j = random.nextInt(fortune + 2) - 1;
|
||||
|
||||
if (j < 0)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
return this.quantityDropped(random) * (j + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.quantityDropped(random);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
|
||||
{
|
||||
Random random = new Random();
|
||||
|
||||
if (this.getItemDropped(p_149690_5_, random, p_149690_7_) != Item.getItemFromBlock(this))
|
||||
{
|
||||
int amount = 0;
|
||||
|
||||
if (this == BlocksAether.ambrosium_ore)
|
||||
{
|
||||
amount = MathHelper.getRandomIntegerInRange(random, 0, 2);
|
||||
}
|
||||
else if (this == BlocksAether.zanite_ore)
|
||||
{
|
||||
amount = MathHelper.getRandomIntegerInRange(random, 2, 5);
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,70 +3,52 @@ package com.legacy.aether.blocks.natural;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.CommonProxy;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBerryBush extends BlockAetherFlower
|
||||
{
|
||||
|
||||
public BlockBerryBush()
|
||||
{
|
||||
this.FLOWER_AABB = new AxisAlignedBB(0F, 0F, 0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setHardness(0.2F);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
this.setHardness(0.2F);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setBlockTextureName(Aether.find("berry_bush"));
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
public Item getItemDropped(int meta, Random rand, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(BlocksAether.berry_bush_stem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
{
|
||||
return this.FLOWER_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return this.FLOWER_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer entityplayer, BlockPos pos, IBlockState state, TileEntity te, ItemStack stackIn)
|
||||
public void harvestBlock(World world, EntityPlayer entityplayer, int x, int y, int z, int meta)
|
||||
{
|
||||
int min, max;
|
||||
|
||||
if (world.getBlockState(pos.down()).getBlock() == BlocksAether.enchanted_aether_grass)
|
||||
if (world.getBlock(x, y, z) == BlocksAether.enchanted_aether_grass)
|
||||
{
|
||||
min = 1;
|
||||
max = 4;
|
||||
|
@ -78,31 +60,58 @@ public class BlockBerryBush extends BlockAetherFlower
|
|||
}
|
||||
|
||||
int randomNum = world.rand.nextInt(max - min + 1) + min;
|
||||
entityplayer.addStat(StatList.getBlockStats(this), 1);
|
||||
entityplayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
entityplayer.addExhaustion(0.025F);
|
||||
|
||||
world.setBlockState(pos, BlocksAether.berry_bush_stem.getDefaultState());
|
||||
world.setBlock(x, y, z, BlocksAether.berry_bush_stem);
|
||||
|
||||
if (randomNum != 0)
|
||||
{
|
||||
spawnAsEntity(world, pos, new ItemStack(ItemsAether.blue_berry, randomNum, 0));
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.blueberry, randomNum, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkAndDropBlock(World world, BlockPos pos, IBlockState state)
|
||||
protected void checkAndDropBlock(World world, int x, int y, int z)
|
||||
{
|
||||
if(!this.canBlockStay(world, pos, state))
|
||||
if(!this.canBlockStay(world, x, y, z))
|
||||
{
|
||||
spawnAsEntity(world, pos, new ItemStack(ItemsAether.blue_berry, 1, 0));
|
||||
super.checkAndDropBlock(world, pos, state);
|
||||
int min, max;
|
||||
|
||||
if (world.getBlock(x, y, z) == BlocksAether.enchanted_aether_grass)
|
||||
{
|
||||
min = 1;
|
||||
max = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
min = 1;
|
||||
max = 3;
|
||||
}
|
||||
|
||||
int randomNum = world.rand.nextInt(max - min + 1) + min;
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.blueberry, randomNum, 0));
|
||||
world.setBlock(x, y, z, BlocksAether.berry_bush_stem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox((double)p_149668_2_ + this.minX, (double)p_149668_3_ + this.minY, (double)p_149668_4_ + this.minZ, (double)p_149668_2_ + this.maxX, (double)p_149668_3_ + this.maxY, (double)p_149668_4_ + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess worldIn, BlockPos pos, EnumFacing side)
|
||||
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.berryBushRenderID;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,86 +2,72 @@ package com.legacy.aether.blocks.natural;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBerryBushStem extends BlockAetherFlower implements IGrowable
|
||||
{
|
||||
|
||||
public BlockBerryBushStem()
|
||||
{
|
||||
this.FLOWER_AABB = new AxisAlignedBB(0.5F - 0.4F, 0.0F, 0.5F - 0.4F, 0.5F + 0.4F, 0.4F * 2.0F, 0.5F + 0.4F);
|
||||
this.setHardness(0.2F);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setBlockTextureName(Aether.find("berry_bush_stem"));
|
||||
this.setBlockBounds(0.5F - 0.4F, 0.0F, 0.5F - 0.4F, 0.5F + 0.4F, 0.4F * 2.0F, 0.5F + 0.4F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
super.updateTick(world, pos, state, random);
|
||||
super.updateTick(world, x, y, z, random);
|
||||
|
||||
if (world.getLight(pos.up()) >= 9 && random.nextInt(60) == 0)
|
||||
if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(60) == 0)
|
||||
{
|
||||
world.setBlockState(pos, BlocksAether.berry_bush.getDefaultState());
|
||||
world.setBlock(x, y, z, BlocksAether.berry_bush);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return this.FLOWER_AABB;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
|
||||
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient)
|
||||
public boolean func_149851_a(World world, int x, int y, int z, boolean isClient)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state)
|
||||
public boolean func_149852_a(World world, Random random, int x, int y, int z)
|
||||
{
|
||||
return (double)worldIn.rand.nextFloat() < 0.45D;
|
||||
return (double)random.nextFloat() < 0.45D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state)
|
||||
public void func_149853_b(World world, Random random, int x, int y, int z)
|
||||
{
|
||||
worldIn.setBlockState(pos, BlocksAether.berry_bush.getDefaultState());
|
||||
world.setBlock(x, y, z, BlocksAether.berry_bush);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockPlanks.EnumType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.blocks.util.EnumCrystalType;
|
||||
import com.legacy.aether.blocks.util.EnumLeafType;
|
||||
import com.legacy.aether.blocks.util.IAetherMeta;
|
||||
import com.legacy.aether.entities.particles.ParticleCrystalLeaves;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockCrystalLeaves extends BlockLeaves implements IAetherMeta
|
||||
{
|
||||
|
||||
public static final PropertyEnum<EnumCrystalType> leaf_type = PropertyEnum.create("crystal_leaves", EnumCrystalType.class);
|
||||
|
||||
public BlockCrystalLeaves()
|
||||
{
|
||||
super();
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setLightOpacity(1);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(leaf_type, EnumCrystalType.Crystal).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
return this.getStateFromMeta(meta).withProperty(DECAYABLE, false).withProperty(CHECK_DECAY, false);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaName(ItemStack stack)
|
||||
{
|
||||
return ((EnumCrystalType)this.getStateFromMeta(stack.getItemDamage()).getValue(leaf_type)).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
|
||||
{
|
||||
super.randomDisplayTick(state, world, pos, random);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().gameSettings.particleSetting != 2)
|
||||
{
|
||||
if (random.nextInt(10) == 0)
|
||||
{
|
||||
for (int l = 0; l < 15; ++l)
|
||||
{
|
||||
double d = (double)pos.getX() + ((double)random.nextFloat() - 0.5D) * 6.0D;
|
||||
double d1 = (double)pos.getY() + ((double)random.nextFloat() - 0.5D) * 6.0D;
|
||||
double d2 = (double)pos.getZ() + ((double)random.nextFloat() - 0.5D) * 6.0D;
|
||||
double d3 = ((double)random.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = ((double)random.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = ((double)random.nextFloat() - 0.5D) * 0.5D;
|
||||
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleCrystalLeaves(world, d, d1, d2, d3, d4, d5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
{
|
||||
for (int j = 0; j < EnumLeafType.values().length; ++j)
|
||||
{
|
||||
EnumLeafType enumdyecolor = EnumLeafType.values()[j];
|
||||
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(leaf_type, EnumCrystalType.getType(meta % 2)).withProperty(DECAYABLE, Boolean.valueOf((meta & 2) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 4) > 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
i = i | ((EnumCrystalType)state.getValue(leaf_type)).getMeta();
|
||||
|
||||
if (!((Boolean)state.getValue(DECAYABLE)).booleanValue())
|
||||
{
|
||||
i |= 2;
|
||||
}
|
||||
|
||||
if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue())
|
||||
{
|
||||
i |= 4;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {leaf_type, DECAYABLE, CHECK_DECAY});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(new ItemStack(this));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumType getWoodType(int meta)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
List<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
if (((EnumCrystalType)state.getValue(leaf_type)) == EnumCrystalType.Crystal_Fruited)
|
||||
{
|
||||
ret.add(new ItemStack(ItemsAether.white_apple));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockEnchantedAetherGrass extends Block
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIconTop;
|
||||
|
||||
public BlockEnchantedAetherGrass()
|
||||
{
|
||||
super(Material.grass);
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setHarvestLevel("shovel", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon("aether_legacy:enchanted_aether_grass_side");
|
||||
this.blockIconTop = registry.registerIcon("aether_legacy:enchanted_aether_grass_top");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.aether_dirt.getBlockTextureFromSide(side) : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
return this.blockIconTop;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
return BlocksAether.aether_dirt.getBlockTextureFromSide(side);
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockPlanks.EnumType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.blocks.util.EnumHolidayType;
|
||||
import com.legacy.aether.blocks.util.EnumLeafType;
|
||||
import com.legacy.aether.blocks.util.IAetherMeta;
|
||||
import com.legacy.aether.entities.particles.ParticleHolidayLeaves;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockHolidayLeaves extends BlockLeaves implements IAetherMeta
|
||||
{
|
||||
|
||||
public static final PropertyEnum<EnumHolidayType> leaf_type = PropertyEnum.create("holiday_leaves", EnumHolidayType.class);
|
||||
|
||||
public BlockHolidayLeaves()
|
||||
{
|
||||
super();
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setLightOpacity(1);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(leaf_type, EnumHolidayType.Holiday_Leaves).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true)));
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
return this.getStateFromMeta(meta).withProperty(DECAYABLE, false).withProperty(CHECK_DECAY, false);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaName(ItemStack stack)
|
||||
{
|
||||
return ((EnumHolidayType)this.getStateFromMeta(stack.getItemDamage()).getValue(leaf_type)).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
|
||||
{
|
||||
super.randomDisplayTick(state, world, pos, random);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().gameSettings.particleSetting != 2)
|
||||
{
|
||||
if (random.nextInt(10) == 0)
|
||||
{
|
||||
for (int l = 0; l < 15; ++l)
|
||||
{
|
||||
double d = (double)pos.getX() + ((double)random.nextFloat() - 0.5D) * 6.0D;
|
||||
double d1 = (double)pos.getY() + ((double)random.nextFloat() - 0.5D) * 6.0D;
|
||||
double d2 = (double)pos.getZ() + ((double)random.nextFloat() - 0.5D) * 6.0D;
|
||||
double d3 = ((double)random.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = ((double)random.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = ((double)random.nextFloat() - 0.5D) * 0.5D;
|
||||
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleHolidayLeaves(world, d, d1, d2, d3, d4, d5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
{
|
||||
for (int j = 0; j < EnumLeafType.values().length; ++j)
|
||||
{
|
||||
EnumLeafType enumdyecolor = EnumLeafType.values()[j];
|
||||
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(leaf_type, EnumHolidayType.getType(meta % 2)).withProperty(DECAYABLE, Boolean.valueOf((meta & 2) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 4) > 0));
|
||||
}
|
||||
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
i = i | ((EnumHolidayType)state.getValue(leaf_type)).getMeta();
|
||||
|
||||
if (!((Boolean)state.getValue(DECAYABLE)).booleanValue())
|
||||
{
|
||||
i |= 2;
|
||||
}
|
||||
|
||||
if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue())
|
||||
{
|
||||
i |= 4;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {leaf_type, DECAYABLE, CHECK_DECAY});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(new ItemStack(this));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumType getWoodType(int meta)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
List<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,73 +1,35 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.items.util.DoubleDropHelper;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHolystone extends Block
|
||||
{
|
||||
|
||||
public static final PropertyBool double_drop = PropertyBool.create(Aether.doubleDropNotifier());
|
||||
|
||||
public BlockHolystone()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
super(Material.rock);
|
||||
|
||||
this.setHardness(0.5F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(double_drop, Boolean.TRUE));
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setBlockTextureName("aether_legacy:holystone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
world.setBlockState(pos, state.withProperty(double_drop, Boolean.FALSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(double_drop, Boolean.valueOf(meta == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if (!((Boolean)state.getValue(double_drop)).booleanValue())
|
||||
{
|
||||
meta |= 1;
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
DoubleDropHelper.dropBlock(player, state, pos, double_drop);
|
||||
DoubleDropHelper.dropBlock(player, x, y, z, this, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {double_drop});
|
||||
}
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockIcestone extends Block
|
||||
{
|
||||
|
||||
public BlockIcestone()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
|
||||
this.setHardness(3F);
|
||||
this.setTickRandomly(true);
|
||||
this.setSoundType(SoundType.GLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
for (int x = pos.getX() - 3; x <= (pos.getX() + 3); ++x)
|
||||
{
|
||||
for (int y = pos.getY() - 3; y <= (pos.getY() + 3); ++y)
|
||||
{
|
||||
for (int z = pos.getZ() - 3; z <= (pos.getZ() + 3); ++z)
|
||||
{
|
||||
BlockPos newPos = new BlockPos(x, y, z);
|
||||
Block block = worldIn.getBlockState(newPos).getBlock();
|
||||
|
||||
if (block == Blocks.WATER || block == Blocks.FLOWING_WATER)
|
||||
{
|
||||
worldIn.setBlockState(newPos, Blocks.ICE.getDefaultState());
|
||||
}
|
||||
else if (block == Blocks.LAVA || block == Blocks.FLOWING_LAVA)
|
||||
{
|
||||
worldIn.setBlockState(newPos, Blocks.OBSIDIAN.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +1,37 @@
|
|||
package com.legacy.aether.blocks.natural;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.items.util.DoubleDropHelper;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockQuicksoil extends Block
|
||||
{
|
||||
|
||||
public static final PropertyBool double_drop = PropertyBool.create(Aether.doubleDropNotifier());
|
||||
|
||||
public BlockQuicksoil()
|
||||
{
|
||||
super(Material.SAND);
|
||||
super(Material.sand);
|
||||
|
||||
this.slipperiness = 1.1F;
|
||||
|
||||
this.setHardness(0.5F);
|
||||
this.setSoundType(SoundType.SAND);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(double_drop, Boolean.TRUE));
|
||||
this.setStepSound(soundTypeSand);
|
||||
this.setHarvestLevel("shovel", 0);
|
||||
this.setBlockTextureName("aether_legacy:quicksoil");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
world.setBlockState(pos, state.withProperty(double_drop, Boolean.FALSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(double_drop, Boolean.valueOf(meta == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if (!((Boolean)state.getValue(double_drop)).booleanValue())
|
||||
{
|
||||
meta |= 1;
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
DoubleDropHelper.dropBlock(player, state, pos, double_drop);
|
||||
DoubleDropHelper.dropBlock(player, x, y, z, this, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {double_drop});
|
||||
}
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural.enchanted;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.blocks.natural.BlockAetherDirt;
|
||||
|
||||
public class BlockEnchantedAetherGrass extends Block
|
||||
{
|
||||
|
||||
public BlockEnchantedAetherGrass()
|
||||
{
|
||||
super(Material.GRASS);
|
||||
|
||||
this.setHardness(0.2F);
|
||||
this.setTickRandomly(true);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(BlocksAether.aether_dirt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getLightOpacity(world, pos) > 2)
|
||||
{
|
||||
world.setBlockState(pos, BlocksAether.aether_dirt.getDefaultState().withProperty(BlockAetherDirt.double_drop, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural.enchanted;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.legacy.aether.blocks.util.BlockFloating;
|
||||
|
||||
public class BlockEnchantedGravitite extends BlockFloating
|
||||
{
|
||||
|
||||
public BlockEnchantedGravitite()
|
||||
{
|
||||
super(Material.IRON, true);
|
||||
|
||||
this.setHardness(5F);
|
||||
this.setSoundType(SoundType.METAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural.ore;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.items.util.DoubleDropHelper;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
|
||||
public class BlockAmbrosiumOre extends Block
|
||||
{
|
||||
|
||||
public static final PropertyBool double_drop = PropertyBool.create(Aether.doubleDropNotifier());
|
||||
|
||||
public BlockAmbrosiumOre()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
|
||||
this.setHardness(3F);
|
||||
this.setResistance(5F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(double_drop, Boolean.TRUE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
|
||||
{
|
||||
return MathHelper.getRandomIntegerInRange(new Random(), 0, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
world.setBlockState(pos, state.withProperty(double_drop, Boolean.FALSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(double_drop, Boolean.valueOf(meta == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if (!((Boolean)state.getValue(double_drop)).booleanValue())
|
||||
{
|
||||
meta |= 1;
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
|
||||
{
|
||||
DoubleDropHelper.dropBlock(player, state, pos, double_drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {double_drop});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
return ItemsAether.ambrosium_shard;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural.ore;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import com.legacy.aether.blocks.util.BlockFloating;
|
||||
|
||||
public class BlockGravititeOre extends BlockFloating
|
||||
{
|
||||
|
||||
public BlockGravititeOre()
|
||||
{
|
||||
super(Material.ROCK, false);
|
||||
|
||||
this.setHardness(5F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package com.legacy.aether.blocks.natural.ore;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
|
||||
public class BlockZaniteOre extends Block
|
||||
{
|
||||
|
||||
public BlockZaniteOre()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
|
||||
this.setHardness(3F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
|
||||
{
|
||||
return MathHelper.getRandomIntegerInRange(new Random(), 3, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
return ItemsAether.zanite_gemstone;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
package com.legacy.aether.blocks.portal;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
|
@ -12,42 +13,34 @@ import com.legacy.aether.blocks.BlocksAether;
|
|||
public class AetherPortalSize
|
||||
{
|
||||
|
||||
private final World world;
|
||||
private final EnumFacing.Axis axis;
|
||||
public final EnumFacing rightDir;
|
||||
public final EnumFacing leftDir;
|
||||
public int portalBlockCount;
|
||||
public BlockPos bottomLeft;
|
||||
private final World world;
|
||||
private final int axis;
|
||||
public final int rightDir;
|
||||
public final int leftDir;
|
||||
public int portalBlockCount = 0;
|
||||
public ChunkCoordinates bottomLeft;
|
||||
public int height;
|
||||
public int width;
|
||||
|
||||
public AetherPortalSize(World worldIn, BlockPos position, EnumFacing.Axis axis)
|
||||
public AetherPortalSize(World worldIn, int x, int y, int z, int axis)
|
||||
{
|
||||
this.world = worldIn;
|
||||
this.axis = axis;
|
||||
|
||||
if (axis == EnumFacing.Axis.X)
|
||||
{
|
||||
this.leftDir = EnumFacing.EAST;
|
||||
this.rightDir = EnumFacing.WEST;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.leftDir = EnumFacing.NORTH;
|
||||
this.rightDir = EnumFacing.SOUTH;
|
||||
}
|
||||
this.leftDir = BlockPortal.field_150001_a[axis][0];
|
||||
this.rightDir = BlockPortal.field_150001_a[axis][1];
|
||||
|
||||
for (BlockPos blockpos = position; position.getY() > blockpos.getY() - 21 && position.getY() > 0 && this.isEmptyBlock(worldIn.getBlockState(position.down()).getBlock()); position = position.down())
|
||||
for (int i1 = y; y > i1 - 21 && y > 0 && this.isEmptyBlock(worldIn.getBlock(x, y - 1, z)); --y)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
int i = this.getDistanceUntilEdge(position, this.leftDir) - 1;
|
||||
int i = this.getDistanceUntilEdge(x, y, z, this.leftDir) - 1;
|
||||
|
||||
if (i >= 0)
|
||||
{
|
||||
this.bottomLeft = position.offset(this.leftDir, i);
|
||||
this.width = this.getDistanceUntilEdge(this.bottomLeft, this.rightDir);
|
||||
this.bottomLeft = new ChunkCoordinates(x + i * Direction.offsetX[this.leftDir], y, z + i * Direction.offsetZ[this.leftDir]);
|
||||
this.width = this.getDistanceUntilEdge(this.bottomLeft.posX, this.bottomLeft.posY, this.bottomLeft.posZ, this.rightDir);
|
||||
|
||||
if (this.width < 2 || this.width > 21)
|
||||
{
|
||||
|
@ -62,22 +55,32 @@ public class AetherPortalSize
|
|||
}
|
||||
}
|
||||
|
||||
protected int getDistanceUntilEdge(BlockPos position, EnumFacing axis)
|
||||
protected int getDistanceUntilEdge(int x, int y, int z, int leftDir)
|
||||
{
|
||||
int i;
|
||||
int j1 = Direction.offsetX[leftDir];
|
||||
int k1 = Direction.offsetZ[leftDir];
|
||||
int i1;
|
||||
Block block;
|
||||
|
||||
for (i = 0; i < 22; ++i)
|
||||
for (i1 = 0; i1 < 22; ++i1)
|
||||
{
|
||||
BlockPos blockpos = position.offset(axis, i);
|
||||
block = this.world.getBlock(x + j1 * i1, y, z + k1 * i1);
|
||||
|
||||
if (!this.isEmptyBlock(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != Blocks.GLOWSTONE)
|
||||
if (!this.isEmptyBlock(block))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Block block1 = this.world.getBlock(x + j1 * i1, y - 1, z + k1 * i1);
|
||||
|
||||
if (block1 != Blocks.glowstone)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Block block = this.world.getBlockState(position.offset(axis, i)).getBlock();
|
||||
return block == Blocks.GLOWSTONE ? i : 0;
|
||||
block = this.world.getBlock(x + j1 * i1, y, z + k1 * i1);
|
||||
return block == Blocks.glowstone ? i1 : 0;
|
||||
}
|
||||
|
||||
public int getHeight()
|
||||
|
@ -98,8 +101,9 @@ public class AetherPortalSize
|
|||
{
|
||||
for (int i = 0; i < this.width; ++i)
|
||||
{
|
||||
BlockPos blockpos = this.bottomLeft.offset(this.rightDir, i).up(this.height);
|
||||
Block block = this.world.getBlockState(blockpos).getBlock();
|
||||
int k = this.bottomLeft.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]];
|
||||
int l = this.bottomLeft.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]];
|
||||
Block block = this.world.getBlock(k, this.bottomLeft.posY + this.height, l);
|
||||
|
||||
if (!this.isEmptyBlock(block))
|
||||
{
|
||||
|
@ -113,18 +117,18 @@ public class AetherPortalSize
|
|||
|
||||
if (i == 0)
|
||||
{
|
||||
block = this.world.getBlockState(blockpos.offset(this.leftDir)).getBlock();
|
||||
block = this.world.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.axis][0]], this.bottomLeft.posY + this.height, l + Direction.offsetZ[BlockPortal.field_150001_a[this.axis][0]]);
|
||||
|
||||
if (block != Blocks.GLOWSTONE)
|
||||
if (block != Blocks.glowstone)
|
||||
{
|
||||
break label24;
|
||||
}
|
||||
}
|
||||
else if (i == this.width - 1)
|
||||
{
|
||||
block = this.world.getBlockState(blockpos.offset(this.rightDir)).getBlock();
|
||||
block = this.world.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]], this.bottomLeft.posY + this.height, l + Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]);
|
||||
|
||||
if (block != Blocks.GLOWSTONE)
|
||||
if (block != Blocks.glowstone)
|
||||
{
|
||||
break label24;
|
||||
}
|
||||
|
@ -134,7 +138,11 @@ public class AetherPortalSize
|
|||
|
||||
for (int j = 0; j < this.width; ++j)
|
||||
{
|
||||
if (this.world.getBlockState(this.bottomLeft.offset(this.rightDir, j).up(this.height)).getBlock() != Blocks.GLOWSTONE)
|
||||
int i = this.bottomLeft.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]];
|
||||
int k = this.bottomLeft.posY + this.height;
|
||||
int l = this.bottomLeft.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]];
|
||||
|
||||
if (this.world.getBlock(i, k, l) != Blocks.glowstone)
|
||||
{
|
||||
this.height = 0;
|
||||
break;
|
||||
|
@ -156,7 +164,7 @@ public class AetherPortalSize
|
|||
|
||||
protected boolean isEmptyBlock(Block blockIn)
|
||||
{
|
||||
return blockIn.getDefaultState().getMaterial() == Material.AIR || blockIn == Blocks.FIRE || blockIn == BlocksAether.aether_portal;
|
||||
return blockIn.getMaterial() == Material.air || blockIn == Blocks.fire || blockIn == BlocksAether.aether_portal;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
|
@ -168,11 +176,13 @@ public class AetherPortalSize
|
|||
{
|
||||
for (int i = 0; i < this.width; ++i)
|
||||
{
|
||||
BlockPos blockpos = this.bottomLeft.offset(this.rightDir, i);
|
||||
int j = this.bottomLeft.posX + Direction.offsetX[this.rightDir] * i;
|
||||
int k = this.bottomLeft.posZ + Direction.offsetZ[this.rightDir] * i;
|
||||
|
||||
for (int j = 0; j < this.height; ++j)
|
||||
for (int l = 0; l < this.height; ++l)
|
||||
{
|
||||
this.world.setBlockState(blockpos.up(j), BlocksAether.aether_portal.getDefaultState().withProperty(BlockAetherPortal.AXIS, this.axis), 2);
|
||||
int i1 = this.bottomLeft.posY + l;
|
||||
this.world.setBlock(j, i1, k, BlocksAether.aether_portal, this.axis, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,26 +4,22 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockWorldState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockPattern;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.entities.particles.ParticleAetherPortal;
|
||||
import com.legacy.aether.entities.util.EntityHook;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAetherPortal extends BlockPortal
|
||||
{
|
||||
|
||||
|
@ -36,20 +32,28 @@ public class BlockAetherPortal extends BlockPortal
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister registry)
|
||||
{
|
||||
this.blockIcon = registry.registerIcon(Aether.find("aether_portal"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
PlayerAether.get((EntityPlayer)entity).setInPortal();
|
||||
}
|
||||
|
||||
return;
|
||||
else if ((entity instanceof EntityLivingBase) && entity.ridingEntity == null && entity.riddenByEntity == null)
|
||||
{
|
||||
((EntityHook)entity.getExtendedProperties("aether_legacy:entity_hook")).setInPortal();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trySpawnPortal(World worldIn, BlockPos pos)
|
||||
public boolean trySpawnPortal(World worldIn, int x, int y, int z)
|
||||
{
|
||||
AetherPortalSize aetherportal$size = new AetherPortalSize(worldIn, pos, EnumFacing.Axis.X);
|
||||
AetherPortalSize aetherportal$size = new AetherPortalSize(worldIn, x, y, z, 1);
|
||||
|
||||
if (aetherportal$size.isValid() && aetherportal$size.portalBlockCount == 0)
|
||||
{
|
||||
|
@ -59,7 +63,7 @@ public class BlockAetherPortal extends BlockPortal
|
|||
}
|
||||
else
|
||||
{
|
||||
AetherPortalSize aetherportal$size1 = new AetherPortalSize(worldIn, pos, EnumFacing.Axis.Z);
|
||||
AetherPortalSize aetherportal$size1 = new AetherPortalSize(worldIn, x, y, z, 2);
|
||||
|
||||
if (aetherportal$size1.isValid() && aetherportal$size1.portalBlockCount == 0)
|
||||
{
|
||||
|
@ -75,122 +79,69 @@ public class BlockAetherPortal extends BlockPortal
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn)
|
||||
public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block blockIn)
|
||||
{
|
||||
EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);
|
||||
int l = func_149999_b(worldIn.getBlockMetadata(x, y, z));
|
||||
|
||||
if (enumfacing$axis == EnumFacing.Axis.X)
|
||||
if (l == 1)
|
||||
{
|
||||
AetherPortalSize blockportal$size = new AetherPortalSize(world, pos, EnumFacing.Axis.X);
|
||||
AetherPortalSize blockportal$size = new AetherPortalSize(worldIn, x, y, z, 1);
|
||||
|
||||
if (!blockportal$size.isValid() || blockportal$size.portalBlockCount < blockportal$size.width * blockportal$size.height)
|
||||
{
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
worldIn.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
}
|
||||
else if (enumfacing$axis == EnumFacing.Axis.Z)
|
||||
else if (l == 2)
|
||||
{
|
||||
AetherPortalSize blockportal$size1 = new AetherPortalSize(world, pos, EnumFacing.Axis.Z);
|
||||
AetherPortalSize blockportal$size1 = new AetherPortalSize(worldIn, x, y, z, 2);
|
||||
|
||||
if (!blockportal$size1.isValid() || blockportal$size1.portalBlockCount < blockportal$size1.width * blockportal$size1.height)
|
||||
{
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
worldIn.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (rand.nextInt(100) == 0)
|
||||
{
|
||||
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, rand.nextFloat() * 0.4F + 0.8F, false);
|
||||
world.playSound((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
double d0 = (double)((float)pos.getX() + rand.nextFloat());
|
||||
double d1 = (double)((float)pos.getY() + rand.nextFloat());
|
||||
double d2 = (double)((float)pos.getZ() + rand.nextFloat());
|
||||
double d0 = (double)((float)x + rand.nextFloat());
|
||||
double d1 = (double)((float)y + rand.nextFloat());
|
||||
double d2 = (double)((float)z + rand.nextFloat());
|
||||
double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
int j = rand.nextInt(2) * 2 - 1;
|
||||
|
||||
if (world.getBlockState(pos.west()).getBlock() != this && world.getBlockState(pos.east()).getBlock() != this)
|
||||
if (world.getBlock(x - 1, y, z) != this && world.getBlock(x + 1, y, z) != this)
|
||||
{
|
||||
d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j;
|
||||
d0 = (double)x + 0.5D + 0.25D * (double)j;
|
||||
d3 = (double)(rand.nextFloat() * 2.0F * (float)j);
|
||||
}
|
||||
else
|
||||
{
|
||||
d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j;
|
||||
d2 = (double)z + 0.5D + 0.25D * (double)j;
|
||||
d5 = (double)(rand.nextFloat() * 2.0F * (float)j);
|
||||
}
|
||||
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleAetherPortal(world, d0, d1, d2, d3, d4, d5));
|
||||
ParticleAetherPortal particle = new ParticleAetherPortal(world, d0, d1, d2, d3, d4, d5);
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_)
|
||||
public void updateTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
|
||||
AetherPortalSize blockportal$size = new AetherPortalSize(worldIn, p_181089_2_, EnumFacing.Axis.X);
|
||||
LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);
|
||||
|
||||
if (!blockportal$size.isValid())
|
||||
{
|
||||
enumfacing$axis = EnumFacing.Axis.X;
|
||||
blockportal$size = new AetherPortalSize(worldIn, p_181089_2_, EnumFacing.Axis.Z);
|
||||
}
|
||||
|
||||
if (!blockportal$size.isValid())
|
||||
{
|
||||
return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] aint = new int[EnumFacing.AxisDirection.values().length];
|
||||
EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
|
||||
BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);
|
||||
|
||||
for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
|
||||
{
|
||||
BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
|
||||
|
||||
for (int i = 0; i < blockportal$size.getWidth(); ++i)
|
||||
{
|
||||
for (int j = 0; j < blockportal$size.getHeight(); ++j)
|
||||
{
|
||||
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
|
||||
|
||||
if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR)
|
||||
{
|
||||
++aint[enumfacing$axisdirection.ordinal()];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
|
||||
|
||||
for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
|
||||
{
|
||||
if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
|
||||
{
|
||||
enumfacing$axisdirection1 = enumfacing$axisdirection2;
|
||||
}
|
||||
}
|
||||
|
||||
return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, BlockPos pos, IBlockState state, Random par5Random)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -4,11 +4,11 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.entities.block.EntityFloatingBlock;
|
||||
|
||||
public class BlockFloating extends Block
|
||||
|
@ -23,54 +23,62 @@ public class BlockFloating extends Block
|
|||
this.leveled = leveled;
|
||||
|
||||
this.setTickRandomly(true);
|
||||
this.setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
world.scheduleUpdate(pos, this, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn)
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
|
||||
{
|
||||
world.scheduleUpdate(pos, this, 3);
|
||||
return this == BlocksAether.enchanted_gravitite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
if (!this.leveled || this.leveled && world.isBlockIndirectlyGettingPowered(pos) != 0)
|
||||
world.scheduleBlockUpdate(x, y, z, this, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighborBlock)
|
||||
{
|
||||
worldIn.scheduleBlockUpdate(x, y, z, this, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (!this.leveled || this.leveled && world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
{
|
||||
this.floatBlock(world, pos);
|
||||
this.floatBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
private void floatBlock(World world, BlockPos pos)
|
||||
private void floatBlock(World world, int x, int y, int z)
|
||||
{
|
||||
if (canContinue(world, pos.up()) && pos.getY() < world.getHeight())
|
||||
if (canContinue(world, x, y + 1, z) && y < world.getHeight())
|
||||
{
|
||||
EntityFloatingBlock floating = new EntityFloatingBlock(world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
EntityFloatingBlock floating = new EntityFloatingBlock(world, pos, world.getBlockState(pos));
|
||||
world.spawnEntityInWorld(floating);
|
||||
}
|
||||
|
||||
world.setBlockToAir(pos);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canContinue(World world, BlockPos pos)
|
||||
public static boolean canContinue(World world, int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
Material material = world.getBlockState(pos).getMaterial();
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material material = block.getMaterial();
|
||||
|
||||
if (block == Blocks.AIR || block == Blocks.FIRE)
|
||||
if (block == Blocks.air || block == Blocks.fire)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (material == Material.WATER || material == Material.LAVA)
|
||||
if (material == Material.water || material == Material.lava)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumCloudType implements IStringSerializable
|
||||
{
|
||||
|
||||
Cold(0, "cold_aercloud"), Blue(1, "blue_aercloud"), Golden(2, "golden_aercloud"), Pink(3, "pink_aercloud");
|
||||
|
||||
private int meta;
|
||||
|
||||
private String unlocalizedName;
|
||||
|
||||
public static final EnumCloudType[] lookup = new EnumCloudType[values().length];
|
||||
|
||||
EnumCloudType(int meta, String unlocalizedName)
|
||||
{
|
||||
this.meta = meta;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
public static EnumCloudType getType(int meta)
|
||||
{
|
||||
return meta == 1 ? Blue : meta == 2 ? Golden : meta == 3 ? Pink : Cold;
|
||||
}
|
||||
|
||||
public int getMeta()
|
||||
{
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumCrystalType implements IStringSerializable
|
||||
{
|
||||
|
||||
Crystal(0, "crystal_leaves"), Crystal_Fruited(1, "crystal_fruit_leaves");
|
||||
|
||||
private int meta;
|
||||
|
||||
private String unlocalizedName;
|
||||
|
||||
EnumCrystalType(int meta, String unlocalizedName)
|
||||
{
|
||||
this.meta = meta;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
public static EnumCrystalType getType(int meta)
|
||||
{
|
||||
return meta == 1 ? Crystal_Fruited : Crystal;
|
||||
}
|
||||
|
||||
public int getMeta()
|
||||
{
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumHolidayType implements IStringSerializable
|
||||
{
|
||||
|
||||
Holiday_Leaves(0, "holiday_leaves"), Decorated_Leaves(1, "decorated_holiday_leaves");
|
||||
|
||||
private int meta;
|
||||
|
||||
private String unlocalizedName;
|
||||
|
||||
EnumHolidayType(int meta, String unlocalizedName)
|
||||
{
|
||||
this.meta = meta;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
public static EnumHolidayType getType(int meta)
|
||||
{
|
||||
return meta == 1 ? Decorated_Leaves : Holiday_Leaves;
|
||||
}
|
||||
|
||||
public int getMeta()
|
||||
{
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumLeafType implements IStringSerializable
|
||||
{
|
||||
|
||||
Green(0, "green_leaves"), Golden(1, "golden_oak_leaves");
|
||||
|
||||
private int meta;
|
||||
|
||||
private String unlocalizedName;
|
||||
|
||||
EnumLeafType(int meta, String unlocalizedName)
|
||||
{
|
||||
this.meta = meta;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
public static EnumLeafType getType(int meta)
|
||||
{
|
||||
return meta == 1 ? Golden : Green;
|
||||
}
|
||||
|
||||
public int getMeta()
|
||||
{
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumLogType implements IStringSerializable
|
||||
{
|
||||
|
||||
Skyroot(0, "skyroot_log"), Oak(1, "golden_oak_log");
|
||||
|
||||
private int meta;
|
||||
|
||||
private String unlocalizedName;
|
||||
|
||||
EnumLogType(int meta, String unlocalizedName)
|
||||
{
|
||||
this.meta = meta;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
public static EnumLogType getType(int meta)
|
||||
{
|
||||
return (meta % 2) == 0 ? Skyroot : Oak;
|
||||
}
|
||||
|
||||
public int getMeta()
|
||||
{
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.unlocalizedName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumStoneType implements IStringSerializable
|
||||
{
|
||||
Carved(0, "carved_stone"), Sentry(1, "sentry_stone"),
|
||||
Angelic(2, "angelic_stone"), Light_angelic(3, "light_angelic_stone"),
|
||||
Hellfire(4, "hellfire_stone"), Light_hellfire(5, "light_hellfire_stone");
|
||||
|
||||
private int meta;
|
||||
|
||||
private String name;
|
||||
|
||||
public static final EnumStoneType[] lookup = new EnumStoneType[values().length];
|
||||
|
||||
EnumStoneType(int id, String name)
|
||||
{
|
||||
this.meta = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static EnumStoneType getType(int meta)
|
||||
{
|
||||
return meta == 1 ? Sentry : (meta == 2 ? Angelic : (meta == 3 ? Light_angelic : (meta == 4 ? Hellfire : meta == 5 ? Light_hellfire : Carved)));
|
||||
}
|
||||
|
||||
public int getMeta()
|
||||
{
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.legacy.aether.blocks.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IAetherMeta
|
||||
{
|
||||
|
||||
public String getMetaName(ItemStack stack);
|
||||
|
||||
}
|
|
@ -8,30 +8,38 @@ import net.minecraft.client.gui.GuiScreen;
|
|||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent;
|
||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent.SetArmorModel;
|
||||
|
||||
import com.legacy.aether.AetherConfig;
|
||||
import com.legacy.aether.client.gui.AetherLoadingScreen;
|
||||
import com.legacy.aether.client.gui.button.GuiAccessoryButton;
|
||||
import com.legacy.aether.containers.inventory.InventoryAccessories;
|
||||
import com.legacy.aether.client.renders.entity.PlayerAetherRenderer;
|
||||
import com.legacy.aether.entities.EntitiesAether;
|
||||
import com.legacy.aether.items.ItemAetherSpawnEgg;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.networking.AetherGuiHandler;
|
||||
import com.legacy.aether.networking.AetherNetworkingManager;
|
||||
import com.legacy.aether.networking.packets.PacketOpenContainer;
|
||||
import com.legacy.aether.items.armor.ItemAetherArmor;
|
||||
import com.legacy.aether.network.AetherGuiHandler;
|
||||
import com.legacy.aether.network.AetherNetwork;
|
||||
import com.legacy.aether.network.packets.PacketOpenContainer;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class AetherClientEvents
|
||||
{
|
||||
|
||||
|
@ -53,25 +61,115 @@ public class AetherClientEvents
|
|||
mc.loadingScreen = new AetherLoadingScreen(mc);
|
||||
}
|
||||
}
|
||||
|
||||
if (mc.thePlayer != null && !(mc.thePlayer.movementInput instanceof AetherMovementInput))
|
||||
{
|
||||
mc.thePlayer.movementInput = new AetherMovementInput(mc, mc.gameSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (phase == TickEvent.Phase.START)
|
||||
{
|
||||
if (type.equals(TickEvent.Type.CLIENT))
|
||||
{
|
||||
if (mc.currentScreen == null || mc.currentScreen.allowUserInput)
|
||||
{
|
||||
if (!mc.thePlayer.isUsingItem())
|
||||
{
|
||||
if (GameSettings.isKeyDown(mc.gameSettings.keyBindPickBlock))
|
||||
{
|
||||
this.sendPickupPacket(mc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPickupPacket(Minecraft mc)
|
||||
{
|
||||
if (mc.objectMouseOver != null)
|
||||
{
|
||||
if (!this.onPickEntity(mc.objectMouseOver, mc.thePlayer, mc.theWorld))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mc.thePlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
int index = mc.thePlayer.inventoryContainer.inventorySlots.size() - 9 + mc.thePlayer.inventory.currentItem;
|
||||
|
||||
mc.playerController.sendSlotPacket(mc.thePlayer.inventory.getStackInSlot(mc.thePlayer.inventory.currentItem), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean onPickEntity(MovingObjectPosition target, EntityPlayer player, World world)
|
||||
{
|
||||
ItemStack result = null;
|
||||
boolean isCreative = player.capabilities.isCreativeMode;
|
||||
|
||||
if (!isCreative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.entityHit != null)
|
||||
{
|
||||
int id = EntitiesAether.getEntityID(target.entityHit);
|
||||
|
||||
if (id >= 0 && ItemAetherSpawnEgg.entityEggs.containsKey(id))
|
||||
{
|
||||
result = new ItemStack(ItemsAether.aether_spawn_egg, 1, id);
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
ItemStack stack = player.inventory.getStackInSlot(x);
|
||||
|
||||
if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result))
|
||||
{
|
||||
player.inventory.currentItem = x;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int slot = player.inventory.getFirstEmptyStack();
|
||||
|
||||
if (slot < 0 || slot >= 9)
|
||||
{
|
||||
slot = player.inventory.currentItem;
|
||||
}
|
||||
|
||||
player.inventory.setInventorySlotContents(slot, result);
|
||||
player.inventory.currentItem = slot;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBowPulled(FOVUpdateEvent event)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (player == null || (player != null && player.getActiveItemStack() == null))
|
||||
if (player == null || (player != null && player.getCurrentEquippedItem() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = player.getActiveItemStack().getItem();
|
||||
Item item = player.getCurrentEquippedItem().getItem();
|
||||
|
||||
if (item == ItemsAether.phoenix_bow)
|
||||
{
|
||||
int i = player.getItemInUseMaxCount();
|
||||
int i = player.getItemInUseDuration();
|
||||
float f1 = (float)i / 20.0F;
|
||||
|
||||
if (f1 > 1.0F)
|
||||
|
@ -83,11 +181,11 @@ public class AetherClientEvents
|
|||
f1 = f1 * f1;
|
||||
}
|
||||
|
||||
float original = event.getFov();
|
||||
float original = event.fov;
|
||||
|
||||
original *= 1.0F - f1 * 0.15F;
|
||||
|
||||
event.setNewfov(original);
|
||||
event.newfov = original;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,57 +194,59 @@ public class AetherClientEvents
|
|||
private static int previousSelectedTabIndex = -1;
|
||||
|
||||
@SubscribeEvent
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onGuiOpened(GuiScreenEvent.InitGuiEvent.Post event)
|
||||
{
|
||||
if (event.getGui() instanceof GuiContainer)
|
||||
if (event.gui instanceof GuiContainer)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
Class<?> clazz = event.getGui().getClass();
|
||||
Class<?> clazz = event.gui.getClass();
|
||||
|
||||
int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiLeft", "field_147003_i");
|
||||
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiTop", "field_147009_r");
|
||||
int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.gui, "guiLeft", "field_147003_i");
|
||||
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.gui, "guiTop", "field_147009_r");
|
||||
|
||||
if (player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (event.getGui() instanceof GuiContainerCreative)
|
||||
if (event.gui instanceof GuiContainerCreative)
|
||||
{
|
||||
if (((GuiContainerCreative)event.getGui()).getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex())
|
||||
if (((GuiContainerCreative)event.gui).func_147056_g() == CreativeTabs.tabInventory.getTabIndex())
|
||||
{
|
||||
event.getButtonList().add(ACCESSORY_BUTTON.setPosition(guiLeft + 73, guiTop + 38));
|
||||
previousSelectedTabIndex = CreativeTabs.INVENTORY.getTabIndex();
|
||||
event.buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 28, guiTop + 38));
|
||||
previousSelectedTabIndex = CreativeTabs.tabInventory.getTabIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (clazz == GuiInventory.class)
|
||||
{
|
||||
event.getButtonList().add(ACCESSORY_BUTTON.setPosition(guiLeft + 26, guiTop + 65));
|
||||
event.buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 26, guiTop + 65));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouseClicked(MouseInputEvent.Post event)
|
||||
public void onMouseClicked(DrawScreenEvent.Post event)
|
||||
{
|
||||
if (event.getGui() instanceof GuiContainerCreative)
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative)
|
||||
{
|
||||
GuiContainerCreative guiScreen = (GuiContainerCreative) event.getGui();
|
||||
List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, (GuiScreen) guiScreen, 7);
|
||||
GuiContainerCreative guiScreen = (GuiContainerCreative) Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
if (previousSelectedTabIndex != guiScreen.getSelectedTabIndex())
|
||||
if (previousSelectedTabIndex != guiScreen.func_147056_g())
|
||||
{
|
||||
if (guiScreen.getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON))
|
||||
{
|
||||
int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiLeft", "field_147003_i");
|
||||
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiTop", "field_147009_r");
|
||||
List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, (GuiScreen) guiScreen, 4);
|
||||
|
||||
buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 73, guiTop + 38));
|
||||
if (guiScreen.func_147056_g() == CreativeTabs.tabInventory.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON))
|
||||
{
|
||||
int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)guiScreen, "guiLeft", "field_147003_i");
|
||||
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)guiScreen, "guiTop", "field_147009_r");
|
||||
|
||||
buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 28, guiTop + 38));
|
||||
}
|
||||
else if (previousSelectedTabIndex == CreativeTabs.INVENTORY.getTabIndex())
|
||||
else if (previousSelectedTabIndex == CreativeTabs.tabInventory.getTabIndex())
|
||||
{
|
||||
buttonList.remove(ACCESSORY_BUTTON);
|
||||
}
|
||||
|
||||
previousSelectedTabIndex = guiScreen.getSelectedTabIndex();
|
||||
previousSelectedTabIndex = guiScreen.func_147056_g();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,41 +254,54 @@ public class AetherClientEvents
|
|||
@SubscribeEvent
|
||||
public void onButtonPressed(GuiScreenEvent.ActionPerformedEvent.Pre event)
|
||||
{
|
||||
Class<?> clazz = event.getGui().getClass();
|
||||
Class<?> clazz = event.gui.getClass();
|
||||
|
||||
if ((clazz == GuiInventory.class || clazz == GuiContainerCreative.class) && event.getButton().id == 18067)
|
||||
if ((clazz == GuiInventory.class || clazz == GuiContainerCreative.class) && event.button.id == 18067)
|
||||
{
|
||||
AetherNetworkingManager.sendToServer(new PacketOpenContainer(AetherGuiHandler.accessories));
|
||||
AetherNetwork.sendToServer(new PacketOpenContainer(AetherGuiHandler.accessories));
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderHand(RenderSpecificHandEvent event)
|
||||
public void onRenderInvisibility(RenderPlayerEvent.Pre event)
|
||||
{
|
||||
PlayerGloveRenderer.renderItemFirstPerson(Minecraft.getMinecraft().thePlayer, event.getPartialTicks(), event.getInterpolatedPitch(), event.getHand(), event.getSwingProgress(), event.getItemStack(), event.getEquipProgress());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInvisibilityPlayerUpdate(RenderPlayerEvent.Pre event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
PlayerAether playerAether = PlayerAether.get(player);
|
||||
|
||||
if (playerAether != null)
|
||||
{
|
||||
if (playerAether.wearingAccessory(ItemsAether.invisibility_cape))
|
||||
if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape)))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerAetherRenderer.instance().setPartialTicks(event.partialRenderTick);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStichedEvent(TextureStitchEvent event)
|
||||
public void onRenderAetherCape(RenderPlayerEvent.Specials.Pre event)
|
||||
{
|
||||
for (int i = 0; i < InventoryAccessories.EMPTY_SLOT_NAMES.length; ++i)
|
||||
event.renderCape = !PlayerAetherRenderer.instance().isCapeRendering();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderAetherArmor(SetArmorModel event)
|
||||
{
|
||||
if (event.stack != null && event.stack.getItem() instanceof ItemAetherArmor)
|
||||
{
|
||||
event.getMap().registerSprite(new ResourceLocation("aether_legacy", "items/slots/" + InventoryAccessories.EMPTY_SLOT_NAMES[i]));
|
||||
event.result = PlayerAetherRenderer.instance().renderAetherArmor(PlayerAether.get(event.entityPlayer), event.renderer, event.stack, 3- event.slot);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderAccessories(RenderLivingEvent.Post event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
PlayerAether playerAether = PlayerAether.get((EntityPlayer) event.entity);
|
||||
|
||||
PlayerAetherRenderer.instance().renderAccessories(playerAether, (RenderPlayer) event.renderer, event.x, event.y, event.z, PlayerAetherRenderer.instance().getPartialTicks());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
package com.legacy.aether.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.legacy.aether.entities.passive.mountable.EntityAerbunny;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
|
||||
public class AetherEntityRenderer extends EntityRenderer
|
||||
{
|
||||
|
||||
private Entity pointedEntity;
|
||||
|
||||
private Minecraft mc;
|
||||
|
||||
public AetherEntityRenderer(Minecraft mc, IResourceManager resources)
|
||||
{
|
||||
super(mc, resources);
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMouseOver(float partialTick)
|
||||
{
|
||||
EntityPlayer entityPlayer = this.mc.thePlayer;
|
||||
|
||||
if (this.mc.thePlayer != null && entityPlayer.inventory.getCurrentItem() != null && PlayerAether.get(entityPlayer) != null && PlayerAether.get(entityPlayer).getReach() == 10.0D)
|
||||
{
|
||||
this.getExtendedReach(partialTick);
|
||||
}
|
||||
else if (this.mc.thePlayer != null && !this.mc.thePlayer.getPassengers().isEmpty() && this.mc.thePlayer.getPassengers().get(0) instanceof EntityAerbunny)
|
||||
{
|
||||
this.getMountRightClick(partialTick);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.getMouseOver(partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
private void getMountRightClick(float partialTick)
|
||||
{
|
||||
Entity entity = this.mc.getRenderViewEntity();
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
if (this.mc.theWorld != null)
|
||||
{
|
||||
this.mc.mcProfiler.startSection("pick");
|
||||
this.mc.pointedEntity = null;
|
||||
double d0 = (double)this.mc.playerController.getBlockReachDistance();
|
||||
this.mc.objectMouseOver = entity.rayTrace(d0, partialTick);
|
||||
double d1 = d0;
|
||||
Vec3d vec3d = entity.getPositionEyes(partialTick);
|
||||
boolean flag = false;
|
||||
|
||||
if (this.mc.playerController.extendedReach())
|
||||
{
|
||||
d0 = 6.0D;
|
||||
d1 = 6.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d0 > 3.0D)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mc.objectMouseOver != null)
|
||||
{
|
||||
d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3d);
|
||||
}
|
||||
|
||||
Vec3d vec3d1 = entity.getLook(partialTick);
|
||||
Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0);
|
||||
this.pointedEntity = null;
|
||||
Vec3d vec3d3 = null;
|
||||
float f = 1.0F;
|
||||
List<Entity> list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0).expand((double)f, (double)f, (double)f), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>()
|
||||
{
|
||||
public boolean apply(@Nullable Entity p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != null;
|
||||
}
|
||||
}));
|
||||
double d2 = d1;
|
||||
|
||||
for (int j = 0; j < list.size(); ++j)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(j);
|
||||
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz((double)entity1.getCollisionBorderSize());
|
||||
RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2);
|
||||
|
||||
if (axisalignedbb.isVecInside(vec3d))
|
||||
{
|
||||
if (d2 >= 0.0D)
|
||||
{
|
||||
this.pointedEntity = entity1;
|
||||
vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec;
|
||||
d2 = 0.0D;
|
||||
}
|
||||
}
|
||||
else if (raytraceresult != null)
|
||||
{
|
||||
double d3 = vec3d.distanceTo(raytraceresult.hitVec);
|
||||
|
||||
if (d3 < d2 || d2 == 0.0D)
|
||||
{
|
||||
if (d2 == 0.0D)
|
||||
{
|
||||
this.pointedEntity = entity1;
|
||||
vec3d3 = raytraceresult.hitVec;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pointedEntity = entity1;
|
||||
vec3d3 = raytraceresult.hitVec;
|
||||
d2 = d3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.pointedEntity != null && flag && vec3d.distanceTo(vec3d3) > 3.0D)
|
||||
{
|
||||
this.pointedEntity = null;
|
||||
this.mc.objectMouseOver = new RayTraceResult(RayTraceResult.Type.MISS, vec3d3, (EnumFacing)null, new BlockPos(vec3d3));
|
||||
}
|
||||
|
||||
if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null))
|
||||
{
|
||||
this.mc.objectMouseOver = new RayTraceResult(this.pointedEntity, vec3d3);
|
||||
|
||||
if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame)
|
||||
{
|
||||
this.mc.pointedEntity = this.pointedEntity;
|
||||
}
|
||||
}
|
||||
|
||||
this.mc.mcProfiler.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getExtendedReach(float partialTicks)
|
||||
{
|
||||
Entity entity = this.mc.getRenderViewEntity();
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
if (this.mc.theWorld != null)
|
||||
{
|
||||
this.mc.mcProfiler.startSection("pick");
|
||||
this.mc.pointedEntity = null;
|
||||
double d0 = 10.0D;
|
||||
this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks);
|
||||
double d1 = d0;
|
||||
Vec3d vec3d = entity.getPositionEyes(partialTicks);
|
||||
boolean flag = false;
|
||||
|
||||
if (this.mc.objectMouseOver != null)
|
||||
{
|
||||
d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3d);
|
||||
}
|
||||
|
||||
Vec3d vec3d1 = entity.getLook(partialTicks);
|
||||
Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0);
|
||||
this.pointedEntity = null;
|
||||
Vec3d vec3d3 = null;
|
||||
float f = 1.0F;
|
||||
List<Entity> list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0).expand((double)f, (double)f, (double)f), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>()
|
||||
{
|
||||
public boolean apply(@Nullable Entity p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != null;
|
||||
}
|
||||
}));
|
||||
double d2 = d1;
|
||||
|
||||
for (int j = 0; j < list.size(); ++j)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(j);
|
||||
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz((double)entity1.getCollisionBorderSize());
|
||||
RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2);
|
||||
|
||||
if (axisalignedbb.isVecInside(vec3d))
|
||||
{
|
||||
if (d2 >= 0.0D)
|
||||
{
|
||||
this.pointedEntity = entity1;
|
||||
vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec;
|
||||
d2 = 0.0D;
|
||||
}
|
||||
}
|
||||
else if (raytraceresult != null)
|
||||
{
|
||||
double d3 = vec3d.distanceTo(raytraceresult.hitVec);
|
||||
|
||||
if (d3 < d2 || d2 == 0.0D)
|
||||
{
|
||||
if (d2 == 0.0D)
|
||||
{
|
||||
this.pointedEntity = entity1;
|
||||
vec3d3 = raytraceresult.hitVec;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pointedEntity = entity1;
|
||||
vec3d3 = raytraceresult.hitVec;
|
||||
d2 = d3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.pointedEntity != null && flag && vec3d.distanceTo(vec3d3) > 3.0D)
|
||||
{
|
||||
this.pointedEntity = null;
|
||||
this.mc.objectMouseOver = new RayTraceResult(RayTraceResult.Type.MISS, vec3d3, (EnumFacing)null, new BlockPos(vec3d3));
|
||||
}
|
||||
|
||||
if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null))
|
||||
{
|
||||
this.mc.objectMouseOver = new RayTraceResult(this.pointedEntity, vec3d3);
|
||||
|
||||
if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame)
|
||||
{
|
||||
this.mc.pointedEntity = this.pointedEntity;
|
||||
}
|
||||
}
|
||||
|
||||
this.mc.mcProfiler.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.legacy.aether.client;
|
||||
|
||||
import com.legacy.aether.entities.passive.mountable.EntitySwet;
|
||||
import com.legacy.aether.entities.util.EntityMountable;
|
||||
import com.legacy.aether.entities.util.EntitySaddleMount;
|
||||
import com.legacy.aether.network.AetherNetwork;
|
||||
import com.legacy.aether.network.packets.PacketSendSneaking;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.util.MovementInputFromOptions;
|
||||
|
||||
public class AetherMovementInput extends MovementInputFromOptions
|
||||
{
|
||||
|
||||
private Minecraft mc;
|
||||
|
||||
private GameSettings gameSettings;
|
||||
|
||||
private boolean currentSneak;
|
||||
|
||||
private boolean previousSneak;
|
||||
|
||||
public AetherMovementInput(Minecraft mc, GameSettings gameSettings)
|
||||
{
|
||||
super(gameSettings);
|
||||
|
||||
this.mc = mc;
|
||||
this.gameSettings = gameSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlayerMoveState()
|
||||
{
|
||||
super.updatePlayerMoveState();
|
||||
|
||||
this.jump = this.gameSettings.keyBindJump.getIsKeyPressed();
|
||||
|
||||
boolean isSneaking = this.gameSettings.keyBindSneak.getIsKeyPressed();
|
||||
|
||||
this.sneak = isSneaking;
|
||||
|
||||
if (this.mc.thePlayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer.ridingEntity instanceof EntitySaddleMount)
|
||||
{
|
||||
if (this.mc.thePlayer.ridingEntity instanceof EntitySaddleMount)
|
||||
{
|
||||
this.sneak = false;
|
||||
this.currentSneak = isSneaking;
|
||||
|
||||
if (this.previousSneak != this.currentSneak)
|
||||
{
|
||||
AetherNetwork.sendToServer(new PacketSendSneaking(this.mc.thePlayer.getEntityId(), this.currentSneak));
|
||||
this.previousSneak = this.currentSneak;
|
||||
}
|
||||
|
||||
if (((EntityMountable) this.mc.thePlayer.ridingEntity).isOnGround())
|
||||
{
|
||||
this.sneak = isSneaking;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.mc.thePlayer.ridingEntity instanceof EntitySwet && !((EntitySwet)this.mc.thePlayer.ridingEntity).isFriendly())
|
||||
{
|
||||
this.sneak = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,86 +1,63 @@
|
|||
package com.legacy.aether.client;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.legacy.aether.CommonProxy;
|
||||
import com.legacy.aether.client.audio.AetherMusicHandler;
|
||||
import com.legacy.aether.client.gui.AetherLoadingScreen;
|
||||
import com.legacy.aether.client.gui.GuiAetherInGame;
|
||||
import com.legacy.aether.client.gui.GuiSunAltar;
|
||||
import com.legacy.aether.client.renders.AetherEntityRenderingRegistry;
|
||||
import com.legacy.aether.client.renders.blocks.BlockRendering;
|
||||
import com.legacy.aether.client.renders.items.ItemRendering;
|
||||
import com.legacy.aether.client.renders.AetherEntityRenderer;
|
||||
import com.legacy.aether.client.renders.RendersAether;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
|
||||
@Override
|
||||
public void preInitialization()
|
||||
{
|
||||
AetherEntityRenderingRegistry.initialize();
|
||||
}
|
||||
public static final IIcon[] ACCESSORY_ICONS = new IIcon[8];
|
||||
|
||||
@Override
|
||||
public void initialization()
|
||||
public void init()
|
||||
{
|
||||
Minecraft.getMinecraft().entityRenderer = new AetherEntityRenderer(Minecraft.getMinecraft(), Minecraft.getMinecraft().getResourceManager());
|
||||
berryBushRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
treasureChestRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
aetherFlowerRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
AetherEntityRenderingRegistry.initializePlayerLayers();
|
||||
Minecraft.getMinecraft().loadingScreen = new AetherLoadingScreen(Minecraft.getMinecraft());
|
||||
|
||||
BlockRendering.initialize();
|
||||
ItemRendering.initialize();
|
||||
EntityRenderer previousRenderer = Minecraft.getMinecraft().entityRenderer;
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new GuiAetherInGame(Minecraft.getMinecraft()));
|
||||
MinecraftForge.EVENT_BUS.register(new AetherClientEvents());
|
||||
Minecraft.getMinecraft().entityRenderer = new AetherEntityRenderer(Minecraft.getMinecraft(), previousRenderer, Minecraft.getMinecraft().getResourceManager());
|
||||
|
||||
RendersAether.initialization();
|
||||
|
||||
registerEvent(new AetherMusicHandler());
|
||||
registerEvent(new AetherClientEvents());
|
||||
registerEvent(new GuiAetherInGame(Minecraft.getMinecraft()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(EntityPlayer player, String message)
|
||||
public void sendMessage(EntityPlayer player, String text)
|
||||
{
|
||||
if (this.getThePlayer() == player)
|
||||
{
|
||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(message));
|
||||
}
|
||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getThePlayer()
|
||||
{
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnSmoke(World world, BlockPos pos)
|
||||
{
|
||||
Random rand = new Random();
|
||||
double a, b, c;
|
||||
a = pos.getX() + 0.5D + ((rand.nextFloat() - rand.nextFloat()) * 0.375D);
|
||||
b = pos.getY() + 0.5D + ((rand.nextFloat() - rand.nextFloat()) * 0.375D);
|
||||
c = pos.getZ() + 0.5D + ((rand.nextFloat() - rand.nextFloat()) * 0.375D);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, a, b, c, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnBlockBrokenFX(IBlockState state, BlockPos pos)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addBlockDestroyEffects(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openSunAltar()
|
||||
public void openSunAltar()
|
||||
{
|
||||
FMLClientHandler.instance().getClient().displayGuiScreen(new GuiSunAltar());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
package com.legacy.aether.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.items.accessories.ItemAccessory;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
|
||||
public class PlayerGloveRenderer
|
||||
{
|
||||
|
||||
private static ModelBiped gloveModel, slimGloveModel;
|
||||
|
||||
private static boolean isSlim = false;
|
||||
|
||||
public static void renderItemFirstPerson(AbstractClientPlayer player, float partialTicks, float interpPitch, EnumHand hand, float swingProgress, ItemStack stack, float equipProgress)
|
||||
{
|
||||
isSlim = player.getSkinType().equals("slim") ? true : false;
|
||||
|
||||
if (gloveModel == null && slimGloveModel == null)
|
||||
{
|
||||
gloveModel = new ModelBiped(0.01F);
|
||||
slimGloveModel = new ModelPlayer(0.01F, true);
|
||||
}
|
||||
|
||||
boolean flag = hand == EnumHand.MAIN_HAND;
|
||||
EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (stack == null)
|
||||
{
|
||||
if (flag && !player.isInvisible())
|
||||
{
|
||||
renderGloveFirstPerson(player, equipProgress, swingProgress, enumhandside);
|
||||
}
|
||||
}
|
||||
else if (stack.getItem() instanceof net.minecraft.item.ItemMap)
|
||||
{
|
||||
if (flag && player.getHeldItemOffhand() == null)
|
||||
{
|
||||
renderMapFirstPerson(player, interpPitch, equipProgress, swingProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderMapFirstPersonSide(player, equipProgress, enumhandside, swingProgress);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private static void renderGloves(AbstractClientPlayer player)
|
||||
{
|
||||
PlayerAether playerAether = PlayerAether.get(player);
|
||||
ItemStack accessoryStack = playerAether.accessories.stacks[6];
|
||||
|
||||
if (accessoryStack != null && accessoryStack.getItem() instanceof ItemAccessory && !player.isInvisible())
|
||||
{
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
renderArm(playerAether, EnumHandSide.RIGHT, (ItemAccessory) accessoryStack.getItem());
|
||||
renderArm(playerAether, EnumHandSide.LEFT, (ItemAccessory) accessoryStack.getItem());
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableCull();
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderArm(PlayerAether playerAether, EnumHandSide hand, ItemAccessory gloves)
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderManager().renderEngine.bindTexture(!isSlim ? gloves.texture : gloves.texture_slim);
|
||||
|
||||
int colour = gloves.getColorFromItemStack(playerAether.accessories.stacks[6], 0);
|
||||
float red = ((colour >> 16) & 0xff) / 255F;
|
||||
float green = ((colour >> 8) & 0xff) / 255F;
|
||||
float blue = (colour & 0xff) / 255F;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (gloves != ItemsAether.phoenix_gloves)
|
||||
{
|
||||
GlStateManager.color(red, green, blue);
|
||||
}
|
||||
|
||||
float f = hand == EnumHandSide.RIGHT ? 1.0F : -1.0F;
|
||||
GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.translate(f * 0.3F, -1.1F, 0.45F);
|
||||
|
||||
if (hand == EnumHandSide.RIGHT)
|
||||
{
|
||||
renderRightGlove(playerAether, gloves);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderLeftArmGlove(playerAether, gloves);
|
||||
}
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private static void renderMapFirstPerson(AbstractClientPlayer player, float interpPitch, float equipProgress, float swingProgress)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
float f = MathHelper.sqrt_float(swingProgress);
|
||||
float f1 = -0.2F * MathHelper.sin(swingProgress * (float)Math.PI);
|
||||
float f2 = -0.4F * MathHelper.sin(f * (float)Math.PI);
|
||||
GlStateManager.translate(0.0F, -f1 / 2.0F, f2);
|
||||
float f3 = getMapAngleFromPitch(interpPitch);
|
||||
GlStateManager.translate(0.0F, 0.04F + equipProgress * -1.2F + f3 * -0.5F, -0.72F);
|
||||
GlStateManager.rotate(f3 * -85.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderGloves(player);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private static void renderMapFirstPersonSide(AbstractClientPlayer player, float equipProgress, EnumHandSide enumhandside, float swingProgress)
|
||||
{
|
||||
float f = enumhandside == EnumHandSide.RIGHT ? 1.0F : -1.0F;
|
||||
|
||||
if (!player.isInvisible())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(f * 0.125F, -0.125F, 0.0F);
|
||||
GlStateManager.rotate(f * 10.0F, 0.0F, 0.0F, 1.0F);
|
||||
renderGloveFirstPerson(player, equipProgress, swingProgress, enumhandside);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderGloveFirstPerson(AbstractClientPlayer player, float equipProgress, float swingProgress, EnumHandSide enumhandside)
|
||||
{
|
||||
PlayerAether playerAether = PlayerAether.get(player);
|
||||
ItemStack accessoryStack = playerAether.accessories.stacks[6];
|
||||
|
||||
if (accessoryStack != null && accessoryStack.getItem() instanceof ItemAccessory)
|
||||
{
|
||||
boolean flag = enumhandside != EnumHandSide.LEFT;
|
||||
float f = flag ? 1.0F : -1.0F;
|
||||
float f1 = MathHelper.sqrt_float(swingProgress);
|
||||
float f2 = -0.3F * MathHelper.sin(f1 * (float)Math.PI);
|
||||
float f3 = 0.4F * MathHelper.sin(f1 * ((float)Math.PI * 2F));
|
||||
float f4 = -0.4F * MathHelper.sin(swingProgress * (float)Math.PI);
|
||||
GlStateManager.translate(f * (f2 + 0.64000005F), f3 + -0.6F + equipProgress * -0.6F, f4 + -0.71999997F);
|
||||
GlStateManager.rotate(f * 45.0F, 0.0F, 1.0F, 0.0F);
|
||||
float f5 = MathHelper.sin(swingProgress * swingProgress * (float)Math.PI);
|
||||
float f6 = MathHelper.sin(f1 * (float)Math.PI);
|
||||
GlStateManager.rotate(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
GlStateManager.translate(f * -1.0F, 3.6F, 3.5F);
|
||||
GlStateManager.rotate(f * 120.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(f * -135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(f * 5.6F, 0.0F, 0.0F);
|
||||
|
||||
GlStateManager.disableCull();
|
||||
|
||||
if (flag)
|
||||
{
|
||||
renderRightGlove(playerAether, (ItemAccessory) accessoryStack.getItem());
|
||||
}
|
||||
else
|
||||
{
|
||||
renderLeftArmGlove(playerAether, (ItemAccessory) accessoryStack.getItem());
|
||||
}
|
||||
|
||||
GlStateManager.enableCull();
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderRightGlove(PlayerAether playerAether, ItemAccessory gloves)
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderManager().renderEngine.bindTexture(!isSlim ? gloves.texture : gloves.texture_slim);
|
||||
|
||||
int colour = gloves.getColorFromItemStack(playerAether.accessories.stacks[6], 0);
|
||||
float red = ((colour >> 16) & 0xff) / 255F;
|
||||
float green = ((colour >> 8) & 0xff) / 255F;
|
||||
float blue = (colour & 0xff) / 255F;
|
||||
|
||||
if (gloves != ItemsAether.phoenix_gloves)
|
||||
{
|
||||
GlStateManager.color(red, green, blue);
|
||||
}
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
getModel().swingProgress = 0.0F;
|
||||
getModel().isSneak = false;
|
||||
getModel().setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, playerAether.thePlayer);
|
||||
getModel().bipedRightArm.rotateAngleX = 0.0F;
|
||||
getModel().bipedRightArm.render(0.0625F);
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private static void renderLeftArmGlove(PlayerAether playerAether, ItemAccessory gloves)
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderManager().renderEngine.bindTexture(!isSlim ? gloves.texture : gloves.texture_slim);
|
||||
|
||||
int colour = gloves.getColorFromItemStack(playerAether.accessories.stacks[6], 0);
|
||||
float red = ((colour >> 16) & 0xff) / 255F;
|
||||
float green = ((colour >> 8) & 0xff) / 255F;
|
||||
float blue = (colour & 0xff) / 255F;
|
||||
|
||||
if (gloves != ItemsAether.phoenix_gloves)
|
||||
{
|
||||
GlStateManager.color(red, green, blue);
|
||||
}
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
getModel().isSneak = false;
|
||||
getModel().swingProgress = 0.0F;
|
||||
getModel().setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, playerAether.thePlayer);
|
||||
getModel().bipedLeftArm.rotateAngleX = 0.0F;
|
||||
getModel().bipedLeftArm.render(0.0625F);
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private static ModelBiped getModel()
|
||||
{
|
||||
return isSlim ? slimGloveModel : gloveModel;
|
||||
}
|
||||
|
||||
private static float getMapAngleFromPitch(float pitch)
|
||||
{
|
||||
float f = 1.0F - pitch / 45.0F + 0.1F;
|
||||
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
|
||||
f = -MathHelper.cos(f * (float)Math.PI) * 0.5F + 0.5F;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,24 +3,25 @@ package com.legacy.aether.client.audio;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.audio.SoundCategory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent17;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.AetherConfig;
|
||||
import com.legacy.aether.client.audio.music.AetherMusicTicker;
|
||||
import com.legacy.aether.registry.sounds.SoundsAether;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class AetherMusicHandler
|
||||
{
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private AetherMusicTicker musicTicker = new AetherMusicTicker(mc);
|
||||
private final AetherMusicTicker musicTicker = new AetherMusicTicker(this.mc);
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) throws Exception
|
||||
|
@ -32,27 +33,33 @@ public class AetherMusicHandler
|
|||
{
|
||||
if (type.equals(TickEvent.Type.CLIENT))
|
||||
{
|
||||
if (!mc.isGamePaused())
|
||||
if (!this.mc.isGamePaused())
|
||||
{
|
||||
musicTicker.update();
|
||||
this.musicTicker.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMusicControl(PlaySoundEvent event)
|
||||
public void onMusicControl(PlaySoundEvent17 event)
|
||||
{
|
||||
ISound sound = event.getSound();
|
||||
SoundCategory category = sound.getCategory();
|
||||
ISound sound = event.result;
|
||||
|
||||
if (sound == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SoundCategory category = event.category;
|
||||
|
||||
if (category == SoundCategory.MUSIC)
|
||||
{
|
||||
if (this.mc.thePlayer != null && this.mc.thePlayer.dimension == AetherConfig.getAetherDimensionID())
|
||||
{
|
||||
if (!sound.getSoundLocation().toString().contains("aether_legacy") && (this.musicTicker.playingMusic() || !this.musicTicker.playingMusic()))
|
||||
if (!sound.getPositionedSoundLocation().toString().contains("aether_legacy") && (this.musicTicker.playingMusic() || !this.musicTicker.playingMusic()))
|
||||
{
|
||||
event.setResultSound(null);
|
||||
event.result = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -70,9 +77,9 @@ public class AetherMusicHandler
|
|||
@SideOnly(Side.CLIENT)
|
||||
public static ISound getAchievementSound(int number)
|
||||
{
|
||||
SoundEvent sound = number == 1 ? SoundsAether.achievement_bronze : number == 2 ? SoundsAether.achievement_silver : SoundsAether.achievement_gen;
|
||||
ResourceLocation sound = number == 1 ? Aether.locate("achievement_bronze") : number == 2 ? Aether.locate("achievement_silver") : Aether.locate("achievement");
|
||||
|
||||
return new PositionedSoundRecord(sound.getSoundName(), SoundCategory.PLAYERS, 1.0F, 1.0F, false, 0, ISound.AttenuationType.NONE, 0, 0, 0);
|
||||
return PositionedSoundRecord.func_147673_a(sound);
|
||||
}
|
||||
|
||||
}
|
|
@ -5,17 +5,19 @@ import java.util.Random;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.audio.SoundCategory;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.AetherConfig;
|
||||
import com.legacy.aether.registry.sounds.SoundsAether;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class AetherMusicTicker implements ITickable
|
||||
public class AetherMusicTicker implements IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
@ -34,6 +36,17 @@ public class AetherMusicTicker implements ITickable
|
|||
|
||||
if (this.mc.thePlayer != null)
|
||||
{
|
||||
if (this.mc.gameSettings.getSoundLevel(SoundCategory.MUSIC) == 0.0F)
|
||||
{
|
||||
if (this.currentMusic != null)
|
||||
{
|
||||
this.stopMusic();
|
||||
this.currentMusic = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer.dimension != AetherConfig.getAetherDimensionID())
|
||||
{
|
||||
this.stopMusic();
|
||||
|
@ -73,7 +86,7 @@ public class AetherMusicTicker implements ITickable
|
|||
|
||||
public void playMusic(TrackType requestedMusicType)
|
||||
{
|
||||
this.currentMusic = PositionedSoundRecord.getMusicRecord(requestedMusicType.getMusicLocation());
|
||||
this.currentMusic = PositionedSoundRecord.func_147673_a(requestedMusicType.getMusicLocation());
|
||||
this.mc.getSoundHandler().playSound(this.currentMusic);
|
||||
this.timeUntilNextMusic = Integer.MAX_VALUE;
|
||||
}
|
||||
|
@ -91,23 +104,23 @@ public class AetherMusicTicker implements ITickable
|
|||
@SideOnly(Side.CLIENT)
|
||||
public static enum TrackType
|
||||
{
|
||||
TRACK_ONE(SoundsAether.aether1, 1200, 1500),
|
||||
TRACK_TWO(SoundsAether.aether2, 1200, 1500),
|
||||
TRACK_THREE(SoundsAether.aether3, 1200, 1500),
|
||||
TRACK_FOUR(SoundsAether.aether4, 1200, 1500);
|
||||
TRACK_ONE(Aether.locate("music.aether1"), 1200, 1500),
|
||||
TRACK_TWO(Aether.locate("music.aether2"), 1200, 1500),
|
||||
TRACK_THREE(Aether.locate("music.aether3"), 1200, 1500),
|
||||
TRACK_FOUR(Aether.locate("music.aether4"), 1200, 1500);
|
||||
|
||||
private final SoundEvent musicLocation;
|
||||
private final ResourceLocation musicLocation;
|
||||
private final int minDelay;
|
||||
private final int maxDelay;
|
||||
|
||||
private TrackType(SoundEvent musicLocationIn, int minDelayIn, int maxDelayIn)
|
||||
private TrackType(ResourceLocation musicLocationIn, int minDelayIn, int maxDelayIn)
|
||||
{
|
||||
this.musicLocation = musicLocationIn;
|
||||
this.minDelay = minDelayIn;
|
||||
this.maxDelay = maxDelayIn;
|
||||
}
|
||||
|
||||
public SoundEvent getMusicLocation()
|
||||
public ResourceLocation getMusicLocation()
|
||||
{
|
||||
return this.musicLocation;
|
||||
}
|
||||
|
|
|
@ -4,15 +4,16 @@ import net.minecraft.client.LoadingScreenRenderer;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.legacy.aether.client.gui.trivia.AetherTrivia;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class AetherLoadingScreen extends LoadingScreenRenderer
|
||||
{
|
||||
|
||||
|
@ -47,7 +48,7 @@ public class AetherLoadingScreen extends LoadingScreenRenderer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void displayLoadingString(String message)
|
||||
public void displayProgressMessage(String message)
|
||||
{
|
||||
this.systemTime = 0L;
|
||||
this.message = message;
|
||||
|
@ -58,100 +59,94 @@ public class AetherLoadingScreen extends LoadingScreenRenderer
|
|||
@Override
|
||||
public void setLoadingProgress(int progress)
|
||||
{
|
||||
long i = Minecraft.getSystemTime();
|
||||
long j = Minecraft.getSystemTime();
|
||||
|
||||
if (i - this.systemTime >= 100L)
|
||||
if (j - this.systemTime >= 100L)
|
||||
{
|
||||
this.systemTime = i;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
|
||||
int j = scaledresolution.getScaleFactor();
|
||||
int k = scaledresolution.getScaledWidth();
|
||||
int l = scaledresolution.getScaledHeight();
|
||||
this.systemTime = j;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
|
||||
int k = scaledresolution.getScaleFactor();
|
||||
int l = scaledresolution.getScaledWidth();
|
||||
int i1 = scaledresolution.getScaledHeight();
|
||||
|
||||
this.mc.fontRendererObj.drawStringWithShadow(this.currentDisplayedTrivia, (k - this.mc.fontRendererObj.getStringWidth(this.currentDisplayedTrivia)) / 2, l - 16, 0xffff99);
|
||||
if (OpenGlHelper.isFramebufferEnabled())
|
||||
{
|
||||
this.framebuffer.framebufferClear();
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.clear(256);
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
this.framebuffer.bindFramebuffer(false);
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D);
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.translate(0.0F, 0.0F, -200.0F);
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, 0.0F, -200.0F);
|
||||
|
||||
if (!OpenGlHelper.isFramebufferEnabled())
|
||||
{
|
||||
GlStateManager.clear(16640);
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
try
|
||||
if (!FMLClientHandler.instance().handleLoadingScreen(scaledresolution))
|
||||
{
|
||||
if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
|
||||
float f = 32.0F;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(4210752);
|
||||
tessellator.addVertexWithUV(0.0D, (double)i1, 0.0D, 0.0D, (double)((float)i1 / f));
|
||||
tessellator.addVertexWithUV((double)l, (double)i1, 0.0D, (double)((float)l / f), (double)((float)i1 / f));
|
||||
tessellator.addVertexWithUV((double)l, 0.0D, 0.0D, (double)((float)l / f), 0.0D);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
|
||||
if (progress >= 0)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldrenderer = tessellator.getBuffer();
|
||||
this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
|
||||
float f = 32.0F;
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos(0.0D, (double)l, 0.0D).tex(0.0D, (double)((float)l / f)).color(64, 64, 64, 255).endVertex();
|
||||
worldrenderer.pos((double)k, (double)l, 0.0D).tex((double)((float)k / f), (double)((float)l / f)).color(64, 64, 64, 255).endVertex();
|
||||
worldrenderer.pos((double)k, 0.0D, 0.0D).tex((double)((float)k / f), 0.0D).color(64, 64, 64, 255).endVertex();
|
||||
worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(64, 64, 64, 255).endVertex();
|
||||
byte b0 = 100;
|
||||
byte b1 = 2;
|
||||
int j1 = l / 2 - b0 / 2;
|
||||
int k1 = i1 / 2 + 16;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(8421504);
|
||||
tessellator.addVertex((double)j1, (double)k1, 0.0D);
|
||||
tessellator.addVertex((double)j1, (double)(k1 + b1), 0.0D);
|
||||
tessellator.addVertex((double)(j1 + b0), (double)(k1 + b1), 0.0D);
|
||||
tessellator.addVertex((double)(j1 + b0), (double)k1, 0.0D);
|
||||
tessellator.setColorOpaque_I(8454016);
|
||||
tessellator.addVertex((double)j1, (double)k1, 0.0D);
|
||||
tessellator.addVertex((double)j1, (double)(k1 + b1), 0.0D);
|
||||
tessellator.addVertex((double)(j1 + progress), (double)(k1 + b1), 0.0D);
|
||||
tessellator.addVertex((double)(j1 + progress), (double)k1, 0.0D);
|
||||
tessellator.draw();
|
||||
|
||||
if (progress >= 0)
|
||||
{
|
||||
int i1 = 100;
|
||||
int j1 = 2;
|
||||
int k1 = k / 2 - i1 / 2;
|
||||
int l1 = l / 2 + 16;
|
||||
GlStateManager.disableTexture2D();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
worldrenderer.pos((double)k1, (double)l1, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)k1, (double)(l1 + j1), 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)(k1 + i1), (double)(l1 + j1), 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)(k1 + i1), (double)l1, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)k1, (double)l1, 0.0D).color(128, 255, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)k1, (double)(l1 + j1), 0.0D).color(128, 255, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)(k1 + progress), (double)(l1 + j1), 0.0D).color(128, 255, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)(k1 + progress), (double)l1, 0.0D).color(128, 255, 128, 255).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215);
|
||||
this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215);
|
||||
this.mc.fontRendererObj.drawStringWithShadow(this.currentDisplayedTrivia, (k - this.mc.fontRendererObj.getStringWidth(this.currentDisplayedTrivia)) / 2, l - 16, 0xffff99);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
catch (java.io.IOException e)
|
||||
{
|
||||
com.google.common.base.Throwables.propagate(e);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (l - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, i1 / 2 - 4 - 16, 16777215);
|
||||
this.mc.fontRenderer.drawStringWithShadow(this.message, (l - this.mc.fontRenderer.getStringWidth(this.message)) / 2, i1 / 2 - 4 + 8, 16777215);
|
||||
this.mc.fontRenderer.drawStringWithShadow(this.currentDisplayedTrivia, (k - this.mc.fontRenderer.getStringWidth(this.currentDisplayedTrivia)) / 2, l - 16, 0xffff99);
|
||||
}
|
||||
|
||||
this.framebuffer.unbindFramebuffer();
|
||||
|
||||
if (OpenGlHelper.isFramebufferEnabled())
|
||||
{
|
||||
this.framebuffer.framebufferRender(k * j, l * j);
|
||||
this.framebuffer.framebufferRender(l * k, i1 * k);
|
||||
}
|
||||
|
||||
this.mc.updateDisplay();
|
||||
this.mc.func_147120_f();
|
||||
|
||||
try
|
||||
{
|
||||
Thread.yield();
|
||||
}
|
||||
catch (Exception var15)
|
||||
catch (Exception exception)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
|
|
@ -7,11 +7,12 @@ import net.minecraftforge.client.event.RenderBlockOverlayEvent;
|
|||
import net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import com.legacy.aether.client.overlay.AetherOverlay;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class GuiAetherInGame extends Gui
|
||||
{
|
||||
|
||||
|
@ -30,7 +31,7 @@ public class GuiAetherInGame extends Gui
|
|||
{
|
||||
PlayerAether player = PlayerAether.get(this.mc.thePlayer);
|
||||
|
||||
if (player.isWearingPhoenixSet() && event.getOverlayType() == OverlayType.FIRE)
|
||||
if (player.getAccessoryInventory().isWearingPhoenixSet() && event.overlayType == OverlayType.FIRE)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
@ -40,37 +41,29 @@ public class GuiAetherInGame extends Gui
|
|||
@SubscribeEvent
|
||||
public void onRenderGui(RenderGameOverlayEvent event)
|
||||
{
|
||||
if (event.isCancelable() || event.getType() != ElementType.TEXT)
|
||||
if (event.isCancelable() || event.type != ElementType.TEXT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerAether player = PlayerAether.get(this.mc.thePlayer);
|
||||
|
||||
if (player.poisonInstance() != null)
|
||||
if (player.getEntity() != null)
|
||||
{
|
||||
AetherOverlay.renderCure(this.mc);
|
||||
AetherOverlay.renderPoison(this.mc);
|
||||
}
|
||||
|
||||
if (player.thePlayer != null)
|
||||
{
|
||||
AetherOverlay.renderIronBubble(this.mc);
|
||||
AetherOverlay.renderCooldown(this.mc);
|
||||
AetherOverlay.renderJumps(this.mc);
|
||||
AetherOverlay.renderBossHP(this.mc);
|
||||
}
|
||||
|
||||
float portalTime = player.portalAnimTime * 1.2F + (player.prevPortalAnimTime - player.portalAnimTime);
|
||||
float portalTime = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * event.partialTicks;//player.portalAnimTime * 1.2F + (player.prevPortalAnimTime - player.portalAnimTime);
|
||||
|
||||
if(portalTime > 0.0F)
|
||||
{
|
||||
if (portalTime > 0.0F)
|
||||
{
|
||||
AetherOverlay.renderAetherPortal(portalTime, new ScaledResolution(this.mc));
|
||||
}
|
||||
AetherOverlay.renderAetherPortal(portalTime, new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -4,14 +4,15 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.containers.ContainerEnchanter;
|
||||
import com.legacy.aether.tile_entities.TileEntityEnchanter;
|
||||
import com.legacy.aether.inventory.ContainerEnchanter;
|
||||
import com.legacy.aether.tileentity.TileEntityEnchanter;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEnchanter extends GuiContainer
|
||||
|
@ -30,7 +31,7 @@ public class GuiEnchanter extends GuiContainer
|
|||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
String enchanterName = this.enchanter.getDisplayName().getFormattedText();
|
||||
String enchanterName = this.enchanter.getInventoryName();
|
||||
|
||||
this.fontRendererObj.drawString(enchanterName, this.xSize / 2 - this.fontRendererObj.getStringWidth(enchanterName) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
|
|
@ -4,14 +4,15 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.containers.ContainerFreezer;
|
||||
import com.legacy.aether.tile_entities.TileEntityFreezer;
|
||||
import com.legacy.aether.inventory.ContainerFreezer;
|
||||
import com.legacy.aether.tileentity.TileEntityFreezer;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFreezer extends GuiContainer
|
||||
|
@ -30,7 +31,7 @@ public class GuiFreezer extends GuiContainer
|
|||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
String freezerName = this.freezer.getDisplayName().getFormattedText();
|
||||
String freezerName = this.freezer.getInventoryName();
|
||||
|
||||
this.fontRendererObj.drawString(freezerName, this.xSize / 2 - this.fontRendererObj.getStringWidth(freezerName) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
@ -48,11 +49,11 @@ public class GuiFreezer extends GuiContainer
|
|||
|
||||
if (this.freezer.isFreezing())
|
||||
{
|
||||
i1 = this.freezer.getEnchantmentTimeRemaining(12);
|
||||
i1 = this.freezer.getFreezingTimeRemaining(12);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
|
||||
}
|
||||
|
||||
i1 = this.freezer.getEnchantmentProgressScaled(24);
|
||||
i1 = this.freezer.getFreezingProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue