Skip to content

Commit

Permalink
docs: replace some var
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolLoong committed Aug 7, 2023
1 parent 5c23c2e commit f12cdcd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cn.allay.api.container.processor;

import cn.allay.api.client.Client;
import cn.allay.api.container.Container;
import cn.allay.api.container.FullContainerType;
import cn.allay.api.item.ItemStack;
import cn.allay.api.client.Client;
import lombok.extern.slf4j.Slf4j;
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction;
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
Expand All @@ -25,13 +25,13 @@ public abstract class TransferItemActionProcessor<T extends TransferItemStackReq

@Override
public List<ItemStackResponse> handle(T action, Client client, int requestId) {
var slot1 = action.getSource().getSlot();
var stackNetworkId1 = action.getSource().getStackNetworkId();
var slot2 = action.getDestination().getSlot();
var stackNetworkId2 = action.getDestination().getStackNetworkId();
int slot1 = action.getSource().getSlot();
int stackNetworkId1 = action.getSource().getStackNetworkId();
int slot2 = action.getDestination().getSlot();
int stackNetworkId2 = action.getDestination().getStackNetworkId();
var source = client.getPlayerEntity().getContainerBySlotType(action.getSource().getContainer());
var destination = client.getPlayerEntity().getContainerBySlotType(action.getDestination().getContainer());
var count = action.getCount();
int count = action.getCount();
var sourItem = source.getItemStack(slot1);
if (sourItem.getItemType() == AIR_TYPE) {
log.warn("place an air item is not allowed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public Map<Integer, ItemStack> load(Void input) {
var index = Integer.parseInt(key);
var obj = (NbtMap) value;
var itemType = ItemTypeRegistry.getRegistry().get(new Identifier(obj.getString("name")));
var count = obj.getInt("count");
var damage = obj.getInt("damage");
var blockStateHash = obj.getInt("blockStateHash");
int count = obj.getInt("count");
int damage = obj.getInt("damage");
int blockStateHash = obj.getInt("blockStateHash");
var blockState = BlockStateHashPalette.getRegistry().get(blockStateHash);
var tag = obj.getCompound("tag", null);
var itemStack = itemType.createItemStack(new ItemStackInitInfo.Simple<>(count, damage, tag, blockState, index + 1, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,13 @@ public void sendChunkPackets() {
private void writeChunkDataToBuffer(ByteBuf retainedBuffer) {
Palette<BiomeType> lastBiomes = new Palette<>(VanillaBiomeId.PLAINS);

for (var sectionY = 0; sectionY < getDimensionInfo().chunkSectionSize(); sectionY++) {
for (int sectionY = 0; sectionY < getDimensionInfo().chunkSectionSize(); sectionY++) {
var section = getSection(sectionY);
if (section == null) break;
section.writeToNetwork(retainedBuffer);
}

for (var sectionY = 0; sectionY < getDimensionInfo().chunkSectionSize(); sectionY++) {
for (int sectionY = 0; sectionY < getDimensionInfo().chunkSectionSize(); sectionY++) {
var section = getSection(sectionY);
if (section == null) {
lastBiomes.writeToNetwork(retainedBuffer, BiomeType::getId, lastBiomes);
Expand Down Expand Up @@ -367,7 +367,7 @@ private void writeChunkDataToBuffer(ByteBuf retainedBuffer) {
}

private int computeNotNullSectionCount() {
for (var count = 0; count < getDimensionInfo().chunkSectionSize(); count++) {
for (int count = 0; count < getDimensionInfo().chunkSectionSize(); count++) {
if (getSection(count) == null)
return count;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void removeUnusedChunks() {
unusedChunkClearCountDown.replaceAll((chunkHash, countDown) -> countDown - 1);
//Remove countdown ended unused chunks
unusedChunkClearCountDown.entrySet().removeIf(entry -> {
var shouldRemove = entry.getValue() == 0;
boolean shouldRemove = entry.getValue() == 0;
if (shouldRemove) {
unloadChunk(entry.getKey());
}
Expand All @@ -90,7 +90,7 @@ private void removeUnusedChunks() {

//Add unused chunk to the clear countdown map
for (var entry : loadedChunks.entrySet()) {
var chunkHash = entry.getKey();
Long chunkHash = entry.getKey();
var loadedChunk = entry.getValue();
if (loadedChunk.getChunkLoaderCount() == 0 && !unusedChunkClearCountDown.containsKey(chunkHash)) {
unusedChunkClearCountDown.put(chunkHash, REMOVE_UNNEEDED_CHUNK_CYCLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ChunkSection getSection(int y) {
@ApiStatus.Internal
@NotNull
public ChunkSection getOrCreateSection(int y) {
for (var i = 0; i <= y; i++) {
for (int i = 0; i <= y; i++) {
sections.compareAndSet(i, null, new ChunkSection(i));
}
return sections.get(y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ public synchronized void writeChunk(int chunkX, int chunkZ, NbtMap chunkData) th
}

// Get the sector index and size previously used by this chunk
var index = index(chunkX, chunkZ);
var previousSectorCount = sectorCount(locations.getInt(index));
var previousSectorStart = sectorIndex(locations.getInt(index));
int index = index(chunkX, chunkZ);
int previousSectorCount = sectorCount(locations.getInt(index));
int previousSectorStart = sectorIndex(locations.getInt(index));

var appendToEnd = false;
boolean appendToEnd = false;
long position;
int sectorStartCount;

Expand Down Expand Up @@ -221,7 +221,7 @@ private int findAvailableSectors(int sectorCount) {

private void alignment4K() throws IOException {
// file is not a multiple of 4kib, add padding
var missingPadding = channel.size() % SECTOR_SIZE;
long missingPadding = channel.size() % SECTOR_SIZE;
if (missingPadding > 0) {
channel.write(ByteBuffer.allocate((int) (SECTOR_SIZE - missingPadding)));
}
Expand Down

0 comments on commit f12cdcd

Please sign in to comment.