Compare commits

..

No commits in common. 'main' and '1.0.0' have entirely different histories.
main ... 1.0.0

@ -1,6 +1,5 @@
plugins { plugins {
id 'babric-loom' version '0.12-SNAPSHOT' id 'babric-loom' version '0.12-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java' id 'java'
} }
@ -8,23 +7,6 @@ group = project.mod_group
archivesBaseName = project.mod_name archivesBaseName = project.mod_name
version = project.mod_version version = project.mod_version
//Begin shadowing weirdness
configurations {
shade
}
shadowJar {
archiveClassifier.set('shadow')
configurations = [project.configurations.shade]
}
tasks.assemble.dependsOn tasks.shadowJar
remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.archiveFile)
}
//End shadowing weirdness
loom { loom {
gluedMinecraftJar() gluedMinecraftJar()
noIntermediateMappings() noIntermediateMappings()
@ -80,9 +62,6 @@ dependencies {
modImplementation "org.slf4j:slf4j-api:1.8.0-beta4" modImplementation "org.slf4j:slf4j-api:1.8.0-beta4"
modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0"
//TOML
modImplementation include(shadow('com.moandjiezana.toml:toml4j:0.7.2'))
} }
java { java {

@ -14,6 +14,6 @@ loader_version=0.14.6-babric.1
halplibe_version=1.0.9 halplibe_version=1.0.9
# Mod # Mod
mod_version=1.0.2 mod_version=1.0.0
mod_group=net.brokenmoon mod_group=net.brokenmoon
mod_name=afloydironchest mod_name=afloydironchest

@ -1,12 +1,12 @@
package net.brokenmoon.afloydironchest; package net.brokenmoon.afloydironchest;
import com.moandjiezana.toml.Toml;
import net.brokenmoon.afloydironchest.blocks.DiamondChest; import net.brokenmoon.afloydironchest.blocks.DiamondChest;
import net.brokenmoon.afloydironchest.blocks.IronChest; import net.brokenmoon.afloydironchest.blocks.IronChest;
import net.brokenmoon.afloydironchest.blocks.GoldChest; import net.brokenmoon.afloydironchest.blocks.GoldChest;
import net.brokenmoon.afloydironchest.blocks.SteelChest; import net.brokenmoon.afloydironchest.blocks.SteelChest;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.minecraft.src.Block; import net.minecraft.src.Block;
import net.minecraft.src.BlockChest;
import net.minecraft.src.Item; import net.minecraft.src.Item;
import net.minecraft.src.Material; import net.minecraft.src.Material;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -14,51 +14,32 @@ import org.slf4j.LoggerFactory;
import turniplabs.halplibe.helper.BlockHelper; import turniplabs.halplibe.helper.BlockHelper;
import turniplabs.halplibe.helper.RecipeHelper; import turniplabs.halplibe.helper.RecipeHelper;
import java.io.*;
public class IronChestMain implements ModInitializer { public class IronChestMain implements ModInitializer {
public static final String MOD_ID = "ironchest"; public static final String MOD_ID = "ironchest";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static Block IronChest; public static Block IronChest = BlockHelper.createBlock(MOD_ID, new IronChest(900, Material.iron), "ironchest",
public static Block GoldChest; "ironchesttop.png", "ironchestbottom.png",
public static Block DiamondChest; "ironchestfront.png", "ironchestside.png", "ironchestside.png", "ironchestside.png",
public static Block SteelChest; Block.soundMetalFootstep, 5, 6, 0);
public static Block GoldChest = BlockHelper.createBlock(MOD_ID, new GoldChest(901, Material.iron), "goldchest",
"goldchesttop.png", "goldchestbottom.png",
"goldchestfront.png", "goldchestside.png", "goldchestside.png", "goldchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
public static Block DiamondChest = BlockHelper.createBlock(MOD_ID, new DiamondChest(902, Material.iron), "diamondchest",
"diamondchesttop.png", "diamondchestbottom.png",
"diamondchestfront.png", "diamondchestside.png", "diamondchestside.png", "diamondchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
public static Block SteelChest = BlockHelper.createBlock(MOD_ID, new SteelChest(903, Material.iron), "steelchest",
"steelchesttop.png", "steelchestbottom.png",
"steelchestfront.png", "steelchestside.png", "steelchestside.png", "steelchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
@Override @Override
public void onInitialize() { public void onInitialize() {
LOGGER.info("AFloydIronChest initialized."); LOGGER.info("AFloydIronChest initialized.");
//Config
Toml toml = new Toml().read(this.getConfig());
int ironChestId = toml.getLong("ids.ironChestID", (long)900).intValue();
int goldChestId = toml.getLong("ids.goldChestID", (long)901).intValue();
int diamondChestId = toml.getLong("ids.diamondChestID", (long)902).intValue();
int steelChestId = toml.getLong("ids.steelChestID", (long)903).intValue();
//Blocks
IronChest = BlockHelper.createBlock(MOD_ID, new IronChest(ironChestId, Material.iron), "ironchest",
"ironchesttop.png", "ironchestbottom.png",
"ironchestfront.png", "ironchestside.png", "ironchestside.png", "ironchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
GoldChest = BlockHelper.createBlock(MOD_ID, new GoldChest(goldChestId, Material.iron), "goldchest",
"goldchesttop.png", "goldchestbottom.png",
"goldchestfront.png", "goldchestside.png", "goldchestside.png", "goldchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
DiamondChest = BlockHelper.createBlock(MOD_ID, new DiamondChest(diamondChestId, Material.iron), "diamondchest",
"diamondchesttop.png", "diamondchestbottom.png",
"diamondchestfront.png", "diamondchestside.png", "diamondchestside.png", "diamondchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
SteelChest = BlockHelper.createBlock(MOD_ID, new SteelChest(steelChestId, Material.iron), "steelchest",
"steelchesttop.png", "steelchestbottom.png",
"steelchestfront.png", "steelchestside.png", "steelchestside.png", "steelchestside.png",
Block.soundMetalFootstep, 5, 6, 0);
//Recipes
RecipeHelper.Crafting.createRecipe(IronChest, 1, new Object[]{ RecipeHelper.Crafting.createRecipe(IronChest, 1, new Object[]{
"AAA", "AAA",
"ABA", "ABA",
@ -95,31 +76,4 @@ public class IronChestMain implements ModInitializer {
'B', GoldChest 'B', GoldChest
}); });
} }
public static File getConfig() {
File config = new File("config/AstoriaIronChest.toml");
if (!config.exists()) {
LOGGER.warn("Config For afloydironchest Not Found! Creating new config based upon default :)");
InputStream in;
OutputStream out;
try {
File configDir = new File("config");
if (!configDir.exists())
configDir.mkdir();
in = IronChestMain.class.getClassLoader().getResourceAsStream("assets/ironchest/config.toml");
out = new FileOutputStream(config);
byte[] buffer = new byte[1024];
int length;
while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
return getConfig();
} catch (IOException e) {
throw new RuntimeException(e);
}
} else {
LOGGER.info("Config for afloydironchest loaded!");
return config;
}
}
} }

@ -1,7 +1,5 @@
package net.brokenmoon.afloydironchest.mixin; package net.brokenmoon.afloydironchest.mixin;
import com.moandjiezana.toml.Toml;
import net.brokenmoon.afloydironchest.IronChestMain;
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerMP; import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerMP;
import net.brokenmoon.afloydironchest.gui.ContainerWideChest; import net.brokenmoon.afloydironchest.gui.ContainerWideChest;
import net.minecraft.src.*; import net.minecraft.src.*;
@ -19,8 +17,6 @@ public class MixinEntityPlayerMP implements IEntityPlayerMP {
@Shadow @Shadow
public NetServerHandler playerNetServerHandler; public NetServerHandler playerNetServerHandler;
public int ironchest_windowid = 0;
public void displayGUIIronChest(IInventory iinventory) { public void displayGUIIronChest(IInventory iinventory) {
this.getNextWindowId(); this.getNextWindowId();
NetServerHandler.logger.info(((EntityPlayerMP)(Object)this).username + " interacted with chest at (" + ((EntityPlayerMP)(Object)this).posX + ", " + ((EntityPlayerMP)(Object)this).posY + ", " + ((EntityPlayerMP)(Object)this).posZ + ")"); NetServerHandler.logger.info(((EntityPlayerMP)(Object)this).username + " interacted with chest at (" + ((EntityPlayerMP)(Object)this).posX + ", " + ((EntityPlayerMP)(Object)this).posY + ", " + ((EntityPlayerMP)(Object)this).posZ + ")");
@ -33,19 +29,9 @@ public class MixinEntityPlayerMP implements IEntityPlayerMP {
public void displayGUIDiamondChest(IInventory iinventory) { public void displayGUIDiamondChest(IInventory iinventory) {
this.getNextWindowId(); this.getNextWindowId();
NetServerHandler.logger.info(((EntityPlayerMP)(Object)this).username + " interacted with chest at (" + ((EntityPlayerMP)(Object)this).posX + ", " + ((EntityPlayerMP)(Object)this).posY + ", " + ((EntityPlayerMP)(Object)this).posZ + ")"); NetServerHandler.logger.info(((EntityPlayerMP)(Object)this).username + " interacted with chest at (" + ((EntityPlayerMP)(Object)this).posX + ", " + ((EntityPlayerMP)(Object)this).posY + ", " + ((EntityPlayerMP)(Object)this).posZ + ")");
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, getIronchest_windowid(), iinventory.getInvName(), iinventory.getSizeInventory())); this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 7, iinventory.getInvName(), iinventory.getSizeInventory()));
((EntityPlayerMP)(Object)this).craftingInventory = new ContainerWideChest(((EntityPlayerMP)(Object)this).inventory, iinventory); ((EntityPlayerMP)(Object)this).craftingInventory = new ContainerWideChest(((EntityPlayerMP)(Object)this).inventory, iinventory);
((EntityPlayerMP)(Object)this).craftingInventory.windowId = this.currentWindowId; ((EntityPlayerMP)(Object)this).craftingInventory.windowId = this.currentWindowId;
((EntityPlayerMP)(Object)this).craftingInventory.onContainerInit(((EntityPlayerMP)(Object)this)); ((EntityPlayerMP)(Object)this).craftingInventory.onContainerInit(((EntityPlayerMP)(Object)this));
} }
public int getIronchest_windowid(){
if (ironchest_windowid != 0 ){
return ironchest_windowid;
} else{
Toml toml = new Toml().read(IronChestMain.getConfig());
ironchest_windowid = toml.getLong("ids.diamondWindowID", (long)7).intValue();
return getIronchest_windowid();
}
}
} }

@ -1,6 +1,5 @@
package net.brokenmoon.afloydironchest.mixin; package net.brokenmoon.afloydironchest.mixin;
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerSP;
import net.brokenmoon.afloydironchest.gui.GuiDiamondChest; import net.brokenmoon.afloydironchest.gui.GuiDiamondChest;
import net.brokenmoon.afloydironchest.gui.GuiIronChest; import net.brokenmoon.afloydironchest.gui.GuiIronChest;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -9,7 +8,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = EntityPlayerSP.class, remap = false) @Mixin(value = EntityPlayerSP.class, remap = false)
public class MixinEntityPlayerSP implements IEntityPlayerSP { public class MixinEntityPlayerSP {
@Shadow @Shadow
protected Minecraft mc; protected Minecraft mc;
public void displayGUIIronChest(IInventory iinventory) { public void displayGUIIronChest(IInventory iinventory) {

@ -1,7 +1,5 @@
package net.brokenmoon.afloydironchest.mixin; package net.brokenmoon.afloydironchest.mixin;
import com.moandjiezana.toml.Toml;
import net.brokenmoon.afloydironchest.IronChestMain;
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerSP; import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerSP;
import net.brokenmoon.afloydironchest.tileEntities.TileEntityDiamondChest; import net.brokenmoon.afloydironchest.tileEntities.TileEntityDiamondChest;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -16,28 +14,16 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = NetClientHandler.class, remap = false) @Mixin(value = NetClientHandler.class, remap = false)
public class MixinNetClientHandler { public class MixinNetClientHandler {
private int ironchest_windowid = 0;
@Shadow @Shadow
private Minecraft mc; private Minecraft mc;
@Inject(method = "handleOpenWindow", at = @At("TAIL")) @Inject(method = "handleOpenWindow", at = @At("TAIL"))
public void injectMethod(Packet100OpenWindow packet100openwindow, CallbackInfo info) { public void injectMethod(Packet100OpenWindow packet100openwindow, CallbackInfo info) {
if (packet100openwindow.inventoryType == getIronchest_windowid()) { if (packet100openwindow.inventoryType == 7) {
TileEntityDiamondChest dchest = new TileEntityDiamondChest(); TileEntityDiamondChest dchest = new TileEntityDiamondChest();
((IEntityPlayerSP)this.mc.thePlayer).displayGUIDiamondChest(dchest); ((IEntityPlayerSP)this.mc.thePlayer).displayGUIDiamondChest(dchest);
this.mc.thePlayer.craftingInventory.windowId = packet100openwindow.windowId; this.mc.thePlayer.craftingInventory.windowId = packet100openwindow.windowId;
} }
} }
public int getIronchest_windowid(){
if (ironchest_windowid != 0 ){
return ironchest_windowid;
} else{
Toml toml = new Toml().read(IronChestMain.getConfig());
ironchest_windowid = toml.getLong("ids.diamondWindowID", (long)7).intValue();
return getIronchest_windowid();
}
}
} }

@ -1,6 +0,0 @@
[ids]
ironChestID = 900
goldChestID = 901
diamondChestID = 902
steelChestID = 903
diamondWindowID = 7

@ -32,8 +32,7 @@
}, },
"custom": { "custom": {
"loom:injected_interfaces": { "loom:injected_interfaces": {
"net/minecraft/src/EntityPlayerSP": ["net/brokenmoon/afloydironchest/MixinInterfaces/IEntityPlayerSP"], "net/minecraft/src/EntityPlayerSP": ["net/brokenmoon/afloydironchest/MixinInterfaces/IEntityPlayerSP"]
"net/minecraft/src/EntityPlayerMP": ["net/brokenmoon/afloydironchest/MixinInterfaces/IEntityPlayerMP"]
} }
} }
} }

Loading…
Cancel
Save