Skip to content

Commit f3399f3

Browse files
committed
Whitespace changes.
1 parent 36c813c commit f3399f3

File tree

120 files changed

+2555
-2555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+2555
-2555
lines changed

src/main/java/net/darkhax/bookshelf/block/DisplayableBlockState.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,119 +22,119 @@
2222
import net.minecraftforge.api.distmarker.OnlyIn;
2323

2424
public class DisplayableBlockState {
25-
25+
2626
public static ISerializer<DisplayableBlockState> SERIALIZER = new Serializer();
27-
27+
2828
private BlockState state;
2929
private Optional<Vector3f> scale;
3030
private Optional<Vector3f> offset;
3131
private boolean renderFluid;
32-
33-
public DisplayableBlockState (BlockState state) {
34-
32+
33+
public DisplayableBlockState(BlockState state) {
34+
3535
this(state, Optional.empty(), Optional.empty(), true);
3636
}
37-
38-
public DisplayableBlockState (BlockState state, Optional<Vector3f> scale, Optional<Vector3f> offset, boolean renderFluid) {
39-
37+
38+
public DisplayableBlockState(BlockState state, Optional<Vector3f> scale, Optional<Vector3f> offset, boolean renderFluid) {
39+
4040
this.state = state;
4141
this.scale = scale;
4242
this.offset = offset;
4343
this.renderFluid = renderFluid;
4444
}
45-
45+
4646
public BlockState getState () {
47-
47+
4848
return this.state;
4949
}
50-
50+
5151
public void setState (BlockState state) {
52-
52+
5353
this.state = state;
5454
}
55-
55+
5656
public Optional<Vector3f> getScale () {
57-
57+
5858
return this.scale;
5959
}
60-
60+
6161
public void setScale (Optional<Vector3f> scale) {
62-
62+
6363
this.scale = scale;
6464
}
65-
65+
6666
public Optional<Vector3f> getOffset () {
67-
67+
6868
return this.offset;
6969
}
70-
70+
7171
public void setOffset (Optional<Vector3f> offset) {
72-
72+
7373
this.offset = offset;
7474
}
75-
75+
7676
public boolean isRenderFluid () {
77-
77+
7878
return this.renderFluid;
7979
}
80-
80+
8181
public void setRenderFluid (boolean renderFluid) {
82-
82+
8383
this.renderFluid = renderFluid;
8484
}
85-
85+
8686
@OnlyIn(Dist.CLIENT)
8787
public void render (World world, BlockPos pos, MatrixStack matrix, IRenderTypeBuffer buffer, int light, int overlay, Direction... preferredSides) {
88-
88+
8989
matrix.pushPose();
9090
this.getScale().ifPresent(vec -> matrix.scale(vec.x(), vec.y(), vec.z()));
9191
this.getOffset().ifPresent(vec -> matrix.translate(vec.x(), vec.y(), vec.z()));
9292
RenderUtils.renderState(this.state, world, pos, matrix, buffer, light, overlay, this.renderFluid, preferredSides);
9393
matrix.popPose();
9494
}
95-
95+
9696
static class Serializer implements ISerializer<DisplayableBlockState> {
97-
97+
9898
@Override
9999
public DisplayableBlockState read (JsonElement json) {
100-
100+
101101
if (json.isJsonObject()) {
102-
102+
103103
final JsonObject obj = json.getAsJsonObject();
104104
final BlockState state = Serializers.BLOCK_STATE.read(obj);
105105
final Optional<Vector3f> scale = Serializers.VEC3F.readOptional(obj, "scale");
106106
final Optional<Vector3f> offset = Serializers.VEC3F.readOptional(obj, "offset");
107107
final boolean renderFluid = Serializers.BOOLEAN.read(obj, "renderFluid", true);
108108
return new DisplayableBlockState(state, scale, offset, renderFluid);
109109
}
110-
110+
111111
throw new JsonParseException("Expected properties to be an object. Recieved " + JSONUtils.getType(json));
112112
}
113-
113+
114114
@Override
115115
public JsonElement write (DisplayableBlockState toWrite) {
116-
116+
117117
final JsonElement json = Serializers.BLOCK_STATE.write(toWrite.getState());
118118
final JsonObject obj = (JsonObject) json;
119119
toWrite.getScale().ifPresent(v -> obj.add("scale", Serializers.VEC3F.writeOptional(toWrite.getScale())));
120120
toWrite.getOffset().ifPresent(v -> obj.add("offset", Serializers.VEC3F.writeOptional(toWrite.getOffset())));
121121
obj.addProperty("renderFluid", toWrite.isRenderFluid());
122122
return obj;
123123
}
124-
124+
125125
@Override
126126
public DisplayableBlockState read (PacketBuffer buffer) {
127-
127+
128128
final BlockState state = Serializers.BLOCK_STATE.read(buffer);
129129
final Optional<Vector3f> scale = Serializers.VEC3F.readOptional(buffer);
130130
final Optional<Vector3f> offset = Serializers.VEC3F.readOptional(buffer);
131131
final boolean renderFluid = Serializers.BOOLEAN.read(buffer);
132132
return new DisplayableBlockState(state, scale, offset, renderFluid);
133133
}
134-
134+
135135
@Override
136136
public void write (PacketBuffer buffer, DisplayableBlockState toWrite) {
137-
137+
138138
Serializers.BLOCK_STATE.write(buffer, toWrite.getState());
139139
Serializers.VEC3F.writeOptional(buffer, toWrite.getScale());
140140
Serializers.VEC3F.writeOptional(buffer, toWrite.getOffset());

src/main/java/net/darkhax/bookshelf/block/IBookshelfBlock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import net.minecraft.item.Item;
66

77
public interface IBookshelfBlock {
8-
8+
99
@Nullable
1010
default Item.Properties getItemBlockProperties () {
11-
11+
1212
return new Item.Properties();
1313
}
1414
}

src/main/java/net/darkhax/bookshelf/block/tileentity/TileEntityBasic.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,100 +22,100 @@
2222
import net.minecraftforge.common.util.Constants.BlockFlags;
2323

2424
public abstract class TileEntityBasic extends TileEntity {
25-
25+
2626
private final LazyValue<ChunkPos> chunkPos;
27-
28-
public TileEntityBasic (TileEntityType<?> tileEntityType) {
29-
27+
28+
public TileEntityBasic(TileEntityType<?> tileEntityType) {
29+
3030
super(tileEntityType);
3131
this.chunkPos = new LazyValue<>( () -> new ChunkPos(this.worldPosition));
3232
}
33-
33+
3434
@Override
3535
public void load (BlockState state, CompoundNBT dataTag) {
36-
36+
3737
this.deserialize(dataTag);
3838
super.load(state, dataTag);
3939
}
40-
40+
4141
@Override
4242
public CompoundNBT save (CompoundNBT dataTag) {
43-
43+
4444
this.serialize(dataTag);
4545
return super.save(dataTag);
4646
}
47-
47+
4848
@Override
4949
public SUpdateTileEntityPacket getUpdatePacket () {
50-
50+
5151
return new SUpdateTileEntityPacket(this.worldPosition, 0, this.getUpdateTag());
5252
}
53-
53+
5454
@Override
5555
public void onDataPacket (NetworkManager net, SUpdateTileEntityPacket packet) {
56-
56+
5757
super.onDataPacket(net, packet);
5858
this.deserialize(packet.getTag());
5959
}
60-
60+
6161
@Override
6262
public CompoundNBT getUpdateTag () {
63-
63+
6464
return this.save(super.getUpdateTag());
6565
}
66-
66+
6767
/**
6868
* Synchronizes the server state of the tile with all clients tracking it.
6969
*
7070
* @param renderUpdate Whether or not a render update should happen as well. Only use this
7171
* if you need to change the block model.
7272
*/
7373
public void sync (boolean renderUpdate) {
74-
74+
7575
if (renderUpdate) {
76-
76+
7777
this.setChanged();
7878
final BlockState state = this.getState();
7979
this.level.sendBlockUpdated(this.worldPosition, state, state, BlockFlags.DEFAULT_AND_RERENDER);
8080
}
81-
81+
8282
else if (this.level instanceof ServerWorld) {
83-
83+
8484
final IPacket<?> packet = this.getUpdatePacket();
8585
WorldUtils.sendToTracking((ServerWorld) this.level, this.getChunkPos(), packet, false);
8686
}
8787
}
88-
88+
8989
/**
9090
* Checks if the tile entity has a valid position.
9191
*
9292
* @return Whether or not the tile entity has a valid position.
9393
*/
9494
public boolean hasPosition () {
95-
95+
9696
return this.worldPosition != null && this.worldPosition != BlockPos.ZERO;
9797
}
98-
98+
9999
/**
100100
* Checks if the tile entity has initialized, and is in a loaded chunk.
101101
*
102102
* @return Whether or not the tile entity is initialized and in a loaded chunk.
103103
*/
104104
public boolean isLoaded () {
105-
105+
106106
return this.hasLevel() && this.hasPosition() && this.getLevel().hasChunkAt(this.getBlockPos());
107107
}
108-
108+
109109
/**
110110
* Gets the block state of the tile entity. Can be null if the tile is not loaded.
111111
*
112112
* @return The block state of the tile.
113113
*/
114114
public BlockState getState () {
115-
115+
116116
return this.isLoaded() ? this.getLevel().getBlockState(this.worldPosition) : null;
117117
}
118-
118+
119119
/**
120120
* Gets the current chunk position of the tile. This is used to optimize chunk related
121121
* calculations. The chunk position is not serialized with the tile entity and is
@@ -124,17 +124,17 @@ public BlockState getState () {
124124
* @return The ChunkPos that this tile entity is within.
125125
*/
126126
public ChunkPos getChunkPos () {
127-
127+
128128
return this.chunkPos.get();
129129
}
130-
130+
131131
/**
132132
* Handles the ability to write custom NBT values to a TileEntity.
133133
*
134134
* @param dataTag: The NBTTagCompound for the TileEntity.
135135
*/
136136
public abstract void serialize (CompoundNBT dataTag);
137-
137+
138138
/**
139139
* Handles the ability to read custom NBT values from the TileEntity's NBTTagCompound.
140140
*

src/main/java/net/darkhax/bookshelf/block/tileentity/TileEntityBasicTickable.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@
1212
import net.minecraft.tileentity.TileEntityType;
1313

1414
public abstract class TileEntityBasicTickable extends TileEntityBasic implements ITickableTileEntity {
15-
16-
public TileEntityBasicTickable (TileEntityType<?> tileEntityType) {
17-
15+
16+
public TileEntityBasicTickable(TileEntityType<?> tileEntityType) {
17+
1818
super(tileEntityType);
1919
}
20-
20+
2121
@Override
2222
public void tick () {
23-
23+
2424
if (this.hasLevel() && this.isLoaded() && !this.isRemoved()) {
2525
try {
26-
26+
2727
this.onTileTick();
2828
}
29-
29+
3030
catch (final Exception exception) {
31-
31+
3232
Bookshelf.LOG.warn("A TileEntity with ID {} at {} in world {} failed a client update tick!", this.getType().getRegistryName(), this.getBlockPos(), this.getLevel().toString());
3333
Bookshelf.LOG.catching(exception);
3434
}
3535
}
3636
}
37-
37+
3838
/**
3939
* Handles the TileEntity update ticks. This method will only be called in a safe
4040
* environment.

0 commit comments

Comments
 (0)