mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Clean-up some misc. parts of the code
This commit is contained in:
committed by
Matthew Miller
parent
dc21b4df58
commit
8c17aab9c5
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.forge;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
@ -63,6 +61,8 @@ import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class ForgeAdapter {
|
||||
|
||||
private ForgeAdapter() {
|
||||
|
@ -27,8 +27,11 @@ import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@ -40,6 +43,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class ForgeBlockRegistry extends BundledBlockRegistry {
|
||||
|
||||
private final int airId = Block.getStateId(Blocks.AIR.getDefaultState());
|
||||
private Map<Material, ForgeBlockMaterial> materialMap = new HashMap<>();
|
||||
|
||||
@Nullable
|
||||
@ -82,4 +86,13 @@ public class ForgeBlockRegistry extends BundledBlockRegistry {
|
||||
return OptionalInt.of(Block.getStateId(equivalent));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockStateByInternalId(int id) {
|
||||
IBlockState equivalent = Block.getStateById(id);
|
||||
if (equivalent.equals(Blocks.AIR.getDefaultState()) && id != airId) {
|
||||
// We didn't find a match.
|
||||
return null;
|
||||
}
|
||||
return ForgeAdapter.adapt(equivalent);
|
||||
}
|
||||
}
|
||||
|
@ -175,9 +175,6 @@ public class ForgeWorldEdit {
|
||||
ItemCategory.REGISTRY.register(name.toString(), new ItemCategory(name.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
config = new ForgeConfiguration(this);
|
||||
config.load();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@ -211,7 +208,7 @@ public class ForgeWorldEdit {
|
||||
InternalPacketHandler.getHandler().sendToServer(new LeftClickAirEventMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean isLeftDeny = event instanceof PlayerInteractEvent.LeftClickBlock
|
||||
&& ((PlayerInteractEvent.LeftClickBlock) event)
|
||||
.getUseItem() == Event.Result.DENY;
|
||||
|
Reference in New Issue
Block a user