Settings are saved across dimensions (including reach upgrades, issue #12).
Fixed silk touch, shearing leaves, dropping bed etc. (issue #15) Items dont drop directly to inventory anymore because of above fix, might be re-added later. Can no longer place blocks in entities (including the player). Added support for changing config ingame. Added preliminary ArchitectureCraft compatibility (places right type, not rotation yet). Updated forge.
This commit is contained in:
@@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
|
||||
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
group = "nl.requios.effortlessbuilding" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "effortlessbuilding"
|
||||
|
||||
@@ -21,7 +21,7 @@ compileJava {
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.4.2705"
|
||||
version = "1.12.2-14.23.5.2768"
|
||||
runDir = "run"
|
||||
|
||||
// the mappings can be changed at any time, and must be in the following format.
|
||||
@@ -29,7 +29,7 @@ minecraft {
|
||||
// stable_# stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings = "snapshot_20171003"
|
||||
mappings = "stable_39"
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BuildModifiers {
|
||||
if (world.isBlockLoaded(blockPos, true)) {
|
||||
//check itemstack empty
|
||||
if (itemStack.isEmpty()) continue;
|
||||
SurvivalHelper.placeBlock(world, player, blockPos, blockState, itemStack, EnumFacing.UP, true, false);
|
||||
SurvivalHelper.placeBlock(world, player, blockPos, blockState, itemStack, EnumFacing.UP, hitVec, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,12 @@ public class BuildSettingsManager {
|
||||
handleNewPlayer(player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEvent event) {
|
||||
EntityPlayer player = event.player;
|
||||
handleNewPlayer(player);
|
||||
}
|
||||
|
||||
private static void handleNewPlayer(EntityPlayer player){
|
||||
if (getBuildSettings(player) == null) {
|
||||
setBuildSettings(player, new BuildSettings());
|
||||
|
||||
@@ -36,7 +36,7 @@ public class EffortlessBuilding
|
||||
{
|
||||
public static final String MODID = "effortlessbuilding";
|
||||
public static final String NAME = "Effortless Building";
|
||||
public static final String VERSION = "1.0.1";
|
||||
public static final String VERSION = "1.0.2";
|
||||
|
||||
@Mod.Instance(EffortlessBuilding.MODID)
|
||||
public static EffortlessBuilding instance;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class EventHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
public static void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if (event.getModID().equals(EffortlessBuilding.MODID))
|
||||
{
|
||||
|
||||
@@ -232,7 +232,7 @@ public class RenderHelper implements IWorldEventListener {
|
||||
ItemStack itemstack = itemStacks.get(i);
|
||||
//Check if can place
|
||||
if (!itemstack.isEmpty() && SurvivalHelper.canPlayerEdit(player, player.world, blockPos, itemstack) &&
|
||||
SurvivalHelper.mayPlace(player.world, Block.getBlockFromItem(itemstack.getItem()), blockState, blockPos, true, EnumFacing.UP, player) &&
|
||||
SurvivalHelper.mayPlace(player.world, Block.getBlockFromItem(itemstack.getItem()), blockState, blockPos, false, EnumFacing.UP, player) &&
|
||||
SurvivalHelper.canReplace(player.world, player, blockPos)) {
|
||||
renderBlockPreview(dispatcher, blockPos, blockState);
|
||||
}
|
||||
|
||||
@@ -13,10 +13,12 @@ import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -34,7 +36,7 @@ public class SurvivalHelper {
|
||||
//Used for all placing of blocks in this mod.
|
||||
//Checks if area is loaded, if player has the right permissions, if existing block can be replaced (drops it if so) and consumes an item from the stack.
|
||||
//Based on ItemBlock#onItemUse
|
||||
public static boolean placeBlock(World world, EntityPlayer player, BlockPos pos, IBlockState blockState, ItemStack itemstack, EnumFacing facing, boolean skipCollisionCheck, boolean playSound) {
|
||||
public static boolean placeBlock(World world, EntityPlayer player, BlockPos pos, IBlockState blockState, ItemStack itemstack, EnumFacing facing, Vec3d hitVec, boolean skipCollisionCheck, boolean playSound) {
|
||||
if (!world.isBlockLoaded(pos, true)) return false;
|
||||
|
||||
//Randomizer bag synergy
|
||||
@@ -55,24 +57,26 @@ public class SurvivalHelper {
|
||||
|
||||
if (!itemstack.isEmpty() && canPlayerEdit(player, world, pos, itemstack) &&
|
||||
mayPlace(world, block, blockState, pos, skipCollisionCheck, facing.getOpposite(), player) &&
|
||||
canReplace(world, player, pos))
|
||||
{
|
||||
canReplace(world, player, pos)) {
|
||||
|
||||
//Drop existing block
|
||||
//TODO check if can replace
|
||||
dropBlock(world, player, pos);
|
||||
|
||||
boolean placed = ((ItemBlock) itemstack.getItem()).placeBlockAt(itemstack, player, world, pos, facing, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, blockState);
|
||||
if (!placed) return false;
|
||||
|
||||
//From ItemBlock#placeBlockAt
|
||||
if (!world.setBlockState(pos, blockState, 11)) return false;
|
||||
|
||||
// if (!world.setBlockState(pos, blockState, 11)) return false;
|
||||
//
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() == block)
|
||||
{
|
||||
((ItemBlock) itemstack.getItem()).setTileEntityNBT(world, player, pos, itemstack);
|
||||
block.onBlockPlacedBy(world, pos, state, player, itemstack);
|
||||
|
||||
// if (player instanceof EntityPlayerMP)
|
||||
// CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP)player, pos, itemstack);
|
||||
}
|
||||
// if (state.getBlock() == block)
|
||||
// {
|
||||
// ((ItemBlock) itemstack.getItem()).setTileEntityNBT(world, player, pos, itemstack);
|
||||
// block.onBlockPlacedBy(world, pos, state, player, itemstack);
|
||||
//
|
||||
//// if (player instanceof EntityPlayerMP)
|
||||
//// CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP)player, pos, itemstack);
|
||||
// }
|
||||
|
||||
if (playSound) {
|
||||
SoundType soundtype = state.getBlock().getSoundType(state, world, pos, player);
|
||||
@@ -168,13 +172,16 @@ public class SurvivalHelper {
|
||||
if (player.isCreative()) return;
|
||||
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand());
|
||||
List<ItemStack> drops = blockState.getBlock().getDrops(world, pos, blockState, fortune);
|
||||
for (ItemStack drop : drops)
|
||||
{
|
||||
ItemHandlerHelper.giveItemToPlayer(player, drop);
|
||||
}
|
||||
block.harvestBlock(world, player, pos, blockState, world.getTileEntity(pos), player.getHeldItemMainhand());
|
||||
|
||||
// int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand());
|
||||
// List<ItemStack> drops = blockState.getBlock().getDrops(world, pos, blockState, fortune);
|
||||
// for (ItemStack drop : drops)
|
||||
// {
|
||||
// ItemHandlerHelper.giveItemToPlayer(player, drop);
|
||||
// }
|
||||
}
|
||||
|
||||
//From EntityPlayer#canPlayerEdit
|
||||
@@ -197,9 +204,9 @@ public class SurvivalHelper {
|
||||
public static boolean mayPlace(World world, Block blockIn, IBlockState newBlockState, BlockPos pos, boolean skipCollisionCheck, EnumFacing sidePlacedOn, @Nullable Entity placer)
|
||||
{
|
||||
IBlockState iblockstate1 = world.getBlockState(pos);
|
||||
AxisAlignedBB axisalignedbb = skipCollisionCheck ? null : blockIn.getDefaultState().getCollisionBoundingBox(world, pos);
|
||||
AxisAlignedBB axisalignedbb = skipCollisionCheck ? Block.NULL_AABB : blockIn.getDefaultState().getCollisionBoundingBox(world, pos);
|
||||
|
||||
if (axisalignedbb != Block.NULL_AABB && !world.checkNoEntityCollision(axisalignedbb.offset(pos), placer))
|
||||
if (axisalignedbb != Block.NULL_AABB && !world.checkNoEntityCollision(axisalignedbb.offset(pos)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
@@ -36,7 +37,7 @@ public class ItemRandomizerBag extends Item {
|
||||
|
||||
public ItemRandomizerBag() {
|
||||
this.setRegistryName(EffortlessBuilding.MODID, "randomizer_bag");
|
||||
this.setUnlocalizedName(this.getRegistryName().toString());
|
||||
this.setTranslationKey(this.getRegistryName().toString());
|
||||
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.TOOLS);
|
||||
@@ -72,14 +73,8 @@ public class ItemRandomizerBag extends Item {
|
||||
IBlockState blockState = Block.getBlockFromItem(toPlace.getItem()).getStateForPlacement(world, pos, facing,
|
||||
hitX, hitY, hitZ, toPlace.getMetadata(), player, hand);
|
||||
|
||||
SurvivalHelper.placeBlock(world, player, pos, blockState, toPlace, facing, false, true);
|
||||
SurvivalHelper.placeBlock(world, player, pos, blockState, toPlace, facing, new Vec3d(hitX, hitY, hitZ), false, true);
|
||||
|
||||
//Synergy
|
||||
//Works without calling
|
||||
// BlockSnapshot blockSnapshot = new BlockSnapshot(player.world, pos, blockState);
|
||||
// BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(blockSnapshot, blockState, player, hand);
|
||||
// Mirror.onBlockPlaced(placeEvent);
|
||||
// Array.onBlockPlaced(placeEvent);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
@@ -181,8 +176,8 @@ public class ItemRandomizerBag extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return super.getUnlocalizedName();
|
||||
public String getTranslationKey() {
|
||||
return super.getTranslationKey();
|
||||
}
|
||||
|
||||
public static void resetRandomness() {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ItemReachUpgrade1 extends Item {
|
||||
|
||||
public ItemReachUpgrade1() {
|
||||
this.setRegistryName(EffortlessBuilding.MODID, "reach_upgrade1");
|
||||
this.setUnlocalizedName(this.getRegistryName().toString());
|
||||
this.setTranslationKey(this.getRegistryName().toString());
|
||||
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.TOOLS);
|
||||
@@ -67,7 +67,7 @@ public class ItemReachUpgrade1 extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return super.getUnlocalizedName();
|
||||
public String getTranslationKey() {
|
||||
return super.getTranslationKey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ItemReachUpgrade2 extends Item {
|
||||
|
||||
public ItemReachUpgrade2() {
|
||||
this.setRegistryName(EffortlessBuilding.MODID, "reach_upgrade2");
|
||||
this.setUnlocalizedName(this.getRegistryName().toString());
|
||||
this.setTranslationKey(this.getRegistryName().toString());
|
||||
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.TOOLS);
|
||||
@@ -65,7 +65,7 @@ public class ItemReachUpgrade2 extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return super.getUnlocalizedName();
|
||||
public String getTranslationKey() {
|
||||
return super.getTranslationKey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ItemReachUpgrade3 extends Item {
|
||||
|
||||
public ItemReachUpgrade3() {
|
||||
this.setRegistryName(EffortlessBuilding.MODID, "reach_upgrade3");
|
||||
this.setUnlocalizedName(this.getRegistryName().toString());
|
||||
this.setTranslationKey(this.getRegistryName().toString());
|
||||
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.TOOLS);
|
||||
@@ -68,7 +68,7 @@ public class ItemReachUpgrade3 extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return super.getUnlocalizedName();
|
||||
public String getTranslationKey() {
|
||||
return super.getTranslationKey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockBrokenMessage implements IMessage {
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
blockHit = buf.readBoolean();
|
||||
blockPos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
|
||||
sideHit = EnumFacing.getFront(buf.readInt());
|
||||
sideHit = EnumFacing.byIndex(buf.readInt());
|
||||
hitVec = new Vec3d(buf.readDouble(), buf.readDouble(), buf.readDouble());
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BlockPlacedMessage implements IMessage {
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
blockHit = buf.readBoolean();
|
||||
blockPos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
|
||||
sideHit = EnumFacing.getFront(buf.readInt());
|
||||
sideHit = EnumFacing.byIndex(buf.readInt());
|
||||
hitVec = new Vec3d(buf.readDouble(), buf.readDouble(), buf.readDouble());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user