mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Drop it like its hot... ill show myself out thank you...
This commit is contained in:
parent
9bb1105c7c
commit
327fdc5c3b
5 changed files with 24 additions and 10 deletions
|
@ -22,21 +22,29 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockDropper extends FullyDirectionalBlock.Container {
|
||||
|
||||
public BlockDropper() {
|
||||
super(ActuallyBlocks.defaultPickProps(0));
|
||||
}
|
||||
|
||||
//@Override
|
||||
public TileEntity newBlockEntity(IBlockReader worldIn) {
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new TileEntityDropper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return ActionResultType.PASS;
|
||||
return ActionResultType.CONSUME;
|
||||
}
|
||||
|
||||
return this.openGui(world, player, pos, TileEntityDropper.class);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||
|
@ -91,7 +92,7 @@ public abstract class BlockContainerBase extends Block {
|
|||
|
||||
public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
||||
if (stack.getItem() == CommonConfig.Other.redstoneConfigureItem) {
|
||||
TileEntity tile = world.getBlockEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
TileEntityBase base = (TileEntityBase) tile;
|
||||
|
@ -155,6 +156,8 @@ public abstract class BlockContainerBase extends Block {
|
|||
if (base.respondsToPulses()) {
|
||||
// TODO: [port] eval what this does? :D
|
||||
// world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
// Who knows -Flanks
|
||||
base.activateOnPulse();
|
||||
}
|
||||
base.setRedstonePowered(true);
|
||||
} else if (!powered && wasPowered) {
|
||||
|
|
|
@ -191,16 +191,16 @@ public class ClientEvents {
|
|||
if (tileHit instanceof TileEntityBase) {
|
||||
TileEntityBase base = (TileEntityBase) tileHit;
|
||||
if (base.isRedstoneToggle()) {
|
||||
String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.name"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode
|
||||
String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode
|
||||
? "pulse"
|
||||
: "deactivation")) + TextFormatting.RESET);
|
||||
font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
String expl;
|
||||
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
||||
if (StackUtil.isValid(stack) && stack.getItem() == CommonConfig.Other.redstoneConfigureItem.asItem()) {
|
||||
expl = TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem");
|
||||
} else {
|
||||
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(CommonConfig.Other.redstoneConfigureItem.getDescriptionId() + ".name"));
|
||||
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId()));
|
||||
}
|
||||
font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,10 @@ public class GuiDropper extends AAScreen<ContainerDropper> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
|
||||
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.dropper);
|
||||
protected void init() {
|
||||
super.init();
|
||||
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
|
||||
titleLabelY = -10;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraft.util.text.StringTextComponent;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
public class TileEntityDropper extends TileEntityInventoryBase implements INamedContainerProvider {
|
||||
|
||||
|
@ -106,7 +107,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed
|
|||
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return StringTextComponent.EMPTY;
|
||||
return new TranslationTextComponent("container.actuallyadditions.dropper");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Reference in a new issue