Skip to content

Commit

Permalink
Campfire Spit Blacklist/Whitelist, Bump Version
Browse files Browse the repository at this point in the history
Campfire Spit blacklist and whitelist support

Bump to 0.3.4
  • Loading branch information
Charles445 committed Nov 12, 2020
1 parent a92a4bd commit 5231fc7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'


version = "1.12.2-0.3.3"
version = "1.12.2-0.3.4"
group = "com.charles445.simpledifficulty" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "SimpleDifficulty"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.charles445.simpledifficulty.config;


import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import com.charles445.simpledifficulty.SimpleDifficulty;
import com.charles445.simpledifficulty.api.config.ClientConfig;
import com.charles445.simpledifficulty.api.config.ClientOptions;
Expand Down Expand Up @@ -115,6 +119,14 @@ public class ConfigMiscellaneous
@Config.Name("CampfireSpitExperience")
public boolean campfireSpitExperience = true;

@Config.Comment("Blacklisted items in the campfire spit (ex. minecraft:beef")
@Config.Name("CampfireSpitBlacklist")
public String[] campfireSpitBlacklist = new String[0];

@Config.Comment("Whether the campfire spit blacklist is a whitelist instead")
@Config.Name("CampfireSpitBlacklistIsWhitelist")
public boolean campfireSpitBlacklistIsWhitelist = false;

@Config.Comment("Whether Golden Apple Juice gives the golden apple effect")
@Config.Name("GoldenAppleJuiceEffect")
public boolean goldenAppleJuiceEffect = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,43 @@ public void handleRightClick(World world, BlockPos pos, IBlockState state, Entit
//Deposit
if(!withdrewToHand && isCookable(heldItemStack))
{
for(int i=0; i < items.getSlots(); i++)
//Check the blacklist
String heldItemName = heldItemStack.getItem().getRegistryName().toString();
boolean isBlacklisted = false;
String[] spitBlacklist = ModConfig.server.miscellaneous.campfireSpitBlacklist;
for(int i = 0; i < spitBlacklist.length; i++)
{
if(items.getStackInSlot(i).isEmpty())
if(spitBlacklist[i].equals(heldItemName))
{
//Insert and break
items.insertItem(i, new ItemStack(heldItemStack.getItem(), 1, heldItemStack.getItemDamage()), false);
heldItemStack.shrink(1);

//Reset Progress
//TODO individual slot progress? lol
progress = 0;

if(!playedSound)
playedSound = playWorldSound(world, pos, true);
found = true;
isBlacklisted = true;
break;
}
}

//If it's in the blacklist, but it's a whitelist, then it's acceptable
//If it's not in the blacklist, and it's a blacklist, it's also acceptable

if(isBlacklisted == ModConfig.server.miscellaneous.campfireSpitBlacklistIsWhitelist)
{
for(int i=0; i < items.getSlots(); i++)
{
if(items.getStackInSlot(i).isEmpty())
{
//Insert and break
items.insertItem(i, new ItemStack(heldItemStack.getItem(), 1, heldItemStack.getItemDamage()), false);
heldItemStack.shrink(1);

//Reset Progress
//TODO individual slot progress? lol
progress = 0;

if(!playedSound)
playedSound = playWorldSound(world, pos, true);
found = true;
break;
}
}
}
}

if(!found && rawWithdraw && player.isSneaking())
Expand Down

0 comments on commit 5231fc7

Please sign in to comment.