Commit 4e3365c9 authored by Zeitheron's avatar Zeitheron 🐸
Browse files

Lower the memory usage when creating ItemStacks, fix #2

parent 8d52549a
Loading
Loading
Loading
Loading
+1 −1
Changes for build.txt: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -14,6 +14,6 @@ jei_version=4.11.0.206
mod_id=baubleshulkerboxes
mod_id_fancy=BaubleShulkerBoxes
mod_name=Bauble Shulker Boxes
mod_version=3r
mod_version=4r
cf_project=303956
release_type=release
 No newline at end of file
+10 −3
Changes for src/main/java/com/zeitheron/baublesb/BaubleShulkerBoxes.java: 10 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -60,9 +60,17 @@ public class BaubleShulkerBoxes
	@SidedProxy(serverSide = "com.zeitheron.baublesb.proxy.CommonProxy", clientSide = "com.zeitheron.baublesb.proxy.ClientProxy")
	public static CommonProxy proxy;
	
	public static final ResourceLocation BAUBLE_CAP_PATH = new ResourceLocation("baubleshulkerboxes", "bauble");
	
	@SubscribeEvent
	public void capAttachStack(AttachCapabilitiesEvent<ItemStack> event)
	{
		ResourceLocation item = event.getObject().getItem().getRegistryName();
		
		// Item is not registered? SKIP IT!
		if(item == null)
			return;
		
		if(Loader.isModLoaded("ironchest"))
			IronChestAPI.attachItemCap(event);
		
@@ -72,9 +80,8 @@ public class BaubleShulkerBoxes
		ItemStack stack = event.getObject();
		
		// Add bauble capability ONLY if it's absent.
		ResourceLocation bauble = new ResourceLocation("baubleshulkerboxes", "bauble");
		if(stack.getItem() instanceof ItemShulkerBox && !event.getCapabilities().containsKey(bauble))
			event.addCapability(bauble, new BaubleProvider(new VanillaShulkerBox(stack)));
		if(stack.getItem() instanceof ItemShulkerBox && !event.getCapabilities().containsKey(BAUBLE_CAP_PATH))
			event.addCapability(BAUBLE_CAP_PATH, new BaubleProvider(new VanillaShulkerBox(stack)));
	}
	
	@SubscribeEvent
+2 −4
Changes for src/main/java/com/zeitheron/baublesb/intr/ironchest/IronChestAPI.java: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
package com.zeitheron.baublesb.intr.ironchest;

import com.zeitheron.baublesb.BaubleShulkerBoxes;
import com.zeitheron.baublesb.boxes.IronShulkerBox;
import com.zeitheron.baublesb.cap.BaubleProvider;

import cpw.mods.ironchest.common.items.shulker.ItemIronShulkerBox;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.AttachCapabilitiesEvent;

public class IronChestAPI
@@ -15,8 +15,6 @@ public class IronChestAPI
		ItemStack stack = event.getObject();
		
		if(stack.getItem() instanceof ItemIronShulkerBox)
		{
			event.addCapability(new ResourceLocation("baubleshulkerboxes", "bauble"), new BaubleProvider(new IronShulkerBox(stack)));
		}
			event.addCapability(BaubleShulkerBoxes.BAUBLE_CAP_PATH, new BaubleProvider(new IronShulkerBox(stack)));
	}
}
 No newline at end of file
+2 −1
Changes for src/main/java/com/zeitheron/baublesb/intr/shulko/ShulkoAPI.java: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
package com.zeitheron.baublesb.intr.shulko;

import com.zeitheron.baublesb.BaubleShulkerBoxes;
import com.zeitheron.baublesb.cap.BaubleImpl;
import com.zeitheron.baublesb.cap.BaubleProvider;

@@ -13,6 +14,6 @@ public class ShulkoAPI
	{
		ResourceLocation item = event.getObject().getItem().getRegistryName();
		if(item.getNamespace().equalsIgnoreCase("shulko") && item.getPath().equalsIgnoreCase("actually_purple_shulker_box"))
			event.addCapability(new ResourceLocation("baubleshulkerboxes", "bauble"), new BaubleProvider(new BaubleImpl(event.getObject(), new ResourceLocation("shulko", "textures/entity/shulker_actually_purple.png"), 27)));
			event.addCapability(BaubleShulkerBoxes.BAUBLE_CAP_PATH, new BaubleProvider(new BaubleImpl(event.getObject(), new ResourceLocation("shulko", "textures/entity/shulker_actually_purple.png"), 27)));
	}
}
 No newline at end of file
+1 −1
Changes for src/main/resources/assets/baubleshulkerboxes/lang/ru_ru.lang: 1 added line, 1 removed line.
Original line number Diff line number Diff line
# English Translations (by Zeitheron)
# Russian Translations (by Zeitheron)

keybind.baubleshulkerbox=Открыть ящик шалкера в бижутериях
 No newline at end of file