Remove useless passing of 1|2 to setblockstate

This commit is contained in:
Vincent Lee committed 2020-01-31 12:59:33 -06:00
1 parent d68f34fcfe
commit ef79dc7507
14 files changed
+19 -19

No files matched your search

@@ -63,7 +63,7 @@ public class BlockAltGrass extends BlockMod {
ItemStack held = player.getHeldItem(hand);
if(held.getItem() instanceof HoeItem && world.isAirBlock(pos.up())) {
held.damageItem(1, player, e -> e.sendBreakAnimation(hand));
world.setBlockState(pos, Blocks.FARMLAND.getDefaultState(), 1 | 2);
world.setBlockState(pos, Blocks.FARMLAND.getDefaultState());
return ActionResultType.SUCCESS;
}
@@ -114,7 +114,7 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
@Override
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
if(state.get(BotaniaStateProps.POWERED))
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false));
}
@Override
@@ -81,7 +81,7 @@ public class BlockLightRelay extends BlockMod implements IWandable {
@Override
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false));
}
@Override
@@ -151,7 +151,7 @@ public class BlockSpecialFlower extends FlowerBlock implements IWandable, IWandH
DyeColor newColor = ((ItemDye) stack.getItem()).color;
DyeColor oldColor = state.get(BotaniaStateProps.COLOR);
if(newColor != oldColor)
world.setBlockState(pos, state.with(BotaniaStateProps.COLOR, newColor), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.COLOR, newColor));
return ActionResultType.SUCCESS;
}
@@ -91,9 +91,9 @@ public class BlockPrism extends BlockMod implements IManaTrigger, IManaCollision
if(!world.isRemote) {
if(power && !powered)
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true));
else if(!power && powered)
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false));
}
}
@@ -61,7 +61,7 @@ public class BlockRedStringInterceptor extends BlockRedString {
@Override
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random update) {
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false));
}
@Override
@@ -52,7 +52,7 @@ public class SubTileKekimurus extends TileEntityGeneratingFlower {
int nextSlicesEaten = state.get(CakeBlock.BITES) + 1;
if(nextSlicesEaten > 6)
getWorld().removeBlock(pos, false);
else getWorld().setBlockState(pos, state.with(CakeBlock.BITES, nextSlicesEaten), 1 | 2);
else getWorld().setBlockState(pos, state.with(CakeBlock.BITES, nextSlicesEaten));
getWorld().playEvent(2001, pos, Block.getStateId(state));
getWorld().playSound(null, getEffectivePos(), SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.BLOCKS, 1F, 0.5F + (float) Math.random() * 0.5F);
@@ -136,7 +136,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
}
if(closeNow) {
world.setBlockState(getPos(), ModBlocks.alfPortal.getDefaultState(), 1 | 2);
world.setBlockState(getPos(), ModBlocks.alfPortal.getDefaultState());
for(int i = 0; i < 36; i++)
blockParticle(state);
closeNow = false;
@@ -144,7 +144,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
if(newState == AlfPortalState.OFF)
for(int i = 0; i < 36; i++)
blockParticle(state);
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState), 1 | 2);
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState));
} else if(explode) {
world.createExplosion(null, pos.getX() + .5, pos.getY() + 2.0, pos.getZ() + .5,
3f, Explosion.Mode.DESTROY);
@@ -193,7 +193,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
if(state == AlfPortalState.OFF) {
AlfPortalState newState = getValidState();
if(newState != AlfPortalState.OFF) {
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState), 1 | 2);
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState));
return true;
}
}
@@ -84,7 +84,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
for(RecipeBrew recipe : BotaniaAPI.brewRecipes.values())
if(recipe.matches(itemHandler) && !recipe.getOutput(itemHandler.getStackInSlot(0)).isEmpty()) {
this.recipe = recipe;
world.setBlockState(pos, ModBlocks.brewery.getDefaultState().with(BotaniaStateProps.POWERED, true), 1 | 2);
world.setBlockState(pos, ModBlocks.brewery.getDefaultState().with(BotaniaStateProps.POWERED, true));
}
}
@@ -97,7 +97,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
for(RecipeBrew recipe : BotaniaAPI.brewRecipes.values())
if(recipe.matches(itemHandler)) {
this.recipe = recipe;
world.setBlockState(pos, ModBlocks.brewery.getDefaultState().with(BotaniaStateProps.POWERED, true), 1 | 2);
world.setBlockState(pos, ModBlocks.brewery.getDefaultState().with(BotaniaStateProps.POWERED, true));
}
if(recipe == null)
@@ -119,7 +119,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
if(recipe != null) {
if(!recipe.matches(itemHandler)) {
recipe = null;
world.setBlockState(pos, ModBlocks.brewery.getDefaultState(), 1 | 2);
world.setBlockState(pos, ModBlocks.brewery.getDefaultState());
}
if(recipe != null) {
@@ -60,7 +60,7 @@ public class TileEnderEye extends TileMod implements ITickableTileEntity {
}
if(looking != wasLooking)
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, looking), 1 | 2);
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, looking));
}
}
@@ -106,7 +106,7 @@ public class EntityVineBall extends ThrowableEntity implements IRendersAsItem {
if(first && !stateSet.isValidPosition(world, pos)) break;
first = false;
world.setBlockState(pos, stateSet, 1 | 2);
world.setBlockState(pos, stateSet);
world.playEvent(2001, pos, Block.getStateId(stateSet));
pos = pos.down();
} else break;
@@ -111,7 +111,7 @@ public class ItemTwigWand extends Item implements ICoordBoundItem {
if(axis != null) {
if(!world.isRemote) {
world.setBlockState(pos, ModBlocks.enchanter.getDefaultState().with(BotaniaStateProps.ENCHANTER_DIRECTION, axis), 1 | 2);
world.setBlockState(pos, ModBlocks.enchanter.getDefaultState().with(BotaniaStateProps.ENCHANTER_DIRECTION, axis));
world.playSound(null, pos, ModSounds.enchanterForm, SoundCategory.BLOCKS, 0.5F, 0.6F);
PlayerHelper.grantCriterion((ServerPlayerEntity) ctx.getPlayer(), new ResourceLocation(LibMisc.MOD_ID, "main/enchanter_make"), "code_triggered");
} else {
@@ -41,7 +41,7 @@ public class LensPiston extends Lens {
if(state.getPushReaction() == PushReaction.NORMAL && state.getBlock() != Blocks.OBSIDIAN
&& state.getBlockHardness(entity.world, pos_) >= 0 && tile == null) {
entity.world.destroyBlock(rtr.getPos(), false);
entity.world.setBlockState(pos_, state, 1 | 2);
entity.world.setBlockState(pos_, state);
}
}
}
@@ -211,7 +211,7 @@ public class ItemExchangeRod extends Item implements IManaUsingItem, IWireframeC
if(!player.abilities.isCreativeMode) {
removeFromInventory(player, stack, state.getBlock(), true);
}
world.setBlockState(pos, state, 1 | 2);
world.setBlockState(pos, state);
state.getBlock().onBlockPlacedBy(world, pos, state, player, placeStack);
}
displayRemainderCounter(player, stack);