New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Slimefun block - Automatic Ignition Chamber #494

Merged
merged 15 commits into from Nov 21, 2017

Conversation

3 participants
@AtomicScience
Contributor

AtomicScience commented Nov 15, 2017

As you know, Smelter, with some probability, extinguish flame under itself. It can annoy some players, and I developed a solution, which can help rich players to craft alloys without being distracted by the constant ignition the block under the Smelter - Automatic Ignition Chamber

How it works:
In Guide Chamber looks like this:
image

Player places it at the Smelter as an usual Hopper:
image

And loads it with any amounts Flint'n Steels:
image
Note: For the convenience of players, content of the Chamber won't be output from it (Look new event hander in ItemListener.java)

So, when player uses the Smelter and flame must be extinguished, Ignition Chamber automatically ignites the block and decrease durability of the loaded Flint'n Stell and play fancy sound of using it.
But, when the durability of the Flint becomes 0, it breaks down (with sound)

And, when Chamber is installed, but no Flints loaded, player'll get this message:
image

AtomicScience added some commits Nov 15, 2017

@AtomicScience

This comment has been minimized.

Contributor

AtomicScience commented Nov 15, 2017

Oh, I almost forgot to show you the recipe of Chamber.
I tried to make it hard enough, so only rich players can craft it

The recipe is followng:
image

Where:
image - Steel Plate
image - Basic Circuit Board
image - Electromotor
image - Just a Hopper

@Poslovitch

Code is clean. However, a research must be added for this item ;)

AtomicScience added some commits Nov 15, 2017

@@ -601,7 +601,7 @@ public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
@Override
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.MAGIC_EYE_OF_ENDER, true)) {
e.setCancelled(true);
e.getParentEvent().setCancelled(true);

This comment has been minimized.

@Poslovitch

Poslovitch Nov 15, 2017

Contributor

This fix is not related to this PR, therefore it shouldn't have been pushed here. However, as this is already done, let's keep it.

AtomicScience and others added some commits Nov 15, 2017

atom
Added few more types of Jerky food - all vanilla types of meat and also
fish. Removed 'Saturation' effects and changed types of Jerky food
atom
Revert "Added few more types of Jerky food - all vanilla types of mea…
…t and also fish. Removed 'Saturation' effects and changed types of Jerky food"

This reverts commit 534ea6b.
@TheBusyBiscuit

This comment has been minimized.

Owner

TheBusyBiscuit commented Nov 15, 2017

The idea is great.
Haven't looked at the code yet but the lore sounds too much like a 90s tv commercial.
Would be nice if you would maybe make the lore shorter and just more objective about what it does.

@AtomicScience

This comment has been minimized.

Contributor

AtomicScience commented Nov 16, 2017

Okey, I changed lore of the Chamber a little.
Any other ideas?

P.S.
I wanna help you in Wiki translation. How can I do it?

}
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
if(isIgniteChamberInstalled) {

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

Please remove your boolean and use

BlockStorage.check(block, "IGNITION_CHAMBER")

instead.

if(resf.getInventory().contains(Material.FLINT_AND_STEEL)) {
ItemStack item = resf.getInventory().getItem(resf.getInventory().first(Material.FLINT_AND_STEEL));
item.setDurability((short) (item.getDurability() + 1));
if(item.getDurability() >= 64) {

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

Use getType().getMaxDurability() instead of 64, just in case Mojang changes it.

item.setDurability((short) (item.getDurability() + 1));
if(item.getDurability() >= 64) {
item.setAmount(0); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

item.setAmount(0) is called twice.

@@ -58,6 +59,13 @@ public ItemListener(SlimefunStartup plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onIgnitionChamberItemMove(InventoryMoveItemEvent e) {
if(e.getInitiator().getName().equalsIgnoreCase(SlimefunItems.IGNITION_CHAMBER.getItemMeta().getDisplayName()) && e.getInitiator().getType() == InventoryType.HOPPER) {

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

Just use

if (BlockStorage.check(block, "IGNITION_CHAMBER")) {

@@ -70,6 +70,7 @@ public static void setup() {
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
local.setDefault("machines.in-use", "&cThis Block's Inventory is currently opened by a different Player.");
local.setDefault("machines.ignition-chamber-no-flint", "&cAutomatic Ignition Chamber failed to ignite block because of no Flint'n steel found");

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

Suggested change:

"Ignition Chamber is missing Flint and Steel."

@@ -361,6 +361,7 @@
public static ItemStack GRIND_STONE = new CustomItem(Material.DISPENSER, "&bGrind Stone", 0, new String[] {"", "&a&oGrinds Items for more Efficiency"});
public static ItemStack ARMOR_FORGE = new CustomItem(Material.ANVIL, "&6Armor Forge", 0, new String[] {"", "&a&oGives you the Ability to create powerful Armor"});
public static ItemStack SMELTERY = new CustomItem(Material.FURNACE, "&6Smeltery", 0, new String[] {"", "&a&oActs as a high-temperature Furnace for Metals"});
public static ItemStack IGNITION_CHAMBER = new CustomItem(new ItemStack(Material.HOPPER), "&4Automatic Ignition Chamber", "&rAutomatically ignites the block under the Smelter,", "&ron which it's installed", "&e&oRequires Flint'n Steels to run");

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

It's Smeltery, not Smelter.
Also, a little misleading as it doesn't ignite the Block. It just prevents it from going out.

"Prevents the Smeltery from using up fire."
"Requires Flint and Steel"
"Must be placed adjacent to the Smeltery's dispenser"

@TheBusyBiscuit

This comment has been minimized.

Owner

TheBusyBiscuit commented Nov 20, 2017

Submitted a code review.

@AtomicScience
I always love to see new people work on the wiki, as the current team is more or less not doing anything.
However, don't take this personal, but I don't think that your English is suitable for official documentation.
But thank you nonetheless, also a great Block idea.

@TheBusyBiscuit

This comment has been minimized.

Owner

TheBusyBiscuit commented Nov 20, 2017

Another note: Is the Recipe too expensive?

I honestly lost track of balance in Slimefun, don't know if this isn't too much.

AtomicScience and others added some commits Nov 20, 2017

@AtomicScience

Well, I done it all. Any other suggestions?

p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
Block raw_disp = b.getRelative(BlockFace.DOWN);
Hopper resf = null;
boolean isIgnitionChamberInstalled = false;

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

You could just remove this boolean and check whether resf != null instead.

This comment has been minimized.

@TheBusyBiscuit

TheBusyBiscuit Nov 20, 2017

Owner

Also why is it named "resf" and not "chamber" or so?

This comment has been minimized.

@AtomicScience

AtomicScience Nov 20, 2017

Contributor

Because I borrowed this part of code from another SF machine

@TheBusyBiscuit

This comment has been minimized.

Owner

TheBusyBiscuit commented Nov 20, 2017

I would rather change the variable to 'chamber' 'resf' is a bit confusing.
After that, it should be ready to merge.

@TheBusyBiscuit TheBusyBiscuit merged commit fc58f91 into TheBusyBiscuit:master Nov 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment