Skip to content

Commit

Permalink
Update to Forge 1.14.
Browse files Browse the repository at this point in the history
  • Loading branch information
wizjany committed Jun 9, 2019
1 parent 22f7af1 commit 12f886a
Show file tree
Hide file tree
Showing 22 changed files with 521 additions and 573 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public boolean actPrimary(Platform server, LocalConfiguration config, Player pla
player.printError("Max blocks change limit reached.");
}

world.playEffect(clicked.toVector(), 2001, blockType.getLegacyId());

return true;
}

Expand Down
12 changes: 6 additions & 6 deletions worldedit-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ buildscript {
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle'

def minecraftVersion = "1.13.2"
def forgeVersion = "25.0.146"
def minecraftVersion = "1.14.2"
def forgeVersion = "26.0.7"

configurations.all { Configuration it ->
it.resolutionStrategy { ResolutionStrategy rs ->
Expand All @@ -36,7 +36,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

minecraft {
mappings channel: 'snapshot', version: '20190415-1.13.2'
mappings channel: 'snapshot', version: "20190608-${minecraftVersion}"

runs {
client = {
Expand All @@ -57,7 +57,7 @@ minecraft {
}
}

accessTransformer = file('worldedit_at.cfg')
//accessTransformer = file('worldedit_at.cfg')
}

project.archivesBaseName = "${project.archivesBaseName}-mc${minecraftVersion}"
Expand All @@ -84,8 +84,8 @@ processResources {
jar {
manifest {
attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar",
"WorldEdit-Version": version,
"FMLAT": "worldedit_at.cfg")
"WorldEdit-Version": version/*,
"FMLAT": "worldedit_at.cfg"*/)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.sk89q.worldedit.internal.util.Substring;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.ServerPlayerEntity;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
import org.enginehub.piston.inject.MapBackedValueStore;
Expand Down Expand Up @@ -78,8 +78,8 @@ public static void register(CommandDispatcher<CommandSource> dispatcher, org.eng
private static Predicate<CommandSource> requirementsFor(org.enginehub.piston.Command mapping) {
return ctx -> {
final Entity entity = ctx.getEntity();
if (!(entity instanceof EntityPlayerMP)) return true;
final Actor actor = ForgeAdapter.adaptPlayer(((EntityPlayerMP) entity));
if (!(entity instanceof ServerPlayerEntity)) return true;
final Actor actor = ForgeAdapter.adaptPlayer(((ServerPlayerEntity) entity));
InjectedValueStore store = MapBackedValueStore.create();
store.injectValue(Key.of(Actor.class), context -> Optional.of(actor));
return mapping.getCondition().satisfied(store);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -92,20 +90,20 @@ public static Vec3d toVec3(BlockVector3 vector) {
return new Vec3d(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}

public static EnumFacing adapt(Direction face) {
public static net.minecraft.util.Direction adapt(Direction face) {
switch (face) {
case NORTH: return EnumFacing.NORTH;
case SOUTH: return EnumFacing.SOUTH;
case WEST: return EnumFacing.WEST;
case EAST: return EnumFacing.EAST;
case DOWN: return EnumFacing.DOWN;
case NORTH: return net.minecraft.util.Direction.NORTH;
case SOUTH: return net.minecraft.util.Direction.SOUTH;
case WEST: return net.minecraft.util.Direction.WEST;
case EAST: return net.minecraft.util.Direction.EAST;
case DOWN: return net.minecraft.util.Direction.DOWN;
case UP:
default:
return EnumFacing.UP;
return net.minecraft.util.Direction.UP;
}
}

public static Direction adaptEnumFacing(EnumFacing face) {
public static Direction adaptEnumFacing(net.minecraft.util.Direction face) {
switch (face) {
case NORTH: return Direction.NORTH;
case SOUTH: return Direction.SOUTH;
Expand Down Expand Up @@ -149,7 +147,7 @@ public static Map<Property<?>, Object> adaptProperties(BlockType block, Map<IPro
for (Map.Entry<IProperty<?>, Comparable<?>> prop : mcProps.entrySet()) {
Object value = prop.getValue();
if (prop.getKey() instanceof DirectionProperty) {
value = adaptEnumFacing((EnumFacing) value);
value = adaptEnumFacing((net.minecraft.util.Direction) value);
} else if (prop.getKey() instanceof net.minecraft.state.EnumProperty) {
value = ((IStringSerializable) value).getName();
}
Expand All @@ -158,14 +156,14 @@ public static Map<Property<?>, Object> adaptProperties(BlockType block, Map<IPro
return props;
}

private static IBlockState applyProperties(StateContainer<Block, IBlockState> stateContainer, IBlockState newState, Map<Property<?>, Object> states) {
private static net.minecraft.block.BlockState applyProperties(StateContainer<Block, net.minecraft.block.BlockState> stateContainer, net.minecraft.block.BlockState newState, Map<Property<?>, Object> states) {
for (Map.Entry<Property<?>, Object> state : states.entrySet()) {
IProperty property = stateContainer.getProperty(state.getKey().getName());
Comparable value = (Comparable) state.getValue();
// we may need to adapt this value, depending on the source prop
if (property instanceof DirectionProperty) {
Direction dir = (Direction) value;
value = ForgeAdapter.adapt(dir);
value = adapt(dir);
} else if (property instanceof net.minecraft.state.EnumProperty) {
String enumName = (String) value;
value = ((net.minecraft.state.EnumProperty<?>) property).parseValue((String) value).orElseGet(() -> {
Expand All @@ -178,16 +176,16 @@ private static IBlockState applyProperties(StateContainer<Block, IBlockState> st
return newState;
}

public static IBlockState adapt(BlockState blockState) {
Block mcBlock = ForgeAdapter.adapt(blockState.getBlockType());
IBlockState newState = mcBlock.getDefaultState();
public static net.minecraft.block.BlockState adapt(BlockState blockState) {
Block mcBlock = adapt(blockState.getBlockType());
net.minecraft.block.BlockState newState = mcBlock.getDefaultState();
Map<Property<?>, Object> states = blockState.getStates();
return applyProperties(mcBlock.getStateContainer(), newState, states);
}

public static BlockState adapt(IBlockState blockState) {
public static BlockState adapt(net.minecraft.block.BlockState blockState) {
BlockType blockType = adapt(blockState.getBlock());
return blockType.getState(ForgeAdapter.adaptProperties(blockType, blockState.getValues()));
return blockType.getState(adaptProperties(blockType, blockState.getValues()));
}

public static Block adapt(BlockType blockType) {
Expand All @@ -207,7 +205,7 @@ public static ItemType adapt(Item item) {
}

public static ItemStack adapt(BaseItemStack baseItemStack) {
NBTTagCompound forgeCompound = null;
CompoundNBT forgeCompound = null;
if (baseItemStack.getNbtData() != null) {
forgeCompound = NBTConverter.toNative(baseItemStack.getNbtData());
}
Expand Down Expand Up @@ -237,7 +235,7 @@ public static BaseItemStack adapt(ItemStack itemStack) {
* @param player the player
* @return the WorldEdit player
*/
public static ForgePlayer adaptPlayer(EntityPlayerMP player) {
public static ForgePlayer adaptPlayer(ServerPlayerEntity player) {
checkNotNull(player);
return new ForgePlayer(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;

import net.minecraft.block.material.EnumPushReaction;
import net.minecraft.block.material.PushReaction;
import net.minecraft.block.material.Material;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -63,12 +63,12 @@ public boolean isSolid() {

@Override
public boolean isFragileWhenPushed() {
return delegate.getPushReaction() == EnumPushReaction.DESTROY;
return delegate.getPushReaction() == PushReaction.DESTROY;
}

@Override
public boolean isUnpushable() {
return delegate.getPushReaction() == EnumPushReaction.BLOCK;
return delegate.getPushReaction() == PushReaction.BLOCK;
}

@Override
Expand Down
Loading

0 comments on commit 12f886a

Please sign in to comment.