Skip to content

Commit

Permalink
Merge branch 'release/its-0.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
edwanvi committed Jun 19, 2018
2 parents 956d1ee + 5c936df commit e2fd9e5
Show file tree
Hide file tree
Showing 59 changed files with 1,670 additions and 209 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ Temporary Items

# ARL Symlinks
api/
libs/
/forgestore.jks
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "0.0.2"
version = "0.0.4"
group = "me.itstheholyblack.vigilant_eureka" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "vigilant_eureka"

Expand All @@ -21,16 +21,25 @@ compileJava {
}

minecraft {
version = "1.12.2-14.23.0.2491"
version = "1.12.2-14.23.4.2705"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// 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_20171108"
mappings = "snapshot_20180619"
makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
if (project.hasProperty('mc_username')) {
clientRunArgs += ['--username', project.mc_username]
if (project.hasProperty('mc_password')) {
clientRunArgs += ['--password', project.mc_password]
}
}
if (project.hasProperty('mc_uuid')) {
clientRunArgs += ['--uuid', project.mc_uuid]
}
}

dependencies {
Expand All @@ -54,7 +63,7 @@ dependencies {
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

compile files('libs/Baubles-deobf.jar')
}

processResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, certificateFingerprint = Reference.MOD_KEY, acceptedMinecraftVersions = "[1.12,)")
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, certificateFingerprint = Reference.MOD_KEY, acceptedMinecraftVersions = "[1.12,)", dependencies = Reference.DEPENDS)
public class Eureka {

@SidedProxy(clientSide = "me.itstheholyblack.vigilant_eureka.proxy.ClientProxy", serverSide = "me.itstheholyblack.vigilant_eureka.proxy.ServerProxy")
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package me.itstheholyblack.vigilant_eureka;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Reference {
public static final String MOD_NAME = "Vigilant Eureka";
static final String MOD_NAME = "Vigilant Eureka";
public static final String MOD_ID = "vigilant_eureka";
public static final String VERSION = "0.0.2-alpha";
public static final String MOD_KEY = "19d2daed26722f2762d067603604a6d1f909f262";
static final String VERSION = "0.0.4";
static final String MOD_KEY = "19d2daed26722f2762d067603604a6d1f909f262";
static final String DEPENDS = "required-after:baubles@[1.5.2,)";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import me.itstheholyblack.vigilant_eureka.Reference;
import me.itstheholyblack.vigilant_eureka.blocks.tiles.LeyLineTile;
import me.itstheholyblack.vigilant_eureka.core.EnumLeyTypes;
import me.itstheholyblack.vigilant_eureka.core.NBTUtil;
import me.itstheholyblack.vigilant_eureka.core.PolyHelper;
import me.itstheholyblack.vigilant_eureka.items.ModItems;
import me.itstheholyblack.vigilant_eureka.util.NBTUtil;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
Expand All @@ -17,6 +17,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
Expand All @@ -29,8 +30,18 @@
import java.util.ArrayList;

public class BlockLeyLine extends BlockTileEntity<LeyLineTile> {

private static final ITextComponent IT_WORKED = new TextComponentTranslation("message.ley_link_good").setStyle(new Style().setColor(TextFormatting.GREEN));
private static final ITextComponent ALREADY_EXISTS = new TextComponentTranslation("message.ley_link_doublelink").setStyle(new Style().setColor(TextFormatting.RED));
private static final ITextComponent TWO_WAY = new TextComponentTranslation("message.ley_link_twoway").setStyle(new Style().setColor(TextFormatting.RED));
private static final ITextComponent SELF_LINK = new TextComponentTranslation("message.ley_link_selflink").setStyle(new Style().setColor(TextFormatting.RED));

private static final ITextComponent LEY_SOLVE_GOOD = new TextComponentTranslation("message.ley_solve_good").setStyle(new Style().setColor(TextFormatting.GREEN));
private static final ITextComponent LEY_SOLVE_INCOMPLETE = new TextComponentTranslation("message.ley_solve_incomplete").setStyle(new Style().setColor(TextFormatting.RED));

public BlockLeyLine() {
super(Material.ROCK, "leyline");
this.setHardness(Float.POSITIVE_INFINITY);
setUnlocalizedName(Reference.MOD_ID + ".leyline");
setRegistryName("leyline");
setCreativeTab(ModItems.CREATIVE_TAB);
Expand All @@ -45,19 +56,20 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state,
LeyLineTile tile = this.getTileEntity(worldIn, pos);
BlockPos p = net.minecraft.nbt.NBTUtil.getPosFromTag(comp.getCompoundTag("tolink"));
LeyLineTile.EnumLinkResults results = tile.addLinkOut(p);
if (results.equals(LeyLineTile.EnumLinkResults.SUCCEED)) {
comp.removeTag("tolink");
playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_good").setStyle(new Style().setColor(TextFormatting.GREEN)), true);
return true;
} else if (results.equals(LeyLineTile.EnumLinkResults.DOUBLELINK)) {
playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_doublelink").setStyle(new Style().setColor(TextFormatting.RED)), true);
return false;
} else if (results.equals(LeyLineTile.EnumLinkResults.TWOWAY)) {
playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_twoway").setStyle(new Style().setColor(TextFormatting.RED)), true);
return false;
} else {
playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_selflink").setStyle(new Style().setColor(TextFormatting.RED)), true);
return false;
switch (results) {
case SUCCEED:
comp.removeTag("tolink");
playerIn.sendStatusMessage(IT_WORKED, true);
return true;
case DOUBLELINK:
playerIn.sendStatusMessage(ALREADY_EXISTS, true);
return false;
case TWOWAY:
playerIn.sendStatusMessage(TWO_WAY, true);
return false;
case SELFLINK:
playerIn.sendStatusMessage(SELF_LINK, true);
return false;
}
} else {
comp.setTag("tolink", net.minecraft.nbt.NBTUtil.createPosTag(pos));
Expand All @@ -71,17 +83,15 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state,
for (BlockPos p : poly) {
LeyLineTile te = (LeyLineTile) worldIn.getTileEntity(p);
te.setPolygon(poly);
if (!te.isLead()) {
continue;
} else {
if (te.isLead()) {
hasLeader = true;
}
}
thisTile.setLead(!hasLeader);
playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_solve_good").setStyle(new Style().setColor(TextFormatting.GREEN)), true);
playerIn.sendStatusMessage(LEY_SOLVE_GOOD, true);
return true;
} else {
playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_solve_incomplete").setStyle(new Style().setColor(TextFormatting.RED)), true);
playerIn.sendStatusMessage(LEY_SOLVE_INCOMPLETE, true);
return false;
}
} else if (stack.getItem().equals(ModItems.leyRune)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ public BlockTileEntity(Material material, String name) {
super(material);
}

/**
* Returns the {@link Class} of this block's tile entity
*/
public abstract Class<TE> getTileEntityClass();

/**
* Returns the {@link TE} instance for this specific block
*/
public TE getTileEntity(IBlockAccess world, BlockPos pos) {
return (TE) world.getTileEntity(pos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,20 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s
} else {
return;
}
if (t.getDestination().getY() > 0 && entityIn instanceof EntityPlayer) {
// NBTTagCompound compound = t.getTileData();
FullPosition destination = t.getDestination();
FullPosition destination = t.getDestination();
if (!t.getDestination().equals(BlockPos.ORIGIN)) {
if (entityIn.dimension != destination.getDimension()) {
CustomTeleporter.teleportToDimension((EntityPlayer) entityIn, destination.getDimension(),
destination.getX(), destination.getY(), destination.getZ());
if (entityIn instanceof EntityPlayer) {
CustomTeleporter.teleportToDimension((EntityPlayer) entityIn, destination.getDimension(),
destination.getX(), destination.getY(), destination.getZ());
} else {
entityIn.setPosition(destination.getX(), destination.getY(), destination.getZ());
entityIn.changeDimension(destination.getDimension());
entityIn.setPositionAndUpdate(destination.getX(), destination.getY(), destination.getZ());
}
} else {
entityIn.setPositionAndUpdate(destination.getX(), destination.getY(), destination.getZ());
}
} else {
System.out.println(t.getDestination().getY());
}
}
}
Expand All @@ -107,6 +110,11 @@ public boolean isNormalCube(IBlockState state, IBlockAccess access, BlockPos pos
return false;
}

@Override
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
return true;
}

@Override
public Class<MovingCastleDoorTile> getTileEntityClass() {
return MovingCastleDoorTile.class;
Expand All @@ -122,6 +130,11 @@ public boolean isOpaqueCube(IBlockState state) {
return false;
}

@Override
public boolean isFullCube(IBlockState state) {
return false;
}

public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(IS_TOP, meta == 1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.itstheholyblack.vigilant_eureka.blocks.tiles;

import me.itstheholyblack.vigilant_eureka.Reference;
import me.itstheholyblack.vigilant_eureka.blocks.ModBlocks;
import me.itstheholyblack.vigilant_eureka.core.EnumLeyTypes;
import me.itstheholyblack.vigilant_eureka.core.Polygon;
Expand All @@ -13,6 +14,7 @@
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
Expand All @@ -26,6 +28,8 @@

public class LeyLineTile extends TileEntity implements ITickable {

private static final ITextComponent ENTER_LEY = new TextComponentTranslation("message.enter_ley").setStyle(new Style().setItalic(true).setColor(TextFormatting.AQUA));

public float ticks = 0;

private BlockPos link_out;
Expand All @@ -50,16 +54,16 @@ public EnumLinkResults addLinkOut(BlockPos bp) {
if (!this.link_out.equals(bp)) {
LeyLineTile otherLine = (LeyLineTile) this.world.getTileEntity(bp);
if (!otherLine.link_out.equals(this.getPos())) {
System.out.println("Link succeeded!");
Reference.LOGGER.debug("Link succeeded!");
this.link_out = bp;
markDirty();
return EnumLinkResults.SUCCEED;
} else {
System.out.println("Link failed - two way connection");
Reference.LOGGER.debug("Link failed - two way connection");
return EnumLinkResults.TWOWAY;
}
} else {
System.out.println("Link failed - double linkage");
Reference.LOGGER.debug("Link failed - double linkage");
return EnumLinkResults.DOUBLELINK;
}
}
Expand Down Expand Up @@ -141,15 +145,35 @@ public NBTTagCompound writeToNBT(NBTTagCompound compound) {
return compound;
}

public boolean isLinked() {
return !this.link_out.equals(BlockPos.ORIGIN) && !this.link_out.equals(BlockPos.ORIGIN.down());
}

@Override
public void update() {
ticks = ticks + 0.1F;
if (!this.world.isRemote && !this.link_out.equals(BlockPos.ORIGIN) && this.world.isAreaLoaded(this.getPos(), 16)) {

if (this.link_out.equals(BlockPos.ORIGIN.down())) {
this.link_out = BlockPos.ORIGIN;
markDirty();
}

if (!this.world.isRemote && this.isLinked() && this.world.isAreaLoaded(this.getPos(), 16)) {
if (!this.getWorld().getBlockState(link_out).getBlock().equals(ModBlocks.leyLine)) {
link_out = BlockPos.ORIGIN;
link_out = BlockPos.ORIGIN.down();
markDirty();
return;
} else {
LeyLineTile te = (LeyLineTile) this.world.getTileEntity(link_out);
if (te.getLinkOut().equals(BlockPos.ORIGIN.down())) {
Reference.LOGGER.debug("Linked to BROKEN link node " + this.link_out);
this.link_out = BlockPos.ORIGIN.down();
markDirty();
return;
}
}
}

if (isLead) {
delayCounter--;
if (delayCounter <= 0 || lastList == null) {
Expand All @@ -159,11 +183,7 @@ public void update() {
for (Entity e : lastList) {
NBTTagCompound compound = e.getEntityData();
if (!(compound.getBoolean("inPoly")) && e instanceof EntityPlayer) {
((EntityPlayer) e).sendStatusMessage(new TextComponentTranslation("message.enter_ley")
.setStyle(new Style()
.setItalic(true)
.setColor(TextFormatting.AQUA)
), true);
((EntityPlayer) e).sendStatusMessage(ENTER_LEY, true);
}
compound.setBoolean("inPoly", specialPoly.contains(e));
compound.setTag("masterPos", NBTUtil.createPosTag(this.pos));
Expand Down Expand Up @@ -197,6 +217,7 @@ public SPacketUpdateTileEntity getUpdatePacket() {
}

@Override
@SideOnly(Side.CLIENT)
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
// Here we get the packet from the server and read it into our client side tile entity
this.readFromNBT(packet.getNbtCompound());
Expand All @@ -217,7 +238,6 @@ public AxisAlignedBB getRenderBoundingBox() {
}

public enum EnumLinkResults {
SUCCEED, SELFLINK, DOUBLELINK, TWOWAY;
SUCCEED, SELFLINK, DOUBLELINK, TWOWAY
}

}
23 changes: 23 additions & 0 deletions src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package me.itstheholyblack.vigilant_eureka.client;

import me.itstheholyblack.vigilant_eureka.client.renderer.RenderHelp;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class Icons {

public static final Icons INSTANCE = new Icons();

public TextureAtlasSprite time_open;
public TextureAtlasSprite time_closed;

private Icons() {
}

@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Pre evt) {
time_open = RenderHelp.forName(evt.getMap(), "time_open_rend", "items");
time_closed = RenderHelp.forName(evt.getMap(), "time_rend", "items");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class Keybinds {

public static KeyBinding warpKey;
public static KeyBinding timeKey;

private static KeyBinding init(String s, int key, String group) {
KeyBinding kb = new KeyBinding(Reference.MOD_ID + ".keybind." + s, key, group);
Expand All @@ -20,5 +21,6 @@ private static KeyBinding init(String s, int key, String group) {

public static void initWarpKey() {
warpKey = init("warp_key", Keyboard.KEY_R, Reference.MOD_ID + ".gui.keybinds");
timeKey = init("time_key", Keyboard.KEY_G, Reference.MOD_ID + ".gui.keybinds");
}
}
Loading

0 comments on commit e2fd9e5

Please sign in to comment.