Skip to content

Commit

Permalink
Make the config option that enables/disables it actually do something.
Browse files Browse the repository at this point in the history
  • Loading branch information
Claycorp committed Nov 27, 2022
1 parent 2e40e8d commit 5c9e61a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {


group = 'net.doubledoordev'
version = '1.0.0'
version = '1.0.0.1'

java {
archivesBaseName = 'paininmyglass'
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/net/doubledoordev/paininmyglass/Paininmyglass.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
@Mod("paininmyglass")
public class Paininmyglass
{

// Directly reference a slf4j logger
private static final Logger LOGGER = LogUtils.getLogger();
Random random;

public Paininmyglass()
{

ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, PaininMyGlassConfig.spec);
MinecraftForge.EVENT_BUS.register(this);

Expand All @@ -42,13 +40,16 @@ public Paininmyglass()
@SubscribeEvent
public void closeContainer(PlayerContainerEvent.Close event)
{
NonNullList<Slot> slots = event.getContainer().slots;
List<? extends String> nameOptions = PaininMyGlassConfig.SERVER.itemNames.get();

for (Slot slot : slots)
if (PaininMyGlassConfig.SERVER.isItOn.get())
{
if (!slot.hasItem() && random.nextDouble() < PaininMyGlassConfig.SERVER.chanceForPane.get())
slot.set(new ItemStack(Items.LIGHT_GRAY_STAINED_GLASS_PANE).setHoverName(new TextComponent(nameOptions.get(random.nextInt(nameOptions.size())))));
NonNullList<Slot> slots = event.getContainer().slots;
List<? extends String> nameOptions = PaininMyGlassConfig.SERVER.itemNames.get();

for (Slot slot : slots)
{
if (!slot.hasItem() && random.nextDouble() < PaininMyGlassConfig.SERVER.chanceForPane.get())
slot.set(new ItemStack(Items.LIGHT_GRAY_STAINED_GLASS_PANE).setHoverName(new TextComponent(nameOptions.get(random.nextInt(nameOptions.size())))));
}
}
}
}

0 comments on commit 5c9e61a

Please sign in to comment.