Fixed items not being registered

This commit is contained in:
Matthew Miller 2018-07-12 22:42:50 +10:00
parent ca06a05117
commit 39c6a5e958
3 changed files with 20 additions and 12 deletions

View File

@ -28,11 +28,11 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
public interface ForgePermissionsProvider {
public boolean hasPermission(EntityPlayerMP player, String permission);
boolean hasPermission(EntityPlayerMP player, String permission);
public void registerPermission(ICommand command, String permission);
void registerPermission(ICommand command, String permission);
public static class VanillaPermissionsProvider implements ForgePermissionsProvider {
class VanillaPermissionsProvider implements ForgePermissionsProvider {
private ForgePlatform platform;
@ -52,7 +52,7 @@ public interface ForgePermissionsProvider {
public void registerPermission(ICommand command, String permission) {}
}
public static class SpongePermissionsProvider implements ForgePermissionsProvider {
class SpongePermissionsProvider implements ForgePermissionsProvider {
@Override
public boolean hasPermission(EntityPlayerMP player, String permission) {

View File

@ -20,7 +20,6 @@
package com.sk89q.worldedit.forge;
import static com.google.common.base.Preconditions.checkNotNull;
import static net.minecraft.block.Block.REGISTRY;
import com.google.common.base.Joiner;
import com.sk89q.worldedit.LocalSession;
@ -32,6 +31,8 @@ import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
@ -124,8 +125,12 @@ public class ForgeWorldEdit {
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
}
for (Block block : REGISTRY) {
BlockTypes.register(new BlockType(REGISTRY.getNameForObject(block).toString()));
for (Block block : Block.REGISTRY) {
BlockTypes.register(new BlockType(Block.REGISTRY.getNameForObject(block).toString()));
}
for (Item item : Item.REGISTRY) {
ItemTypes.register(new ItemType(Item.REGISTRY.getNameForObject(item).toString()));
}
}

View File

@ -19,6 +19,8 @@
package com.sk89q.worldedit.sponge;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.entity.metadata.EntityType;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.Entity;
@ -28,7 +30,11 @@ import org.spongepowered.api.entity.Item;
import org.spongepowered.api.entity.explosive.PrimedTNT;
import org.spongepowered.api.entity.hanging.ItemFrame;
import org.spongepowered.api.entity.hanging.Painting;
import org.spongepowered.api.entity.living.*;
import org.spongepowered.api.entity.living.Ambient;
import org.spongepowered.api.entity.living.ArmorStand;
import org.spongepowered.api.entity.living.Humanoid;
import org.spongepowered.api.entity.living.Living;
import org.spongepowered.api.entity.living.Villager;
import org.spongepowered.api.entity.living.animal.Animal;
import org.spongepowered.api.entity.living.complex.ComplexLivingPart;
import org.spongepowered.api.entity.living.golem.Golem;
@ -39,9 +45,6 @@ import org.spongepowered.api.entity.vehicle.minecart.Minecart;
import org.spongepowered.api.text.Text;
import java.util.Optional;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull;
public class SpongeEntityType implements EntityType {
@ -129,7 +132,7 @@ public class SpongeEntityType implements EntityType {
@Override
public boolean isTamed() {
return entity.get(Keys.TAMED_OWNER).orElse(Optional.<UUID>empty()).isPresent();
return entity.get(Keys.TAMED_OWNER).orElse(Optional.empty()).isPresent();
}
@Override