something something crusher screen is done i think...

This commit is contained in:
Flanks255 2021-11-21 11:36:46 -06:00
parent 01ee39973a
commit eccf77dd54
6 changed files with 38 additions and 39 deletions

View file

@ -48,7 +48,7 @@ public class ActuallyAdditionsClient {
ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), GuiGrinder::new);
ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new);
ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);

View file

@ -29,7 +29,7 @@ public class ActuallyContainers {
public static final RegistryObject<ContainerType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeContainerType.create(ContainerFireworkBox::fromNetwork));
public static final RegistryObject<ContainerType<ContainerFluidCollector>> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IForgeContainerType.create(ContainerFluidCollector::fromNetwork));
public static final RegistryObject<ContainerType<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeContainerType.create(ContainerFurnaceDouble::fromNetwork));
public static final RegistryObject<ContainerType<ContainerGrinder>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(ContainerGrinder::fromNetwork));
public static final RegistryObject<ContainerType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(CrusherContainer::fromNetwork));
public static final RegistryObject<ContainerType<ContainerLaserRelayItemWhitelist>> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IForgeContainerType.create(ContainerLaserRelayItemWhitelist::fromNetwork));
public static final RegistryObject<ContainerType<ContainerMiner>> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IForgeContainerType.create(ContainerMiner::fromNetwork));
public static final RegistryObject<ContainerType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeContainerType.create(ContainerOilGenerator::fromNetwork));

View file

@ -22,11 +22,11 @@ import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerGrinder extends Container {
public class CrusherContainer extends Container {
public final TileEntityCrusher tileGrinder;
public final boolean isDouble;
public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityCrusher tile) {
public CrusherContainer(int windowId, PlayerInventory inventory, TileEntityCrusher tile) {
super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId);
this.tileGrinder = tile;
this.isDouble = tile.isDouble;
@ -56,8 +56,8 @@ public class ContainerGrinder extends Container {
}
}
public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerGrinder(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
public static CrusherContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new CrusherContainer(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
}
@Override

View file

@ -12,7 +12,8 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.widget.button.Button;
@ -21,11 +22,12 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder");
private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double");
@ -35,7 +37,7 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
private Button buttonAutoSplit;
public GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) {
public CrusherScreen(CrusherContainer container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
this.tileGrinder = container.tileGrinder;
this.isDouble = container.isDouble;
@ -50,18 +52,17 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
? 13
: 42), this.topPos + 5, this.tileGrinder.storage);
// if (this.isDouble) {
// this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos - 10, this.topPos, "S");
// this.addButton(this.buttonAutoSplit);
// }
if (this.isDouble) {
this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new StringTextComponent("S"), (button) -> actionPerformed(0));
this.addButton(this.buttonAutoSplit);
}
}
// @Override
// protected void actionPerformed(Button button) throws IOException {
// if (this.isDouble && button.id == 0) {
// PacketHandlerHelper.sendButtonPacket(this.tileGrinder, button.id);
// }
// }
protected void actionPerformed(int id) {
if (this.isDouble && id == 0) {
PacketHandlerHelper.sendButtonPacket(this.tileGrinder, id);
}
}
@Override
public void tick() {
@ -75,16 +76,14 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
public void render(MatrixStack matrixStack, int x, int y, float f) {
super.render(matrixStack, x, y, f);
this.energy.render(matrixStack, x, y);
// if (this.isDouble && this.buttonAutoSplit.isMouseOver()) {
//
// this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileGrinder.isAutoSplit
// ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
// : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
// }
if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) {
drawString(matrixStack, font, new TranslationTextComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(TextFormatting.BOLD), x , y, 0xffffff);
}
}
@Override
@ -120,10 +119,10 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
this.energy.draw(matrices);
}
public static class GuiGrinderDouble extends GuiGrinder {
public static class CrusherDoubleScreen extends CrusherScreen {
public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) {
super(containerGrinder, inventory, tile);
public CrusherDoubleScreen(CrusherContainer crusherContainer, PlayerInventory inventory, ITextComponent tile) {
super(crusherContainer, inventory, tile);
}
}
}

View file

@ -14,16 +14,16 @@ import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.Rarity;
import net.minecraft.potion.Effect;
import net.minecraft.potion.Effects;
import net.minecraft.potion.Potion;
@Deprecated
public enum ThePotionRings {
SPEED(
Effects.SPEED.getName(),
Effects.MOVEMENT_SPEED.getDescriptionId(),
8171462,
MobEffects.SPEED,
Effects.MOVEMENT_SPEED,
0,
1,
10,
@ -146,18 +146,18 @@ public enum ThePotionRings {
public final String name;
public final int color;
public final Rarity rarity;
public final int effectID;
public final Effect effect;
public final int normalAmplifier;
public final int advancedAmplifier;
public final int activeTime;
public final boolean needsWaitBeforeActivating;
public final ItemStack craftingItem;
ThePotionRings(String name, int color, Potion effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) {
ThePotionRings(String name, int color, Effect effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) {
this.name = name;
this.color = color;
this.rarity = rarity;
this.effectID = Potion.byName(effect);
this.effect = effect;
this.normalAmplifier = normalAmplifier;
this.advancedAmplifier = advancedAmplifier;
this.activeTime = activeTime;

View file

@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -287,6 +287,6 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerGrinder(windowId, playerInventory, this);
return new CrusherContainer(windowId, playerInventory, this);
}
}