Skip to content

Commit

Permalink
Fixed command on server, fixed bonfire collision box and drops
Browse files Browse the repository at this point in the history
  • Loading branch information
Wehavecookies56 committed Dec 18, 2016
1 parent c4256cd commit 8ae7f1b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.resources.I18n;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
Expand Down Expand Up @@ -91,7 +90,7 @@ public String getUsage(ICommandSender sender) {
public static void listQueriedBonfires(List<Bonfire> query, ICommandSender sender) {
query.forEach((bonfires -> {
GameProfile owner = sender.getServer().getPlayerProfileCache().getProfileByUUID(bonfires.getOwner());
String name = I18n.format(LocalStrings.COMMAND_NA);
String name = new TextComponentTranslation(LocalStrings.COMMAND_NA).getUnformattedComponentText();
if(owner != null) {
name = owner.getName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class BlockAshBonePile extends Block implements ITileEntityProvider {

public static final PropertyDirection FACING = BlockHorizontal.FACING;
public static final PropertyBool LIT = PropertyBool.create("lit");
boolean dropFragment = false;

public BlockAshBonePile(Material blockMaterialIn) {
super(blockMaterialIn);
Expand Down Expand Up @@ -82,7 +83,10 @@ public EnumBlockRenderType getRenderType(IBlockState state) {
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> stacks = new ArrayList<>();
stacks.add(new ItemStack(getItemDropped(state, new Random(), fortune)));
stacks.add(new ItemStack(Bonfires.coiledSwordFragment));
if (dropFragment) {
stacks.add(new ItemStack(Bonfires.coiledSwordFragment));
dropFragment = false;
}
return stacks;
}

Expand Down Expand Up @@ -161,6 +165,9 @@ public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState st
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
TileEntityBonfire te = (TileEntityBonfire) worldIn.getTileEntity(pos);
if (te != null) {
if (te.isBonfire()) {
dropFragment = true;
}
if (te.isLit()) {
te.destroyBonfire(te.getID());
BonfireRegistry.INSTANCE.removeBonfire(te.getID());
Expand All @@ -178,11 +185,16 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
if (state.getValue(LIT)) {
return new AxisAlignedBB(0.2, 0, 0.2, 0.8, 1.0, 0.8);
} else {
return new AxisAlignedBB(0.2, 0, 0.2, 0.8, 0.2, 0.8);
if (source.getTileEntity(pos) != null) {
if (source.getTileEntity(pos) instanceof TileEntityBonfire) {
if (((TileEntityBonfire)source.getTileEntity(pos)).isBonfire()) {
return new AxisAlignedBB(0.2, 0, 0.2, 0.8, 1.0, 0.8);
} else {
return new AxisAlignedBB(0.2, 0, 0.2, 0.8, 0.2, 0.8);
}
}
}
return new AxisAlignedBB(0.2, 0, 0.2, 0.8, 0.2, 0.8);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/bonfires/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ command.radius.match=Found %1$s bonfire(s) within a radius of %2$s blocks
command.radius.nomatch=No bonfires found within a radius of %1$s blocks
command.radius.invalid=Error: '%1$s' is not a valid radius
command.filter.invalid=Not a valid filter. Use /bonfires filters for the list of filters
command.bonfires.usage=Usage: /bonfires <filter> <parameter>, /bonfires filters to display list of filters
command.bonfires.usage=Usage: /bonfires <filter> [parameter], /bonfires filters to display list of filters
command.all.desc=%1$s, displays every bonfire in the world
command.dim.desc=%1$s, displays every bonfire in the specified dimension
command.name.desc=%1$s, displays every bonfire with a name containing the specified name
Expand Down

0 comments on commit 8ae7f1b

Please sign in to comment.