chore: containers ported mostly, gui's ported for comparability

This commit is contained in:
Michael Hillcox 2021-03-01 17:11:34 +00:00
parent cb650b6689
commit fcb150ebaf
101 changed files with 1359 additions and 1170 deletions

View file

@ -20,7 +20,6 @@ import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen; import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining; import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
@ -113,7 +112,6 @@ public class ActuallyAdditions {
InitFluids.init(); InitFluids.init();
new UpdateChecker(); new UpdateChecker();
BannerHelper.init(); BannerHelper.init();
GuiHandler.init();
InitEntities.init(); // todo: [port] replace InitEntities.init(); // todo: [port] replace
AAWorldGen gen = new AAWorldGen(); AAWorldGen gen = new AAWorldGen();
ItemCoffee.initIngredients(); ItemCoffee.initIngredients();

View file

@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm; import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
import de.ellpeck.actuallyadditions.mod.event.ClientEvents; import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBag; import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
import de.ellpeck.actuallyadditions.mod.tile.ActuallyTiles; import de.ellpeck.actuallyadditions.mod.tile.ActuallyTiles;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -31,7 +31,31 @@ public class ActuallyAdditionsClient {
public static void setup() { public static void setup() {
ScreenManager.registerFactory(ActuallyContainers.BAG_CONTAINER.get(), GuiBag::new); ScreenManager.registerFactory(ActuallyContainers.BAG_CONTAINER.get(), GuiBag::new);
ScreenManager.registerFactory(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new);
ScreenManager.registerFactory(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new);
ScreenManager.registerFactory(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new);
ScreenManager.registerFactory(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new);
ScreenManager.registerFactory(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new);
ScreenManager.registerFactory(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new);
ScreenManager.registerFactory(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new);
ScreenManager.registerFactory(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new);
ScreenManager.registerFactory(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new);
ScreenManager.registerFactory(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new);
ScreenManager.registerFactory(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new);
ScreenManager.registerFactory(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new);
ScreenManager.registerFactory(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new);
ScreenManager.registerFactory(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new);
ScreenManager.registerFactory(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
ScreenManager.registerFactory(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
ScreenManager.registerFactory(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
ScreenManager.registerFactory(ActuallyContainers.GRINDER_CONTAINER.get(), GuiGrinder::new);
ScreenManager.registerFactory(ActuallyContainers.INPUTTER_CONTAINER.get(), GuiInputter::new);
ScreenManager.registerFactory(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
ScreenManager.registerFactory(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
ScreenManager.registerFactory(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);
ScreenManager.registerFactory(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new);
ScreenManager.registerFactory(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
ScreenManager.registerFactory(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
// From old proxy // From old proxy
InitEntities.initClient(); InitEntities.initClient();
MinecraftForge.EVENT_BUS.register(new ClientEvents()); MinecraftForge.EVENT_BUS.register(new ClientEvents());

View file

@ -37,7 +37,6 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;

View file

@ -23,7 +23,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import org.apache.commons.lang3.tuple.Triple; import org.apache.commons.lang3.tuple.Triple;
import java.util.Random; import java.util.Random;

View file

@ -28,7 +28,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random; import java.util.Random;

View file

@ -25,7 +25,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.List; import java.util.List;

View file

@ -50,7 +50,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {

View file

@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay { public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {

View file

@ -29,7 +29,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockMiner extends BlockContainerBase implements IHudDisplay { public class BlockMiner extends BlockContainerBase implements IHudDisplay {

View file

@ -30,7 +30,6 @@ import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random; import java.util.Random;

View file

@ -36,7 +36,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockPhantom extends BlockContainerBase implements IHudDisplay { public class BlockPhantom extends BlockContainerBase implements IHudDisplay {

View file

@ -28,7 +28,7 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay { public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {

View file

@ -29,7 +29,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockSlabs extends BlockBase { public class BlockSlabs extends BlockBase {

View file

@ -26,7 +26,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;

View file

@ -25,7 +25,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockWallAA extends BlockBase { public class BlockWallAA extends BlockBase {

View file

@ -20,10 +20,10 @@
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import net.minecraft.block.BlockHorizontal; //import net.minecraft.block.BlockHorizontal;
//import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
//import net.minecraft.client.renderer.GlStateManager; //
//import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; //import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
//import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.fml.relauncher.OnlyIn; //
// //
//import java.util.Locale; //import java.util.Locale;
// //

View file

@ -73,7 +73,7 @@ public class BookmarkButton extends Button {
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.blendFunc(770, 771); GlStateManager.blendFunc(770, 771);
int renderHeight = 25; int renderHeight = 25;
this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null
? 0 ? 0
: 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight); : 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight);
this.mouseDragged(minecraft, x, y); this.mouseDragged(minecraft, x, y);

View file

@ -124,7 +124,7 @@ public abstract class GuiBooklet extends GuiBookletBase {
int xStart = this.guiLeft + this.xSize / 2 - 16 * this.bookmarkButtons.length / 2; int xStart = this.guiLeft + this.xSize / 2 - 16 * this.bookmarkButtons.length / 2;
for (int i = 0; i < this.bookmarkButtons.length; i++) { for (int i = 0; i < this.bookmarkButtons.length; i++) {
this.bookmarkButtons[i] = new BookmarkButton(1337 + i, xStart + i * 16, this.guiTop + this.ySize, this); this.bookmarkButtons[i] = new BookmarkButton(1337 + i, xStart + i * 16, this.guiTop + this.ySize, this);
this.buttonList.add(this.bookmarkButtons[i]); this.addButton(this.bookmarkButtons[i]);
if (data.bookmarks[i] != null) { if (data.bookmarks[i] != null) {
this.bookmarkButtons[i].assignedPage = data.bookmarks[i]; this.bookmarkButtons[i].assignedPage = data.bookmarks[i];
@ -133,7 +133,7 @@ public abstract class GuiBooklet extends GuiBookletBase {
} }
this.buttonTrials = new TrialsButton(this); this.buttonTrials = new TrialsButton(this);
this.buttonList.add(this.buttonTrials); this.addButton(this.buttonTrials);
} }
@Override @Override
@ -171,12 +171,12 @@ public abstract class GuiBooklet extends GuiBookletBase {
public void drawScreenPre(int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(int mouseX, int mouseY, float partialTicks) {
GlStateManager.color(1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F);
this.mc.getTextureManager().bindTexture(RES_LOC_GUI); this.getMinecraft().getTextureManager().bindTexture(RES_LOC_GUI);
drawModalRectWithCustomSizedTexture(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512); drawModalRectWithCustomSizedTexture(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512);
if (this.hasSearchBar()) { if (this.hasSearchBar()) {
this.mc.getTextureManager().bindTexture(RES_LOC_GADGETS); this.getMinecraft().getTextureManager().bindTexture(RES_LOC_GADGETS);
this.drawTexturedModalRect(this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14); this.blit(matrices, this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14);
boolean unicodeBefore = this.fontRenderer.getUnicodeFlag(); boolean unicodeBefore = this.fontRenderer.getUnicodeFlag();
this.fontRenderer.setUnicodeFlag(true); this.fontRenderer.setUnicodeFlag(true);

View file

@ -17,11 +17,9 @@ import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -94,7 +92,7 @@ public class GuiEntry extends GuiBooklet {
int id = y + x * BUTTONS_PER_PAGE; int id = y + x * BUTTONS_PER_PAGE;
if (this.chapters.size() > id + idOffset) { if (this.chapters.size() > id + idOffset) {
IBookletChapter chapter = this.chapters.get(id + idOffset); IBookletChapter chapter = this.chapters.get(id + idOffset);
this.buttonList.add(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack())); this.addButton(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack()));
} else { } else {
return; return;
} }

View file

@ -136,20 +136,20 @@ public class GuiMainPage extends GuiBooklet {
configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name")); configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name"));
configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200));
this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText); this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText);
this.buttonList.add(this.configButton); this.addButton(this.configButton);
List<String> achievementText = new ArrayList<>(); List<String> achievementText = new ArrayList<>();
achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name")); achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name"));
achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200));
//this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText); //this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText);
//this.buttonList.add(this.achievementButton); //this.addButton(this.achievementButton);
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
if (!data.didBookTutorial) { if (!data.didBookTutorial) {
this.showTutorial = true; this.showTutorial = true;
this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3"); this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3");
this.buttonList.add(this.tutorialButton); this.addButton(this.tutorialButton);
this.configButton.visible = false; this.configButton.visible = false;
//this.achievementButton.visible = false; //this.achievementButton.visible = false;
@ -159,7 +159,7 @@ public class GuiMainPage extends GuiBooklet {
List<IBookletEntry> displayed = getDisplayedEntries(); List<IBookletEntry> displayed = getDisplayedEntries();
if (displayed.size() > i) { if (displayed.size() > i) {
IBookletEntry entry = displayed.get(i); IBookletEntry entry = displayed.get(i);
this.buttonList.add(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY)); this.addButton(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY));
} else { } else {
return; return;
} }

View file

@ -118,7 +118,7 @@ public class GuiPage extends GuiBooklet {
List<String> links = this.getWebLinks(); List<String> links = this.getWebLinks();
if (links != null && !links.isEmpty()) { if (links != null && !links.isEmpty()) {
this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, -782822, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name"))); this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, -782822, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")));
this.buttonList.add(this.buttonViewOnline); this.addButton(this.buttonViewOnline);
} }
for (int i = 0; i < this.pages.length; i++) { for (int i = 0; i < this.pages.length; i++) {

View file

@ -19,7 +19,7 @@ import net.minecraft.client.gui.achievement.GuiAchievements;
import net.minecraft.stats.StatisticsManager; import net.minecraft.stats.StatisticsManager;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import java.io.IOException; import java.io.IOException;

View file

@ -25,7 +25,7 @@
//import net.minecraftforge.fluids.FluidStack; //import net.minecraftforge.fluids.FluidStack;
//import net.minecraftforge.fluids.FluidUtil; //import net.minecraftforge.fluids.FluidUtil;
//import net.minecraftforge.fml.relauncher.Side; //import net.minecraftforge.fml.relauncher.Side;
//import net.minecraftforge.fml.relauncher.OnlyIn; //
// //
//public class CreativeTab extends CreativeTabs { //public class CreativeTab extends CreativeTabs {
// //

View file

@ -14,8 +14,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public final class InitEntities { public final class InitEntities {

View file

@ -13,14 +13,13 @@ package de.ellpeck.actuallyadditions.mod.entity;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class RenderWorm extends Render<EntityWorm> { public class RenderWorm extends Render<EntityWorm> {

View file

@ -17,8 +17,26 @@ public class ActuallyContainers {
public static final RegistryObject<ContainerType<ContainerCoalGenerator>> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IForgeContainerType.create(ContainerCoalGenerator::fromNetwork)); public static final RegistryObject<ContainerType<ContainerCoalGenerator>> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IForgeContainerType.create(ContainerCoalGenerator::fromNetwork));
public static final RegistryObject<ContainerType<ContainerCoffeeMachine>> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IForgeContainerType.create(ContainerCoffeeMachine::fromNetwork)); public static final RegistryObject<ContainerType<ContainerCoffeeMachine>> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IForgeContainerType.create(ContainerCoffeeMachine::fromNetwork));
public static final RegistryObject<ContainerType<ContainerDirectionalBreaker>> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IForgeContainerType.create(ContainerDirectionalBreaker::fromNetwork)); public static final RegistryObject<ContainerType<ContainerDirectionalBreaker>> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IForgeContainerType.create(ContainerDirectionalBreaker::fromNetwork));
public static final RegistryObject<ContainerType<ContainerDrill>> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IForgeContainerType.create(ContainerDrill::fromNetwork));
public static final RegistryObject<ContainerType<ContainerDropper>> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IForgeContainerType.create(ContainerDropper::fromNetwork)); public static final RegistryObject<ContainerType<ContainerDropper>> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IForgeContainerType.create(ContainerDropper::fromNetwork));
public static final RegistryObject<ContainerType<ContainerEnervator>> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IForgeContainerType.create(ContainerEnervator::fromNetwork)); public static final RegistryObject<ContainerType<ContainerEnervator>> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IForgeContainerType.create(ContainerEnervator::fromNetwork));
public static final RegistryObject<ContainerType<ContainerEnergizer>> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IForgeContainerType.create(ContainerEnergizer::fromNetwork)); public static final RegistryObject<ContainerType<ContainerEnergizer>> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IForgeContainerType.create(ContainerEnergizer::fromNetwork));
public static final RegistryObject<ContainerType<ContainerFarmer>> FARMER_CONTAINER = CONTAINERS.register("farmer_container", () -> IForgeContainerType.create(ContainerFarmer::fromNetwork));
public static final RegistryObject<ContainerType<ContainerFeeder>> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IForgeContainerType.create(ContainerFeeder::fromNetwork));
public static final RegistryObject<ContainerType<ContainerFermentingBarrel>> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IForgeContainerType.create(ContainerFermentingBarrel::fromNetwork));
public static final RegistryObject<ContainerType<ContainerFilter>> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IForgeContainerType.create(ContainerFilter::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<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<ContainerInputter>> INPUTTER_CONTAINER = CONTAINERS.register("inputter_container", () -> IForgeContainerType.create(ContainerInputter::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));
public static final RegistryObject<ContainerType<ContainerPhantomPlacer>> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IForgeContainerType.create(ContainerPhantomPlacer::fromNetwork));
public static final RegistryObject<ContainerType<ContainerRangedCollector>> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IForgeContainerType.create(ContainerRangedCollector::fromNetwork));
public static final RegistryObject<ContainerType<ContainerXPSolidifier>> XPSOLIDIFIER_CONTAINER = CONTAINERS.register("xpsolidifier_container", () -> IForgeContainerType.create(ContainerXPSolidifier::fromNetwork));
} }

View file

@ -23,7 +23,7 @@ import net.minecraft.network.PacketBuffer;
import java.util.Objects; import java.util.Objects;
public class ContainerBioReactor extends Container { public class ContainerBioReactor extends Container {
private final TileEntityBioReactor tile; public final TileEntityBioReactor tile;
public static ContainerBioReactor fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerBioReactor fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerBioReactor(windowId, inv, (TileEntityBioReactor) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerBioReactor(windowId, inv, (TileEntityBioReactor) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));

View file

@ -25,7 +25,7 @@ import java.util.Objects;
public class ContainerCanolaPress extends Container { public class ContainerCanolaPress extends Container {
private final TileEntityCanolaPress press; public final TileEntityCanolaPress press;
public static ContainerCanolaPress fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerCanolaPress fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerCanolaPress(windowId, inv, (TileEntityCanolaPress) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerCanolaPress(windowId, inv, (TileEntityCanolaPress) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));

View file

@ -25,7 +25,7 @@ import java.util.Objects;
public class ContainerCoalGenerator extends Container { public class ContainerCoalGenerator extends Container {
private final TileEntityCoalGenerator generator; public final TileEntityCoalGenerator generator;
public static ContainerCoalGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerCoalGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerCoalGenerator(windowId, inv, (TileEntityCoalGenerator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerCoalGenerator(windowId, inv, (TileEntityCoalGenerator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));

View file

@ -24,7 +24,7 @@ import java.util.Objects;
public class ContainerDirectionalBreaker extends Container { public class ContainerDirectionalBreaker extends Container {
private final TileEntityDirectionalBreaker breaker; public final TileEntityDirectionalBreaker breaker;
public static ContainerDirectionalBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerDirectionalBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerDirectionalBreaker(windowId, inv, (TileEntityDirectionalBreaker) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerDirectionalBreaker(windowId, inv, (TileEntityDirectionalBreaker) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));

View file

@ -18,10 +18,11 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.ClickType; import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
public class ContainerDrill extends Container { public class ContainerDrill extends Container {
@ -30,11 +31,16 @@ public class ContainerDrill extends Container {
private final ItemStackHandlerAA drillInventory = new ItemStackHandlerAA(SLOT_AMOUNT); private final ItemStackHandlerAA drillInventory = new ItemStackHandlerAA(SLOT_AMOUNT);
private final PlayerInventory inventory; private final PlayerInventory inventory;
public ContainerDrill(PlayerInventory inventory) { public static ContainerDrill fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerDrill(windowId, inv);
}
public ContainerDrill(int windowId, PlayerInventory inventory) {
super(ActuallyContainers.DRILL_CONTAINER.get(), windowId);
this.inventory = inventory; this.inventory = inventory;
for (int i = 0; i < SLOT_AMOUNT; i++) { for (int i = 0; i < SLOT_AMOUNT; i++) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.drillInventory, i, 44 + i * 18, 19) { this.addSlot(new SlotItemHandlerUnconditioned(this.drillInventory, i, 44 + i * 18, 19) {
@Override @Override
public boolean isItemValid(ItemStack stack) { public boolean isItemValid(ItemStack stack) {
return stack.getItem() instanceof ItemDrillUpgrade; return stack.getItem() instanceof ItemDrillUpgrade;
@ -44,14 +50,14 @@ public class ContainerDrill extends Container {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 58 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 58 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
if (i == inventory.currentItem) { if (i == inventory.currentItem) {
this.addSlotToContainer(new SlotImmovable(inventory, i, 8 + i * 18, 116)); this.addSlot(new SlotImmovable(inventory, i, 8 + i * 18, 116));
} else { } else {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 116)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 116));
} }
} }

View file

@ -25,7 +25,7 @@ import java.util.Objects;
public class ContainerDropper extends Container { public class ContainerDropper extends Container {
private final TileEntityDropper dropper; public final TileEntityDropper dropper;
PlayerEntity player; PlayerEntity player;
public static ContainerDropper fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerDropper fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {

View file

@ -30,7 +30,7 @@ import java.util.Objects;
public class ContainerEnergizer extends Container { public class ContainerEnergizer extends Container {
public static final EquipmentSlotType[] VALID_EQUIPMENT_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; public static final EquipmentSlotType[] VALID_EQUIPMENT_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET};
private final TileEntityEnergizer energizer; public final TileEntityEnergizer energizer;
public static ContainerEnergizer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerEnergizer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerEnergizer(windowId, inv, (TileEntityEnergizer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerEnergizer(windowId, inv, (TileEntityEnergizer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));

View file

@ -28,14 +28,14 @@ import java.util.Objects;
public class ContainerEnervator extends Container { public class ContainerEnervator extends Container {
private final TileEntityEnervator enervator; public final TileEntityEnervator enervator;
public static ContainerEnervator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerEnervator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerEnervator(windowId, inv, (TileEntityEnervator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerEnervator(windowId, inv, (TileEntityEnervator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
} }
public ContainerEnervator(int windowId, PlayerInventory inventory, TileEntityEnervator tile) { public ContainerEnervator(int windowId, PlayerInventory inventory, TileEntityEnervator tile) {
super(ActuallyContainers.ENERGIZER_CONTAINER.get(), windowId); super(ActuallyContainers.ENERVATOR_CONTAINER.get(), windowId);
this.enervator = tile; this.enervator = tile;
this.addSlot(new SlotItemHandlerUnconditioned(this.enervator.inv, 0, 76, 73)); this.addSlot(new SlotItemHandlerUnconditioned(this.enervator.inv, 0, 76, 73));

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -19,13 +18,21 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerFarmer extends Container { public class ContainerFarmer extends Container {
private final TileEntityFarmer farmer; public final TileEntityFarmer farmer;
public ContainerFarmer(PlayerInventory inventory, TileEntityBase tile) { public static ContainerFarmer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.farmer = (TileEntityFarmer) tile; return new ContainerFarmer(windowId, inv, (TileEntityFarmer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerFarmer(int windowId, PlayerInventory inventory, TileEntityFarmer tile) {
super(ActuallyContainers.FARMER_CONTAINER.get(), windowId);
this.farmer = tile;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {

View file

@ -11,30 +11,37 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerFeeder extends Container { public class ContainerFeeder extends Container {
private final TileEntityFeeder tileFeeder; public final TileEntityFeeder feeder;
public ContainerFeeder(PlayerInventory inventory, TileEntityBase tile) { public static ContainerFeeder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.tileFeeder = (TileEntityFeeder) tile; return new ContainerFeeder(windowId, inv, (TileEntityFeeder) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileFeeder.inv, 0, 80, 45)); }
public ContainerFeeder(int windowId, PlayerInventory inventory, TileEntityFeeder tile) {
super(ActuallyContainers.FEEDER_CONTAINER.get(), windowId);
this.feeder = tile;
this.addSlot(new SlotItemHandlerUnconditioned(this.feeder.inv, 0, 80, 45));
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 132)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 132));
} }
} }
@ -86,6 +93,6 @@ public class ContainerFeeder extends Container {
@Override @Override
public boolean canInteractWith(PlayerEntity player) { public boolean canInteractWith(PlayerEntity player) {
return this.tileFeeder.canPlayerUse(player); return this.feeder.canPlayerUse(player);
} }
} }

View file

@ -10,29 +10,36 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerFermentingBarrel extends Container { public class ContainerFermentingBarrel extends Container {
private final TileEntityFermentingBarrel barrel; public final TileEntityFermentingBarrel barrel;
public ContainerFermentingBarrel(PlayerInventory inventory, TileEntityBase tile) { public static ContainerFermentingBarrel fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.barrel = (TileEntityFermentingBarrel) tile; return new ContainerFermentingBarrel(windowId, inv, (TileEntityFermentingBarrel) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerFermentingBarrel(int windowId, PlayerInventory inventory, TileEntityFermentingBarrel tile) {
super(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), windowId);
this.barrel = tile;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -17,10 +17,11 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.ClickType; import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
public class ContainerFilter extends Container { public class ContainerFilter extends Container {
@ -29,25 +30,30 @@ public class ContainerFilter extends Container {
private final ItemStackHandlerAA filterInventory = new ItemStackHandlerAA(SLOT_AMOUNT); private final ItemStackHandlerAA filterInventory = new ItemStackHandlerAA(SLOT_AMOUNT);
private final PlayerInventory inventory; private final PlayerInventory inventory;
public ContainerFilter(PlayerInventory inventory) { public static ContainerFilter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerFilter(windowId, inv);
}
public ContainerFilter(int windowId, PlayerInventory inventory) {
super(ActuallyContainers.FILTER_CONTAINER.get(), windowId);
this.inventory = inventory; this.inventory = inventory;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
for (int j = 0; j < 6; j++) { for (int j = 0; j < 6; j++) {
this.addSlotToContainer(new SlotFilter(this.filterInventory, j + i * 6, 35 + j * 18, 10 + i * 18)); this.addSlot(new SlotFilter(this.filterInventory, j + i * 6, 35 + j * 18, 10 + i * 18));
} }
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 94 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 94 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
if (i == inventory.currentItem) { if (i == inventory.currentItem) {
this.addSlotToContainer(new SlotImmovable(inventory, i, 8 + i * 18, 152)); this.addSlot(new SlotImmovable(inventory, i, 8 + i * 18, 152));
} else { } else {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 152)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 152));
} }
} }

View file

@ -11,11 +11,21 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Container; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
public class ContainerFireworkBox extends Container { public class ContainerFireworkBox extends Container {
public static ContainerFireworkBox fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerFireworkBox(windowId, inv);
}
public ContainerFireworkBox(int windowId, PlayerInventory inventory) {
super(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), windowId);
}
@Override @Override
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
return ItemStack.EMPTY; return ItemStack.EMPTY;

View file

@ -10,29 +10,36 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerFluidCollector extends Container { public class ContainerFluidCollector extends Container {
private final TileEntityFluidCollector collector; public final TileEntityFluidCollector collector;
public ContainerFluidCollector(PlayerInventory inventory, TileEntityBase tile) { public static ContainerFluidCollector fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.collector = (TileEntityFluidCollector) tile; return new ContainerFluidCollector(windowId, inv, (TileEntityFluidCollector) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerFluidCollector(int windowId, PlayerInventory inventory, TileEntityFluidCollector tile) {
super(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), windowId);
this.collector = tile;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -12,35 +12,42 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerFurnaceDouble extends Container { public class ContainerFurnaceDouble extends Container {
private final TileEntityFurnaceDouble tileFurnace; public final TileEntityFurnaceDouble furnace;
public ContainerFurnaceDouble(PlayerInventory inventory, TileEntityBase tile) { public static ContainerFurnaceDouble fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.tileFurnace = (TileEntityFurnaceDouble) tile; return new ContainerFurnaceDouble(windowId, inv, (TileEntityFurnaceDouble) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileFurnace.inv, TileEntityFurnaceDouble.SLOT_INPUT_1, 51, 21)); public ContainerFurnaceDouble(int windowId, PlayerInventory inventory, TileEntityFurnaceDouble tile) {
this.addSlotToContainer(new SlotOutput(this.tileFurnace.inv, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69)); super(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), windowId);
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileFurnace.inv, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21)); this.furnace = tile;
this.addSlotToContainer(new SlotOutput(this.tileFurnace.inv, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
this.addSlot(new SlotItemHandlerUnconditioned(this.furnace.inv, TileEntityFurnaceDouble.SLOT_INPUT_1, 51, 21));
this.addSlot(new SlotOutput(this.furnace.inv, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69));
this.addSlot(new SlotItemHandlerUnconditioned(this.furnace.inv, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21));
this.addSlot(new SlotOutput(this.furnace.inv, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }
@ -105,6 +112,6 @@ public class ContainerFurnaceDouble extends Container {
@Override @Override
public boolean canInteractWith(PlayerEntity player) { public boolean canInteractWith(PlayerEntity player) {
return this.tileFurnace.canPlayerUse(player); return this.furnace.canPlayerUse(player);
} }
} }

View file

@ -1,98 +1,99 @@
/* // TODO: [port][note] no longer used
* This file ("ContainerGiantChest.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("ContainerGiantChest.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.inventory; //
//package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; //
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; //import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import invtweaks.api.container.ChestContainer; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; //import invtweaks.api.container.ChestContainer;
import net.minecraft.entity.player.PlayerInventory; //import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Container; //import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot; //import net.minecraft.inventory.container.Container;
import net.minecraft.item.ItemStack; //import net.minecraft.inventory.container.Slot;
//import net.minecraft.item.ItemStack;
@ChestContainer(rowSize = 13, isLargeChest = true) //
public class ContainerGiantChest extends Container { //@ChestContainer(rowSize = 13, isLargeChest = true)
//public class ContainerGiantChest extends Container {
public final TileEntityGiantChest tileChest; //
// public final TileEntityGiantChest tileChest;
public ContainerGiantChest(PlayerInventory inventory, TileEntityBase tile, int page) { //
this.tileChest = (TileEntityGiantChest) tile; // public ContainerGiantChest(PlayerInventory inventory, TileEntityBase tile, int page) {
// this.tileChest = (TileEntityGiantChest) tile;
for (int i = 0; i < 9; i++) { //
for (int j = 0; j < 13; j++) { // for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileChest.inv, 9 * 13 * page + j + i * 13, 5 + j * 18, 5 + i * 18)); // for (int j = 0; j < 13; j++) {
} // this.addSlot(new SlotItemHandlerUnconditioned(this.tileChest.inv, 9 * 13 * page + j + i * 13, 5 + j * 18, 5 + i * 18));
} // }
// }
for (int i = 0; i < 3; i++) { //
for (int j = 0; j < 9; j++) { // for (int i = 0; i < 3; i++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 33 + 8 + j * 18, 172 + 4 + i * 18)); // for (int j = 0; j < 9; j++) {
} // this.addSlot(new Slot(inventory, j + i * 9 + 9, 33 + 8 + j * 18, 172 + 4 + i * 18));
} // }
for (int i = 0; i < 9; i++) { // }
this.addSlotToContainer(new Slot(inventory, i, 33 + 8 + i * 18, 172 + 62)); // for (int i = 0; i < 9; i++) {
} // this.addSlot(new Slot(inventory, i, 33 + 8 + i * 18, 172 + 62));
} // }
// }
@Override //
public ItemStack transferStackInSlot(PlayerEntity player, int slot) { // @Override
int inventoryStart = 117; // public ItemStack transferStackInSlot(PlayerEntity player, int slot) {
int inventoryEnd = inventoryStart + 26; // int inventoryStart = 117;
int hotbarStart = inventoryEnd + 1; // int inventoryEnd = inventoryStart + 26;
int hotbarEnd = hotbarStart + 8; // int hotbarStart = inventoryEnd + 1;
// int hotbarEnd = hotbarStart + 8;
Slot theSlot = this.inventorySlots.get(slot); //
// Slot theSlot = this.inventorySlots.get(slot);
if (theSlot != null && theSlot.getHasStack()) { //
ItemStack newStack = theSlot.getStack(); // if (theSlot != null && theSlot.getHasStack()) {
ItemStack currentStack = newStack.copy(); // ItemStack newStack = theSlot.getStack();
// ItemStack currentStack = newStack.copy();
//Other Slots in Inventory excluded //
if (slot >= inventoryStart) { // //Other Slots in Inventory excluded
//Shift from Inventory // if (slot >= inventoryStart) {
if (!this.mergeItemStack(newStack, 0, 117, false)) { // //Shift from Inventory
// // if (!this.mergeItemStack(newStack, 0, 117, false)) {
if (slot >= inventoryStart && slot <= inventoryEnd) { // //
if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) {
return StackUtil.getEmpty(); // if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) {
} // return StackUtil.getEmpty();
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { // }
return StackUtil.getEmpty(); // } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) {
} // return StackUtil.getEmpty();
} // }
} else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { // }
return StackUtil.getEmpty(); // } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) {
} // return StackUtil.getEmpty();
// }
if (!StackUtil.isValid(newStack)) { //
theSlot.putStack(StackUtil.getEmpty()); // if (!StackUtil.isValid(newStack)) {
} else { // theSlot.putStack(StackUtil.getEmpty());
theSlot.onSlotChanged(); // } else {
} // theSlot.onSlotChanged();
// }
if (newStack.getCount() == currentStack.getCount()) { //
return StackUtil.getEmpty(); // if (newStack.getCount() == currentStack.getCount()) {
} // return StackUtil.getEmpty();
theSlot.onTake(player, newStack); // }
// theSlot.onTake(player, newStack);
return currentStack; //
} // return currentStack;
return StackUtil.getEmpty(); // }
} // return StackUtil.getEmpty();
// }
@Override //
public boolean canInteractWith(PlayerEntity player) { // @Override
return this.tileChest.canPlayerUse(player); // public boolean canInteractWith(PlayerEntity player) {
} // return this.tileChest.canPlayerUse(player);
} // }
//}

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -21,38 +20,45 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerGrinder extends Container { public class ContainerGrinder extends Container {
public final TileEntityGrinder tileGrinder; public final TileEntityGrinder tileGrinder;
private final boolean isDouble; public final boolean isDouble;
public ContainerGrinder(PlayerInventory inventory, TileEntityBase tile, boolean isDouble) { public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.tileGrinder = (TileEntityGrinder) tile; return new ContainerGrinder(windowId, inv, data.readBoolean(), (TileEntityGrinder) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerGrinder(int windowId, PlayerInventory inventory, boolean isDouble, TileEntityGrinder tile) {
super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId);
this.tileGrinder = tile;
this.isDouble = isDouble; this.isDouble = isDouble;
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble
? 51 ? 51
: 80, 21)); : 80, 21));
this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble
? 37 ? 37
: 66, 69)); : 66, 69));
this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble
? 64 ? 64
: 92, 69)); : 92, 69));
if (this.isDouble) { if (this.isDouble) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_2, 109, 21)); this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_2, 109, 21));
this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_1, 96, 69)); this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_1, 96, 69));
this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69)); this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69));
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -13,27 +13,32 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter; import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.ClickType; import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerInputter extends Container { public class ContainerInputter extends Container {
public final TileEntityInputter tileInputter;
public final boolean isAdvanced;
private final TileEntityInputter tileInputter; public static ContainerInputter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerInputter(windowId, inv, data.readBoolean(), (TileEntityInputter) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
private final boolean isAdvanced; public ContainerInputter(int windowId, PlayerInventory inventory, boolean isAdvanced, TileEntityInputter tile) {
super(ActuallyContainers.INPUTTER_CONTAINER.get(), windowId);
public ContainerInputter(PlayerInventory inventory, TileEntityBase tile, boolean isAdvanced) { this.tileInputter = tile;
this.tileInputter = (TileEntityInputter) tile;
this.isAdvanced = isAdvanced; this.isAdvanced = isAdvanced;
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileInputter.inv, 0, 80, 21 + (isAdvanced this.addSlot(new SlotItemHandlerUnconditioned(this.tileInputter.inv, 0, 80, 21 + (isAdvanced
? 12 ? 12
: 0))); : 0)));
@ -41,7 +46,7 @@ public class ContainerInputter extends Container {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
for (int x = 0; x < 3; x++) { for (int x = 0; x < 3; x++) {
for (int y = 0; y < 4; y++) { for (int y = 0; y < 4; y++) {
this.addSlotToContainer(new SlotFilter(i == 0 this.addSlot(new SlotFilter(i == 0
? this.tileInputter.leftFilter ? this.tileInputter.leftFilter
: this.tileInputter.rightFilter, y + x * 4, 20 + i * 84 + x * 18, 6 + y * 18)); : this.tileInputter.rightFilter, y + x * 4, 20 + i * 84 + x * 18, 6 + y * 18));
} }
@ -51,13 +56,13 @@ public class ContainerInputter extends Container {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 101 + i * 18 + (isAdvanced this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 101 + i * 18 + (isAdvanced
? GuiInputter.OFFSET_ADVANCED ? GuiInputter.OFFSET_ADVANCED
: 0))); : 0)));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 159 + (isAdvanced this.addSlot(new Slot(inventory, i, 8 + i * 18, 159 + (isAdvanced
? GuiInputter.OFFSET_ADVANCED ? GuiInputter.OFFSET_ADVANCED
: 0))); : 0)));
} }

View file

@ -11,27 +11,34 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.ClickType; import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerLaserRelayItemWhitelist extends Container { public class ContainerLaserRelayItemWhitelist extends Container {
private final TileEntityLaserRelayItemWhitelist tile; public final TileEntityLaserRelayItemWhitelist tile;
public ContainerLaserRelayItemWhitelist(PlayerInventory inventory, TileEntityBase tile) { public static ContainerLaserRelayItemWhitelist fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.tile = (TileEntityLaserRelayItemWhitelist) tile; return new ContainerLaserRelayItemWhitelist(windowId, inv, (TileEntityLaserRelayItemWhitelist) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerLaserRelayItemWhitelist(int windowId, PlayerInventory inventory, TileEntityLaserRelayItemWhitelist tile) {
super(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), windowId);
this.tile = tile;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
for (int x = 0; x < 3; x++) { for (int x = 0; x < 3; x++) {
for (int y = 0; y < 4; y++) { for (int y = 0; y < 4; y++) {
this.addSlotToContainer(new SlotFilter(i == 0 this.addSlot(new SlotFilter(i == 0
? this.tile.leftFilter ? this.tile.leftFilter
: this.tile.rightFilter, y + x * 4, 20 + i * 84 + x * 18, 6 + y * 18)); : this.tile.rightFilter, y + x * 4, 20 + i * 84 + x * 18, 6 + y * 18));
} }
@ -40,11 +47,11 @@ public class ContainerLaserRelayItemWhitelist extends Container {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -11,35 +11,42 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerMiner extends Container { public class ContainerMiner extends Container {
private final TileEntityMiner miner; public final TileEntityMiner miner;
public ContainerMiner(PlayerInventory inventory, TileEntityBase tile) { public static ContainerMiner fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.miner = (TileEntityMiner) tile; return new ContainerMiner(windowId, inv, (TileEntityMiner) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerMiner(int windowId, PlayerInventory inventory, TileEntityMiner tile) {
super(ActuallyContainers.MINER_CONTAINER.get(), windowId);
this.miner = tile;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.miner.inv, j + i * 3, 62 + j * 18, 21 + i * 18)); this.addSlot(new SlotItemHandlerUnconditioned(this.miner.inv, j + i * 3, 62 + j * 18, 21 + i * 18));
} }
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -10,29 +10,36 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerOilGenerator extends Container { public class ContainerOilGenerator extends Container {
private final TileEntityOilGenerator generator; public final TileEntityOilGenerator generator;
public ContainerOilGenerator(PlayerInventory inventory, TileEntityBase tile) { public static ContainerOilGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.generator = (TileEntityOilGenerator) tile; return new ContainerOilGenerator(windowId, inv, (TileEntityOilGenerator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerOilGenerator(int windowId, PlayerInventory inventory, TileEntityOilGenerator tile) {
super(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), windowId);
this.generator = tile;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -11,35 +11,42 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerPhantomPlacer extends Container { public class ContainerPhantomPlacer extends Container {
private final TileEntityPhantomPlacer placer; public final TileEntityPhantomPlacer placer;
public ContainerPhantomPlacer(PlayerInventory inventory, TileEntityBase tile) { public static ContainerPhantomPlacer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.placer = (TileEntityPhantomPlacer) tile; return new ContainerPhantomPlacer(windowId, inv, (TileEntityPhantomPlacer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerPhantomPlacer(int windowId, PlayerInventory inventory, TileEntityPhantomPlacer tile) {
super(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), windowId);
this.placer = tile;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.placer.inv, j + i * 3, 62 + j * 18, 21 + i * 18)); this.addSlot(new SlotItemHandlerUnconditioned(this.placer.inv, j + i * 3, 62 + j * 18, 21 + i * 18));
} }
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -12,41 +12,48 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.ClickType; import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerRangedCollector extends Container { public class ContainerRangedCollector extends Container {
private final TileEntityRangedCollector collector; public final TileEntityRangedCollector collector;
public ContainerRangedCollector(PlayerInventory inventory, TileEntityBase tile) { public static ContainerRangedCollector fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.collector = (TileEntityRangedCollector) tile; return new ContainerRangedCollector(windowId, inv, (TileEntityRangedCollector) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
public ContainerRangedCollector(int windowId, PlayerInventory inventory, TileEntityRangedCollector tile) {
super(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), windowId);
this.collector = tile;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.collector.inv, j + i * 3, 96 + j * 18, 24 + i * 18)); this.addSlot(new SlotItemHandlerUnconditioned(this.collector.inv, j + i * 3, 96 + j * 18, 24 + i * 18));
} }
} }
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
this.addSlotToContainer(new SlotFilter(this.collector.filter, j + i * 3, 20 + j * 18, 6 + i * 18)); this.addSlot(new SlotFilter(this.collector.filter, j + i * 3, 20 + j * 18, 6 + i * 18));
} }
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 90 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 90 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 148)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 148));
} }
} }

View file

@ -1,97 +1,98 @@
/* // TODO: [port][note] no longer needed
* This file ("ContainerRepairer.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("ContainerRepairer.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.inventory; //
//package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; //
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; //import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; //import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.minecraft.entity.player.PlayerEntity; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerInventory; //import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Container; //import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot; //import net.minecraft.inventory.container.Container;
import net.minecraft.item.ItemStack; //import net.minecraft.inventory.container.Slot;
//import net.minecraft.item.ItemStack;
public class ContainerRepairer extends Container { //
//public class ContainerRepairer extends Container {
private final TileEntityItemRepairer tileRepairer; //
// private final TileEntityItemRepairer tileRepairer;
public ContainerRepairer(PlayerInventory inventory, TileEntityBase tile) { //
this.tileRepairer = (TileEntityItemRepairer) tile; // public ContainerRepairer(PlayerInventory inventory, TileEntityBase tile) {
// this.tileRepairer = (TileEntityItemRepairer) tile;
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileRepairer.inv, TileEntityItemRepairer.SLOT_INPUT, 47, 53)); //
this.addSlotToContainer(new SlotOutput(this.tileRepairer.inv, TileEntityItemRepairer.SLOT_OUTPUT, 109, 53)); // this.addSlot(new SlotItemHandlerUnconditioned(this.tileRepairer.inv, TileEntityItemRepairer.SLOT_INPUT, 47, 53));
// this.addSlot(new SlotOutput(this.tileRepairer.inv, TileEntityItemRepairer.SLOT_OUTPUT, 109, 53));
for (int i = 0; i < 3; i++) { //
for (int j = 0; j < 9; j++) { // for (int i = 0; i < 3; i++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); // for (int j = 0; j < 9; j++) {
} // this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} // }
for (int i = 0; i < 9; i++) { // }
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); // for (int i = 0; i < 9; i++) {
} // this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} // }
// }
@Override //
public ItemStack transferStackInSlot(PlayerEntity player, int slot) { // @Override
int inventoryStart = 2; // public ItemStack transferStackInSlot(PlayerEntity player, int slot) {
int inventoryEnd = inventoryStart + 26; // int inventoryStart = 2;
int hotbarStart = inventoryEnd + 1; // int inventoryEnd = inventoryStart + 26;
int hotbarEnd = hotbarStart + 8; // int hotbarStart = inventoryEnd + 1;
// int hotbarEnd = hotbarStart + 8;
Slot theSlot = this.inventorySlots.get(slot); //
// Slot theSlot = this.inventorySlots.get(slot);
if (theSlot != null && theSlot.getHasStack()) { //
ItemStack newStack = theSlot.getStack(); // if (theSlot != null && theSlot.getHasStack()) {
ItemStack currentStack = newStack.copy(); // ItemStack newStack = theSlot.getStack();
// ItemStack currentStack = newStack.copy();
//Other Slots in Inventory excluded //
if (slot >= inventoryStart) { // //Other Slots in Inventory excluded
//Shift from Inventory // if (slot >= inventoryStart) {
if (TileEntityItemRepairer.canBeRepaired(newStack)) { // //Shift from Inventory
if (!this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT + 1, false)) { // if (TileEntityItemRepairer.canBeRepaired(newStack)) {
return StackUtil.getEmpty(); // if (!this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT + 1, false)) {
} // return StackUtil.getEmpty();
} // }
// // }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { //
if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { // else if (slot >= inventoryStart && slot <= inventoryEnd) {
return StackUtil.getEmpty(); // if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) {
} // return StackUtil.getEmpty();
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { // }
return StackUtil.getEmpty(); // } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) {
} // return StackUtil.getEmpty();
} else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { // }
return StackUtil.getEmpty(); // } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) {
} // return StackUtil.getEmpty();
// }
if (!StackUtil.isValid(newStack)) { //
theSlot.putStack(StackUtil.getEmpty()); // if (!StackUtil.isValid(newStack)) {
} else { // theSlot.putStack(StackUtil.getEmpty());
theSlot.onSlotChanged(); // } else {
} // theSlot.onSlotChanged();
// }
if (newStack.getCount() == currentStack.getCount()) { //
return StackUtil.getEmpty(); // if (newStack.getCount() == currentStack.getCount()) {
} // return StackUtil.getEmpty();
theSlot.onTake(player, newStack); // }
// theSlot.onTake(player, newStack);
return currentStack; //
} // return currentStack;
return StackUtil.getEmpty(); // }
} // return StackUtil.getEmpty();
// }
@Override //
public boolean canInteractWith(PlayerEntity player) { // @Override
return this.tileRepairer.canPlayerUse(player); // public boolean canInteractWith(PlayerEntity player) {
} // return this.tileRepairer.canPlayerUse(player);
} // }
//}

View file

@ -1,28 +1,29 @@
/* // TODO: [port][note] no longer needed
* This file ("ContainerSmileyCloud.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("ContainerSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.inventory; //
//package de.ellpeck.actuallyadditions.mod.inventory;
import net.minecraft.entity.player.PlayerEntity; //
import net.minecraft.inventory.Container; //import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; //import net.minecraft.inventory.container.Container;
//import net.minecraft.item.ItemStack;
public class ContainerSmileyCloud extends Container { //
//public class ContainerSmileyCloud extends Container {
@Override //
public ItemStack transferStackInSlot(PlayerEntity player, int slot) { // @Override
return ItemStack.EMPTY; // public ItemStack transferStackInSlot(PlayerEntity player, int slot) {
} // return ItemStack.EMPTY;
// }
@Override //
public boolean canInteractWith(PlayerEntity player) { // @Override
return true; // public boolean canInteractWith(PlayerEntity player) {
} // return true;
} // }
//}

View file

@ -13,32 +13,39 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
public class ContainerXPSolidifier extends Container { public class ContainerXPSolidifier extends Container {
private final TileEntityXPSolidifier solidifier; public final TileEntityXPSolidifier solidifier;
public ContainerXPSolidifier(PlayerInventory inventory, TileEntityBase tile) { public static ContainerXPSolidifier fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
this.solidifier = (TileEntityXPSolidifier) tile; return new ContainerXPSolidifier(windowId, inv, (TileEntityXPSolidifier) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
}
this.addSlotToContainer(new SlotOutput(this.solidifier.inv, 0, 95, 8)); public ContainerXPSolidifier(int windowId, PlayerInventory inventory, TileEntityXPSolidifier tile) {
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.solidifier.inv, 1, 65, 8)); super(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), windowId);
this.solidifier = tile;
this.addSlot(new SlotOutput(this.solidifier.inv, 0, 95, 8));
this.addSlot(new SlotItemHandlerUnconditioned(this.solidifier.inv, 1, 65, 8));
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
} }
} }

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
@ -22,99 +21,92 @@ import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
public class GuiHandler implements IGuiHandler { public class GuiHandler {
public static void init() { @Deprecated
ActuallyAdditions.LOGGER.info("Initializing GuiHandler...");
NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.INSTANCE, new GuiHandler());
}
@Override
public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) {
TileEntityBase tile = null; TileEntityBase tile = null;
if (GuiTypes.values()[id].checkTileEntity) { if (GuiTypes.values()[id].checkTileEntity) {
tile = (TileEntityBase) world.getTileEntity(new BlockPos(x, y, z)); tile = (TileEntityBase) world.getTileEntity(new BlockPos(x, y, z));
} }
switch (GuiTypes.values()[id]) { switch (GuiTypes.values()[id]) {
case FEEDER: // case FEEDER:
return new ContainerFeeder(player.inventory, tile); // return new ContainerFeeder(player.inventory, tile);
case GIANT_CHEST: // case GIANT_CHEST:
return new ContainerGiantChest(player.inventory, tile, 0); // return new ContainerGiantChest(player.inventory, tile, 0);
case GIANT_CHEST_PAGE_2: // case GIANT_CHEST_PAGE_2:
return new ContainerGiantChest(player.inventory, tile, 1); // return new ContainerGiantChest(player.inventory, tile, 1);
case GIANT_CHEST_PAGE_3: // case GIANT_CHEST_PAGE_3:
return new ContainerGiantChest(player.inventory, tile, 2); // return new ContainerGiantChest(player.inventory, tile, 2);
case CRAFTER: // case CRAFTER:
return CompatUtil.getCrafterContainerElement(player, world, x, y, z); // return CompatUtil.getCrafterContainerElement(player, world, x, y, z);
case GRINDER: // case GRINDER:
return new ContainerGrinder(player.inventory, tile, false); // return new ContainerGrinder(player.inventory, tile, false);
case GRINDER_DOUBLE: // case GRINDER_DOUBLE:
return new ContainerGrinder(player.inventory, tile, true); // return new ContainerGrinder(player.inventory, tile, true);
case FURNACE_DOUBLE: // case FURNACE_DOUBLE:
return new ContainerFurnaceDouble(player.inventory, tile); // return new ContainerFurnaceDouble(player.inventory, tile);
case INPUTTER: // case INPUTTER:
return new ContainerInputter(player.inventory, tile, false); // return new ContainerInputter(player.inventory, tile, false);
case INPUTTER_ADVANCED: // case INPUTTER_ADVANCED:
return new ContainerInputter(player.inventory, tile, true); // return new ContainerInputter(player.inventory, tile, true);
case REPAIRER: // case REPAIRER:
return new ContainerRepairer(player.inventory, tile); // return new ContainerRepairer(player.inventory, tile);
case BREAKER: // case BREAKER:
return new ContainerBreaker(player.inventory, tile); // return new ContainerBreaker(player.inventory, tile);
case DROPPER: // case DROPPER:
return new ContainerDropper(player, tile); // return new ContainerDropper(player, tile);
case CANOLA_PRESS: // case CANOLA_PRESS:
return new ContainerCanolaPress(player.inventory, tile); // return new ContainerCanolaPress(player.inventory, tile);
case FERMENTING_BARREL: // case FERMENTING_BARREL:
return new ContainerFermentingBarrel(player.inventory, tile); // return new ContainerFermentingBarrel(player.inventory, tile);
case COAL_GENERATOR: // case COAL_GENERATOR:
return new ContainerCoalGenerator(player.inventory, tile); // return new ContainerCoalGenerator(player.inventory, tile);
case OIL_GENERATOR: // case OIL_GENERATOR:
return new ContainerOilGenerator(player.inventory, tile); // return new ContainerOilGenerator(player.inventory, tile);
case PHANTOM_PLACER: // case PHANTOM_PLACER:
return new ContainerPhantomPlacer(player.inventory, tile); // return new ContainerPhantomPlacer(player.inventory, tile);
case FLUID_COLLECTOR: // case FLUID_COLLECTOR:
return new ContainerFluidCollector(player.inventory, tile); // return new ContainerFluidCollector(player.inventory, tile);
case COFFEE_MACHINE: // case COFFEE_MACHINE:
return new ContainerCoffeeMachine(player.inventory, tile); // return new ContainerCoffeeMachine(player.inventory, tile);
case DRILL: // case DRILL:
return new ContainerDrill(player.inventory); // return new ContainerDrill(player.inventory);
case FILTER: // case FILTER:
return new ContainerFilter(player.inventory); // return new ContainerFilter(player.inventory);
case ENERGIZER: // case ENERGIZER:
return new ContainerEnergizer(player, tile); // return new ContainerEnergizer(player, tile);
case ENERVATOR: // case ENERVATOR:
return new ContainerEnervator(player, tile); // return new ContainerEnervator(player, tile);
case XP_SOLIDIFIER: // case XP_SOLIDIFIER:
return new ContainerXPSolidifier(player.inventory, tile); // return new ContainerXPSolidifier(player.inventory, tile);
case CLOUD: // case CLOUD:
return new ContainerSmileyCloud(); // return new ContainerSmileyCloud();
case DIRECTIONAL_BREAKER: // case DIRECTIONAL_BREAKER:
return new ContainerDirectionalBreaker(player.inventory, tile); // return new ContainerDirectionalBreaker(player.inventory, tile);
case RANGED_COLLECTOR: // case RANGED_COLLECTOR:
return new ContainerRangedCollector(player.inventory, tile); // return new ContainerRangedCollector(player.inventory, tile);
case MINER: // case MINER:
return new ContainerMiner(player.inventory, tile); // return new ContainerMiner(player.inventory, tile);
case LASER_RELAY_ITEM_WHITELIST: // case LASER_RELAY_ITEM_WHITELIST:
return new ContainerLaserRelayItemWhitelist(player.inventory, tile); // return new ContainerLaserRelayItemWhitelist(player.inventory, tile);
case BAG: // case BAG:
return new ContainerBag(player.getHeldItemMainhand(), player.inventory, false); // return new ContainerBag(player.getHeldItemMainhand(), player.inventory, false);
case VOID_BAG: // case VOID_BAG:
return new ContainerBag(player.getHeldItemMainhand(), player.inventory, true); // return new ContainerBag(player.getHeldItemMainhand(), player.inventory, true);
case BIO_REACTOR: // case BIO_REACTOR:
return new ContainerBioReactor(player.inventory, tile); // return new ContainerBioReactor(player.inventory, tile);
case FARMER: // case FARMER:
return new ContainerFarmer(player.inventory, tile); // return new ContainerFarmer(player.inventory, tile);
case FIREWORK_BOX: // case FIREWORK_BOX:
return new ContainerFireworkBox(); // return new ContainerFireworkBox();
default: default:
return null; return null;
} }
} }
@Override @Deprecated
public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) {
TileEntityBase tile = null; TileEntityBase tile = null;
if (GuiTypes.values()[id].checkTileEntity) { if (GuiTypes.values()[id].checkTileEntity) {
@ -143,8 +135,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiInputter(player.inventory, tile, true); return new GuiInputter(player.inventory, tile, true);
case REPAIRER: case REPAIRER:
return new GuiRepairer(player.inventory, tile); return new GuiRepairer(player.inventory, tile);
case BREAKER: // case BREAKER:
return new GuiBreaker(player.inventory, tile); // return new GuiBreaker(player.inventory, tile);
case DROPPER: case DROPPER:
return new GuiDropper(player, tile); return new GuiDropper(player, tile);
case CANOLA_PRESS: case CANOLA_PRESS:
@ -209,6 +201,7 @@ public class GuiHandler implements IGuiHandler {
} }
} }
@Deprecated
public enum GuiTypes { public enum GuiTypes {
FEEDER, FEEDER,
GIANT_CHEST, GIANT_CHEST,

View file

@ -15,10 +15,8 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -57,19 +55,19 @@ public class EnergyDisplay extends Gui {
int barY = this.y; int barY = this.y;
if (this.outline) { if (this.outline) {
this.drawTexturedModalRect(this.x, this.y, 52, 163, 26, 93); this.blit(matrices, this.x, this.y, 52, 163, 26, 93);
barX += 4; barX += 4;
barY += 4; barY += 4;
} }
this.drawTexturedModalRect(barX, barY, 18, 171, 18, 85); this.blit(matrices, barX, barY, 18, 171, 18, 85);
if (this.rfReference.getEnergyStored() > 0) { if (this.rfReference.getEnergyStored() > 0) {
int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored(); int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored();
float[] color = AssetUtil.getWheelColor(mc.world.getTotalWorldTime() % 256); float[] color = AssetUtil.getWheelColor(mc.world.getTotalWorldTime() % 256);
GlStateManager.color(color[0] / 255F, color[1] / 255F, color[2] / 255F); GlStateManager.color(color[0] / 255F, color[1] / 255F, color[2] / 255F);
this.drawTexturedModalRect(barX + 1, barY + 84 - i, 36, 172, 16, i); this.blit(matrices, barX + 1, barY + 84 - i, 36, 172, 16, i);
GlStateManager.color(1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F);
} }

View file

@ -16,10 +16,8 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

View file

@ -14,13 +14,11 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Collections; import java.util.Collections;
@ -63,12 +61,12 @@ public class FluidDisplay extends Gui {
int barY = this.y; int barY = this.y;
if (this.outline) { if (this.outline) {
this.drawTexturedModalRect(this.x, this.y, 52, 163, 26, 93); this.blit(matrices, this.x, this.y, 52, 163, 26, 93);
barX += 4; barX += 4;
barY += 4; barY += 4;
} }
this.drawTexturedModalRect(barX, barY, 0, 171, 18, 85); this.blit(matrices, barX, barY, 0, 171, 18, 85);
FluidStack stack = this.fluidReference.getFluid(); FluidStack stack = this.fluidReference.getFluid();
Fluid fluid = stack == null Fluid fluid = stack == null

View file

@ -56,7 +56,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
this.buttonAutoInsert = new GuiButton(0, this.guiLeft - 21, this.guiTop + 8, 20, 20, (this.container.autoInsert this.buttonAutoInsert = new GuiButton(0, this.guiLeft - 21, this.guiTop + 8, 20, 20, (this.container.autoInsert
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "I"); : TextFormatting.RED) + "I");
this.buttonList.add(this.buttonAutoInsert); this.addButton(this.buttonAutoInsert);
} }
@Override @Override

View file

@ -11,30 +11,29 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
public class GuiBioReactor extends GuiWtfMojang { public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bio_reactor"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bio_reactor");
private final TileEntityBioReactor tile; private final TileEntityBioReactor tile;
private EnergyDisplay energy; private EnergyDisplay energy;
public GuiBioReactor(PlayerInventory inventory, TileEntityBase tile) { public GuiBioReactor(ContainerBioReactor container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerBioReactor(inventory, tile)); super(container, inventory);
this.tile = (TileEntityBioReactor) tile; this.tile = container.tile;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@Override @Override
public void initGui() { public void init() {
super.initGui(); super.init();
this.energy = new EnergyDisplay(this.guiLeft + 116, this.guiTop + 5, this.tile.storage); this.energy = new EnergyDisplay(this.guiLeft + 116, this.guiTop + 5, this.tile.storage);
} }
@ -53,15 +52,15 @@ public class GuiBioReactor extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.tile.burnTime > 0) { if (this.tile.burnTime > 0) {
int i = this.tile.burnTime * 13 / this.tile.maxBurnTime; int i = this.tile.burnTime * 13 / this.tile.maxBurnTime;
this.drawTexturedModalRect(this.guiLeft + 87, this.guiTop + 51 + 12 - i, 176, 96 - i, 14, i); this.blit(matrices, this.guiLeft + 87, this.guiTop + 51 + 12 - i, 176, 96 - i, 14, i);
} }
if (this.tile.producePerTick > 0) { if (this.tile.producePerTick > 0) {

View file

@ -10,26 +10,27 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiCanolaPress extends GuiWtfMojang { public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_canola_press"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_canola_press");
private final TileEntityCanolaPress press; private final TileEntityCanolaPress press;
private EnergyDisplay energy; private EnergyDisplay energy;
private FluidDisplay fluid; private FluidDisplay fluid;
public GuiCanolaPress(PlayerInventory inventory, TileEntityBase tile) { public GuiCanolaPress(ContainerCanolaPress container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerCanolaPress(inventory, tile)); super(container, inventory);
this.press = (TileEntityCanolaPress) tile; this.press = container.press;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -58,15 +59,15 @@ public class GuiCanolaPress extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.press.currentProcessTime > 0) { if (this.press.currentProcessTime > 0) {
int i = this.press.getProcessScaled(29); int i = this.press.getProcessScaled(29);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 32, 176, 0, 12, i); this.blit(matrices, this.guiLeft + 83, this.guiTop + 32, 176, 0, 12, i);
} }
this.energy.draw(); this.energy.draw();

View file

@ -11,24 +11,24 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiCoalGenerator extends GuiWtfMojang { public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coal_generator"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coal_generator");
private final TileEntityCoalGenerator generator; private final TileEntityCoalGenerator generator;
private EnergyDisplay energy; private EnergyDisplay energy;
public GuiCoalGenerator(PlayerInventory inventory, TileEntityBase tile) { public GuiCoalGenerator(ContainerCoalGenerator container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerCoalGenerator(inventory, tile)); super(container, inventory);
this.generator = (TileEntityCoalGenerator) tile; this.generator = container.generator;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -54,15 +54,15 @@ public class GuiCoalGenerator extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.generator.currentBurnTime > 0) { if (this.generator.currentBurnTime > 0) {
int i = this.generator.getBurningScaled(13); int i = this.generator.getBurningScaled(13);
this.drawTexturedModalRect(this.guiLeft + 87, this.guiTop + 27 + 12 - i, 176, 96 - i, 14, i); this.blit(matrices, this.guiLeft + 87, this.guiTop + 27 + 12 - i, 176, 96 - i, 14, i);
} }
this.energy.draw(); this.energy.draw();

View file

@ -13,20 +13,18 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import java.util.Collections; import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiCoffeeMachine extends GuiWtfMojang { public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coffee_machine"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coffee_machine");
private final TileEntityCoffeeMachine machine; private final TileEntityCoffeeMachine machine;
@ -34,9 +32,9 @@ public class GuiCoffeeMachine extends GuiWtfMojang {
private EnergyDisplay energy; private EnergyDisplay energy;
private FluidDisplay fluid; private FluidDisplay fluid;
public GuiCoffeeMachine(PlayerInventory inventory, TileEntityBase tile) { public GuiCoffeeMachine(ContainerCoffeeMachine container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerCoffeeMachine(inventory, tile)); super(container, inventory);
this.machine = (TileEntityCoffeeMachine) tile; this.machine = container.machine;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -46,7 +44,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang {
super.initGui(); super.initGui();
GuiButton buttonOkay = new GuiButton(0, this.guiLeft + 60, this.guiTop + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok")); GuiButton buttonOkay = new GuiButton(0, this.guiLeft + 60, this.guiTop + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok"));
this.buttonList.add(buttonOkay); this.addButton(buttonOkay);
this.energy = new EnergyDisplay(this.guiLeft + 16, this.guiTop + 5, this.machine.storage); this.energy = new EnergyDisplay(this.guiLeft + 16, this.guiTop + 5, this.machine.storage);
this.fluid = new FluidDisplay(this.guiLeft - 30, this.guiTop + 1, this.machine.tank, true, false); this.fluid = new FluidDisplay(this.guiLeft - 30, this.guiTop + 1, this.machine.tank, true, false);
@ -74,23 +72,23 @@ public class GuiCoffeeMachine extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.machine.coffeeCacheAmount > 0) { if (this.machine.coffeeCacheAmount > 0) {
int i = this.machine.getCoffeeScaled(30); int i = this.machine.getCoffeeScaled(30);
this.drawTexturedModalRect(this.guiLeft + 41, this.guiTop + 56 - i, 192, 0, 8, i); this.blit(matrices, this.guiLeft + 41, this.guiTop + 56 - i, 192, 0, 8, i);
} }
if (this.machine.brewTime > 0) { if (this.machine.brewTime > 0) {
int i = this.machine.getBrewScaled(23); int i = this.machine.getBrewScaled(23);
this.drawTexturedModalRect(this.guiLeft + 53, this.guiTop + 42, 192, 30, i, 16); this.blit(matrices, this.guiLeft + 53, this.guiTop + 42, 192, 30, i, 16);
int j = this.machine.getBrewScaled(26); int j = this.machine.getBrewScaled(26);
this.drawTexturedModalRect(this.guiLeft + 99 + 25 - j, this.guiTop + 44, 192 + 25 - j, 46, j, 12); this.blit(matrices, this.guiLeft + 99 + 25 - j, this.guiTop + 44, 192 + 25 - j, 46, j, 12);
} }
this.energy.draw(); this.energy.draw();

View file

@ -10,25 +10,27 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiDirectionalBreaker extends GuiWtfMojang { public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBreaker> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_directional_breaker"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_directional_breaker");
private final TileEntityDirectionalBreaker breaker; private final TileEntityDirectionalBreaker breaker;
private EnergyDisplay energy; private EnergyDisplay energy;
public GuiDirectionalBreaker(PlayerInventory inventory, TileEntityBase tile) { public GuiDirectionalBreaker(ContainerDirectionalBreaker container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerDirectionalBreaker(inventory, tile)); super(container, inventory);
this.breaker = (TileEntityDirectionalBreaker) tile; this.breaker = container.breaker;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -55,11 +57,11 @@ public class GuiDirectionalBreaker extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw();
} }

View file

@ -10,22 +10,25 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiDrill extends GuiWtfMojang { public class GuiDrill extends GuiWtfMojang<ContainerDrill> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_drill"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_drill");
public GuiDrill(PlayerInventory inventory) { public GuiDrill(ContainerDrill container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerDrill(inventory)); super(container, inventory);
this.xSize = 176; this.xSize = 176;
this.ySize = 54 + 86; this.ySize = 54 + 86;
} }
@ -39,10 +42,10 @@ public class GuiDrill extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 54, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 54, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 54); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 54);
} }
} }

View file

@ -10,25 +10,26 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiDropper extends GuiWtfMojang { public class GuiDropper extends GuiWtfMojang<ContainerDropper> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityDropper dropper; private final TileEntityDropper dropper;
public GuiDropper(PlayerEntity player, TileEntityBase tile) { public GuiDropper(ContainerDropper container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerDropper(player, tile)); super(container, inventory);
this.dropper = (TileEntityDropper) tile; this.dropper = container.dropper;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -42,10 +43,10 @@ public class GuiDropper extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
} }
} }

View file

@ -10,26 +10,26 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiEnergizer extends GuiWtfMojang { public class GuiEnergizer extends GuiWtfMojang<ContainerEnergizer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer");
private final TileEntityEnergizer energizer; private final TileEntityEnergizer energizer;
private EnergyDisplay energy; private EnergyDisplay energy;
public GuiEnergizer(PlayerEntity inventory, TileEntityBase tile) { public GuiEnergizer(ContainerEnergizer container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerEnergizer(inventory, tile)); super(container, inventory);
this.energizer = (TileEntityEnergizer) tile; this.energizer = container.energizer;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -55,11 +55,11 @@ public class GuiEnergizer extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw();
} }

View file

@ -10,26 +10,27 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiEnervator extends GuiWtfMojang { public class GuiEnervator extends GuiWtfMojang<ContainerEnervator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer");
private final TileEntityEnervator enervator; private final TileEntityEnervator enervator;
private EnergyDisplay energy; private EnergyDisplay energy;
public GuiEnervator(PlayerEntity inventory, TileEntityBase tile) { public GuiEnervator(ContainerEnervator container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerEnervator(inventory, tile)); super(container, inventory);
this.enervator = (TileEntityEnervator) tile; this.enervator = container.enervator;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -55,11 +56,11 @@ public class GuiEnervator extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw();
} }

View file

@ -10,26 +10,28 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFarmer extends GuiWtfMojang { public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_farmer"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_farmer");
private final TileEntityFarmer farmer; private final TileEntityFarmer farmer;
private EnergyDisplay energy; private EnergyDisplay energy;
public GuiFarmer(PlayerInventory inventory, TileEntityBase tile) { public GuiFarmer(ContainerFarmer container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerFarmer(inventory, tile)); super(container, inventory);
this.farmer = (TileEntityFarmer) tile; this.farmer = container.farmer;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -50,11 +52,11 @@ public class GuiFarmer extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw();
} }

View file

@ -10,28 +10,29 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Arrays; import java.util.Arrays;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFeeder extends GuiWtfMojang { public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_feeder"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_feeder");
public final TileEntityFeeder tileFeeder; public final TileEntityFeeder tileFeeder;
public GuiFeeder(PlayerInventory inventory, TileEntityBase tile) { public GuiFeeder(ContainerFeeder container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerFeeder(inventory, tile)); super(container, inventory);
this.tileFeeder = (TileEntityFeeder) tile; this.tileFeeder = container.feeder;
this.xSize = 176; this.xSize = 176;
this.ySize = 70 + 86; this.ySize = 70 + 86;
} }
@ -57,22 +58,22 @@ public class GuiFeeder extends GuiWtfMojang {
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 70, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 70, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 70); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 70);
if (this.tileFeeder.currentTimer > 0) { if (this.tileFeeder.currentTimer > 0) {
int i = this.tileFeeder.getCurrentTimerToScale(20); int i = this.tileFeeder.getCurrentTimerToScale(20);
this.drawTexturedModalRect(this.guiLeft + 85, this.guiTop + 42 - i, 181, 19 + 19 - i, 6, 20); this.blit(matrices, this.guiLeft + 85, this.guiTop + 42 - i, 181, 19 + 19 - i, 6, 20);
} }
if (this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) { if (this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) {
this.drawTexturedModalRect(this.guiLeft + 70, this.guiTop + 31, 192, 16, 8, 8); this.blit(matrices, this.guiLeft + 70, this.guiTop + 31, 192, 16, 8, 8);
} }
if (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD) { if (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD) {
this.drawTexturedModalRect(this.guiLeft + 70, this.guiTop + 31, 192, 24, 8, 8); this.blit(matrices, this.guiLeft + 70, this.guiTop + 31, 192, 24, 8, 8);
} }
} }
} }

View file

@ -10,26 +10,28 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFermentingBarrel extends GuiWtfMojang { public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fermenting_barrel"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fermenting_barrel");
private final TileEntityFermentingBarrel press; private final TileEntityFermentingBarrel press;
private FluidDisplay input; private FluidDisplay input;
private FluidDisplay output; private FluidDisplay output;
public GuiFermentingBarrel(PlayerInventory inventory, TileEntityBase tile) { public GuiFermentingBarrel(ContainerFermentingBarrel container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerFermentingBarrel(inventory, tile)); super(container, inventory);
this.press = (TileEntityFermentingBarrel) tile; this.press = container.barrel;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -57,15 +59,15 @@ public class GuiFermentingBarrel extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.press.currentProcessTime > 0) { if (this.press.currentProcessTime > 0) {
int i = this.press.getProcessScaled(29); int i = this.press.getProcessScaled(29);
this.drawTexturedModalRect(this.guiLeft + 82, this.guiTop + 34, 176, 0, 12, i); this.blit(matrices, this.guiLeft + 82, this.guiTop + 34, 176, 0, 12, i);
} }
this.input.draw(); this.input.draw();

View file

@ -10,22 +10,25 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFilter extends GuiWtfMojang { public class GuiFilter extends GuiWtfMojang<ContainerFilter> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_filter"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_filter");
public GuiFilter(PlayerInventory inventory) { public GuiFilter(ContainerFilter container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerFilter(inventory)); super(container, inventory);
this.xSize = 176; this.xSize = 176;
this.ySize = 90 + 86; this.ySize = 90 + 86;
} }
@ -39,10 +42,10 @@ public class GuiFilter extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 90, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 90); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 90);
} }
} }

View file

@ -8,18 +8,19 @@
* © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder; import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
import net.minecraft.client.gui.GuiSlider; import net.minecraft.client.gui.GuiSlider;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFireworkBox extends GuiContainer implements GuiResponder { public class GuiFireworkBox extends GuiContainer implements GuiResponder {
@ -37,20 +38,20 @@ public class GuiFireworkBox extends GuiContainer implements GuiResponder {
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
this.buttonList.add(new CustomSlider(this, 0, this.guiLeft, this.guiTop, "Value Play", 0F, 5F, this.tile.intValuePlay, IntFormatter.INSTANCE)); this.addButton(new CustomSlider(this, 0, this.guiLeft, this.guiTop, "Value Play", 0F, 5F, this.tile.intValuePlay, IntFormatter.INSTANCE));
this.buttonList.add(new CustomSlider(this, 1, this.guiLeft, this.guiTop + 20, "Average Charge Amount", 1F, 4F, this.tile.chargeAmount, IntFormatter.INSTANCE)); this.addButton(new CustomSlider(this, 1, this.guiLeft, this.guiTop + 20, "Average Charge Amount", 1F, 4F, this.tile.chargeAmount, IntFormatter.INSTANCE));
this.buttonList.add(new CustomSlider(this, 2, this.guiLeft, this.guiTop + 40, "Average Flight Time", 1F, 3F, this.tile.flightTime, IntFormatter.INSTANCE)); this.addButton(new CustomSlider(this, 2, this.guiLeft, this.guiTop + 40, "Average Flight Time", 1F, 3F, this.tile.flightTime, IntFormatter.INSTANCE));
this.buttonList.add(new CustomSlider(this, 3, this.guiLeft, this.guiTop + 60, "Effect Chance", 0F, 1F, this.tile.trailOrFlickerChance, null)); this.addButton(new CustomSlider(this, 3, this.guiLeft, this.guiTop + 60, "Effect Chance", 0F, 1F, this.tile.trailOrFlickerChance, null));
this.buttonList.add(new CustomSlider(this, 4, this.guiLeft, this.guiTop + 80, "Flicker/Trail Ratio", 0F, 1F, this.tile.flickerChance, null)); this.addButton(new CustomSlider(this, 4, this.guiLeft, this.guiTop + 80, "Flicker/Trail Ratio", 0F, 1F, this.tile.flickerChance, null));
this.buttonList.add(new CustomSlider(this, 5, this.guiLeft, this.guiTop + 100, "Color Amount", 1, 6, this.tile.colorAmount, IntFormatter.INSTANCE)); this.addButton(new CustomSlider(this, 5, this.guiLeft, this.guiTop + 100, "Color Amount", 1, 6, this.tile.colorAmount, IntFormatter.INSTANCE));
this.buttonList.add(new CustomSlider(this, 6, this.guiLeft + 150, this.guiTop, "Small Ball", 0F, 1F, this.tile.typeChance0, null)); this.addButton(new CustomSlider(this, 6, this.guiLeft + 150, this.guiTop, "Small Ball", 0F, 1F, this.tile.typeChance0, null));
this.buttonList.add(new CustomSlider(this, 7, this.guiLeft + 150, this.guiTop + 20, "Large Ball", 0F, 1F, this.tile.typeChance1, null)); this.addButton(new CustomSlider(this, 7, this.guiLeft + 150, this.guiTop + 20, "Large Ball", 0F, 1F, this.tile.typeChance1, null));
this.buttonList.add(new CustomSlider(this, 8, this.guiLeft + 150, this.guiTop + 40, "Star Shape", 0F, 1F, this.tile.typeChance2, null)); this.addButton(new CustomSlider(this, 8, this.guiLeft + 150, this.guiTop + 40, "Star Shape", 0F, 1F, this.tile.typeChance2, null));
this.buttonList.add(new CustomSlider(this, 9, this.guiLeft + 150, this.guiTop + 60, "Creeper Shape", 0F, 1F, this.tile.typeChance3, null)); this.addButton(new CustomSlider(this, 9, this.guiLeft + 150, this.guiTop + 60, "Creeper Shape", 0F, 1F, this.tile.typeChance3, null));
this.buttonList.add(new CustomSlider(this, 10, this.guiLeft + 150, this.guiTop + 80, "Burst", 0F, 1F, this.tile.typeChance4, null)); this.addButton(new CustomSlider(this, 10, this.guiLeft + 150, this.guiTop + 80, "Burst", 0F, 1F, this.tile.typeChance4, null));
this.buttonList.add(new CustomSlider(this, 11, this.guiLeft + 150, this.guiTop + 100, "Area of Effect", 0, 4, this.tile.areaOfEffect, IntFormatter.INSTANCE)); this.addButton(new CustomSlider(this, 11, this.guiLeft + 150, this.guiTop + 100, "Area of Effect", 0, 4, this.tile.areaOfEffect, IntFormatter.INSTANCE));
} }
@Override @Override

View file

@ -10,25 +10,27 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFluidCollector extends GuiWtfMojang { public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fluid_collector"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fluid_collector");
private final TileEntityFluidCollector collector; private final TileEntityFluidCollector collector;
private FluidDisplay fluid; private FluidDisplay fluid;
public GuiFluidCollector(PlayerInventory inventory, TileEntityBase tile) { public GuiFluidCollector(ContainerFluidCollector container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerFluidCollector(inventory, tile)); super(container, inventory);
this.collector = (TileEntityFluidCollector) tile; this.collector = container.collector;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -55,11 +57,11 @@ public class GuiFluidCollector extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.fluid.draw(); this.fluid.draw();
} }

View file

@ -10,25 +10,25 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFurnaceDouble extends GuiWtfMojang { public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_furnace_double"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_furnace_double");
private final TileEntityFurnaceDouble tileFurnace; private final TileEntityFurnaceDouble tileFurnace;
@ -36,9 +36,9 @@ public class GuiFurnaceDouble extends GuiWtfMojang {
private GuiButton buttonAutoSplit; private GuiButton buttonAutoSplit;
public GuiFurnaceDouble(PlayerInventory inventory, TileEntityBase tile) { public GuiFurnaceDouble(ContainerFurnaceDouble container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerFurnaceDouble(inventory, tile)); super(container, inventory);
this.tileFurnace = (TileEntityFurnaceDouble) tile; this.tileFurnace = container.furnace;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -61,7 +61,7 @@ public class GuiFurnaceDouble extends GuiWtfMojang {
this.energy = new EnergyDisplay(this.guiLeft + 27, this.guiTop + 5, this.tileFurnace.storage); this.energy = new EnergyDisplay(this.guiLeft + 27, this.guiTop + 5, this.tileFurnace.storage);
this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.guiLeft, this.guiTop, "S"); this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.guiLeft, this.guiTop, "S");
this.buttonList.add(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
@Override @Override
@ -89,19 +89,19 @@ public class GuiFurnaceDouble extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.tileFurnace.firstSmeltTime > 0) { if (this.tileFurnace.firstSmeltTime > 0) {
int i = this.tileFurnace.getFirstTimeToScale(23); int i = this.tileFurnace.getFirstTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft + 51, this.guiTop + 40, 176, 0, 24, i); this.blit(matrices, this.guiLeft + 51, this.guiTop + 40, 176, 0, 24, i);
} }
if (this.tileFurnace.secondSmeltTime > 0) { if (this.tileFurnace.secondSmeltTime > 0) {
int i = this.tileFurnace.getSecondTimeToScale(23); int i = this.tileFurnace.getSecondTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i); this.blit(matrices, this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i);
} }
this.energy.draw(); this.energy.draw();

View file

@ -1,78 +1,79 @@
/* // TODO: [port] no longer needed
* This file ("GuiGiantChest.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("GuiGiantChest.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.inventory.gui; //
//package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGiantChest; //
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; //import de.ellpeck.actuallyadditions.mod.inventory.ContainerGiantChest;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; //import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
import net.minecraft.client.gui.GuiButton; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; //import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; //import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; //import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException; //
//import java.io.IOException;
@OnlyIn(Dist.CLIENT) //
public class GuiGiantChest extends GuiWtfMojang { //@OnlyIn(Dist.CLIENT)
//public class GuiGiantChest extends GuiWtfMojang {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_giant_chest"); //
// private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_giant_chest");
private final TileEntityGiantChest chest; //
private final int page; // private final TileEntityGiantChest chest;
// private final int page;
public GuiGiantChest(PlayerInventory inventory, TileEntityBase tile, int page) { //
super(new ContainerGiantChest(inventory, tile, page)); // public GuiGiantChest(PlayerInventory inventory, TileEntityBase tile, int page) {
this.chest = (TileEntityGiantChest) tile; // super(new ContainerGiantChest(inventory, tile, page));
this.page = page; // this.chest = (TileEntityGiantChest) tile;
// this.page = page;
this.xSize = 242; //
this.ySize = 172 + 86; // this.xSize = 242;
} // this.ySize = 172 + 86;
// }
@Override //
public void initGui() { // @Override
super.initGui(); // public void initGui() {
// super.initGui();
if (this.page > 0) { //
this.buttonList.add(new GuiButton(this.page - 1, this.guiLeft + 13, this.guiTop + 172, 20, 20, "<")); // if (this.page > 0) {
} // this.addButton(new GuiButton(this.page - 1, this.guiLeft + 13, this.guiTop + 172, 20, 20, "<"));
// }
if (this.page == 0 && this.chest instanceof TileEntityGiantChestMedium || this.page <= 1 && this.chest instanceof TileEntityGiantChestLarge) { //
this.buttonList.add(new GuiButton(this.page + 1, this.guiLeft + 209, this.guiTop + 172, 20, 20, ">")); // if (this.page == 0 && this.chest instanceof TileEntityGiantChestMedium || this.page <= 1 && this.chest instanceof TileEntityGiantChestLarge) {
} // this.addButton(new GuiButton(this.page + 1, this.guiLeft + 209, this.guiTop + 172, 20, 20, ">"));
} // }
// }
@Override //
protected void actionPerformed(GuiButton button) throws IOException { // @Override
if (button.id >= 0 && button.id < 3) { // protected void actionPerformed(GuiButton button) throws IOException {
PacketHandlerHelper.sendButtonPacket(this.chest, button.id); // if (button.id >= 0 && button.id < 3) {
} // PacketHandlerHelper.sendButtonPacket(this.chest, button.id);
} // }
// }
@Override //
public void drawGuiContainerForegroundLayer(int x, int y) { // @Override
AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.chest); // public void drawGuiContainerForegroundLayer(int x, int y) {
} // AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.chest);
// }
@Override //
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { // @Override
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); // public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
this.mc.getTextureManager().bindTexture(RES_LOC); // GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 190); // this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); // this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 242, 190);
this.drawTexturedModalRect(this.guiLeft + 33, this.guiTop + 172, 0, 0, 176, 86); // this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
} // this.blit(matrices, this.guiLeft + 33, this.guiTop + 172, 0, 0, 176, 86);
} // }
//}

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
@ -17,18 +18,19 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiGrinder extends GuiWtfMojang { public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
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");
@ -36,16 +38,16 @@ public class GuiGrinder extends GuiWtfMojang {
private final boolean isDouble; private final boolean isDouble;
private EnergyDisplay energy; private EnergyDisplay energy;
private GuiButton buttonAutoSplit; private Button buttonAutoSplit;
public GuiGrinder(PlayerInventory inventoryPlayer, TileEntityBase tile) { public GuiGrinder(PlayerInventory inventoryPlayer, TileEntityBase tile) {
this(inventoryPlayer, tile, false); this(inventoryPlayer, tile, false);
} }
private GuiGrinder(PlayerInventory inventory, TileEntityBase tile, boolean isDouble) { private GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerGrinder(inventory, tile, isDouble)); super(container, inventory);
this.tileGrinder = (TileEntityGrinder) tile; this.tileGrinder = container.tileGrinder;
this.isDouble = isDouble; this.isDouble = container.isDouble;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -59,7 +61,7 @@ public class GuiGrinder extends GuiWtfMojang {
if (this.isDouble) { if (this.isDouble) {
this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.guiLeft - 10, this.guiTop, "S"); this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.guiLeft - 10, this.guiTop, "S");
this.buttonList.add(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
} }
@ -103,24 +105,24 @@ public class GuiGrinder extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(this.isDouble this.getMinecraft().getTextureManager().bindTexture(this.isDouble
? RES_LOC_DOUBLE ? RES_LOC_DOUBLE
: RES_LOC); : RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.tileGrinder.firstCrushTime > 0) { if (this.tileGrinder.firstCrushTime > 0) {
int i = this.tileGrinder.getFirstTimeToScale(23); int i = this.tileGrinder.getFirstTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft + (this.isDouble this.blit(matrices, this.guiLeft + (this.isDouble
? 51 ? 51
: 80), this.guiTop + 40, 176, 0, 24, i); : 80), this.guiTop + 40, 176, 0, 24, i);
} }
if (this.isDouble) { if (this.isDouble) {
if (this.tileGrinder.secondCrushTime > 0) { if (this.tileGrinder.secondCrushTime > 0) {
int i = this.tileGrinder.getSecondTimeToScale(23); int i = this.tileGrinder.getSecondTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i); this.blit(matrices, this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i);
} }
} }

View file

@ -10,26 +10,27 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter; import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import java.io.IOException; import java.io.IOException;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiInputter extends GuiWtfMojang { public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
public static final int OFFSET_ADVANCED = 12 + 36; public static final int OFFSET_ADVANCED = 12 + 36;
public static final String[] SIDES = new String[]{StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.disabled"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.up"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.down"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.north"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.east"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.south"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.west")}; public static final String[] SIDES = new String[]{StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.disabled"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.up"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.down"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.north"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.east"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.south"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.west")};
@ -45,14 +46,14 @@ public class GuiInputter extends GuiWtfMojang {
private FilterSettingsGui leftFilter; private FilterSettingsGui leftFilter;
private FilterSettingsGui rightFilter; private FilterSettingsGui rightFilter;
public GuiInputter(PlayerInventory inventory, TileEntityBase tile, boolean isAdvanced) { public GuiInputter(ContainerInputter container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerInputter(inventory, tile, isAdvanced)); super(container, inventory);
this.tileInputter = (TileEntityInputter) tile; this.tileInputter = container.tileInputter;
this.xSize = 176; this.xSize = 176;
this.ySize = 97 + 86 + (isAdvanced this.ySize = 97 + 86 + (container.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0); : 0);
this.isAdvanced = isAdvanced; this.isAdvanced = container.isAdvanced;
} }
@Override @Override
@ -100,12 +101,12 @@ public class GuiInputter extends GuiWtfMojang {
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), "<"); : 0), "<");
this.buttonList.add(buttonSidePutP); this.addButton(buttonSidePutP);
this.buttonList.add(buttonSidePullP); this.addButton(buttonSidePullP);
this.buttonList.add(buttonSidePutM); this.addButton(buttonSidePutM);
this.buttonList.add(buttonSidePullM); this.addButton(buttonSidePullM);
this.buttonList.add(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, this.guiLeft + 84, this.guiTop + 91 + (this.isAdvanced this.addButton(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, this.guiLeft + 84, this.guiTop + 91 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0))); : 0)));
} }
@ -146,15 +147,15 @@ public class GuiInputter extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 97 + (this.isAdvanced this.blit(matrices, this.guiLeft, this.guiTop + 97 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), 0, 0, 176, 86); : 0), 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(this.isAdvanced this.getMinecraft().getTextureManager().bindTexture(this.isAdvanced
? RES_LOC_ADVANCED ? RES_LOC_ADVANCED
: RES_LOC); : RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 97 + (this.isAdvanced this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 97 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0)); : 0));
@ -273,7 +274,7 @@ public class GuiInputter extends GuiWtfMojang {
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class SmallerButton extends GuiButton { public static class SmallerButton extends Button {
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
private final boolean smaller; private final boolean smaller;
@ -299,7 +300,7 @@ public class GuiInputter extends GuiWtfMojang {
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.blendFunc(770, 771); GlStateManager.blendFunc(770, 771);
this.drawTexturedModalRect(this.x, this.y, this.smaller this.blit(matrices, this.x, this.y, this.smaller
? 200 ? 200
: 176, k * this.height, this.width, this.height); : 176, k * this.height, this.width, this.height);
this.mouseDragged(mc, x, y); this.mouseDragged(mc, x, y);
@ -337,7 +338,7 @@ public class GuiInputter extends GuiWtfMojang {
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.blendFunc(770, 771); GlStateManager.blendFunc(770, 771);
this.drawTexturedModalRect(this.x, this.y, 192, k * 8, 8, 8); this.blit(matrices, this.x, this.y, 192, k * 8, 8, 8);
this.mouseDragged(mc, x, y); this.mouseDragged(mc, x, y);
} }
} }

View file

@ -10,26 +10,27 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton; import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiLaserRelayItemWhitelist extends GuiWtfMojang { public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelayItemWhitelist> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_laser_relay_item_whitelist"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_laser_relay_item_whitelist");
private final TileEntityLaserRelayItemWhitelist tile; private final TileEntityLaserRelayItemWhitelist tile;
@ -37,12 +38,12 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang {
private FilterSettingsGui leftFilter; private FilterSettingsGui leftFilter;
private FilterSettingsGui rightFilter; private FilterSettingsGui rightFilter;
private GuiButton buttonSmartWhitelistLeft; private Button buttonSmartWhitelistLeft;
private GuiButton buttonSmartWhitelistRight; private Button buttonSmartWhitelistRight;
public GuiLaserRelayItemWhitelist(PlayerInventory inventory, TileEntityBase tile) { public GuiLaserRelayItemWhitelist(ContainerLaserRelayItemWhitelist container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerLaserRelayItemWhitelist(inventory, tile)); super(container, inventory);
this.tile = (TileEntityLaserRelayItemWhitelist) tile; this.tile = container.tile;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -64,12 +65,12 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang {
this.buttonSmartWhitelistLeft = new SmallerButton(2, this.guiLeft + 3, this.guiTop + 79, "S"); this.buttonSmartWhitelistLeft = new SmallerButton(2, this.guiLeft + 3, this.guiTop + 79, "S");
this.buttonSmartWhitelistRight = new SmallerButton(3, this.guiLeft + 157, this.guiTop + 79, "S"); this.buttonSmartWhitelistRight = new SmallerButton(3, this.guiLeft + 157, this.guiTop + 79, "S");
this.buttonList.add(this.buttonSmartWhitelistLeft); this.addButton(this.buttonSmartWhitelistLeft);
this.buttonList.add(this.buttonSmartWhitelistRight); this.addButton(this.buttonSmartWhitelistRight);
} }
@Override @Override
public void actionPerformed(GuiButton button) { public void actionPerformed(Button button) {
PacketHandlerHelper.sendButtonPacket(this.tile, button.id); PacketHandlerHelper.sendButtonPacket(this.tile, button.id);
} }
@ -102,11 +103,11 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
} }
} }

View file

@ -10,27 +10,28 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner; import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiMiner extends GuiWtfMojang { public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityMiner miner; private final TileEntityMiner miner;
public GuiMiner(PlayerInventory inventory, TileEntityBase tile) { public GuiMiner(ContainerMiner container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerMiner(inventory, tile)); super(container, inventory);
this.miner = (TileEntityMiner) tile; this.miner = container.miner;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -40,10 +41,10 @@ public class GuiMiner extends GuiWtfMojang {
super.initGui(); super.initGui();
GuiButton buttonMode = new GuiButton(0, this.guiLeft + this.xSize / 2 - 51, this.guiTop + 75, 50, 20, "Mode"); GuiButton buttonMode = new GuiButton(0, this.guiLeft + this.xSize / 2 - 51, this.guiTop + 75, 50, 20, "Mode");
this.buttonList.add(buttonMode); this.addButton(buttonMode);
GuiButton buttonReset = new GuiButton(1, this.guiLeft + this.xSize / 2 + 1, this.guiTop + 75, 50, 20, "Reset"); GuiButton buttonReset = new GuiButton(1, this.guiLeft + this.xSize / 2 + 1, this.guiTop + 75, 50, 20, "Reset");
this.buttonList.add(buttonReset); this.addButton(buttonReset);
} }
@Override @Override
@ -55,11 +56,11 @@ public class GuiMiner extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
String mining = this.miner.onlyMineOres String mining = this.miner.onlyMineOres
? "Only Mining Ores" ? "Only Mining Ores"

View file

@ -10,19 +10,21 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiOilGenerator extends GuiWtfMojang { public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_oil_generator"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_oil_generator");
private final TileEntityOilGenerator generator; private final TileEntityOilGenerator generator;
@ -30,9 +32,9 @@ public class GuiOilGenerator extends GuiWtfMojang {
private EnergyDisplay energy; private EnergyDisplay energy;
private FluidDisplay fluid; private FluidDisplay fluid;
public GuiOilGenerator(PlayerInventory inventory, TileEntityBase tile) { public GuiOilGenerator(ContainerOilGenerator container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerOilGenerator(inventory, tile)); super(container, inventory);
this.generator = (TileEntityOilGenerator) tile; this.generator = container.generator;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -60,15 +62,15 @@ public class GuiOilGenerator extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
if (this.generator.currentBurnTime > 0 && this.generator.maxBurnTime > 0) { if (this.generator.currentBurnTime > 0 && this.generator.maxBurnTime > 0) {
int i = this.generator.getBurningScaled(13); int i = this.generator.getBurningScaled(13);
this.drawTexturedModalRect(this.guiLeft + 72, this.guiTop + 44 + 12 - i, 176, 96 - i, 14, i); this.blit(matrices, this.guiLeft + 72, this.guiTop + 44 + 12 - i, 176, 96 - i, 14, i);
} }
if (this.generator.maxBurnTime > 0 && this.generator.currentEnergyProduce > 0) { if (this.generator.maxBurnTime > 0 && this.generator.currentEnergyProduce > 0) {

View file

@ -10,33 +10,33 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiPhantomPlacer extends GuiWtfMojang { public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityPhantomPlacer placer; private final TileEntityPhantomPlacer placer;
public GuiPhantomPlacer(PlayerInventory inventory, TileEntityBase tile) { public GuiPhantomPlacer(ContainerPhantomPlacer container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerPhantomPlacer(inventory, tile)); super(container, inventory);
this.placer = (TileEntityPhantomPlacer) tile; this.placer = container.placer;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@ -46,7 +46,7 @@ public class GuiPhantomPlacer extends GuiWtfMojang {
super.initGui(); super.initGui();
if (!this.placer.isBreaker) { if (!this.placer.isBreaker) {
this.buttonList.add(new GuiButton(0, this.guiLeft + 63, this.guiTop + 75, 50, 20, this.getSide())); this.addButton(new GuiButton(0, this.guiLeft + 63, this.guiTop + 75, 50, 20, this.getSide()));
} }
} }
@ -93,10 +93,10 @@ public class GuiPhantomPlacer extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
} }
} }

View file

@ -10,28 +10,29 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector; import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiRangedCollector extends GuiWtfMojang { public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_ranged_collector"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_ranged_collector");
private final TileEntityRangedCollector collector; private final TileEntityRangedCollector collector;
private FilterSettingsGui filter; private FilterSettingsGui filter;
public GuiRangedCollector(PlayerInventory inventory, TileEntityBase tile) { public GuiRangedCollector(ContainerRangedCollector container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerRangedCollector(inventory, tile)); super(container, inventory);
this.collector = (TileEntityRangedCollector) tile; this.collector = container.collector;
this.xSize = 176; this.xSize = 176;
this.ySize = 86 + 86; this.ySize = 86 + 86;
} }
@ -66,11 +67,11 @@ public class GuiRangedCollector extends GuiWtfMojang {
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 86, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 86, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 86);
} }
@Override @Override

View file

@ -1,69 +1,72 @@
/* // TODO: [port][note] no longer needed
* This file ("GuiRepairer.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("GuiRepairer.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.inventory.gui; //
//package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRepairer; //
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; //import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.inventory.ContainerRepairer;
import net.minecraft.client.renderer.GlStateManager; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.minecraft.entity.player.PlayerInventory; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.util.ResourceLocation; //import net.minecraft.entity.player.PlayerInventory;
import net.minecraftforge.fml.relauncher.OnlyIn; //import net.minecraft.util.ResourceLocation;
//import net.minecraftforge.api.distmarker.Dist;
@OnlyIn(Dist.CLIENT) //import net.minecraftforge.api.distmarker.OnlyIn;
public class GuiRepairer extends GuiWtfMojang { //
//
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_repairer"); //@OnlyIn(Dist.CLIENT)
private final TileEntityItemRepairer tileRepairer; //public class GuiRepairer extends GuiWtfMojang {
private EnergyDisplay energy; //
// private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_repairer");
public GuiRepairer(PlayerInventory inventory, TileEntityBase tile) { // private final TileEntityItemRepairer tileRepairer;
super(new ContainerRepairer(inventory, tile)); // private EnergyDisplay energy;
this.tileRepairer = (TileEntityItemRepairer) tile; //
this.xSize = 176; // public GuiRepairer(PlayerInventory inventory, TileEntityBase tile) {
this.ySize = 93 + 86; // super(new ContainerRepairer(inventory, tile));
} // this.tileRepairer = (TileEntityItemRepairer) tile;
// this.xSize = 176;
@Override // this.ySize = 93 + 86;
public void initGui() { // }
super.initGui(); //
this.energy = new EnergyDisplay(this.guiLeft + 27, this.guiTop + 5, this.tileRepairer.storage); // @Override
} // public void initGui() {
// super.initGui();
@Override // this.energy = new EnergyDisplay(this.guiLeft + 27, this.guiTop + 5, this.tileRepairer.storage);
public void drawScreen(int x, int y, float f) { // }
super.drawScreen(x, y, f); //
this.energy.drawOverlay(x, y); // @Override
} // public void drawScreen(int x, int y, float f) {
// super.drawScreen(x, y, f);
@Override // this.energy.drawOverlay(x, y);
public void drawGuiContainerForegroundLayer(int x, int y) { // }
AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.tileRepairer); //
} // @Override
// public void drawGuiContainerForegroundLayer(int x, int y) {
@Override // AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.tileRepairer);
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { // }
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); //
// @Override
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); // public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); // GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
//
this.mc.getTextureManager().bindTexture(RES_LOC); // this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); // this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
//
if (TileEntityItemRepairer.canBeRepaired(this.tileRepairer.inv.getStackInSlot(TileEntityItemRepairer.SLOT_INPUT))) { // this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
int i = this.tileRepairer.getItemDamageToScale(22); // this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.drawTexturedModalRect(this.guiLeft + 73, this.guiTop + 52, 176, 28, i, 16); //
} // if (TileEntityItemRepairer.canBeRepaired(this.tileRepairer.inv.getStackInSlot(TileEntityItemRepairer.SLOT_INPUT))) {
// int i = this.tileRepairer.getItemDamageToScale(22);
this.energy.draw(); // this.blit(matrices, this.guiLeft + 73, this.guiTop + 52, 176, 28, i, 16);
} // }
} //
// this.energy.draw();
// }
//}

View file

@ -1,126 +1,127 @@
/* // TODO: [port][note] no longer needed
* This file ("GuiSmileyCloud.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("GuiSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.inventory.gui; //
//package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //
import de.ellpeck.actuallyadditions.mod.inventory.ContainerSmileyCloud; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer; //import de.ellpeck.actuallyadditions.mod.inventory.ContainerSmileyCloud;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler; //import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; //import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud; //import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiTextField; //import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager; //import net.minecraft.client.gui.GuiTextField;
import net.minecraft.nbt.CompoundNBT; //import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation; //import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; //import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.OnlyIn; //import net.minecraftforge.api.distmarker.Dist;
import org.lwjgl.input.Keyboard; //import net.minecraftforge.api.distmarker.OnlyIn;
//import org.lwjgl.input.Keyboard;
import java.io.IOException; //
//import java.io.IOException;
@OnlyIn(Dist.CLIENT) //
public class GuiSmileyCloud extends GuiWtfMojang { //@OnlyIn(Dist.CLIENT)
//public class GuiSmileyCloud extends GuiWtfMojang {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_smiley_cloud"); //
// private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_smiley_cloud");
private final int x; //
private final int y; // private final int x;
private final int z; // private final int y;
private final World world; // private final int z;
private final TileEntitySmileyCloud cloud; // private final World world;
private GuiTextField nameField; // private final TileEntitySmileyCloud cloud;
// private GuiTextField nameField;
public GuiSmileyCloud(TileEntityBase tile, int x, int y, int z, World world) { //
super(new ContainerSmileyCloud()); // public GuiSmileyCloud(TileEntityBase tile, int x, int y, int z, World world) {
this.cloud = (TileEntitySmileyCloud) tile; // super(new ContainerSmileyCloud());
this.x = x; // this.cloud = (TileEntitySmileyCloud) tile;
this.y = y; // this.x = x;
this.z = z; // this.y = y;
this.world = world; // this.z = z;
this.xSize = 124; // this.world = world;
this.ySize = 20; // this.xSize = 124;
} // this.ySize = 20;
// }
@Override //
public void initGui() { // @Override
super.initGui(); // public void initGui() {
// super.initGui();
this.nameField = new GuiTextField(4000, this.fontRenderer, this.guiLeft + 5, this.guiTop + 6, 114, 8); //
this.nameField.setMaxStringLength(20); // this.nameField = new GuiTextField(4000, this.fontRenderer, this.guiLeft + 5, this.guiTop + 6, 114, 8);
this.nameField.setEnableBackgroundDrawing(false); // this.nameField.setMaxStringLength(20);
this.nameField.setFocused(true); // this.nameField.setEnableBackgroundDrawing(false);
} // this.nameField.setFocused(true);
// }
@Override //
public void drawGuiContainerForegroundLayer(int x, int y) { // @Override
String name = this.cloud.name == null || this.cloud.name.isEmpty() // public void drawGuiContainerForegroundLayer(int x, int y) {
? "" // String name = this.cloud.name == null || this.cloud.name.isEmpty()
: TextFormatting.GOLD + this.cloud.name + TextFormatting.RESET + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.the") + " "; // ? ""
String localizedName = name + StringUtil.localize("container." + ActuallyAdditions.MODID + ".cloud.name"); // : TextFormatting.GOLD + this.cloud.name + TextFormatting.RESET + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.the") + " ";
this.fontRenderer.drawString(localizedName, this.xSize / 2 - this.fontRenderer.getStringWidth(localizedName) / 2, -10, StringUtil.DECIMAL_COLOR_WHITE); // String localizedName = name + StringUtil.localize("container." + ActuallyAdditions.MODID + ".cloud.name");
} // this.fontRenderer.drawString(localizedName, this.xSize / 2 - this.fontRenderer.getStringWidth(localizedName) / 2, -10, StringUtil.DECIMAL_COLOR_WHITE);
// }
@Override //
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { // @Override
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); // public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(RES_LOC); //
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); // this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
// this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
this.nameField.drawTextBox(); //
} // this.nameField.drawTextBox();
// }
@Override //
protected void mouseClicked(int par1, int par2, int par3) throws IOException { // @Override
this.nameField.mouseClicked(par1, par2, par3); // protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3); // this.nameField.mouseClicked(par1, par2, par3);
} // super.mouseClicked(par1, par2, par3);
// }
@Override //
public void keyTyped(char theChar, int key) throws IOException { // @Override
if (key != 1 && this.nameField.isFocused()) { // public void keyTyped(char theChar, int key) throws IOException {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) { // if (key != 1 && this.nameField.isFocused()) {
this.setVariable(this.nameField); // if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
} else { // this.setVariable(this.nameField);
this.nameField.textboxKeyTyped(theChar, key); // } else {
} // this.nameField.textboxKeyTyped(theChar, key);
} else { // }
super.keyTyped(theChar, key); // } else {
} // super.keyTyped(theChar, key);
} // }
// }
@Override //
public void updateScreen() { // @Override
super.updateScreen(); // public void updateScreen() {
this.nameField.updateCursorCounter(); // super.updateScreen();
} // this.nameField.updateCursorCounter();
// }
public void setVariable(GuiTextField field) { //
this.sendPacket(field.getText(), 0); // public void setVariable(GuiTextField field) {
field.setText(""); // this.sendPacket(field.getText(), 0);
} // field.setText("");
// }
private void sendPacket(String text, int textID) { //
CompoundNBT compound = new CompoundNBT(); // private void sendPacket(String text, int textID) {
compound.putInt("X", this.x); // CompoundNBT compound = new CompoundNBT();
compound.putInt("Y", this.y); // compound.putInt("X", this.x);
compound.putInt("Z", this.z); // compound.putInt("Y", this.y);
compound.putInt("WorldID", this.world.provider.getDimension()); // compound.putInt("Z", this.z);
compound.putInt("PlayerID", Minecraft.getInstance().player.getEntityId()); // compound.putInt("WorldID", this.world.provider.getDimension());
compound.putInt("TextID", textID); // compound.putInt("PlayerID", Minecraft.getInstance().player.getEntityId());
compound.setString("Text", text); // compound.putInt("TextID", textID);
PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_STRING_TO_TILE_HANDLER)); // compound.setString("Text", text);
} // PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_STRING_TO_TILE_HANDLER));
} // }
//}

View file

@ -10,77 +10,80 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier; import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiXPSolidifier extends GuiWtfMojang { public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_xp_solidifier"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_xp_solidifier");
private final TileEntityXPSolidifier solidifier; private final TileEntityXPSolidifier solidifier;
public GuiXPSolidifier(PlayerInventory inventory, TileEntityBase tile) { public GuiXPSolidifier(ContainerXPSolidifier container, PlayerInventory inventory, ITextComponent title) {
super(new ContainerXPSolidifier(inventory, tile)); super(container, inventory);
this.solidifier = (TileEntityXPSolidifier) tile; this.solidifier = container.solidifier;
this.xSize = 176; this.xSize = 176;
this.ySize = 93 + 86; this.ySize = 93 + 86;
} }
@Override @Override
public void initGui() { public void init() {
super.initGui(); super.init();
GuiButton buttonOne = new GuiInputter.SmallerButton(0, this.guiLeft + 62, this.guiTop + 44, "1"); Button buttonOne = new GuiInputter.SmallerButton(0, this.guiLeft + 62, this.guiTop + 44, "1");
GuiButton buttonFive = new GuiInputter.SmallerButton(1, this.guiLeft + 80, this.guiTop + 44, "5"); Button buttonFive = new GuiInputter.SmallerButton(1, this.guiLeft + 80, this.guiTop + 44, "5");
GuiButton buttonTen = new GuiInputter.SmallerButton(2, this.guiLeft + 99, this.guiTop + 44, "10"); Button buttonTen = new GuiInputter.SmallerButton(2, this.guiLeft + 99, this.guiTop + 44, "10");
GuiButton buttonTwenty = new GuiInputter.SmallerButton(3, this.guiLeft + 62, this.guiTop + 61, "20"); Button buttonTwenty = new GuiInputter.SmallerButton(3, this.guiLeft + 62, this.guiTop + 61, "20");
GuiButton buttonThirty = new GuiInputter.SmallerButton(4, this.guiLeft + 80, this.guiTop + 61, "30"); Button buttonThirty = new GuiInputter.SmallerButton(4, this.guiLeft + 80, this.guiTop + 61, "30");
GuiButton buttonForty = new GuiInputter.SmallerButton(5, this.guiLeft + 99, this.guiTop + 61, "40"); Button buttonForty = new GuiInputter.SmallerButton(5, this.guiLeft + 99, this.guiTop + 61, "40");
GuiButton buttonFifty = new GuiInputter.SmallerButton(6, this.guiLeft + 62, this.guiTop + 78, "50"); Button buttonFifty = new GuiInputter.SmallerButton(6, this.guiLeft + 62, this.guiTop + 78, "50");
GuiButton buttonSixtyFour = new GuiInputter.SmallerButton(7, this.guiLeft + 80, this.guiTop + 78, "64"); Button buttonSixtyFour = new GuiInputter.SmallerButton(7, this.guiLeft + 80, this.guiTop + 78, "64");
GuiButton buttonAll = new GuiInputter.SmallerButton(8, this.guiLeft + 99, this.guiTop + 78, "All"); Button buttonAll = new GuiInputter.SmallerButton(8, this.guiLeft + 99, this.guiTop + 78, "All");
this.buttonList.add(buttonOne); this.addButton(buttonOne);
this.buttonList.add(buttonFive); this.addButton(buttonFive);
this.buttonList.add(buttonTen); this.addButton(buttonTen);
this.buttonList.add(buttonTwenty); this.addButton(buttonTwenty);
this.buttonList.add(buttonThirty); this.addButton(buttonThirty);
this.buttonList.add(buttonForty); this.addButton(buttonForty);
this.buttonList.add(buttonFifty); this.addButton(buttonFifty);
this.buttonList.add(buttonSixtyFour); this.addButton(buttonSixtyFour);
this.buttonList.add(buttonAll); this.addButton(buttonAll);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.solidifier); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.solidifier);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.drawCenteredString(this.fontRenderer, Integer.toString(this.solidifier.amount), this.guiLeft + 88, this.guiTop + 30, StringUtil.DECIMAL_COLOR_WHITE); drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.guiLeft + 88, this.guiTop + 30, StringUtil.DECIMAL_COLOR_WHITE);
} }
@Override @Override
public void actionPerformed(GuiButton button) { public void actionPerformed(Button button) {
PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id); PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id);
this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player); this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player);

View file

@ -55,7 +55,7 @@ public class TexturedButton extends Button {
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.blendFunc(770, 771); GlStateManager.blendFunc(770, 771);
this.drawTexturedModalRect(this.x, this.y, this.texturePosX, this.texturePosY - this.height + k * this.height, this.width, this.height); this.blit(matrices, this.x, this.y, this.texturePosX, this.texturePosY - this.height + k * this.height, this.width, this.height);
this.mouseDragged(minecraft, x, y); this.mouseDragged(minecraft, x, y);
} }
} }

View file

@ -32,7 +32,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;

View file

@ -21,8 +21,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraftforge.common.IRarity; import net.minecraftforge.common.IRarity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { public class ItemCrystalShard extends ItemBase implements IColorProvidingItem {
@ -39,12 +38,16 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem {
@Override @Override
public String getTranslationKey(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
} }
@Override @Override
public IRarity getForgeRarity(ItemStack stack) { public IRarity getForgeRarity(ItemStack stack) {
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? EnumRarity.COMMON : BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].rarity; return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length
? EnumRarity.COMMON
: BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].rarity;
} }
@Override @Override

View file

@ -20,8 +20,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class ItemDust extends ItemBase implements IColorProvidingItem { public class ItemDust extends ItemBase implements IColorProvidingItem {
@ -39,12 +38,16 @@ public class ItemDust extends ItemBase implements IColorProvidingItem {
@Override @Override
public String getTranslationKey(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_DUSTS[stack.getItemDamage()].name; return stack.getItemDamage() >= ALL_DUSTS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + ALL_DUSTS[stack.getItemDamage()].name;
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { public EnumRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_DUSTS.length ? EnumRarity.COMMON : ALL_DUSTS[stack.getItemDamage()].rarity; return stack.getItemDamage() >= ALL_DUSTS.length
? EnumRarity.COMMON
: ALL_DUSTS[stack.getItemDamage()].rarity;
} }
@Override @Override
@ -67,12 +70,16 @@ public class ItemDust extends ItemBase implements IColorProvidingItem {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@Override @Override
public IItemColor getItemColor() { public IItemColor getItemColor() {
return (stack, pass) -> stack.getItemDamage() >= ALL_DUSTS.length ? 0xFFFFFF : ALL_DUSTS[stack.getItemDamage()].color; return (stack, pass) -> stack.getItemDamage() >= ALL_DUSTS.length
? 0xFFFFFF
: ALL_DUSTS[stack.getItemDamage()].color;
} }
@Override @Override
public int getItemBurnTime(ItemStack stack) { public int getItemBurnTime(ItemStack stack) {
if (stack.getMetadata() == 6) return 1200; if (stack.getMetadata() == 6) {
return 1200;
}
return super.getItemBurnTime(stack); return super.getItemBurnTime(stack);
} }
} }

View file

@ -25,8 +25,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class ItemFoods extends ItemFoodBase { public class ItemFoods extends ItemFoodBase {
@ -42,7 +41,9 @@ public class ItemFoods extends ItemFoodBase {
@Override @Override
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) { public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) {
ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); ItemStack stackToReturn = super.onItemUseFinish(stack, world, player);
ItemStack returnItem = stack.getItemDamage() >= ALL_FOODS.length ? null : ALL_FOODS[stack.getItemDamage()].returnItem; ItemStack returnItem = stack.getItemDamage() >= ALL_FOODS.length
? null
: ALL_FOODS[stack.getItemDamage()].returnItem;
if (StackUtil.isValid(returnItem) && player instanceof PlayerEntity) { if (StackUtil.isValid(returnItem) && player instanceof PlayerEntity) {
if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) { if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) {
if (!world.isRemote) { if (!world.isRemote) {
@ -57,22 +58,32 @@ public class ItemFoods extends ItemFoodBase {
@Override @Override
public int getMaxItemUseDuration(ItemStack stack) { public int getMaxItemUseDuration(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].useDuration; return stack.getItemDamage() >= ALL_FOODS.length
? 0
: ALL_FOODS[stack.getItemDamage()].useDuration;
} }
@Override @Override
public EnumAction getItemUseAction(ItemStack stack) { public EnumAction getItemUseAction(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT; return stack.getItemDamage() >= ALL_FOODS.length
? EnumAction.EAT
: ALL_FOODS[stack.getItemDamage()].getsDrunken
? EnumAction.DRINK
: EnumAction.EAT;
} }
@Override @Override
public int getHealAmount(ItemStack stack) { public int getHealAmount(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].healAmount; return stack.getItemDamage() >= ALL_FOODS.length
? 0
: ALL_FOODS[stack.getItemDamage()].healAmount;
} }
@Override @Override
public float getSaturationModifier(ItemStack stack) { public float getSaturationModifier(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].saturation; return stack.getItemDamage() >= ALL_FOODS.length
? 0
: ALL_FOODS[stack.getItemDamage()].saturation;
} }
@Override @Override
@ -82,12 +93,16 @@ public class ItemFoods extends ItemFoodBase {
@Override @Override
public String getTranslationKey(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_FOODS[stack.getItemDamage()].name; return stack.getItemDamage() >= ALL_FOODS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + ALL_FOODS[stack.getItemDamage()].name;
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { public EnumRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length ? EnumRarity.COMMON : ALL_FOODS[stack.getItemDamage()].rarity; return stack.getItemDamage() >= ALL_FOODS.length
? EnumRarity.COMMON
: ALL_FOODS[stack.getItemDamage()].rarity;
} }
@Override @Override

View file

@ -27,8 +27,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class ItemJams extends ItemFoodBase implements IColorProvidingItem { public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
@ -48,12 +47,16 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
@Override @Override
public String getTranslationKey(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_JAMS[stack.getItemDamage()].name; return stack.getItemDamage() >= ALL_JAMS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + ALL_JAMS[stack.getItemDamage()].name;
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { public EnumRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_JAMS.length ? EnumRarity.COMMON : ALL_JAMS[stack.getItemDamage()].rarity; return stack.getItemDamage() >= ALL_JAMS.length
? EnumRarity.COMMON
: ALL_JAMS[stack.getItemDamage()].rarity;
} }
@Override @Override
@ -89,12 +92,16 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
@Override @Override
public int getHealAmount(ItemStack stack) { public int getHealAmount(ItemStack stack) {
return stack.getItemDamage() >= ALL_JAMS.length ? 0 : ALL_JAMS[stack.getItemDamage()].healAmount; return stack.getItemDamage() >= ALL_JAMS.length
? 0
: ALL_JAMS[stack.getItemDamage()].healAmount;
} }
@Override @Override
public float getSaturationModifier(ItemStack stack) { public float getSaturationModifier(ItemStack stack) {
return stack.getItemDamage() >= ALL_JAMS.length ? 0 : ALL_JAMS[stack.getItemDamage()].saturation; return stack.getItemDamage() >= ALL_JAMS.length
? 0
: ALL_JAMS[stack.getItemDamage()].saturation;
} }
@Override @Override
@ -107,6 +114,10 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public IItemColor getItemColor() { public IItemColor getItemColor() {
return (stack, pass) -> pass > 0 ? stack.getItemDamage() >= ALL_JAMS.length ? 0xFFFFFF : ALL_JAMS[stack.getItemDamage()].color : 0xFFFFFF; return (stack, pass) -> pass > 0
? stack.getItemDamage() >= ALL_JAMS.length
? 0xFFFFFF
: ALL_JAMS[stack.getItemDamage()].color
: 0xFFFFFF;
} }
} }

View file

@ -26,7 +26,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.IRarity; import net.minecraftforge.common.IRarity;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class ItemMisc extends ItemBase { public class ItemMisc extends ItemBase {

View file

@ -34,7 +34,6 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collections; import java.util.Collections;

View file

@ -20,7 +20,7 @@
//import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; //import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import net.minecraft.block.Block; //import net.minecraft.block.Block;
//import net.minecraft.client.renderer.GlStateManager; //
//import net.minecraft.init.Blocks; //import net.minecraft.init.Blocks;
//import net.minecraft.init.Items; //import net.minecraft.init.Items;
//import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;

View file

@ -21,7 +21,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.OnlyIn;
public final class PacketHandlerHelper { public final class PacketHandlerHelper {

View file

@ -18,7 +18,7 @@ import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class PacketServerToClient implements IMessage { public class PacketServerToClient implements IMessage {

View file

@ -10,9 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public interface IEnergyDisplay { public interface IEnergyDisplay {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)

View file

@ -17,7 +17,7 @@ import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fml.relauncher.OnlyIn;
/** /**
* (Excerpted from Tinkers' Construct with permission, thanks guys!) * (Excerpted from Tinkers' Construct with permission, thanks guys!)

View file

@ -11,8 +11,7 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public interface IColorProvidingBlock { public interface IColorProvidingBlock {

View file

@ -11,8 +11,7 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public interface IColorProvidingItem { public interface IColorProvidingItem {

View file

@ -2,11 +2,9 @@ package de.ellpeck.actuallyadditions.mod.util.compat;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
import shadows.fastbench.gui.ContainerFastBench; import shadows.fastbench.gui.ContainerFastBench;
import shadows.fastbench.gui.GuiFastBench; import shadows.fastbench.gui.GuiFastBench;

Some files were not shown because too many files have changed in this diff Show more