Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Add block registration to Forge WorldEdit.
Dieser Commit ist enthalten in:
Ursprung
3aff57d071
Commit
d12ad2548a
@ -21,6 +21,7 @@ package com.sk89q.worldedit.blocks;
|
|||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -49,6 +50,22 @@ public class LazyBlock extends BaseBlock {
|
|||||||
* @param extent the extent to later load the full block data from
|
* @param extent the extent to later load the full block data from
|
||||||
* @param position the position to later load the full block data from
|
* @param position the position to later load the full block data from
|
||||||
*/
|
*/
|
||||||
|
public LazyBlock(BlockType type, Extent extent, Vector position) {
|
||||||
|
super(type);
|
||||||
|
checkNotNull(extent);
|
||||||
|
checkNotNull(position);
|
||||||
|
this.extent = extent;
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new lazy block.
|
||||||
|
*
|
||||||
|
* @param type the block type
|
||||||
|
* @param extent the extent to later load the full block data from
|
||||||
|
* @param position the position to later load the full block data from
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public LazyBlock(int type, Extent extent, Vector position) {
|
public LazyBlock(int type, Extent extent, Vector position) {
|
||||||
super(type);
|
super(type);
|
||||||
checkNotNull(extent);
|
checkNotNull(extent);
|
||||||
@ -65,6 +82,24 @@ public class LazyBlock extends BaseBlock {
|
|||||||
* @param extent the extent to later load the full block data from
|
* @param extent the extent to later load the full block data from
|
||||||
* @param position the position to later load the full block data from
|
* @param position the position to later load the full block data from
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public LazyBlock(BlockType type, int data, Extent extent, Vector position) {
|
||||||
|
super(type, data);
|
||||||
|
checkNotNull(extent);
|
||||||
|
checkNotNull(position);
|
||||||
|
this.extent = extent;
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new lazy block.
|
||||||
|
*
|
||||||
|
* @param type the block type
|
||||||
|
* @param data the data value
|
||||||
|
* @param extent the extent to later load the full block data from
|
||||||
|
* @param position the position to later load the full block data from
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public LazyBlock(int type, int data, Extent extent, Vector position) {
|
public LazyBlock(int type, int data, Extent extent, Vector position) {
|
||||||
super(type, data);
|
super(type, data);
|
||||||
checkNotNull(extent);
|
checkNotNull(extent);
|
||||||
@ -83,6 +118,11 @@ public class LazyBlock extends BaseBlock {
|
|||||||
throw new UnsupportedOperationException("This object is immutable");
|
throw new UnsupportedOperationException("This object is immutable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setType(BlockType type) {
|
||||||
|
throw new UnsupportedOperationException("This object is immutable");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getNbtData() {
|
public CompoundTag getNbtData() {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
@ -54,8 +56,11 @@ import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
|
|||||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
|
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import org.spongepowered.api.Sponge;
|
||||||
|
import org.spongepowered.api.block.BlockType;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static net.minecraft.block.Block.REGISTRY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Forge implementation of WorldEdit.
|
* The Forge implementation of WorldEdit.
|
||||||
@ -121,6 +126,10 @@ public class ForgeWorldEdit {
|
|||||||
} else {
|
} else {
|
||||||
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
|
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Block block : REGISTRY) {
|
||||||
|
com.sk89q.worldedit.blocks.type.BlockTypes.registerBlock(new com.sk89q.worldedit.blocks.type.BlockType(REGISTRY.getNameForObject(block).toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren