mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
Remove a bunch of bouncer methods between special flower blocks and tile entities, they can be implemented by a custom block subclass if needed.
This has some gameplay implications due to mistakes in the old implementation: - Flowers no longer always claim they can emit redstone power. As a result, redstone dust will no longer point into flowers by default. This is consistent with vanilla. - Flowers no longer claim to always have a custom comparator signal
This commit is contained in:
1 parent
f9e0d7cd8b
commit
32bf8054ce
3 files changed
-150
No files matched your search
@@ -236,30 +236,6 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
|
||||
*/
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity entity, ItemStack stack) {}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks this sub tile.
|
||||
*/
|
||||
public ActionResultType onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this sub tile is added to the world.
|
||||
*/
|
||||
public void onBlockAdded(World world, BlockPos pos, BlockState state) {}
|
||||
|
||||
/**
|
||||
* Called when this sub tile is harvested
|
||||
*/
|
||||
public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) {}
|
||||
|
||||
/**
|
||||
* Allows additional processing of sub tile drops
|
||||
*/
|
||||
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block coordinates this is bound to, for use with the wireframe render
|
||||
* when the sub tile is being hovered with a wand of the forest.
|
||||
@@ -302,20 +278,6 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {}
|
||||
|
||||
/**
|
||||
* Gets the comparator input value for this SubTileEntity
|
||||
*/
|
||||
public int getComparatorInputOverride() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the redstone power level for this SubTileEntity
|
||||
*/
|
||||
public int getPowerLevel(Direction side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if this SubTileEntity is affected by Enchanted Soil's speed boost.
|
||||
*/
|
||||
|
||||
@@ -49,54 +49,10 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
this.teProvider = teProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).getComparatorInputOverride();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).getPowerLevel(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
|
||||
return getWeakPower(state, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void animateTick(BlockState state, World world, BlockPos pos, Random rand) {}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
super.onBlockHarvested(world, pos, state, player);
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockHarvested(world, pos, state, player);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
|
||||
List<ItemStack> drops = super.getDrops(state, builder);
|
||||
TileEntity te = builder.get(LootParameters.BLOCK_ENTITY);
|
||||
|
||||
if (te instanceof TileEntitySpecialFlower) {
|
||||
return ((TileEntitySpecialFlower) te).getDrops(drops, builder);
|
||||
} else {
|
||||
return drops;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(PlayerEntity player, ItemStack stack, World world, BlockPos pos, Direction side) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
@@ -107,21 +63,6 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
ActionResultType tileResult = ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit);
|
||||
if (tileResult.isSuccessOrConsume()) {
|
||||
return tileResult;
|
||||
} else {
|
||||
return super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos, state);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc, World world, BlockPos pos) {
|
||||
|
||||
@@ -61,31 +61,6 @@ public class BlockSpecialFlower extends FlowerBlock implements ITileEntityProvid
|
||||
return SHAPE.withOffset(shift.x, shift.y, shift.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).getComparatorInputOverride();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).getPowerLevel(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
|
||||
return getWeakPower(state, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return state.getBlock() == ModBlocks.redStringRelay
|
||||
@@ -93,24 +68,6 @@ public class BlockSpecialFlower extends FlowerBlock implements ITileEntityProvid
|
||||
|| super.isValidGround(state, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
super.onBlockHarvested(world, pos, state, player);
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockHarvested(world, pos, state, player);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
|
||||
List<ItemStack> drops = super.getDrops(state, builder);
|
||||
TileEntity te = builder.get(LootParameters.BLOCK_ENTITY);
|
||||
if (te instanceof TileEntitySpecialFlower) {
|
||||
return ((TileEntitySpecialFlower) te).getDrops(drops, builder);
|
||||
} else {
|
||||
return drops;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(BlockState state, World world, BlockPos pos, int event, int param) {
|
||||
super.eventReceived(state, world, pos, event, param);
|
||||
@@ -134,16 +91,6 @@ public class BlockSpecialFlower extends FlowerBlock implements ITileEntityProvid
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc, World world, BlockPos pos) {
|
||||
|
||||
Reference in new issue
Block a user