Skip to content

Commit

Permalink
Updating some reward setting
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTurkeyDev committed May 20, 2021
1 parent 7c81228 commit cf51357
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void trigger(final ServerWorld world, final BlockPos pos, final PlayerEnt

RewardsUtil.placeBlock(Blocks.CAKE.getDefaultState(), world, pos);

final int lieChance = super.getSettingAsInt(settings, "lie_chance", 10, 0, 100);
final int lieChance = super.getSettingAsInt(settings, "lieChance", 10, 0, 100);

if(RewardsUtil.rand.nextInt(3) == 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ public void trigger(ServerWorld world, BlockPos pos, PlayerEntity player, JsonOb
int maxHeight = minHeight - super.getSettingAsInt(settings, "maxHeight", 13, 1, 50);
if(maxHeight < 1)
maxHeight = 1;

//Because someone will do it...
if(minHeight > maxHeight)
{
int swap = minHeight;
minHeight = maxHeight;
maxHeight = swap;
}

int height = RewardsUtil.rand.nextInt(maxHeight) + minHeight;
Entity last;
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public void trigger(ServerWorld world, BlockPos pos, final PlayerEntity player,
world.addEntity(entitytntprimed);
world.playSound(player, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);

int outOf = super.getSettingAsInt(settings, "realOutOf", 5, 1, 1000);
int outOf = super.getSettingAsInt(settings, "isReal", 2, 0, 100);

if(RewardsUtil.rand.nextInt(outOf) != 1)
if(RewardsUtil.rand.nextInt(100) < outOf)
{
Scheduler.scheduleTask(new Task("TrollTNT", 77)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ public void trigger(final ServerWorld world, BlockPos pos, final PlayerEntity pl
int maxDuration = minDuration - super.getSettingAsInt(settings, "maxDuration", 5000, 1, Integer.MAX_VALUE);
if(maxDuration < 1)
maxDuration = 1;
//Because someone will do it...
if(minDuration > maxDuration)
{
int swap = minDuration;
minDuration = maxDuration;
maxDuration = swap;
}

Scheduler.scheduleTask(new Task("Wait For It", RewardsUtil.rand.nextInt(maxDuration) + minDuration)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public WitherReward()
@Override
public void trigger(ServerWorld world, BlockPos pos, final PlayerEntity player, JsonObject settings)
{
int realOutOf = super.getSettingAsInt(settings, "realOutOf", 10, 1, Integer.MAX_VALUE);
int isReal = super.getSettingAsInt(settings, "isReal", 10, 0, 100);
final WitherEntity wither = EntityType.WITHER.create(world);
wither.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 1.5D, 90.0F, 0.0F);
wither.renderYawOffset = 90.0F;
Expand All @@ -47,7 +47,7 @@ public void callback()

private boolean removeEnts(Entity ent)
{
if(RewardsUtil.rand.nextInt(realOutOf) != 1)
if(RewardsUtil.rand.nextInt(100) < isReal)
{
ent.remove();
return true;
Expand Down

0 comments on commit cf51357

Please sign in to comment.