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.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new); ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::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.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new); ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::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<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<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<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<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<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)); 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; import java.util.Objects;
public class ContainerGrinder extends Container { public class CrusherContainer extends Container {
public final TileEntityCrusher tileGrinder; public final TileEntityCrusher tileGrinder;
public final boolean isDouble; 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); super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId);
this.tileGrinder = tile; this.tileGrinder = tile;
this.isDouble = tile.isDouble; this.isDouble = tile.isDouble;
@ -56,8 +56,8 @@ public class ContainerGrinder extends Container {
} }
} }
public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static CrusherContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerGrinder(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); return new CrusherContainer(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
} }
@Override @Override

View file

@ -12,7 +12,8 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; 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.tile.TileEntityCrusher;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.widget.button.Button; 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.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @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 = AssetUtil.getGuiLocation("gui_grinder");
private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double"); 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; private Button buttonAutoSplit;
public GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) { public CrusherScreen(CrusherContainer container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory); super(container, inventory);
this.tileGrinder = container.tileGrinder; this.tileGrinder = container.tileGrinder;
this.isDouble = container.isDouble; this.isDouble = container.isDouble;
@ -50,18 +52,17 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
? 13 ? 13
: 42), this.topPos + 5, this.tileGrinder.storage); : 42), this.topPos + 5, this.tileGrinder.storage);
// if (this.isDouble) { if (this.isDouble) {
// this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos - 10, this.topPos, "S"); this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new StringTextComponent("S"), (button) -> actionPerformed(0));
// this.addButton(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
// } }
} }
// @Override protected void actionPerformed(int id) {
// protected void actionPerformed(Button button) throws IOException { if (this.isDouble && id == 0) {
// if (this.isDouble && button.id == 0) { PacketHandlerHelper.sendButtonPacket(this.tileGrinder, id);
// PacketHandlerHelper.sendButtonPacket(this.tileGrinder, button.id); }
// } }
// }
@Override @Override
public void tick() { public void tick() {
@ -75,16 +76,14 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
} }
@Override @Override
public void render(MatrixStack matrices, int x, int y, float f) { public void render(MatrixStack matrixStack, int x, int y, float f) {
super.render(matrices, x, y, f); super.render(matrixStack, x, y, f);
this.energy.render(matrices, x, y); this.energy.render(matrixStack, x, y);
// if (this.isDouble && this.buttonAutoSplit.isMouseOver()) { if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) {
//
// this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileGrinder.isAutoSplit drawString(matrixStack, font, new TranslationTextComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(TextFormatting.BOLD), x , y, 0xffffff);
// ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on") }
// : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
// }
} }
@Override @Override
@ -120,10 +119,10 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
this.energy.draw(matrices); this.energy.draw(matrices);
} }
public static class GuiGrinderDouble extends GuiGrinder { public static class CrusherDoubleScreen extends CrusherScreen {
public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) { public CrusherDoubleScreen(CrusherContainer crusherContainer, PlayerInventory inventory, ITextComponent tile) {
super(containerGrinder, inventory, 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.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.Rarity; import net.minecraft.item.Rarity;
import net.minecraft.potion.Effect;
import net.minecraft.potion.Effects; import net.minecraft.potion.Effects;
import net.minecraft.potion.Potion;
@Deprecated @Deprecated
public enum ThePotionRings { public enum ThePotionRings {
SPEED( SPEED(
Effects.SPEED.getName(), Effects.MOVEMENT_SPEED.getDescriptionId(),
8171462, 8171462,
MobEffects.SPEED, Effects.MOVEMENT_SPEED,
0, 0,
1, 1,
10, 10,
@ -146,18 +146,18 @@ public enum ThePotionRings {
public final String name; public final String name;
public final int color; public final int color;
public final Rarity rarity; public final Rarity rarity;
public final int effectID; public final Effect effect;
public final int normalAmplifier; public final int normalAmplifier;
public final int advancedAmplifier; public final int advancedAmplifier;
public final int activeTime; public final int activeTime;
public final boolean needsWaitBeforeActivating; public final boolean needsWaitBeforeActivating;
public final ItemStack craftingItem; 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.name = name;
this.color = color; this.color = color;
this.rarity = rarity; this.rarity = rarity;
this.effectID = Potion.byName(effect); this.effect = effect;
this.normalAmplifier = normalAmplifier; this.normalAmplifier = normalAmplifier;
this.advancedAmplifier = advancedAmplifier; this.advancedAmplifier = advancedAmplifier;
this.activeTime = activeTime; 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.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; 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.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -287,6 +287,6 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
@Nullable @Nullable
@Override @Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerGrinder(windowId, playerInventory, this); return new CrusherContainer(windowId, playerInventory, this);
} }
} }