Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Apr 28, 2024
1 parent 917a1f6 commit f35439c
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 84 deletions.
58 changes: 29 additions & 29 deletions src/main/java/net/id/paradiselost/blocks/BlockRegistration.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ static class ParadiseLostStairsBlock extends StairsBlock {

public static WoodBlockSet registerWoodBlockSet(String id, SaplingGenerator saplingGenerator, MapColor woodColor, MapColor barkColor, MapColor leafColor) {
return registerWoodBlockSet(
id+"_sapling", "potted_"+id+"_sapling",
id+"_log", id+"_wood", "stripped_"+id+"_log", "stripped_"+id+"_wood",
id+"_leaves",
id+"_planks", id+"_stairs",id+"_slab",
id+"_fence",id+"_fence_gate",
id+"_door",id+"_trapdoor",
id+"_button",id+"_pressure_plate",
id + "_sapling", "potted_" + id + "_sapling",
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
id + "_leaves",
id + "_planks", id + "_stairs", id + "_slab",
id + "_fence", id + "_fence_gate",
id + "_door", id + "_trapdoor",
id + "_button", id + "_pressure_plate",
saplingGenerator, woodColor, barkColor, leafColor
);
}
Expand All @@ -76,32 +76,32 @@ public static WoodBlockSet registerWoodBlockSetMotherAurel() {
var saplingSettings = AbstractBlock.Settings.copy(Blocks.OAK_SAPLING).mapColor(MapColor.GOLD).luminance(state -> 3);
var flowerPotSettings = AbstractBlock.Settings.copy(Blocks.POTTED_OAK_SAPLING).luminance(state -> 3);
var leavesSettings = AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).mapColor(MapColor.GOLD).luminance(state -> 5);
SaplingBlock sapling = add(id+"_sapling", new ParadiseLostSaplingBlock(new MotherAurelSaplingGenerator(), saplingSettings));
SaplingBlock sapling = add(id + "_sapling", new ParadiseLostSaplingBlock(new MotherAurelSaplingGenerator(), saplingSettings));
return registerWoodBlockSet(
sapling,
add("potted_"+id+"_sapling", new FlowerPotBlock(sapling, flowerPotSettings)),
id+"_log", id+"_wood", "stripped_"+id+"_log", "stripped_"+id+"_wood",
add(id+"_leaves", new ParadiseLostLeavesBlock(leavesSettings, true), flammableLeaves, cutoutMippedRenderLayer),
id+"_planks", id+"_stairs",id+"_slab",
id+"_fence",id+"_fence_gate",
id+"_door",id+"_trapdoor",
id+"_button",id+"_pressure_plate",
add("potted_" + id + "_sapling", new FlowerPotBlock(sapling, flowerPotSettings)),
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
add(id + "_leaves", new ParadiseLostLeavesBlock(leavesSettings, true), flammableLeaves, cutoutMippedRenderLayer),
id + "_planks", id + "_stairs", id + "_slab",
id + "_fence", id + "_fence_gate",
id + "_door", id + "_trapdoor",
id + "_button", id + "_pressure_plate",
MapColor.GOLD, MapColor.TERRACOTTA_RED
);
}

public static WoodBlockSet registerWoodBlockSetOrange() {
String id = "orange";
var leavesSettings = AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).mapColor(MapColor.PALE_GREEN).sounds(BlockSoundGroup.AZALEA_LEAVES);
FruitingLeavesBlock leaves = add(id+"_leaves", new FruitingLeavesBlock(leavesSettings, () -> ParadiseLostItems.ORANGE), flammableLeaves, cutoutMippedRenderLayer);
FruitingLeavesBlock leaves = add(id + "_leaves", new FruitingLeavesBlock(leavesSettings, () -> ParadiseLostItems.ORANGE), flammableLeaves, cutoutMippedRenderLayer);
return registerWoodBlockSet(
id+"_sapling", "potted_"+id+"_sapling",
id+"_log", id+"_wood", "stripped_"+id+"_log", "stripped_"+id+"_wood",
id + "_sapling", "potted_" + id + "_sapling",
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
leaves,
id+"_planks", id+"_stairs",id+"_slab",
id+"_fence",id+"_fence_gate",
id+"_door",id+"_trapdoor",
id+"_button",id+"_pressure_plate",
id + "_planks", id + "_stairs", id + "_slab",
id + "_fence", id + "_fence_gate",
id + "_door", id + "_trapdoor",
id + "_button", id + "_pressure_plate",
new OrangeSaplingGenerator(), MapColor.TERRACOTTA_LIGHT_GRAY, MapColor.RAW_IRON_PINK
);
}
Expand All @@ -110,12 +110,12 @@ public static WoodBlockSet registerWoodBlockSetWisteria() {
String id = "wisteria";
return registerWoodBlockSet(
null, null,
id+"_log", id+"_wood", "stripped_"+id+"_log", "stripped_"+id+"_wood",
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
null,
id+"_planks", id+"_stairs",id+"_slab",
id+"_fence",id+"_fence_gate",
id+"_door",id+"_trapdoor",
id+"_button",id+"_pressure_plate",
id + "_planks", id + "_stairs", id + "_slab",
id + "_fence", id + "_fence_gate",
id + "_door", id + "_trapdoor",
id + "_button", id + "_pressure_plate",
MapColor.PALE_YELLOW, MapColor.BROWN
);
}
Expand Down Expand Up @@ -229,7 +229,7 @@ public record WoodBlockSet(
FenceBlock fence, FenceGateBlock fenceGate,
DoorBlock door, TrapdoorBlock trapdoor,
WoodenButtonBlock button, PressurePlateBlock pressurePlate
) implements Iterable<Block> {
) implements Iterable<Block> {
public @NotNull Iterator<Block> iterator() {
return Arrays.stream(new Block[]{
sapling, flowerPot,
Expand Down Expand Up @@ -266,7 +266,7 @@ public record SignSet(
SignType type,
SignBlock sign,
WallSignBlock wallSign
) implements Iterable<Block> {
) implements Iterable<Block> {
public @NotNull Iterator<Block> iterator() {
return Arrays.stream(new Block[]{sign, wallSign}).iterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.id.paradiselost.ParadiseLost;
import net.id.paradiselost.blocks.decorative.*;
import net.id.paradiselost.blocks.mechanical.CherineCampfireBlock;
import net.id.paradiselost.blocks.mechanical.FoodBowlBlock;
Expand All @@ -26,11 +25,9 @@
import net.id.paradiselost.blocks.natural.plant.*;
import net.id.paradiselost.blocks.natural.tree.*;
import net.id.paradiselost.fluids.ParadiseLostFluids;
import net.id.paradiselost.items.ParadiseLostItems;
import net.id.paradiselost.registry.ParadiseLostRegistryQueues;
import net.id.paradiselost.tag.ParadiseLostBlockTags;
import net.id.paradiselost.world.feature.tree.generator.*;
import net.id.incubus_core.util.RegistryQueue.Action;
import net.minecraft.block.*;
import net.minecraft.block.AbstractBlock.Settings;
import net.minecraft.client.render.TexturedRenderLayers;
Expand All @@ -40,12 +37,10 @@
import net.minecraft.tag.BlockTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.util.registry.Registry;
import java.util.List;

import static net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings.copy;
import static net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings.of;
import static net.id.paradiselost.ParadiseLost.locate;
import static net.id.paradiselost.blocks.ParadiseLostBlockActions.*;
import static net.minecraft.block.Blocks.*;
import static net.id.paradiselost.blocks.BlockRegistration.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import net.minecraft.util.Hand;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class FoodBowlBlockEntity extends BlockEntity {
private final DefaultedList<ItemStack> inventory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void ignite(World world, BlockPos pos, float power) {
}

private static void ignite(World world, BlockPos pos, float power, @Nullable LivingEntity igniter) {
Explosion explosion = new Explosion(world, igniter, null, null, pos.getX(), pos.getY()+0.5D, pos.getZ(), power, false, Explosion.DestructionType.BREAK);
Explosion explosion = new Explosion(world, igniter, null, null, pos.getX(), pos.getY() + 0.5D, pos.getZ(), power, false, Explosion.DestructionType.BREAK);
if (!world.isClient) {
explosion.collectBlocksAndDamageEntities();
world.emitGameEvent(igniter, GameEvent.PRIME_FUSE, pos);
Expand Down Expand Up @@ -95,7 +95,7 @@ public void onProjectileHit(World world, BlockState state, BlockHitResult hit, P
BlockPos blockPos = hit.getBlockPos();
Entity entity = projectile.getOwner();
if (projectile.isOnFire() && projectile.canModifyAt(world, blockPos)) {
ignite(world, blockPos, 2F, entity instanceof LivingEntity ? (LivingEntity)entity : null);
ignite(world, blockPos, 2F, entity instanceof LivingEntity ? (LivingEntity) entity : null);
world.removeBlock(blockPos, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Pair;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import static net.id.paradiselost.ParadiseLost.locate;
import static net.minecraft.entity.EntityDimensions.changing;
import static net.minecraft.entity.EntityDimensions.fixed;
import static net.minecraft.entity.SpawnGroup.*;

@SuppressWarnings({"unused", "SameParameterValue"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
import net.id.paradiselost.util.EnumExtender;
import net.minecraft.block.Block;
import net.minecraft.block.DoorBlock;
import net.minecraft.block.SignBlock;
import net.minecraft.block.TallFlowerBlock;
import net.minecraft.block.TallPlantBlock;
import net.minecraft.block.WallSignBlock;
import net.minecraft.entity.vehicle.BoatEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.*;
Expand All @@ -34,7 +31,6 @@
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Rarity;
import net.minecraft.util.SignType;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
Expand Down Expand Up @@ -500,7 +496,7 @@ public record BoatSet(
BoatEntity.Type type,
BoatItem boat,
BoatItem chestBoat
) implements Iterable<Item> {
) implements Iterable<Item> {
public @NotNull Iterator<Item> iterator() {
return Arrays.stream(new Item[]{boat, chestBoat}).iterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public abstract class BoatEntityMixin {
private void checkCustomBoats(CallbackInfoReturnable<Item> cir) {
BoatEntity.Type type = this.getBoatType();
if (type != BoatEntity.Type.OAK) {
for (var entry : ParadiseLostItems.BOAT_SETS){
if (type == entry.type()){
for (var entry : ParadiseLostItems.BOAT_SETS) {
if (type == entry.type()) {
cir.setReturnValue(entry.boat());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.world.World;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
Expand All @@ -24,8 +23,8 @@ public ChestBoatEntityMixin(EntityType<? extends BoatEntity> entityType, World w
private void checkCustomBoats(CallbackInfoReturnable<Item> cir) {
BoatEntity.Type type = this.getBoatType();
if (type != BoatEntity.Type.OAK) {
for (var entry : ParadiseLostItems.BOAT_SETS){
if (type == entry.type()){
for (var entry : ParadiseLostItems.BOAT_SETS) {
if (type == entry.type()) {
cir.setReturnValue(entry.chestBoat());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package net.id.paradiselost.mixin.entity;

import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Entity.class)
public abstract class EntityMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
35 changes: 13 additions & 22 deletions src/main/java/net/id/paradiselost/mixin/world/ExplosionMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
Expand All @@ -21,7 +20,6 @@
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
Expand All @@ -31,11 +29,6 @@
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.List;

@Mixin(Explosion.class)
public abstract class ExplosionMixin extends Object implements ExplosionExtensions {
Expand Down Expand Up @@ -105,17 +98,17 @@ public void affectWorld(boolean particles, SoundEvent customSound) {
Util.shuffle(this.affectedBlocks, this.world.random);
ObjectListIterator var5 = this.affectedBlocks.iterator();

while(var5.hasNext()) {
BlockPos blockPos = (BlockPos)var5.next();
while (var5.hasNext()) {
BlockPos blockPos = (BlockPos) var5.next();
BlockState blockState = this.world.getBlockState(blockPos);
Block block = blockState.getBlock();
if (!blockState.isAir()) {
BlockPos blockPos2 = blockPos.toImmutable();
this.world.getProfiler().push("explosion_blocks");
if (block.shouldDropItemsOnExplosion((Explosion) (Object)this)) {
if (block.shouldDropItemsOnExplosion((Explosion) (Object) this)) {
World var11 = this.world;
if (var11 instanceof ServerWorld) {
ServerWorld serverWorld = (ServerWorld)var11;
ServerWorld serverWorld = (ServerWorld) var11;
BlockEntity blockEntity = blockState.hasBlockEntity() ? this.world.getBlockEntity(blockPos) : null;
LootContext.Builder builder = (new LootContext.Builder(serverWorld)).random(this.world.random).parameter(LootContextParameters.ORIGIN, Vec3d.ofCenter(blockPos)).parameter(LootContextParameters.TOOL, ItemStack.EMPTY).optionalParameter(LootContextParameters.BLOCK_ENTITY, blockEntity).optionalParameter(LootContextParameters.THIS_ENTITY, this.entity);
if (this.destructionType == Explosion.DestructionType.DESTROY) {
Expand All @@ -130,24 +123,22 @@ public void affectWorld(boolean particles, SoundEvent customSound) {
}

this.world.setBlockState(blockPos, Blocks.AIR.getDefaultState(), 3);
block.onDestroyedByExplosion(this.world, blockPos, (Explosion) (Object)this);
block.onDestroyedByExplosion(this.world, blockPos, (Explosion) (Object) this);
this.world.getProfiler().pop();
}
}

var5 = objectArrayList.iterator();

while(var5.hasNext()) {
Pair<ItemStack, BlockPos> pair = (Pair)var5.next();
Block.dropStack(this.world, (BlockPos)pair.getSecond(), (ItemStack)pair.getFirst());
while (var5.hasNext()) {
Pair<ItemStack, BlockPos> pair = (Pair) var5.next();
Block.dropStack(this.world, pair.getSecond(), pair.getFirst());
}
}

if (this.createFire) {
ObjectListIterator var13 = this.affectedBlocks.iterator();

while(var13.hasNext()) {
BlockPos blockPos3 = (BlockPos)var13.next();
for (BlockPos blockPos3 : this.affectedBlocks) {
if (this.random.nextInt(3) == 0 && this.world.getBlockState(blockPos3).isAir() && this.world.getBlockState(blockPos3.down()).isOpaqueFullCube(this.world, blockPos3.down())) {
this.world.setBlockState(blockPos3, AbstractFireBlock.getState(this.world, blockPos3));
}
Expand All @@ -159,12 +150,12 @@ public void affectWorld(boolean particles, SoundEvent customSound) {
private static void tryMergeStack(ObjectArrayList<Pair<ItemStack, BlockPos>> stacks, ItemStack stack, BlockPos pos) {
int i = stacks.size();

for(int j = 0; j < i; ++j) {
Pair<ItemStack, BlockPos> pair = (Pair)stacks.get(j);
ItemStack itemStack = (ItemStack)pair.getFirst();
for (int j = 0; j < i; ++j) {
Pair<ItemStack, BlockPos> pair = stacks.get(j);
ItemStack itemStack = pair.getFirst();
if (ItemEntity.canMerge(itemStack, stack)) {
ItemStack itemStack2 = ItemEntity.merge(itemStack, stack, 16);
stacks.set(j, Pair.of(itemStack2, (BlockPos)pair.getSecond()));
stacks.set(j, Pair.of(itemStack2, pair.getSecond()));
if (stack.isEmpty()) {
return;
}
Expand Down

0 comments on commit f35439c

Please sign in to comment.