mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 10:34:40 +00:00
Merge pull request #2396 from quat1024/master
Daffomills and anime torches face away from the player when placed
This commit is contained in:
commit
4ccf4e7275
3 files changed
+26
No files matched your search
@@ -15,6 +15,7 @@ import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -59,6 +60,11 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
((TileAnimatedTorch) world.getTileEntity(pos)).onPlace(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
|
||||
|
||||
@@ -10,12 +10,16 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
@@ -108,6 +112,13 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
return true;
|
||||
} else return super.onWanded(player, wand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
if(entity != null)
|
||||
orientation = entity.getHorizontalFacing();
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RadiusDescriptor getRadius() {
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -23,6 +24,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TileAnimatedTorch extends TileMod {
|
||||
|
||||
public static final String TAG_SIDE = "side";
|
||||
@@ -61,6 +64,12 @@ public class TileAnimatedTorch extends TileMod {
|
||||
if(!world.isRemote)
|
||||
world.addBlockEvent(getPos(), ModBlocks.animatedTorch, 0, (side + 1) % 4);
|
||||
}
|
||||
|
||||
public void onPlace(EntityLivingBase entity) {
|
||||
if(entity != null) {
|
||||
side = Arrays.asList(SIDES).indexOf(entity.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
}
|
||||
|
||||
public void toggle() {
|
||||
if(!world.isRemote) {
|
||||
|
||||
Reference in new issue
Block a user