mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-11-26 14:53:00 +00:00
Update to 1.7.10
1.0.1.2 - added a simple way to switch between the normal and baubles inventory. Thanks to Vazkii for the idea and permission to port it to base Baubles. - removed the Miners Ring crafting recipe... it is a bit op. I will leave the item in so it is attainable in creative and so it can still serve as an example bauble for devs. 1.0.1.1 - added backwards compatibility for legacy (pre 1.7.10) savefiles 1.0.1.0 - update for MC 1.7.10 - no requires Forge 10.13.0.1177 - removed support for legacy save format and moved saving/loading to new forge events
This commit is contained in:
1 parent
b515b965d5
commit
3e8015e246
12 files changed
+149
-9
No files matched your search
@@ -4,6 +4,8 @@ package baubles.client;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import baubles.client.gui.GuiEvents;
|
||||
import baubles.client.gui.GuiPlayerExpanded;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.CommonProxy;
|
||||
@@ -20,6 +22,7 @@ public class ClientProxy extends CommonProxy {
|
||||
public void registerKeyBindings() {
|
||||
keyHandler = new KeyHandler();
|
||||
FMLCommonHandler.instance().bus().register(keyHandler);
|
||||
MinecraftForge.EVENT_BUS.register(new GuiEvents());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package baubles.client.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
|
||||
public class GuiBaublesButton extends GuiButton {
|
||||
|
||||
public GuiBaublesButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_,
|
||||
int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
|
||||
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
|
||||
}
|
||||
|
||||
public void drawButton(Minecraft mc, int xx, int yy)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
FontRenderer fontrenderer = mc.fontRenderer;
|
||||
mc.getTextureManager().bindTexture(GuiPlayerExpanded.background);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = xx >= this.xPosition && yy >= this.yPosition && xx < this.xPosition + this.width && yy < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
if (k==1) {
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 200, 48, 10, 10);
|
||||
} else {
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 210, 48, 10, 10);
|
||||
this.drawCenteredString(fontrenderer, this.displayString,
|
||||
this.xPosition + 5, this.yPosition + this.height, 0xffffff);
|
||||
}
|
||||
|
||||
this.mouseDragged(mc, xx, yy);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package baubles.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import baubles.common.network.PacketHandler;
|
||||
import baubles.common.network.PacketOpenBaublesInventory;
|
||||
import baubles.common.network.PacketOpenNormalInventory;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class GuiEvents {
|
||||
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
|
||||
if (event.gui instanceof GuiInventory || event.gui instanceof GuiPlayerExpanded) {
|
||||
|
||||
int xSize = 176;
|
||||
int ySize = 166;
|
||||
|
||||
int guiLeft = (event.gui.width - xSize) / 2;
|
||||
int guiTop = (event.gui.height - ySize) / 2;
|
||||
|
||||
if (!event.gui.mc.thePlayer.getActivePotionEffects().isEmpty()) {
|
||||
guiLeft = 160 + (event.gui.width - xSize - 200) / 2;
|
||||
}
|
||||
|
||||
event.buttonList.add(new GuiBaublesButton(55, guiLeft + 66, guiTop + 9, 10, 10,
|
||||
I18n.format((event.gui instanceof GuiInventory)?"button.baubles":"button.normal", new Object[0])));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void guiPostAction(GuiScreenEvent.ActionPerformedEvent.Post event) {
|
||||
|
||||
if (event.gui instanceof GuiInventory) {
|
||||
if (event.button.id == 55) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenBaublesInventory(event.gui.mc.thePlayer));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.gui instanceof GuiPlayerExpanded) {
|
||||
if (event.button.id == 55) {
|
||||
event.gui.mc.displayGuiScreen(new GuiInventory(event.gui.mc.thePlayer));
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenNormalInventory(event.gui.mc.thePlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import baubles.common.container.ContainerPlayerExpanded;
|
||||
|
||||
public class GuiPlayerExpanded extends InventoryEffectRenderer {
|
||||
|
||||
protected static final ResourceLocation background =
|
||||
public static final ResourceLocation background =
|
||||
new ResourceLocation("baubles","textures/gui/expanded_inventory.png");
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Baubles {
|
||||
|
||||
public static final String MODID = "Baubles";
|
||||
public static final String MODNAME = "Baubles";
|
||||
public static final String VERSION = "1.0.1.1";
|
||||
public static final String VERSION = "1.0.1.2";
|
||||
|
||||
@SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@@ -34,11 +34,11 @@ public class Config {
|
||||
}
|
||||
|
||||
public static void initRecipe() {
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(itemRing), new Object[] {
|
||||
"PIP", "IPI", "PIP",
|
||||
Character.valueOf('I'), new ItemStack(Items.iron_ingot),
|
||||
Character.valueOf('P'), new ItemStack(Items.potionitem,1,8226)});
|
||||
// GameRegistry.addShapedRecipe(
|
||||
// new ItemStack(itemRing), new Object[] {
|
||||
// "PIP", "IPI", "PIP",
|
||||
// Character.valueOf('I'), new ItemStack(Items.iron_ingot),
|
||||
// Character.valueOf('P'), new ItemStack(Items.potionitem,1,8226)});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ public class PacketHandler
|
||||
public static void init()
|
||||
{
|
||||
INSTANCE.registerMessage(PacketOpenBaublesInventory.class, PacketOpenBaublesInventory.class, 0, Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketSyncBauble.class, PacketSyncBauble.class, 1, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketOpenNormalInventory.class, PacketOpenNormalInventory.class, 1, Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketSyncBauble.class, PacketSyncBauble.class, 2, Side.CLIENT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package baubles.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class PacketOpenNormalInventory implements IMessage, IMessageHandler<PacketOpenNormalInventory, IMessage> {
|
||||
|
||||
public PacketOpenNormalInventory() {}
|
||||
|
||||
public PacketOpenNormalInventory(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketOpenNormalInventory message, MessageContext ctx) {
|
||||
ctx.getServerHandler().playerEntity.openContainer = ctx.getServerHandler().playerEntity.inventoryContainer;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user