Increased and change the chances for things, also fixed the small syntax error in the AdvancementTab

This commit is contained in:
MalekiRe 2021-06-10 00:10:59 -07:00
parent 2638d1ba5b
commit d1bc33123c
4 changed files with 22 additions and 11 deletions

View file

@ -113,7 +113,7 @@ public class AdvancementTab implements Consumer<Consumer<Advancement>> {
ModDimensions.DUNGEON, ModDimensions.DUNGEON,
null, null,
LightPredicate.ANY, LightPredicate.ANY,
BlockPredicate.Builder.create().block(Blocks.CHEST).build(), BlockPredicate.Builder.create().blocks(Blocks.CHEST).build(),
FluidPredicate.ANY FluidPredicate.ANY
), ),
new ItemPredicate( new ItemPredicate(

View file

@ -178,6 +178,8 @@ public final class ModConfig implements ConfigData {
@Tooltip public int armorDamageFray = 125; @Tooltip public int armorDamageFray = 125;
@Tooltip public int grayScreenFray = 175; @Tooltip public int grayScreenFray = 175;
@Tooltip public int unravelledStatueFray = 200; @Tooltip public int unravelledStatueFray = 200;
@Tooltip public int minFrayForTickFray = 125;
@Tooltip public int unravledFabricInInventoryFray = 150;
} }
} }

View file

@ -25,9 +25,9 @@ import java.util.Random;
@Mixin(value = PlayerEntity.class, priority = 900) @Mixin(value = PlayerEntity.class, priority = 900)
public abstract class PlayerEntityMixin extends LivingEntity { public abstract class PlayerEntityMixin extends LivingEntity {
private static final int RANDOM_ACTION_BOUND = 200; private static final int RANDOM_ACTION_BOUND = 400;
private static final int CHANCE_TO_DECREASE_ARMOR_DURABILITY = 10; private static final int CHANCE_TO_DECREASE_ARMOR_DURABILITY = 20;
private static final int CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC = 30; private static final int CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC = 10;
Random random = new Random(); Random random = new Random();
@Shadow @Shadow
@ -60,16 +60,24 @@ public abstract class PlayerEntityMixin extends LivingEntity {
} }
private void addRandomUnravledFabric(PlayerEntity player) { private void addRandomUnravledFabric(PlayerEntity player) {
if(random.nextInt(CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC) == 0) { if(PlayerModifiersComponent.getFray(player) < DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.unravledFabricInInventoryFray)
return;
if(random.nextInt(CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC) != 0)
return;
int slot = random.nextInt(player.getInventory().main.size()); int slot = random.nextInt(player.getInventory().main.size());
if(player.getInventory().main.get(slot).isEmpty() || player.getInventory().main.get(slot).getItem() == ModItems.UNRAVELLED_FABRIC) {
if(player.getInventory().main.get(slot).getCount() < 64) if(!player.getInventory().main.get(slot).isEmpty() && ! (player.getInventory().main.get(slot).getItem() == ModItems.UNRAVELLED_FABRIC))
player.getInventory().main.set(slot, new ItemStack(ModItems.UNRAVELLED_FABRIC, 1+player.getInventory().main.get(slot).getCount())); return;
} if (player.getInventory().main.get(slot).getCount() >= 64)
} return;
player.getInventory().main.set(slot, new ItemStack(ModItems.UNRAVELLED_FABRIC, 1 + player.getInventory().main.get(slot).getCount()));
} }
private void decreaseArmorDurability(PlayerEntity player) { private void decreaseArmorDurability(PlayerEntity player) {
if(PlayerModifiersComponent.getFray(player) < DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.unravledFabricInInventoryFray)
return;
for (int i = 0; i < player.getInventory().armor.size(); i++) for (int i = 0; i < player.getInventory().armor.size(); i++)
if (random.nextInt(CHANCE_TO_DECREASE_ARMOR_DURABILITY) == 0) if (random.nextInt(CHANCE_TO_DECREASE_ARMOR_DURABILITY) == 0)
player.getArmorItems().forEach((itemStack) -> { player.getArmorItems().forEach((itemStack) -> {

View file

@ -81,6 +81,7 @@ public class PlayerModifiersComponent implements ComponentV3, AutoSyncedComponen
player.kill(); player.kill();
//Fray should be reset by mixinging into the player class and changing the kill event or some other funciton that happens when a player dies. //Fray should be reset by mixinging into the player class and changing the kill event or some other funciton that happens when a player dies.
//This is just temporary //This is just temporary
//On second thought, this should get rid of fray, and fray should stay with the player otherwise, that way they have to actively try to get rid of it without just like, dying.
resetFray(player); resetFray(player);
player.getEntityWorld().setBlockState(player.getBlockPos(), ModBlocks.STONE_PLAYER.getDefaultState(), 3); player.getEntityWorld().setBlockState(player.getBlockPos(), ModBlocks.STONE_PLAYER.getDefaultState(), 3);
} }