Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Runemoro committed Jan 24, 2018
1 parent ed8f57e commit 5ba2c7a
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 111 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/dimdev/ddutils/blocks/BlockSpecialAir.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* method of the block that would have been hit if the block wasn't there. Left clicks pass through the
* block (or maybe add an onLeftClick method).
*/ // TODO
public abstract class BlockSpecialAir extends Block { // TODO: make water and pistons pass through but not destroy
public abstract class BlockSpecialAir extends Block {

public BlockSpecialAir() {
// This is the only way to make it collide with water but not other entities, but still have a collision box for raytracing.
Expand Down Expand Up @@ -67,8 +67,7 @@ public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAcces
// Disable raytrace hitting this block in survival unless the hitIfLiquid flag is true
@Override
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) {
//EntityPlayer player = DimDoors.proxy.getLocalPlayer();
return /*player != null && player.isCreative() ||*/ hitIfLiquid; // TODO: re-enable this later
return hitIfLiquid;
}

// Disable dropping/picking item
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/dimdev/ddutils/math/GridUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ public static int posToNum(GridPos pos) {
return (z + 1) * z + z - x; // (number of points in the rectangle (z + 1) * z) + (z - x points on the top layer)
}
}
// TODO: add more modes: hexagonal sphere packing and maybe spiral, triangle
}
2 changes: 1 addition & 1 deletion src/main/java/org/dimdev/ddutils/nbt/NBTUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import lombok.Getter;

import org.dimdev.ddutils.StringUtils;

public final class NBTUtils {
Expand Down
126 changes: 50 additions & 76 deletions src/main/java/org/dimdev/ddutils/schem/Schematic.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class CommandPocket extends CommandBase {

@Override
public String getName() {
return "pockets";
return "pocket";
}

@Override
public String getUsage(ICommandSender sender) {
return "commands.pockets.usage";
return "commands.pocket.usage";
}

@Override
Expand All @@ -41,7 +41,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args

// Check that the number of arguments is correct
if (args.length < 2 || args.length > 3) {
throw new WrongUsageException("commands.pockets.usage");
throw new WrongUsageException("commands.pocket.usage");
}

// Make sure the player is in a pocket world
Expand All @@ -54,12 +54,12 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args

// Check if the schematic exists
if (!SchematicHandler.INSTANCE.getTemplateGroups().contains(group)) {
throw new CommandException("commands.pockets.groupnotfound", group);
throw new CommandException("commands.pocket.group_not_found", group);
} else if (!SchematicHandler.INSTANCE.getTemplateNames(group).contains(name)) {
throw new CommandException("commands.pockets.templatenotfound", group);
throw new CommandException("commands.pocket.template_not_found", name);
}

boolean setup = parseBoolean(args[3]);
boolean setup = args.length < 3 || parseBoolean(args[2]);

// Generate the schematic
PocketTemplate template = SchematicHandler.INSTANCE.getTemplate(group, name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.dimdev.dimdoors.shared.commands;

import com.flowpowered.math.vector.Vector3i;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import org.dimdev.ddutils.schem.Schematic;
import org.dimdev.dimdoors.shared.pockets.SchematicHandler;
import org.dimdev.pocketlib.Pocket;
Expand Down Expand Up @@ -39,15 +38,12 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition());
if (pocket == null) throw new CommandException("commands.generic.dimdoors.not_in_pocket");

Schematic schematic = Schematic.createFromWorld(player.world, toVector3i(pocket.getOrigin()), toVector3i(pocket.getOrigin()).add(Vector3i.from((pocket.getSize() + 1) * 16 - 1)));
int size = (pocket.getSize() + 1) * 16 - 1;
Schematic schematic = Schematic.createFromWorld(player.world, pocket.getOrigin(), pocket.getOrigin().add(new Vec3i(size, size, size)));
schematic.name = args[0];
schematic.author = player.getName();

SchematicHandler.INSTANCE.saveSchematic(schematic, args[0]);
notifyCommandListener(sender, this, "commands.saveschem.success", args[0]);
}

private Vector3i toVector3i(BlockPos pos) {
return Vector3i.from(pos.getX(), pos.getY(), pos.getZ());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

import java.awt.*;
import java.util.List;

public class ItemRiftRemover extends Item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void place(Pocket pocket) {

// Place the schematic
DimDoors.log.info("Placing new pocket using schematic " + id + " at x = " + xBase + ", z = " + zBase);
Schematic.place(schematic, world, xBase, yBase, zBase);
schematic.place(world, xBase, yBase, zBase);
}

public void setup(Pocket pocket, RiftDestination linkTo, LinkProperties linkProperties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ private void constructNameMap() {
}
}
}

nameMap.put(SAVED_POCKETS_GROUP_NAME, new HashMap<>());
}

public Set<String> getTemplateGroups() {
Expand Down Expand Up @@ -294,7 +292,7 @@ public PocketTemplate getPublicPocketTemplate() {
}

public void saveSchematic(Schematic schematic, String id) {
NBTTagCompound schematicNBT = Schematic.saveToNBT(schematic);
NBTTagCompound schematicNBT = schematic.saveToNBT();
File saveFolder = new File(DimDoors.getConfigurationFolder(), "/schematics/saved");
if (!saveFolder.exists()) {
saveFolder.mkdirs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import lombok.Getter;
import lombok.ToString;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import org.dimdev.dimdoors.shared.rifts.RiftDestination;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import lombok.Getter;
import lombok.ToString;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import org.dimdev.dimdoors.shared.rifts.RiftDestination;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static void main(String... args) throws IOException, NoSuchMethodExceptio
String[] saveFolders = {"public/", "private/", "blank/", "blank/", "blank/"};
int i = 0;
for (Schematic schematic : schematics) {
NBTTagCompound schematicNBT = Schematic.saveToNBT(schematic);
NBTTagCompound schematicNBT = schematic.saveToNBT();
File saveFile = new File(schematicDir, saveFolders[i++ % saveFolders.length] + schematic.name + ".schem");
saveFile.getParentFile().mkdirs();
DataOutputStream schematicDataStream = new DataOutputStream(new FileOutputStream(saveFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public static Schematic convertSchematic(NBTTagCompound nbt, String schematicId,
if (baseState.getBlock().equals(ModBlocks.FABRIC) || baseState.getBlock().equals(ModBlocks.ANCIENT_FABRIC)) {
blockState = baseState;
} else {
//noinspection deprecation
blockState = baseState.getBlock().getStateFromMeta(metadata);
}
if (schematic.palette.contains(blockState)) { //check whether or not this blockstate is already in the list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public BaseSchematicGateway(String id) {

@Override
public void generate(World world, int x, int y, int z) {
Schematic.place(schematic, world, x, y, z);
schematic.place(world, x, y, z);
generateRandomBits(world, x, y, z);
}

Expand Down
11 changes: 4 additions & 7 deletions src/main/resources/assets/dimdoors/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,18 @@ info.stabilized_rift_signature.unbound2=the first and last locations together.

info.chaos_dimensional_door=Caution: Leads to random destination

info.warp_dimensional_door0=Place on the block under
info.warp_dimensional_door1=a rift to create a portal,
info.warp_dimensional_door2=or place anywhere in a
info.warp_dimensional_door3=pocket dimension to exit.
info.warp_dimensional_door0=Place on the block under a rift to create a portal, or place anywhere in a pocket dimension to exit.

entity.dimdoors.monolith.name=Monolith

commands.dimteleport.usage=/dimteleport <dimension> <x> <y> <z> [yaw] [pitch]
commands.fabricconvert.usage=/fabricconvert
commands.fabricconvert.success=All fabric of reality has been converted to black.
commands.pocket.usage=/pocket <group> <name> [setup]
commands.pocket.groupnotfound=Group %s not found
commands.pocket.templatenotfound=Template %s not found
commands.pocket.group_not_found=Group %s not found
commands.pocket.template_not_found=Template %s not found
commands.saveschem.usage=/saveschem <name>
commands.saveshcem.success=Pocket %s has been successfully saved
commands.saveschem.success=Pocket %s has been successfully saved
commands.generic.dimdoors.not_in_pocket_dim=You must be in a pocket dimension to use this command.
commands.generic.dimdoors.not_in_pocket=You must be in a pocket to use this command.

Expand Down

0 comments on commit 5ba2c7a

Please sign in to comment.