mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Remove some utils that were stupid
This commit is contained in:
parent
fad1a1b0c9
commit
0eb64b2659
64 changed files with 251 additions and 341 deletions
|
@ -141,7 +141,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||||
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
||||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -102,16 +101,16 @@ public class BlockBookletStand extends BlockContainerBase implements IHudDisplay
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if(rotation == 0){
|
||||||
PosUtil.setMetadata(pos, world, 0, 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if(rotation == 1){
|
||||||
PosUtil.setMetadata(pos, world, 3, 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if(rotation == 2){
|
||||||
PosUtil.setMetadata(pos, world, 1, 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if(rotation == 3){
|
||||||
PosUtil.setMetadata(pos, world, 2, 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(pos);
|
TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(pos);
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -75,7 +74,7 @@ public class BlockBreaker extends BlockContainerBase{
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||||
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
||||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyInteger;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
|
@ -97,16 +96,16 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if(rotation == 0){
|
||||||
PosUtil.setMetadata(pos, world, 0, 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if(rotation == 1){
|
||||||
PosUtil.setMetadata(pos, world, 3, 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if(rotation == 2){
|
||||||
PosUtil.setMetadata(pos, world, 1, 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if(rotation == 3){
|
||||||
PosUtil.setMetadata(pos, world, 2, 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -68,7 +67,7 @@ public class BlockColoredLamp extends BlockBase{
|
||||||
//Turning On
|
//Turning On
|
||||||
if(player.isSneaking()){
|
if(player.isSneaking()){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
PosUtil.setBlock(pos, world, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, PosUtil.getMetadata(state), 2);
|
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getStateFromMeta(this.getMetaFromState(state)), 2);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -81,9 +80,9 @@ public class BlockColoredLamp extends BlockBase{
|
||||||
String name = OreDictionary.getOreName(oreID);
|
String name = OreDictionary.getOreName(oreID);
|
||||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||||
if(color != null){
|
if(color != null){
|
||||||
if(PosUtil.getMetadata(state) != color.ordinal()){
|
if(this.getMetaFromState(state) != color.ordinal()){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
PosUtil.setMetadata(pos, world, color.ordinal(), 2);
|
world.setBlockState(pos, this.getStateFromMeta(color.ordinal()), 2);
|
||||||
if(!player.capabilities.isCreativeMode){
|
if(!player.capabilities.isCreativeMode){
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -72,7 +71,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||||
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
||||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -71,7 +70,7 @@ public class BlockDropper extends BlockContainerBase{
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||||
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
||||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -78,7 +77,7 @@ public class BlockFluidCollector extends BlockContainerBase{
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||||
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
||||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyInteger;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
|
@ -59,7 +58,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
||||||
int meta = PosUtil.getMetadata(state);
|
int meta = this.getMetaFromState(state);
|
||||||
|
|
||||||
if(meta > 3){
|
if(meta > 3){
|
||||||
float f = (float)pos.getX()+0.5F;
|
float f = (float)pos.getX()+0.5F;
|
||||||
|
@ -105,7 +104,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
||||||
return PosUtil.getMetadata(state) > 3 ? 12 : 0;
|
return this.getMetaFromState(state) > 3 ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,16 +117,16 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if(rotation == 0){
|
||||||
PosUtil.setMetadata(pos, world, 0, 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if(rotation == 1){
|
||||||
PosUtil.setMetadata(pos, world, 3, 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if(rotation == 2){
|
||||||
PosUtil.setMetadata(pos, world, 1, 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if(rotation == 3){
|
||||||
PosUtil.setMetadata(pos, world, 2, 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyInteger;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
|
@ -60,7 +59,7 @@ public class BlockGrinder extends BlockContainerBase{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
||||||
int meta = PosUtil.getMetadata(state);
|
int meta = this.getMetaFromState(state);
|
||||||
|
|
||||||
if(meta == 1){
|
if(meta == 1){
|
||||||
for(int i = 0; i < 5; i++){
|
for(int i = 0; i < 5; i++){
|
||||||
|
@ -86,7 +85,7 @@ public class BlockGrinder extends BlockContainerBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
||||||
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
|
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -60,7 +59,7 @@ public class BlockItemRepairer extends BlockContainerBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
||||||
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
|
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
|
@ -51,23 +50,26 @@ public class BlockLampPowerer extends BlockBase{
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||||
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
|
||||||
PosUtil.setMetadata(pos, world, rotation, 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLamp(World world, BlockPos pos){
|
private void updateLamp(World world, BlockPos pos){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
BlockPos coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(pos, world)), pos, 0);
|
IBlockState state = world.getBlockState(pos);
|
||||||
if(PosUtil.getBlock(coords, world) instanceof BlockColoredLamp){
|
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)));
|
||||||
|
IBlockState coordsState = world.getBlockState(coords);
|
||||||
|
if(coordsState.getBlock() instanceof BlockColoredLamp){
|
||||||
|
int meta = coordsState.getBlock().getMetaFromState(coordsState);
|
||||||
if(world.isBlockIndirectlyGettingPowered(pos) > 0){
|
if(world.isBlockIndirectlyGettingPowered(pos) > 0){
|
||||||
if(!((BlockColoredLamp)PosUtil.getBlock(coords, world)).isOn){
|
if(!((BlockColoredLamp)coordsState.getBlock()).isOn){
|
||||||
PosUtil.setBlock(coords, world, InitBlocks.blockColoredLampOn, PosUtil.getMetadata(coords, world), 2);
|
world.setBlockState(coords, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(((BlockColoredLamp)PosUtil.getBlock(coords, world)).isOn){
|
if(((BlockColoredLamp)coordsState.getBlock()).isOn){
|
||||||
PosUtil.setBlock(coords, world, InitBlocks.blockColoredLamp, PosUtil.getMetadata(coords, world), 2);
|
world.setBlockState(coords, InitBlocks.blockColoredLamp.getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -135,8 +135,10 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
||||||
minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
if(phantom.hasBoundPosition()){
|
if(phantom.hasBoundPosition()){
|
||||||
int distance = (int)new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition()));
|
int distance = (int)new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition()));
|
||||||
Item item = PosUtil.getItemBlock(phantom.getBoundPosition(), minecraft.theWorld);
|
IBlockState state = minecraft.theWorld.getBlockState(phantom.getBoundPosition());
|
||||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(PosUtil.getBlock(phantom.getBoundPosition(), minecraft.theWorld), 1, PosUtil.getMetadata(phantom.getBoundPosition(), minecraft.theWorld)));
|
Block block = state.getBlock();
|
||||||
|
Item item = Item.getItemFromBlock(block);
|
||||||
|
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state)));
|
||||||
StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||||
|
|
||||||
if(phantom.isBoundThingInRange()){
|
if(phantom.isBoundThingInRange()){
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -108,16 +107,16 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if(rotation == 0){
|
||||||
PosUtil.setMetadata(pos, world, 0, 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if(rotation == 1){
|
||||||
PosUtil.setMetadata(pos, world, 3, 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if(rotation == 2){
|
||||||
PosUtil.setMetadata(pos, world, 1, 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if(rotation == 3){
|
||||||
PosUtil.setMetadata(pos, world, 2, 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
||||||
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -83,16 +82,16 @@ public class BlockTreasureChest extends BlockBase{
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if(rotation == 0){
|
||||||
PosUtil.setMetadata(pos, world, 0, 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if(rotation == 1){
|
||||||
PosUtil.setMetadata(pos, world, 3, 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if(rotation == 2){
|
||||||
PosUtil.setMetadata(pos, world, 1, 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if(rotation == 3){
|
||||||
PosUtil.setMetadata(pos, world, 2, 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockFenceGate;
|
import net.minecraft.block.BlockFenceGate;
|
||||||
import net.minecraft.block.BlockWall;
|
import net.minecraft.block.BlockWall;
|
||||||
|
@ -132,8 +131,8 @@ public class BlockWallAA extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
|
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
|
||||||
Block block = PosUtil.getBlock(pos, worldIn);
|
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
IBlockState state = worldIn.getBlockState(pos);
|
||||||
|
Block block = state.getBlock();
|
||||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.GOURD));
|
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.GOURD));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
|
@ -50,15 +49,17 @@ public class BlockWildPlant extends BlockBushBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
|
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
|
||||||
BlockPos offset = PosUtil.offset(pos, 0, -1, 0);
|
BlockPos offset = pos.down();
|
||||||
return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.WATER : PosUtil.getBlock(offset, world).canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this);
|
IBlockState offsetState = world.getBlockState(offset);
|
||||||
|
Block offsetBlock = offsetState.getBlock();
|
||||||
|
return offsetBlock.getMetaFromState(offsetState) == TheWildPlants.RICE.ordinal() ? offsetBlock.getMaterial(offsetState) == Material.WATER : offsetBlock.canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
|
||||||
int metadata = PosUtil.getMetadata(pos, world);
|
int metadata = this.getMetaFromState(state);
|
||||||
return metadata >= ALL_WILD_PLANTS.length ? null : new ItemStack(((BlockPlant)ALL_WILD_PLANTS[metadata].wildVersionOf).seedItem);
|
return metadata >= ALL_WILD_PLANTS.length ? null : new ItemStack(((BlockPlant)ALL_WILD_PLANTS[metadata].wildVersionOf).seedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ public class BlockWildPlant extends BlockBushBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||||
int metadata = PosUtil.getMetadata(state);
|
int metadata = this.getMetaFromState(state);
|
||||||
return metadata >= ALL_WILD_PLANTS.length ? null : ALL_WILD_PLANTS[metadata].wildVersionOf.getDrops(world, pos, ALL_WILD_PLANTS[metadata].wildVersionOf.getStateFromMeta(7), fortune);
|
return metadata >= ALL_WILD_PLANTS.length ? null : ALL_WILD_PLANTS[metadata].wildVersionOf.getDrops(world, pos, ALL_WILD_PLANTS[metadata].wildVersionOf.getStateFromMeta(7), fortune);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -74,16 +73,16 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if(rotation == 0){
|
||||||
PosUtil.setMetadata(pos, world, 0, 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if(rotation == 1){
|
||||||
PosUtil.setMetadata(pos, world, 3, 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if(rotation == 2){
|
||||||
PosUtil.setMetadata(pos, world, 1, 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if(rotation == 3){
|
||||||
PosUtil.setMetadata(pos, world, 2, 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -52,12 +51,12 @@ public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBas
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDisplace(IBlockAccess world, BlockPos pos){
|
public boolean canDisplace(IBlockAccess world, BlockPos pos){
|
||||||
return !PosUtil.getMaterial(pos, world).isLiquid() && super.canDisplace(world, pos);
|
return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean displaceIfPossible(World world, BlockPos pos){
|
public boolean displaceIfPossible(World world, BlockPos pos){
|
||||||
return !PosUtil.getMaterial(pos, world).isLiquid() && super.displaceIfPossible(world, pos);
|
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,7 +14,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -34,7 +34,8 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
|
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||||
|
int meta = state.getBlock().getMetaFromState(state);
|
||||||
if(meta == 0){
|
if(meta == 0){
|
||||||
GlStateManager.translate(0F, -0.5F, 0F);
|
GlStateManager.translate(0F, -0.5F, 0F);
|
||||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||||
|
|
|
@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
@ -42,7 +42,8 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
if(triggerName != null && theCloud.name != null){
|
if(triggerName != null && theCloud.name != null){
|
||||||
if(triggerName.equalsIgnoreCase(theCloud.name)){
|
if(triggerName.equalsIgnoreCase(theCloud.name)){
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
|
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
||||||
|
switch(state.getBlock().getMetaFromState(state)){
|
||||||
case 1:
|
case 1:
|
||||||
GlStateManager.rotate(180, 0, 1, 0);
|
GlStateManager.rotate(180, 0, 1, 0);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
|
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockRedstoneTorch;
|
import net.minecraft.block.BlockRedstoneTorch;
|
||||||
|
@ -143,7 +142,7 @@ public class ClientEvents{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(posHit != null && posHit.getBlockPos() != null){
|
if(posHit != null && posHit.getBlockPos() != null){
|
||||||
Block blockHit = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld);
|
Block blockHit = minecraft.theWorld.getBlockState(posHit.getBlockPos()).getBlock();
|
||||||
TileEntity tileHit = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
TileEntity tileHit = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
||||||
|
|
||||||
if(blockHit instanceof IHudDisplay){
|
if(blockHit instanceof IHudDisplay){
|
||||||
|
|
|
@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -38,6 +37,7 @@ import net.minecraftforge.fml.common.IWorldGenerator;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -59,7 +59,7 @@ public class OreGen implements IWorldGenerator{
|
||||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
|
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
|
||||||
int dimension = world.provider.getDimension();
|
int dimension = world.provider.getDimension();
|
||||||
if(dimension != -1 && dimension != 1){
|
if(dimension != -1 && dimension != 1){
|
||||||
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), world.provider.getDimension()) < 0){
|
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ArrayUtils.toObject(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue()), world.provider.getDimension()) < 0){
|
||||||
this.generateDefault(world, random, chunkX*16, chunkZ*16);
|
this.generateDefault(world, random, chunkX*16, chunkZ*16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class OreGen implements IWorldGenerator{
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
|
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
|
||||||
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
|
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
|
||||||
if(Util.arrayContains(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue(), event.getWorld().provider.getDimension()) < 0){
|
if(Util.arrayContains(ArrayUtils.toObject(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue()), event.getWorld().provider.getDimension()) < 0){
|
||||||
this.generateRice(event);
|
this.generateRice(event);
|
||||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
|
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
|
||||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event);
|
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event);
|
||||||
|
@ -111,8 +111,8 @@ public class OreGen implements IWorldGenerator{
|
||||||
if(event.getWorld().getBiomeGenForCoords(randomPos) instanceof BiomeOcean){
|
if(event.getWorld().getBiomeGenForCoords(randomPos) instanceof BiomeOcean){
|
||||||
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
|
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
|
||||||
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
|
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
|
||||||
if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.getWorld()).isSolid()){
|
if(event.getWorld().getBlockState(randomPos.down()).getMaterial().isSolid()){
|
||||||
PosUtil.setBlock(randomPos, event.getWorld(), InitBlocks.blockTreasureChest, event.getRand().nextInt(4), 2);
|
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getStateFromMeta(event.getRand().nextInt(4)), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,13 +128,13 @@ public class OreGen implements IWorldGenerator{
|
||||||
if(event.getRand().nextInt(50) == 0){
|
if(event.getRand().nextInt(50) == 0){
|
||||||
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
||||||
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
||||||
if(PosUtil.getMaterial(randomPos, event.getWorld()) == Material.WATER){
|
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
|
||||||
ArrayList<Material> blocksAroundBottom = WorldUtil.getMaterialsAround(event.getWorld(), randomPos);
|
ArrayList<Material> blocksAroundBottom = WorldUtil.getMaterialsAround(event.getWorld(), randomPos);
|
||||||
BlockPos posToGenAt = PosUtil.offset(randomPos, 0, 1, 0);
|
BlockPos posToGenAt = randomPos.up();
|
||||||
ArrayList<Material> blocksAroundTop = WorldUtil.getMaterialsAround(event.getWorld(), posToGenAt);
|
ArrayList<Material> blocksAroundTop = WorldUtil.getMaterialsAround(event.getWorld(), posToGenAt);
|
||||||
if(blocksAroundBottom.contains(Material.GRASS) || blocksAroundBottom.contains(Material.GROUND) || blocksAroundBottom.contains(Material.ROCK) || blocksAroundBottom.contains(Material.SAND)){
|
if(blocksAroundBottom.contains(Material.GRASS) || blocksAroundBottom.contains(Material.GROUND) || blocksAroundBottom.contains(Material.ROCK) || blocksAroundBottom.contains(Material.SAND)){
|
||||||
if(!blocksAroundTop.contains(Material.WATER) && PosUtil.getMaterial(posToGenAt, event.getWorld()) == Material.AIR){
|
if(!blocksAroundTop.contains(Material.WATER) && event.getWorld().getBlockState(posToGenAt).getMaterial() == Material.AIR){
|
||||||
PosUtil.setBlock(posToGenAt, event.getWorld(), InitBlocks.blockWildPlant, TheWildPlants.RICE.ordinal(), 2);
|
event.getWorld().setBlockState(posToGenAt, InitBlocks.blockWildPlant.getStateFromMeta(TheWildPlants.RICE.ordinal()), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ public class OreGen implements IWorldGenerator{
|
||||||
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
||||||
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
||||||
|
|
||||||
if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.getWorld()) == blockBelow){
|
if(event.getWorld().getBlockState(randomPos.down()).getMaterial() == blockBelow){
|
||||||
if(plant.canPlaceBlockAt(event.getWorld(), randomPos) && event.getWorld().isAirBlock(randomPos)){
|
if(plant.canPlaceBlockAt(event.getWorld(), randomPos) && event.getWorld().isAirBlock(randomPos)){
|
||||||
PosUtil.setBlock(randomPos, event.getWorld(), plant, meta, 2);
|
event.getWorld().setBlockState(randomPos, plant.getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -59,8 +59,9 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ){
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ){
|
||||||
if(player.isSneaking()){
|
if(player.isSneaking()){
|
||||||
Block block = PosUtil.getBlock(pos, world);
|
IBlockState state = world.getBlockState(pos);
|
||||||
ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(pos, world));
|
Block block = state.getBlock();
|
||||||
|
ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||||
BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
|
BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
|
||||||
if(page != null){
|
if(page != null){
|
||||||
if(world.isRemote){
|
if(world.isRemote){
|
||||||
|
@ -98,9 +99,10 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
|
||||||
@Override
|
@Override
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
|
||||||
if(posHit != null){
|
if(posHit != null){
|
||||||
Block block = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld);
|
IBlockState state = minecraft.theWorld.getBlockState(posHit.getBlockPos());
|
||||||
|
Block block = state.getBlock();
|
||||||
if(block != null && !block.isAir(minecraft.theWorld.getBlockState(posHit.getBlockPos()), minecraft.theWorld, posHit.getBlockPos())){
|
if(block != null && !block.isAir(minecraft.theWorld.getBlockState(posHit.getBlockPos()), minecraft.theWorld, posHit.getBlockPos())){
|
||||||
ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(posHit.getBlockPos(), minecraft.theWorld));
|
ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||||
int height = resolution.getScaledHeight()/5*3;
|
int height = resolution.getScaledHeight()/5*3;
|
||||||
if(player.isSneaking()){
|
if(player.isSneaking()){
|
||||||
BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
|
BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
|
||||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockChest;
|
import net.minecraft.block.BlockChest;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -39,7 +38,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{
|
||||||
public EnumActionResult onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){
|
public EnumActionResult onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){
|
||||||
if(player.isSneaking()){
|
if(player.isSneaking()){
|
||||||
TileEntity tileHit = world.getTileEntity(pos);
|
TileEntity tileHit = world.getTileEntity(pos);
|
||||||
Block block = PosUtil.getBlock(pos, world);
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
if(block instanceof BlockChest && tileHit instanceof TileEntityChest){
|
if(block instanceof BlockChest && tileHit instanceof TileEntityChest){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityChest chest = (TileEntityChest)tileHit;
|
TileEntityChest chest = (TileEntityChest)tileHit;
|
||||||
|
@ -58,7 +57,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{
|
||||||
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
||||||
world.playEvent(2001, pos, Block.getStateId(world.getBlockState(pos)));
|
world.playEvent(2001, pos, Block.getStateId(world.getBlockState(pos)));
|
||||||
}
|
}
|
||||||
PosUtil.setBlock(pos, world, InitBlocks.blockGiantChest, 0, 2);
|
world.setBlockState(pos, InitBlocks.blockGiantChest.getDefaultState(), 2);
|
||||||
|
|
||||||
//Copy Items into new Chest
|
//Copy Items into new Chest
|
||||||
TileEntity newTileHit = world.getTileEntity(pos);
|
TileEntity newTileHit = world.getTileEntity(pos);
|
||||||
|
|
|
@ -21,7 +21,6 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -430,7 +429,8 @@ public class ItemDrill extends ItemEnergy{
|
||||||
}
|
}
|
||||||
|
|
||||||
//Not defined later because main Block is getting broken below
|
//Not defined later because main Block is getting broken below
|
||||||
float mainHardness = PosUtil.getBlock(aPos, world).getBlockHardness(world.getBlockState(aPos), world, aPos);
|
IBlockState state = world.getBlockState(aPos);
|
||||||
|
float mainHardness = state.getBlockHardness(world, aPos);
|
||||||
|
|
||||||
//Break Middle Block first
|
//Break Middle Block first
|
||||||
int use = this.getEnergyUsePerBlock(stack);
|
int use = this.getEnergyUsePerBlock(stack);
|
||||||
|
@ -452,7 +452,8 @@ public class ItemDrill extends ItemEnergy{
|
||||||
if(this.getEnergyStored(stack) >= use){
|
if(this.getEnergyStored(stack) >= use){
|
||||||
//Only break Blocks around that are (about) as hard or softer
|
//Only break Blocks around that are (about) as hard or softer
|
||||||
BlockPos thePos = new BlockPos(xPos, yPos, zPos);
|
BlockPos thePos = new BlockPos(xPos, yPos, zPos);
|
||||||
if(PosUtil.getBlock(thePos, world).getBlockHardness(world.getBlockState(thePos), world, thePos) <= mainHardness+5.0F){
|
IBlockState theState = world.getBlockState(thePos);
|
||||||
|
if(theState.getBlockHardness(world, thePos) <= mainHardness+5.0F){
|
||||||
this.tryHarvestBlock(world, thePos, true, stack, player, use);
|
this.tryHarvestBlock(world, thePos, true, stack, player, use);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,8 +480,8 @@ public class ItemDrill extends ItemEnergy{
|
||||||
* @param use The Energy that should be extracted per Block
|
* @param use The Energy that should be extracted per Block
|
||||||
*/
|
*/
|
||||||
private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){
|
private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){
|
||||||
Block block = PosUtil.getBlock(pos, world);
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
Block block = state.getBlock();
|
||||||
float hardness = block.getBlockHardness(state, world, pos);
|
float hardness = block.getBlockHardness(state, world, pos);
|
||||||
boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F);
|
boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F);
|
||||||
if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){
|
if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockGrass;
|
import net.minecraft.block.BlockGrass;
|
||||||
import net.minecraft.block.IGrowable;
|
import net.minecraft.block.IGrowable;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
@ -57,7 +57,7 @@ public class ItemGrowthRing extends ItemEnergy{
|
||||||
int theY = MathHelper.floor_double(player.posY+y);
|
int theY = MathHelper.floor_double(player.posY+y);
|
||||||
int theZ = MathHelper.floor_double(player.posZ+z);
|
int theZ = MathHelper.floor_double(player.posZ+z);
|
||||||
BlockPos posInQuestion = new BlockPos(theX, theY, theZ);
|
BlockPos posInQuestion = new BlockPos(theX, theY, theZ);
|
||||||
Block theBlock = PosUtil.getBlock(posInQuestion, world);
|
Block theBlock = world.getBlockState(posInQuestion).getBlock();
|
||||||
if((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof BlockGrass)){
|
if((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof BlockGrass)){
|
||||||
blocks.add(posInQuestion);
|
blocks.add(posInQuestion);
|
||||||
}
|
}
|
||||||
|
@ -71,11 +71,14 @@ public class ItemGrowthRing extends ItemEnergy{
|
||||||
if(this.getEnergyStored(stack) >= energyUse){
|
if(this.getEnergyStored(stack) >= energyUse){
|
||||||
BlockPos pos = blocks.get(Util.RANDOM.nextInt(blocks.size()));
|
BlockPos pos = blocks.get(Util.RANDOM.nextInt(blocks.size()));
|
||||||
|
|
||||||
int metaBefore = PosUtil.getMetadata(pos, world);
|
IBlockState state = world.getBlockState(pos);
|
||||||
PosUtil.getBlock(pos, world).updateTick(world, pos, world.getBlockState(pos), Util.RANDOM);
|
Block block = state.getBlock();
|
||||||
|
int metaBefore = block.getMetaFromState(state);
|
||||||
|
block.updateTick(world, pos, world.getBlockState(pos), Util.RANDOM);
|
||||||
|
|
||||||
//Show Particles if Metadata changed
|
//Show Particles if Metadata changed
|
||||||
if(PosUtil.getMetadata(pos, world) != metaBefore){
|
IBlockState newState = world.getBlockState(pos);
|
||||||
|
if(newState.getBlock().getMetaFromState(newState) != metaBefore){
|
||||||
world.playEvent(2005, pos, 0);
|
world.playEvent(2005, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items;
|
||||||
import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem;
|
import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockBush;
|
import net.minecraft.block.BlockBush;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
@ -108,7 +107,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{
|
||||||
for(int reachY = (this.isAdvanced ? -rangeSides : -rangeUp); reachY < (this.isAdvanced ? rangeSides : rangeUp)+1; reachY++){
|
for(int reachY = (this.isAdvanced ? -rangeSides : -rangeUp); reachY < (this.isAdvanced ? rangeSides : rangeUp)+1; reachY++){
|
||||||
//The current Block to break
|
//The current Block to break
|
||||||
BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ);
|
BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ);
|
||||||
Block block = PosUtil.getBlock(pos, world);
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world.getBlockState(pos), world, pos)))){
|
if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world.getBlockState(pos), world, pos)))){
|
||||||
breakPositions.add(pos);
|
breakPositions.add(pos);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +119,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{
|
||||||
Collections.shuffle(breakPositions);
|
Collections.shuffle(breakPositions);
|
||||||
|
|
||||||
BlockPos theCoord = breakPositions.get(0);
|
BlockPos theCoord = breakPositions.get(0);
|
||||||
Block theBlock = PosUtil.getBlock(theCoord, world);
|
Block theBlock = world.getBlockState(theCoord).getBlock();
|
||||||
|
|
||||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
//Gets all of the Drops the Block should have
|
//Gets all of the Drops the Block should have
|
||||||
|
|
|
@ -12,8 +12,6 @@ package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -97,7 +95,7 @@ public class ItemWaterBowl extends ItemBase{
|
||||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
BlockPos pos1 = PosUtil.getBlock(pos, world).isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP ? pos : pos.offset(trace.sideHit);
|
BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP ? pos : pos.offset(trace.sideHit);
|
||||||
|
|
||||||
if(!player.canPlayerEdit(pos1, trace.sideHit, stack)){
|
if(!player.canPlayerEdit(pos1, trace.sideHit, stack)){
|
||||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -52,7 +51,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{
|
||||||
|
|
||||||
//Remove Water
|
//Remove Water
|
||||||
BlockPos pos = new BlockPos(theX, theY, theZ);
|
BlockPos pos = new BlockPos(theX, theY, theZ);
|
||||||
Block block = PosUtil.getBlock(pos, world);
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
if((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && this.getEnergyStored(stack) >= energyUse){
|
if((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && this.getEnergyStored(stack) >= energyUse){
|
||||||
world.setBlockToAir(pos);
|
world.setBlockToAir(pos);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -53,10 +52,12 @@ public class LensColor extends Lens{
|
||||||
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
||||||
if(hitBlock != null){
|
if(hitBlock != null){
|
||||||
if(tile.getEnergy() >= ENERGY_USE){
|
if(tile.getEnergy() >= ENERGY_USE){
|
||||||
int meta = PosUtil.getMetadata(hitBlock, tile.getWorldObject());
|
IBlockState state = tile.getWorldObject().getBlockState(hitBlock);
|
||||||
ItemStack returnStack = this.tryConvert(new ItemStack(PosUtil.getBlock(hitBlock, tile.getWorldObject()), 1, meta), hitState, hitBlock, tile);
|
Block block = state.getBlock();
|
||||||
|
int meta = block.getMetaFromState(state);
|
||||||
|
ItemStack returnStack = this.tryConvert(new ItemStack(block, 1, meta), hitState, hitBlock, tile);
|
||||||
if(returnStack != null && returnStack.getItem() instanceof ItemBlock){
|
if(returnStack != null && returnStack.getItem() instanceof ItemBlock){
|
||||||
PosUtil.setBlock(hitBlock, tile.getWorldObject(), Block.getBlockFromItem(returnStack.getItem()), returnStack.getItemDamage(), 2);
|
tile.getWorldObject().setBlockState(hitBlock, Block.getBlockFromItem(returnStack.getItem()).getStateFromMeta(returnStack.getItemDamage()), 2);
|
||||||
|
|
||||||
tile.extractEnergy(ENERGY_USE);
|
tile.extractEnergy(ENERGY_USE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.DamageSources;
|
import de.ellpeck.actuallyadditions.mod.misc.DamageSources;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -35,7 +34,7 @@ public class LensDeath extends Lens{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock);
|
return hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ public class LensDetonation extends Lens{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean invoke(IBlockState state, BlockPos hitBlock, IAtomicReconstructor tile){
|
public boolean invoke(IBlockState state, BlockPos hitBlock, IAtomicReconstructor tile){
|
||||||
if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(state, tile.getWorldObject(), hitBlock)){
|
if(hitBlock != null && !state.getBlock().isAir(state, tile.getWorldObject(), hitBlock)){
|
||||||
int use = 250000;
|
int use = 250000;
|
||||||
if(tile.getEnergy() >= use){
|
if(tile.getEnergy() >= use){
|
||||||
tile.getWorldObject().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
tile.getWorldObject().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
||||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -31,7 +30,7 @@ public class LensDisruption extends Lens{
|
||||||
@Override
|
@Override
|
||||||
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
||||||
int energyUse = 150000;
|
int energyUse = 150000;
|
||||||
if(tile.getEnergy() >= energyUse && hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock)){
|
if(tile.getEnergy() >= energyUse && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)){
|
||||||
int range = 2;
|
int range = 2;
|
||||||
ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range));
|
ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range));
|
||||||
for(EntityItem item : items){
|
for(EntityItem item : items){
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
@ -91,8 +90,8 @@ public final class LaserRelayConnectionHandler{
|
||||||
* (Puts it into the correct network!)
|
* (Puts it into the correct network!)
|
||||||
*/
|
*/
|
||||||
public static boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world){
|
public static boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world){
|
||||||
int distance = (int)PosUtil.toVec(firstRelay).distanceTo(PosUtil.toVec(secondRelay));
|
int distanceSq = (int)firstRelay.distanceSq(secondRelay);
|
||||||
if(distance > TileEntityLaserRelay.MAX_DISTANCE || PosUtil.areSamePos(firstRelay, secondRelay)){
|
if(distanceSq > TileEntityLaserRelay.MAX_DISTANCE*TileEntityLaserRelay.MAX_DISTANCE || firstRelay.equals(secondRelay)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ public final class LaserRelayConnectionHandler{
|
||||||
|
|
||||||
public boolean contains(BlockPos relay){
|
public boolean contains(BlockPos relay){
|
||||||
for(BlockPos position : this.positions){
|
for(BlockPos position : this.positions){
|
||||||
if(position != null && PosUtil.areSamePos(position, relay)){
|
if(position != null && position.equals(relay)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
@ -120,7 +119,7 @@ public class MethodHandler implements IMethodHandler{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
public boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
||||||
if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock)){
|
if(hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)){
|
||||||
int range = 2;
|
int range = 2;
|
||||||
|
|
||||||
//Converting the Blocks
|
//Converting the Blocks
|
||||||
|
@ -128,7 +127,7 @@ public class MethodHandler implements IMethodHandler{
|
||||||
for(int reachZ = -range; reachZ < range+1; reachZ++){
|
for(int reachZ = -range; reachZ < range+1; reachZ++){
|
||||||
for(int reachY = -range; reachY < range+1; reachY++){
|
for(int reachY = -range; reachY < range+1; reachY++){
|
||||||
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
||||||
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject())));
|
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(hitState.getBlock(), 1, hitState.getBlock().getMetaFromState(hitState)));
|
||||||
for(LensConversionRecipe recipe : recipes){
|
for(LensConversionRecipe recipe : recipes){
|
||||||
if(recipe != null && recipe.type == tile.getLens() && tile.getEnergy() >= recipe.energyUse){
|
if(recipe != null && recipe.type == tile.getLens() && tile.getEnergy() >= recipe.energyUse){
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
|
@ -138,7 +137,7 @@ public class MethodHandler implements IMethodHandler{
|
||||||
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
||||||
tile.getWorldObject().playEvent(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos)));
|
tile.getWorldObject().playEvent(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos)));
|
||||||
}
|
}
|
||||||
PosUtil.setBlock(pos, tile.getWorldObject(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2);
|
tile.getWorldObject().setBlockState(pos, Block.getBlockFromItem(output.getItem()).getStateFromMeta(output.getItemDamage()), 2);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
|
EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
//TODO Make this less hideous
|
||||||
public class FuelHandler implements IFuelHandler{
|
public class FuelHandler implements IFuelHandler{
|
||||||
|
|
||||||
private static final HashMap<Pair<Item, Integer>, Integer> FUEL_LIST = new HashMap<Pair<Item, Integer>, Integer>();
|
private static final HashMap<Pair<Item, Integer>, Integer> FUEL_LIST = new HashMap<Pair<Item, Integer>, Integer>();
|
||||||
|
|
|
@ -19,8 +19,8 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -99,7 +99,8 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
|
|
||||||
private void doWork(){
|
private void doWork(){
|
||||||
if(this.storage.getEnergyStored() >= ENERGY_USE){
|
if(this.storage.getEnergyStored() >= ENERGY_USE){
|
||||||
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, this.worldObj));
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state));
|
||||||
//Extract energy for shooting the laser itself too!
|
//Extract energy for shooting the laser itself too!
|
||||||
this.storage.extractEnergy(ENERGY_USE, false);
|
this.storage.extractEnergy(ENERGY_USE, false);
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
Lens currentLens = this.getLens();
|
Lens currentLens = this.getLens();
|
||||||
int distance = currentLens.getDistance();
|
int distance = currentLens.getDistance();
|
||||||
for(int i = 0; i < distance; i++){
|
for(int i = 0; i < distance; i++){
|
||||||
BlockPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, i);
|
BlockPos hitBlock = this.pos.offset(sideToManipulate, i);
|
||||||
|
|
||||||
if(currentLens.invoke(this.worldObj.getBlockState(hitBlock), hitBlock, this)){
|
if(currentLens.invoke(this.worldObj.getBlockState(hitBlock), hitBlock, this)){
|
||||||
shootLaser(this.worldObj, this.getX(), this.getY(), this.getZ(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
|
shootLaser(this.worldObj, this.getX(), this.getY(), this.getZ(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -80,11 +79,12 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doWork(){
|
private void doWork(){
|
||||||
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, this.worldObj));
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state));
|
||||||
|
|
||||||
BlockPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, 0);
|
BlockPos coordsBlock = this.pos.offset(sideToManipulate, 0);
|
||||||
Block blockToBreak = PosUtil.getBlock(coordsBlock, this.worldObj);
|
|
||||||
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
|
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
|
||||||
|
Block blockToBreak = stateToBreak.getBlock();
|
||||||
if(!this.isPlacer && blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(stateToBreak, this.worldObj, coordsBlock) > -1.0F){
|
if(!this.isPlacer && blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(stateToBreak, this.worldObj, coordsBlock) > -1.0F){
|
||||||
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, stateToBreak, 0);
|
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, stateToBreak, 0);
|
||||||
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
||||||
|
@ -94,7 +94,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
||||||
this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(stateToBreak));
|
this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(stateToBreak));
|
||||||
}
|
}
|
||||||
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.pos);
|
this.worldObj.setBlockToAir(coordsBlock);
|
||||||
WorldUtil.addToInventory(this, drops, true, true);
|
WorldUtil.addToInventory(this, drops, true, true);
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,11 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockAir;
|
import net.minecraft.block.BlockAir;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -82,11 +82,12 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
||||||
|
|
||||||
private void doWork(){
|
private void doWork(){
|
||||||
if(this.storage.getEnergyStored() >= ENERGY_USE*RANGE){
|
if(this.storage.getEnergyStored() >= ENERGY_USE*RANGE){
|
||||||
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, this.worldObj));
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state));
|
||||||
|
|
||||||
for(int i = 0; i < RANGE; i++){
|
for(int i = 0; i < RANGE; i++){
|
||||||
BlockPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, i);
|
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i);
|
||||||
Block blockToBreak = PosUtil.getBlock(coordsBlock, this.worldObj);
|
Block blockToBreak = this.worldObj.getBlockState(coordsBlock).getBlock();
|
||||||
if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(this.worldObj.getBlockState(coordsBlock), this.worldObj, this.pos) > -1.0F){
|
if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(this.worldObj.getBlockState(coordsBlock), this.worldObj, this.pos) > -1.0F){
|
||||||
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0);
|
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0);
|
||||||
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
||||||
|
@ -96,7 +97,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
||||||
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
|
||||||
this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(this.worldObj.getBlockState(coordsBlock)));
|
this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(this.worldObj.getBlockState(coordsBlock)));
|
||||||
}
|
}
|
||||||
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.getPos(), i);
|
this.worldObj.setBlockToAir(coordsBlock);
|
||||||
WorldUtil.addToInventory(this, drops, true, true);
|
WorldUtil.addToInventory(this, drops, true, true);
|
||||||
this.storage.extractEnergy(ENERGY_USE, false);
|
this.storage.extractEnergy(ENERGY_USE, false);
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -67,7 +67,8 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
||||||
if(this.removeFromInventory(false) != null){
|
if(this.removeFromInventory(false) != null){
|
||||||
ItemStack stack = this.removeFromInventory(true);
|
ItemStack stack = this.removeFromInventory(true);
|
||||||
stack.stackSize = 1;
|
stack.stackSize = 1;
|
||||||
WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, this.worldObj)), this.worldObj, this.pos, stack);
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)), this.worldObj, this.pos, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -57,14 +56,14 @@ public class TileEntityFishingNet extends TileEntityBase{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if(!this.worldObj.isRemote){
|
if(!this.worldObj.isRemote){
|
||||||
if(!this.isRedstonePowered){
|
if(!this.isRedstonePowered){
|
||||||
if(PosUtil.getMaterial(PosUtil.offset(this.pos, 0, -1, 0), this.worldObj) == Material.WATER){
|
if(this.worldObj.getBlockState(this.pos.down()).getMaterial() == Material.WATER){
|
||||||
if(this.timeUntilNextDrop > 0){
|
if(this.timeUntilNextDrop > 0){
|
||||||
this.timeUntilNextDrop--;
|
this.timeUntilNextDrop--;
|
||||||
if(this.timeUntilNextDrop <= 0){
|
if(this.timeUntilNextDrop <= 0){
|
||||||
LootContext.Builder builder = new LootContext.Builder((WorldServer)this.worldObj);
|
LootContext.Builder builder = new LootContext.Builder((WorldServer)this.worldObj);
|
||||||
List<ItemStack> fishables = this.worldObj.getLootTableManager().getLootTableFromLocation(LootTableList.GAMEPLAY_FISHING).generateLootForPools(Util.RANDOM, builder.build());
|
List<ItemStack> fishables = this.worldObj.getLootTableManager().getLootTableFromLocation(LootTableList.GAMEPLAY_FISHING).generateLootForPools(Util.RANDOM, builder.build());
|
||||||
for(ItemStack fishable : fishables){
|
for(ItemStack fishable : fishables){
|
||||||
TileEntity tile = this.worldObj.getTileEntity(PosUtil.offset(this.pos, 0, 1, 0));
|
TileEntity tile = this.worldObj.getTileEntity(this.pos.up());
|
||||||
if(tile != null && tile instanceof IInventory){
|
if(tile != null && tile instanceof IInventory){
|
||||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||||
list.add(fishable);
|
list.add(fishable);
|
||||||
|
|
|
@ -10,12 +10,11 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -63,39 +62,41 @@ public class TileEntityFluidCollector extends TileEntityBase implements net.mine
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doWork(){
|
private void doWork(){
|
||||||
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, this.worldObj));
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
BlockPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, 0);
|
Block block = state.getBlock();
|
||||||
|
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(block.getMetaFromState(state));
|
||||||
|
BlockPos coordsBlock = this.pos.offset(sideToManipulate, 0);
|
||||||
|
|
||||||
Block blockToBreak = PosUtil.getBlock(coordsBlock, this.worldObj);
|
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
|
||||||
if(!this.isPlacer && blockToBreak != null && PosUtil.getMetadata(coordsBlock, this.worldObj) == 0 && Util.BUCKET <= this.tank.getCapacity()-this.tank.getFluidAmount()){
|
Block blockToBreak = stateToBreak.getBlock();
|
||||||
|
if(!this.isPlacer && blockToBreak != null && blockToBreak.getMetaFromState(stateToBreak) == 0 && Util.BUCKET <= this.tank.getCapacity()-this.tank.getFluidAmount()){
|
||||||
if(blockToBreak instanceof IFluidBlock && ((IFluidBlock)blockToBreak).getFluid() != null){
|
if(blockToBreak instanceof IFluidBlock && ((IFluidBlock)blockToBreak).getFluid() != null){
|
||||||
if(this.tank.fillInternal(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), Util.BUCKET), false) >= Util.BUCKET){
|
if(this.tank.fillInternal(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), Util.BUCKET), false) >= Util.BUCKET){
|
||||||
this.tank.fillInternal(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), Util.BUCKET), true);
|
this.tank.fillInternal(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), Util.BUCKET), true);
|
||||||
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.pos);
|
this.worldObj.setBlockToAir(coordsBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(blockToBreak == Blocks.LAVA || blockToBreak == Blocks.FLOWING_LAVA){
|
else if(blockToBreak == Blocks.LAVA || blockToBreak == Blocks.FLOWING_LAVA){
|
||||||
if(this.tank.fillInternal(new FluidStack(FluidRegistry.LAVA, Util.BUCKET), false) >= Util.BUCKET){
|
if(this.tank.fillInternal(new FluidStack(FluidRegistry.LAVA, Util.BUCKET), false) >= Util.BUCKET){
|
||||||
this.tank.fillInternal(new FluidStack(FluidRegistry.LAVA, Util.BUCKET), true);
|
this.tank.fillInternal(new FluidStack(FluidRegistry.LAVA, Util.BUCKET), true);
|
||||||
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.pos);
|
this.worldObj.setBlockToAir(coordsBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(blockToBreak == Blocks.WATER || blockToBreak == Blocks.FLOWING_WATER){
|
else if(blockToBreak == Blocks.WATER || blockToBreak == Blocks.FLOWING_WATER){
|
||||||
if(this.tank.fillInternal(new FluidStack(FluidRegistry.WATER, Util.BUCKET), false) >= Util.BUCKET){
|
if(this.tank.fillInternal(new FluidStack(FluidRegistry.WATER, Util.BUCKET), false) >= Util.BUCKET){
|
||||||
this.tank.fillInternal(new FluidStack(FluidRegistry.WATER, Util.BUCKET), true);
|
this.tank.fillInternal(new FluidStack(FluidRegistry.WATER, Util.BUCKET), true);
|
||||||
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.pos);
|
this.worldObj.setBlockToAir(coordsBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(this.isPlacer && PosUtil.getBlock(coordsBlock, this.worldObj).isReplaceable(this.worldObj, coordsBlock)){
|
else if(this.isPlacer && blockToBreak.isReplaceable(this.worldObj, coordsBlock)){
|
||||||
if(this.tank.getFluidAmount() >= Util.BUCKET){
|
if(this.tank.getFluidAmount() >= Util.BUCKET){
|
||||||
Block block = this.tank.getFluid().getFluid().getBlock();
|
Block fluid = this.tank.getFluid().getFluid().getBlock();
|
||||||
if(block != null){
|
if(fluid != null){
|
||||||
BlockPos offsetPos = this.pos.offset(sideToManipulate);
|
BlockPos offsetPos = this.pos.offset(sideToManipulate);
|
||||||
Block blockPresent = PosUtil.getBlock(offsetPos, this.worldObj);
|
boolean placeable = !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && blockToBreak.isReplaceable(this.worldObj, offsetPos);
|
||||||
boolean placeable = !(blockPresent instanceof BlockLiquid) && !(blockPresent instanceof IFluidBlock) && blockPresent.isReplaceable(this.worldObj, offsetPos);
|
|
||||||
if(placeable){
|
if(placeable){
|
||||||
PosUtil.setBlock(offsetPos, this.worldObj, block, 0, 3);
|
this.worldObj.setBlockState(offsetPos, fluid.getDefaultState(), 3);
|
||||||
this.tank.drainInternal(Util.BUCKET, true);
|
this.tank.drainInternal(Util.BUCKET, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -98,14 +99,16 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
if(flag != (this.firstSmeltTime > 0 || this.secondSmeltTime > 0)){
|
if(flag != (this.firstSmeltTime > 0 || this.secondSmeltTime > 0)){
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
int meta = PosUtil.getMetadata(this.pos, this.worldObj);
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
Block block = state.getBlock();
|
||||||
|
int meta = block.getMetaFromState(state);
|
||||||
if(meta > 3){
|
if(meta > 3){
|
||||||
if(!this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1) && !this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2)){
|
if(!this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1) && !this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2)){
|
||||||
PosUtil.setMetadata(this.pos, this.worldObj, meta-4, 2);
|
this.worldObj.setBlockState(this.pos, block.getStateFromMeta(meta-4), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
PosUtil.setMetadata(this.pos, this.worldObj, meta+4, 2);
|
this.worldObj.setBlockState(this.pos, block.getStateFromMeta(meta+4), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyProvider;
|
import cofh.api.energy.IEnergyProvider;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -80,8 +80,9 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
||||||
|
|
||||||
public boolean hasBlockAbove(){
|
public boolean hasBlockAbove(){
|
||||||
for(int y = 1; y <= this.worldObj.getHeight(); y++){
|
for(int y = 1; y <= this.worldObj.getHeight(); y++){
|
||||||
BlockPos offset = PosUtil.offset(this.pos, 0, y, 0);
|
BlockPos offset = this.pos.down(y);
|
||||||
if(!PosUtil.getBlock(offset, this.worldObj).isAir(this.worldObj.getBlockState(offset), this.worldObj, offset)){
|
IBlockState state = this.worldObj.getBlockState(offset);
|
||||||
|
if(!state.getBlock().isAir(state, this.worldObj, offset)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,11 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockGrass;
|
import net.minecraft.block.BlockGrass;
|
||||||
import net.minecraft.block.IGrowable;
|
import net.minecraft.block.IGrowable;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
@ -54,10 +53,13 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
|
||||||
if(this.timeUntilNextFert <= 0){
|
if(this.timeUntilNextFert <= 0){
|
||||||
BlockPos blockToFert = this.blockToFertilize();
|
BlockPos blockToFert = this.blockToFertilize();
|
||||||
if(blockToFert != null){
|
if(blockToFert != null){
|
||||||
int metaBefore = PosUtil.getMetadata(blockToFert, this.worldObj);
|
IBlockState state = this.worldObj.getBlockState(blockToFert);
|
||||||
PosUtil.getBlock(blockToFert, this.worldObj).updateTick(this.worldObj, blockToFert, this.worldObj.getBlockState(blockToFert), Util.RANDOM);
|
Block block = state.getBlock();
|
||||||
|
int metaBefore = block.getMetaFromState(state);
|
||||||
|
block.updateTick(this.worldObj, blockToFert, this.worldObj.getBlockState(blockToFert), Util.RANDOM);
|
||||||
|
|
||||||
if(PosUtil.getMetadata(blockToFert, this.worldObj) != metaBefore){
|
IBlockState newState = this.worldObj.getBlockState(blockToFert);
|
||||||
|
if(newState.getBlock().getMetaFromState(newState) != metaBefore){
|
||||||
this.worldObj.playEvent(2005, blockToFert, 0);
|
this.worldObj.playEvent(2005, blockToFert, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +76,7 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
|
||||||
public BlockPos blockToFertilize(){
|
public BlockPos blockToFertilize(){
|
||||||
for(int i = this.pos.getY()-1; i > 0; i--){
|
for(int i = this.pos.getY()-1; i > 0; i--){
|
||||||
BlockPos offset = new BlockPos(this.pos.getX(), i, this.pos.getZ());
|
BlockPos offset = new BlockPos(this.pos.getX(), i, this.pos.getZ());
|
||||||
Block block = PosUtil.getBlock(this.pos, this.worldObj);
|
Block block = this.worldObj.getBlockState(this.pos).getBlock();
|
||||||
if(block != null && !(this.worldObj.isAirBlock(offset))){
|
if(block != null && !(this.worldObj.isAirBlock(offset))){
|
||||||
if((block instanceof IGrowable || block instanceof IPlantable) && !(block instanceof BlockGrass)){
|
if((block instanceof IGrowable || block instanceof IPlantable) && !(block instanceof BlockGrass)){
|
||||||
return offset;
|
return offset;
|
||||||
|
|
|
@ -16,8 +16,9 @@ import cofh.api.energy.IEnergyReceiver;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -145,14 +146,16 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
|
|
||||||
if(flag != (this.firstCrushTime > 0 || this.secondCrushTime > 0)){
|
if(flag != (this.firstCrushTime > 0 || this.secondCrushTime > 0)){
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
int meta = PosUtil.getMetadata(this.pos, this.worldObj);
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
Block block = state.getBlock();
|
||||||
|
int meta = block.getMetaFromState(state);
|
||||||
if(meta == 1){
|
if(meta == 1){
|
||||||
if(!this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2) && (!this.isDouble || !this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2))){
|
if(!this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2) && (!this.isDouble || !this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2))){
|
||||||
PosUtil.setMetadata(this.pos, this.worldObj, 0, 2);
|
this.worldObj.setBlockState(this.pos, block.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
PosUtil.setMetadata(this.pos, this.worldObj, 1, 2);
|
this.worldObj.setBlockState(this.pos, block.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyProvider;
|
import cofh.api.energy.IEnergyProvider;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -55,9 +55,10 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
||||||
ArrayList<Integer> blocksAround = new ArrayList<Integer>();
|
ArrayList<Integer> blocksAround = new ArrayList<Integer>();
|
||||||
if(ENERGY_PRODUCE <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){
|
if(ENERGY_PRODUCE <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){
|
||||||
for(int i = 1; i <= 5; i++){
|
for(int i = 1; i <= 5; i++){
|
||||||
BlockPos coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionBySidesInOrder(i), this.pos, 0);
|
BlockPos coords = this.pos.offset(WorldUtil.getDirectionBySidesInOrder(i));
|
||||||
Block block = PosUtil.getBlock(coords, this.worldObj);
|
IBlockState state = this.worldObj.getBlockState(coords);
|
||||||
if(block != null && block.getMaterial(this.worldObj.getBlockState(coords)) == Material.LAVA && PosUtil.getMetadata(coords, this.worldObj) == 0){
|
Block block = state.getBlock();
|
||||||
|
if(block != null && block.getMaterial(this.worldObj.getBlockState(coords)) == Material.LAVA && block.getMetaFromState(state) == 0){
|
||||||
blocksAround.add(i);
|
blocksAround.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
||||||
|
|
||||||
if(Util.RANDOM.nextInt(10000) == 0){
|
if(Util.RANDOM.nextInt(10000) == 0){
|
||||||
int randomSide = blocksAround.get(Util.RANDOM.nextInt(blocksAround.size()));
|
int randomSide = blocksAround.get(Util.RANDOM.nextInt(blocksAround.size()));
|
||||||
WorldUtil.breakBlockAtSide(WorldUtil.getDirectionBySidesInOrder(randomSide), this.worldObj, this.pos);
|
this.worldObj.setBlockToAir(this.pos.offset(WorldUtil.getDirectionBySidesInOrder(randomSide)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
*/
|
*/
|
||||||
public void initVars(){
|
public void initVars(){
|
||||||
if(this.sideToPull != -1){
|
if(this.sideToPull != -1){
|
||||||
this.placeToPull = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionBySidesInOrder(this.sideToPull), this.worldObj, this.pos);
|
this.placeToPull = this.worldObj.getTileEntity(this.pos.offset(WorldUtil.getDirectionBySidesInOrder(this.sideToPull)));
|
||||||
|
|
||||||
if(this.placeToPull instanceof IInventory){
|
if(this.placeToPull instanceof IInventory){
|
||||||
if(this.slotToPullEnd <= 0){
|
if(this.slotToPullEnd <= 0){
|
||||||
|
@ -291,7 +291,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.sideToPut != -1){
|
if(this.sideToPut != -1){
|
||||||
this.placeToPut = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionBySidesInOrder(this.sideToPut), this.worldObj, this.pos);
|
this.placeToPut = this.worldObj.getTileEntity(this.pos.offset(WorldUtil.getDirectionBySidesInOrder(this.sideToPut)));
|
||||||
|
|
||||||
if(this.placeToPut instanceof IInventory){
|
if(this.placeToPut instanceof IInventory){
|
||||||
if(this.slotToPutEnd <= 0){
|
if(this.slotToPutEnd <= 0){
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
|
||||||
if(this.worldObj != null){ //Why is that even possible..?
|
if(this.worldObj != null){ //Why is that even possible..?
|
||||||
for(int i = 0; i <= 5; i++){
|
for(int i = 0; i <= 5; i++){
|
||||||
EnumFacing side = WorldUtil.getDirectionBySidesInOrder(i);
|
EnumFacing side = WorldUtil.getDirectionBySidesInOrder(i);
|
||||||
BlockPos pos = WorldUtil.getCoordsFromSide(side, this.getPos(), 0);
|
BlockPos pos = this.getPos().offset(side);
|
||||||
TileEntity tile = this.worldObj.getTileEntity(pos);
|
TileEntity tile = this.worldObj.getTileEntity(pos);
|
||||||
|
|
||||||
if(tile instanceof TileEntityLaserRelayItem){
|
if(tile instanceof TileEntityLaserRelayItem){
|
||||||
|
|
|
@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench.WrenchMode;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler.ConnectionPair;
|
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler.ConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -108,7 +107,7 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{
|
||||||
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getNetworkFor(this.pos, this.worldObj);
|
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getNetworkFor(this.pos, this.worldObj);
|
||||||
if(network != null){
|
if(network != null){
|
||||||
for(ConnectionPair aPair : network.connections){
|
for(ConnectionPair aPair : network.connections){
|
||||||
if(aPair.contains(this.pos) && PosUtil.areSamePos(this.pos, aPair.positions[0])){
|
if(aPair.contains(this.pos) && this.pos.equals(aPair.positions[0])){
|
||||||
AssetUtil.renderParticlesFromAToB(aPair.positions[0].getX(), aPair.positions[0].getY(), aPair.positions[0].getZ(), aPair.positions[1].getX(), aPair.positions[1].getY(), aPair.positions[1].getZ(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, this.isItem ? COLOR_ITEM : COLOR, 1F);
|
AssetUtil.renderParticlesFromAToB(aPair.positions[0].getX(), aPair.positions[0].getY(), aPair.positions[0].getZ(), aPair.positions[1].getX(), aPair.positions[1].getY(), aPair.positions[1].getZ(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, this.isItem ? COLOR_ITEM : COLOR, 1F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay implements
|
||||||
this.receiversAround.clear();
|
this.receiversAround.clear();
|
||||||
|
|
||||||
for(EnumFacing side : EnumFacing.values()){
|
for(EnumFacing side : EnumFacing.values()){
|
||||||
BlockPos pos = WorldUtil.getCoordsFromSide(side, this.getPos(), 0);
|
BlockPos pos = this.getPos().offset(side);
|
||||||
TileEntity tile = this.worldObj.getTileEntity(pos);
|
TileEntity tile = this.worldObj.getTileEntity(pos);
|
||||||
if(tile instanceof IEnergyReceiver && !(tile instanceof TileEntityLaserRelay)){
|
if(tile instanceof IEnergyReceiver && !(tile instanceof TileEntityLaserRelay)){
|
||||||
this.receiversAround.put(side, (IEnergyReceiver)tile);
|
this.receiversAround.put(side, (IEnergyReceiver)tile);
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay{
|
||||||
|
|
||||||
for(int i = 0; i <= 5; i++){
|
for(int i = 0; i <= 5; i++){
|
||||||
EnumFacing side = WorldUtil.getDirectionBySidesInOrder(i);
|
EnumFacing side = WorldUtil.getDirectionBySidesInOrder(i);
|
||||||
BlockPos pos = WorldUtil.getCoordsFromSide(side, this.getPos(), 0);
|
BlockPos pos = this.getPos().offset(side);
|
||||||
TileEntity tile = this.worldObj.getTileEntity(pos);
|
TileEntity tile = this.worldObj.getTileEntity(pos);
|
||||||
if(tile != null && !(tile instanceof TileEntityItemViewer)){
|
if(tile != null && !(tile instanceof TileEntityItemViewer)){
|
||||||
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite());
|
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite());
|
||||||
|
|
|
@ -14,8 +14,9 @@ import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -63,7 +64,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
||||||
this.currentWorkTime++;
|
this.currentWorkTime++;
|
||||||
if(this.currentWorkTime >= 200){
|
if(this.currentWorkTime >= 200){
|
||||||
this.currentWorkTime = 0;
|
this.currentWorkTime = 0;
|
||||||
PosUtil.setBlock(PosUtil.offset(this.pos, 0, 1, 0), this.worldObj, Blocks.LAVA, 0, 2);
|
this.worldObj.setBlockState(this.pos.up(), Blocks.LAVA.getDefaultState(), 2);
|
||||||
this.storage.extractEnergy(ENERGY_USE, false);
|
this.storage.extractEnergy(ENERGY_USE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,18 +81,20 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
||||||
public int isMultiblock(){
|
public int isMultiblock(){
|
||||||
BlockPos thisPos = this.pos;
|
BlockPos thisPos = this.pos;
|
||||||
BlockPos[] positions = new BlockPos[]{
|
BlockPos[] positions = new BlockPos[]{
|
||||||
PosUtil.offset(thisPos, 1, 1, 0),
|
thisPos.add(1, 1, 0),
|
||||||
PosUtil.offset(thisPos, -1, 1, 0),
|
thisPos.add(-1, 1, 0),
|
||||||
PosUtil.offset(thisPos, 0, 1, 1),
|
thisPos.add(0, 1, 1),
|
||||||
PosUtil.offset(thisPos, 0, 1, -1)
|
thisPos.add(0, 1, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(WorldUtil.hasBlocksInPlacesGiven(positions, InitBlocks.blockMisc, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal(), this.worldObj)){
|
if(WorldUtil.hasBlocksInPlacesGiven(positions, InitBlocks.blockMisc, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal(), this.worldObj)){
|
||||||
BlockPos pos = PosUtil.offset(thisPos, 0, 1, 0);
|
BlockPos pos = thisPos.up();
|
||||||
if(PosUtil.getBlock(pos, this.worldObj) == Blocks.LAVA || PosUtil.getBlock(pos, this.worldObj) == Blocks.FLOWING_LAVA){
|
IBlockState state = this.worldObj.getBlockState(pos);
|
||||||
|
Block block = state.getBlock();
|
||||||
|
if(block == Blocks.LAVA || block == Blocks.FLOWING_LAVA){
|
||||||
return HAS_LAVA;
|
return HAS_LAVA;
|
||||||
}
|
}
|
||||||
if(PosUtil.getBlock(pos, this.worldObj) == null || this.worldObj.isAirBlock(pos)){
|
if(block == null || this.worldObj.isAirBlock(pos)){
|
||||||
return HAS_AIR;
|
return HAS_AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyProvider;
|
import cofh.api.energy.IEnergyProvider;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -65,8 +64,8 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
|
||||||
for(int reachX = -RANGE; reachX < RANGE+1; reachX++){
|
for(int reachX = -RANGE; reachX < RANGE+1; reachX++){
|
||||||
for(int reachZ = -RANGE; reachZ < RANGE+1; reachZ++){
|
for(int reachZ = -RANGE; reachZ < RANGE+1; reachZ++){
|
||||||
for(int reachY = -RANGE; reachY < RANGE+1; reachY++){
|
for(int reachY = -RANGE; reachY < RANGE+1; reachY++){
|
||||||
BlockPos pos = PosUtil.offset(this.pos, reachX, reachY, reachZ);
|
BlockPos pos = this.pos.add(reachX, reachY, reachZ);
|
||||||
Block block = PosUtil.getBlock(pos, this.worldObj);
|
Block block = this.worldObj.getBlockState(pos).getBlock();
|
||||||
if(block != null && block.isLeaves(this.worldObj.getBlockState(pos), this.worldObj, pos)){
|
if(block != null && block.isLeaves(this.worldObj.getBlockState(pos), this.worldObj, pos)){
|
||||||
breakPositions.add(pos);
|
breakPositions.add(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
|
import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -105,7 +104,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
||||||
|
|
||||||
IBlockState state = this.worldObj.getBlockState(pos);
|
IBlockState state = this.worldObj.getBlockState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
int meta = PosUtil.getMetadata(pos, this.worldObj);
|
int meta = block.getMetaFromState(state);
|
||||||
if(!block.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)){
|
if(!block.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)){
|
||||||
if(block.getHarvestLevel(this.worldObj.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getBlockHardness(this.worldObj, pos) >= 0F && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && this.isMinable(block, meta)){
|
if(block.getHarvestLevel(this.worldObj.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getBlockHardness(this.worldObj, pos) >= 0F && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && this.isMinable(block, meta)){
|
||||||
List<ItemStack> drops = block.getDrops(this.worldObj, pos, this.worldObj.getBlockState(pos), 0);
|
List<ItemStack> drops = block.getDrops(this.worldObj, pos, this.worldObj.getBlockState(pos), 0);
|
||||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -126,7 +125,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
private void doWork(){
|
private void doWork(){
|
||||||
if(this.isBreaker){
|
if(this.isBreaker){
|
||||||
Block blockToBreak = PosUtil.getBlock(this.boundPosition, this.worldObj);
|
Block blockToBreak = this.worldObj.getBlockState(this.boundPosition).getBlock();
|
||||||
if(blockToBreak != null && blockToBreak.getBlockHardness(this.worldObj.getBlockState(this.boundPosition), this.worldObj, this.boundPosition) > -1.0F){
|
if(blockToBreak != null && blockToBreak.getBlockHardness(this.worldObj.getBlockState(this.boundPosition), this.worldObj, this.boundPosition) > -1.0F){
|
||||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
drops.addAll(blockToBreak.getDrops(this.worldObj, this.boundPosition, this.worldObj.getBlockState(this.boundPosition), 0));
|
drops.addAll(blockToBreak.getDrops(this.worldObj, this.boundPosition, this.worldObj.getBlockState(this.boundPosition), 0));
|
||||||
|
@ -171,7 +170,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBoundThingInRange(){
|
public boolean isBoundThingInRange(){
|
||||||
return this.hasBoundPosition() && PosUtil.toVec(this.boundPosition).distanceTo(new Vec3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ())) <= this.range;
|
return this.hasBoundPosition() && this.boundPosition.distanceSq(this.pos) <= this.range*this.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -181,7 +180,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBoundPosition(BlockPos pos){
|
public void setBoundPosition(BlockPos pos){
|
||||||
this.boundPosition = pos == null ? null : PosUtil.copyPos(pos);
|
this.boundPosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom;
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -45,7 +44,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
public static int upgradeRange(int defaultRange, World world, BlockPos pos){
|
public static int upgradeRange(int defaultRange, World world, BlockPos pos){
|
||||||
int newRange = defaultRange;
|
int newRange = defaultRange;
|
||||||
for(int i = 0; i < 3; i++){
|
for(int i = 0; i < 3; i++){
|
||||||
Block block = PosUtil.getBlock(PosUtil.offset(pos, 0, 1+i, 0), world);
|
Block block = world.getBlockState(pos.up(1+i)).getBlock();
|
||||||
if(block == InitBlocks.blockPhantomBooster){
|
if(block == InitBlocks.blockPhantomBooster){
|
||||||
newRange = newRange*2;
|
newRange = newRange*2;
|
||||||
}
|
}
|
||||||
|
@ -106,15 +105,15 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean doesNeedUpdateSend(){
|
protected boolean doesNeedUpdateSend(){
|
||||||
return this.boundPosition != this.boundPosBefore || (this.boundPosition != null && PosUtil.getBlock(this.boundPosition, this.worldObj) != this.boundBlockBefore) || this.rangeBefore != this.range;
|
return this.boundPosition != this.boundPosBefore || (this.boundPosition != null && this.worldObj.getBlockState(this.boundPosition).getBlock() != this.boundBlockBefore) || this.rangeBefore != this.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onUpdateSent(){
|
protected void onUpdateSent(){
|
||||||
this.rangeBefore = this.range;
|
this.rangeBefore = this.range;
|
||||||
this.boundPosBefore = this.boundPosition;
|
this.boundPosBefore = this.boundPosition;
|
||||||
this.boundBlockBefore = this.boundPosition == null ? null : PosUtil.getBlock(this.boundPosition, this.worldObj);
|
this.boundBlockBefore = this.boundPosition == null ? null : this.worldObj.getBlockState(this.boundPosition).getBlock();
|
||||||
|
|
||||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, PosUtil.getBlock(this.pos, this.worldObj));
|
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.worldObj.getBlockState(this.boundPosition).getBlock());
|
||||||
|
|
||||||
this.sendUpdate();
|
this.sendUpdate();
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
@ -158,7 +157,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBoundThingInRange(){
|
public boolean isBoundThingInRange(){
|
||||||
return this.hasBoundPosition() && PosUtil.toVec(this.boundPosition).distanceTo(PosUtil.toVec(this.getPos())) <= this.range;
|
return this.hasBoundPosition() && this.boundPosition.distanceSq(this.getPos()) <= this.range*this.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,7 +167,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBoundPosition(BlockPos pos){
|
public void setBoundPosition(BlockPos pos){
|
||||||
this.boundPosition = pos == null ? null : PosUtil.copyPos(pos);
|
this.boundPosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
|
import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
@ -58,15 +59,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(boolean pinkAndFluffy){
|
public void setStatus(boolean pinkAndFluffy){
|
||||||
int meta = PosUtil.getMetadata(this.pos, this.worldObj);
|
IBlockState state = this.worldObj.getBlockState(this.pos);
|
||||||
|
Block block = state.getBlock();
|
||||||
|
int meta = block.getMetaFromState(state);
|
||||||
if(pinkAndFluffy){
|
if(pinkAndFluffy){
|
||||||
if(meta <= 3){
|
if(meta <= 3){
|
||||||
PosUtil.setMetadata(this.pos, this.worldObj, meta+4, 2);
|
this.worldObj.setBlockState(this.pos, block.getStateFromMeta(meta+4), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(meta >= 4){
|
if(meta >= 4){
|
||||||
PosUtil.setMetadata(this.pos, this.worldObj, meta-4, 2);
|
this.worldObj.setBlockState(this.pos, block.getStateFromMeta(meta-4), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,20 +35,25 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public final class AssetUtil{
|
public final class AssetUtil{
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory");
|
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory");
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static ResourceLocation getGuiLocation(String file){
|
public static ResourceLocation getGuiLocation(String file){
|
||||||
return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/"+file+".png");
|
return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/"+file+".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static ResourceLocation getBookletGuiLocation(String file){
|
public static ResourceLocation getBookletGuiLocation(String file){
|
||||||
return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/booklet/"+file+".png");
|
return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/booklet/"+file+".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String text){
|
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String text){
|
||||||
font.drawString(text, xSize/2-font.getStringWidth(text)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
|
font.drawString(text, xSize/2-font.getStringWidth(text)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, TileEntity tile){
|
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, TileEntity tile){
|
||||||
displayNameString(font, xSize, yPositionOfMachineText, tile.getDisplayName().getFormattedText());
|
displayNameString(font, xSize, yPositionOfMachineText, tile.getDisplayName().getFormattedText());
|
||||||
}
|
}
|
||||||
|
@ -94,6 +99,7 @@ public final class AssetUtil{
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copied from Gui.class and changed
|
//Copied from Gui.class and changed
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static void drawHorizontalGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, float zLevel){
|
public static void drawHorizontalGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, float zLevel){
|
||||||
float f = (float)(startColor >> 24 & 255)/255.0F;
|
float f = (float)(startColor >> 24 & 255)/255.0F;
|
||||||
float f1 = (float)(startColor >> 16 & 255)/255.0F;
|
float f1 = (float)(startColor >> 16 & 255)/255.0F;
|
||||||
|
@ -122,6 +128,7 @@ public final class AssetUtil{
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static void renderNameTag(String tag, double x, double y, double z){
|
public static void renderNameTag(String tag, double x, double y, double z){
|
||||||
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj;
|
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj;
|
||||||
float f = 1.6F;
|
float f = 1.6F;
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PosUtil.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2016 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public final class PosUtil{
|
|
||||||
|
|
||||||
public static Material getMaterial(BlockPos pos, IBlockAccess world){
|
|
||||||
return getBlock(pos, world).getMaterial(world.getBlockState(pos));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block getBlock(BlockPos pos, IBlockAccess world){
|
|
||||||
if(pos != null){
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
if(state != null){
|
|
||||||
return state.getBlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMetadata(BlockPos pos, IBlockAccess world){
|
|
||||||
Block block = getBlock(pos, world);
|
|
||||||
return block != null ? block.getMetaFromState(world.getBlockState(pos)) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMetadata(IBlockState state){
|
|
||||||
Block block = state.getBlock();
|
|
||||||
return block != null ? block.getMetaFromState(state) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockPos offset(BlockPos pos, int x, int y, int z){
|
|
||||||
return new BlockPos(pos.getX()+x, pos.getY()+y, pos.getZ()+z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean setBlock(BlockPos pos, World world, Block block, int meta, int flag){
|
|
||||||
return world.setBlockState(pos, block.getStateFromMeta(meta), flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vec3d toVec(BlockPos pos){
|
|
||||||
return new Vec3d(pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockPos copyPos(BlockPos pos){
|
|
||||||
return new BlockPos(pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBlock getItemBlock(BlockPos pos, IBlockAccess world){
|
|
||||||
Item item = Item.getItemFromBlock(getBlock(pos, world));
|
|
||||||
if(item instanceof ItemBlock){
|
|
||||||
return (ItemBlock)item;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMetadata(BlockPos pos, World world, int meta, int flag){
|
|
||||||
world.setBlockState(pos, getBlock(pos, world).getStateFromMeta(meta), flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean areSamePos(BlockPos first, BlockPos second){
|
|
||||||
return first.getX() == second.getX() && first.getY() == second.getY() && first.getZ() == second.getZ();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,6 +13,8 @@ package de.ellpeck.actuallyadditions.mod.util;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -37,6 +39,7 @@ public final class StringUtil{
|
||||||
return I18n.translateToLocalFormatted(text, replace);
|
return I18n.translateToLocalFormatted(text, replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
||||||
List list = renderer.listFormattedStringToWidth(strg, width);
|
List list = renderer.listFormattedStringToWidth(strg, width);
|
||||||
for(int i = 0; i < list.size(); i++){
|
for(int i = 0; i < list.size(); i++){
|
||||||
|
@ -45,6 +48,7 @@ public final class StringUtil{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static String getFluidInfo(FluidTank tank){
|
public static String getFluidInfo(FluidTank tank){
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == null ? "0/"+tank.getCapacity()+" mB" : tank.getFluidAmount()+"/"+tank.getCapacity()+" mB "+tank.getFluid().getLocalizedName();
|
return tank.getFluid() == null || tank.getFluid().getFluid() == null ? "0/"+tank.getCapacity()+" mB" : tank.getFluidAmount()+"/"+tank.getCapacity()+" mB "+tank.getFluid().getLocalizedName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,4 @@ public final class Util{
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int arrayContains(int[] array, int num){
|
|
||||||
for(int i = 0; i < array.length; i++){
|
|
||||||
if(num == array[i]){
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -55,21 +55,9 @@ import java.util.List;
|
||||||
|
|
||||||
public final class WorldUtil{
|
public final class WorldUtil{
|
||||||
|
|
||||||
public static void breakBlockAtSide(EnumFacing side, World world, BlockPos pos){
|
|
||||||
breakBlockAtSide(side, world, pos, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void breakBlockAtSide(EnumFacing side, World world, BlockPos pos, int offset){
|
|
||||||
world.setBlockToAir(getCoordsFromSide(side, pos, offset));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockPos getCoordsFromSide(EnumFacing side, BlockPos pos, int offset){
|
|
||||||
return new BlockPos(pos.getX()+side.getFrontOffsetX()*(offset+1), pos.getY()+side.getFrontOffsetY()*(offset+1), pos.getZ()+side.getFrontOffsetZ()*(offset+1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void doEnergyInteraction(TileEntity tile){
|
public static void doEnergyInteraction(TileEntity tile){
|
||||||
for(EnumFacing side : EnumFacing.values()){
|
for(EnumFacing side : EnumFacing.values()){
|
||||||
TileEntity otherTile = getTileEntityFromSide(side, tile.getWorld(), tile.getPos());
|
TileEntity otherTile = tile.getWorld().getTileEntity(tile.getPos().offset(side));
|
||||||
if(otherTile != null){
|
if(otherTile != null){
|
||||||
IEnergyReceiver handlerTo = null;
|
IEnergyReceiver handlerTo = null;
|
||||||
IEnergyProvider handlerFrom = null;
|
IEnergyProvider handlerFrom = null;
|
||||||
|
@ -103,7 +91,7 @@ public final class WorldUtil{
|
||||||
|
|
||||||
public static void doFluidInteraction(TileEntity tile){
|
public static void doFluidInteraction(TileEntity tile){
|
||||||
for(EnumFacing side : EnumFacing.values()){
|
for(EnumFacing side : EnumFacing.values()){
|
||||||
TileEntity otherTile = getTileEntityFromSide(side, tile.getWorld(), tile.getPos());
|
TileEntity otherTile = tile.getWorld().getTileEntity(tile.getPos().offset(side));
|
||||||
if(otherTile != null){
|
if(otherTile != null){
|
||||||
for(int i = 0; i < 2; i++){
|
for(int i = 0; i < 2; i++){
|
||||||
//Push and pull with old fluid system
|
//Push and pull with old fluid system
|
||||||
|
@ -137,11 +125,6 @@ public final class WorldUtil{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileEntity getTileEntityFromSide(EnumFacing side, World world, BlockPos pos){
|
|
||||||
BlockPos c = getCoordsFromSide(side, pos, 0);
|
|
||||||
return world.getTileEntity(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given Block with a given Meta is present in given Positions
|
* Checks if a given Block with a given Meta is present in given Positions
|
||||||
*
|
*
|
||||||
|
@ -153,7 +136,8 @@ public final class WorldUtil{
|
||||||
*/
|
*/
|
||||||
public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, int meta, World world){
|
public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, int meta, World world){
|
||||||
for(BlockPos pos : positions){
|
for(BlockPos pos : positions){
|
||||||
if(!(PosUtil.getBlock(pos, world) == block && PosUtil.getMetadata(pos, world) == meta)){
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
if(!(state.getBlock() == block && block.getMetaFromState(state) == meta)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +147,8 @@ public final class WorldUtil{
|
||||||
public static ItemStack useItemAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack){
|
public static ItemStack useItemAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack){
|
||||||
if(world instanceof WorldServer && stack != null && stack.getItem() != null){
|
if(world instanceof WorldServer && stack != null && stack.getItem() != null){
|
||||||
BlockPos offsetPos = pos.offset(side);
|
BlockPos offsetPos = pos.offset(side);
|
||||||
Block block = PosUtil.getBlock(offsetPos, world);
|
IBlockState state = world.getBlockState(offsetPos);
|
||||||
|
Block block = state.getBlock();
|
||||||
boolean replaceable = block.isReplaceable(world, offsetPos);
|
boolean replaceable = block.isReplaceable(world, offsetPos);
|
||||||
|
|
||||||
//Fluids
|
//Fluids
|
||||||
|
@ -177,7 +162,7 @@ public final class WorldUtil{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fluid != null && fluid.amount >= Util.BUCKET && fluid.getFluid().getBlock() != null && fluid.getFluid().getBlock().canPlaceBlockAt(world, offsetPos)){
|
if(fluid != null && fluid.amount >= Util.BUCKET && fluid.getFluid().getBlock() != null && fluid.getFluid().getBlock().canPlaceBlockAt(world, offsetPos)){
|
||||||
if(PosUtil.setBlock(offsetPos, world, fluid.getFluid().getBlock(), 0, 2)){
|
if(world.setBlockState(offsetPos, fluid.getFluid().getBlock().getDefaultState(), 2)){
|
||||||
return stack.getItem().getContainerItem(stack);
|
return stack.getItem().getContainerItem(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +170,7 @@ public final class WorldUtil{
|
||||||
|
|
||||||
//Redstone
|
//Redstone
|
||||||
if(replaceable && stack.getItem() == Items.REDSTONE){
|
if(replaceable && stack.getItem() == Items.REDSTONE){
|
||||||
PosUtil.setBlock(offsetPos, world, Blocks.REDSTONE_WIRE, 0, 2);
|
world.setBlockState(offsetPos, Blocks.REDSTONE_WIRE.getDefaultState(), 2);
|
||||||
stack.stackSize--;
|
stack.stackSize--;
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +201,7 @@ public final class WorldUtil{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dropItemAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack){
|
public static void dropItemAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack){
|
||||||
BlockPos coords = getCoordsFromSide(side, pos, 0);
|
BlockPos coords = pos.offset(side);
|
||||||
EntityItem item = new EntityItem(world, coords.getX()+0.5, coords.getY()+0.5, coords.getZ()+0.5, stack);
|
EntityItem item = new EntityItem(world, coords.getX()+0.5, coords.getY()+0.5, coords.getZ()+0.5, stack);
|
||||||
item.motionX = 0;
|
item.motionX = 0;
|
||||||
item.motionY = 0;
|
item.motionY = 0;
|
||||||
|
@ -247,10 +232,10 @@ public final class WorldUtil{
|
||||||
|
|
||||||
public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos){
|
public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos){
|
||||||
ArrayList<Material> blocks = new ArrayList<Material>();
|
ArrayList<Material> blocks = new ArrayList<Material>();
|
||||||
blocks.add(PosUtil.getMaterial(pos.offset(EnumFacing.NORTH), world));
|
blocks.add(world.getBlockState(pos.offset(EnumFacing.NORTH)).getMaterial());
|
||||||
blocks.add(PosUtil.getMaterial(pos.offset(EnumFacing.EAST), world));
|
blocks.add(world.getBlockState(pos.offset(EnumFacing.EAST)).getMaterial());
|
||||||
blocks.add(PosUtil.getMaterial(pos.offset(EnumFacing.SOUTH), world));
|
blocks.add(world.getBlockState(pos.offset(EnumFacing.SOUTH)).getMaterial());
|
||||||
blocks.add(PosUtil.getMaterial(pos.offset(EnumFacing.WEST), world));
|
blocks.add(world.getBlockState(pos.offset(EnumFacing.WEST)).getMaterial());
|
||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +247,7 @@ public final class WorldUtil{
|
||||||
return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork);
|
return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO This is disgusting and has to be updated to the capability system
|
||||||
/**
|
/**
|
||||||
* Add an ArrayList of ItemStacks to an Array of slots
|
* Add an ArrayList of ItemStacks to an Array of slots
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue