- TileManipulationFocus: fixed & texture updated

This commit is contained in:
HellFirePvP committed 2015-11-10 00:54:22 +01:00
1 parent c77555e5e4
commit 2088f3d2d2
12 files changed
+95 -27

No files matched your search

@@ -123,8 +123,8 @@ public class ClientProxy extends CommonProxy {
ItemRenderStoneMachine itemRenderStoneMachine = new ItemRenderStoneMachine();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine), itemRenderStoneMachine);
itemRenderStoneMachine.registerRenderer(0, new TileManipulationFocus(0), renderTileManipulationFocus);
itemRenderStoneMachine.registerRenderer(3, new TileManipulationFocus(1), renderTileManipulationFocus);
itemRenderStoneMachine.registerRenderer(0, new TileManipulationFocus().setFociId(0), renderTileManipulationFocus);
itemRenderStoneMachine.registerRenderer(3, new TileManipulationFocus().setFociId(1), renderTileManipulationFocus);
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemFamiliar, new ItemRenderFamiliar());
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer());
@@ -21,6 +21,7 @@ public class RenderTileManipulationFocus extends TileEntitySpecialRenderer {
private static final ModelFocusPortalPart PORTAL_FOCUS = new ModelFocusPortalPart();
public void renderTileEntityAt(TileManipulationFocus tile, double x, double y, double z, float partialTicks) {
if(tile.getFociId() == -1) return;
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
@@ -84,7 +84,7 @@ public class BlockNodeManipulator extends BlockStoneDevice {
if (tile.isMultiblockStructurePresent()) {
String research = tile.getMultiblockType().getResearchNeeded();
if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), research)) return false;
if (ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsNodeManipulatorMultiblock, true)) {
if (ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, tile.getMultiblockType().getMultiblockCosts(), true)) {
tile.formMultiblock();
return true;
}
@@ -105,13 +105,13 @@ public class BlockStoneMachine extends Block {
if (metadata == 15) {
return new TileManipulatorPillar();
} else if (metadata == 0) {
return new TileManipulationFocus(0);
return new TileManipulationFocus();
} else if(metadata == 1) {
return new TilePedestal();
} else if(metadata == 2) {
return new TileBlockProtector();
} else if(metadata == 3) {
return new TileManipulationFocus(1);
return new TileManipulationFocus();
}
return null;
}
@@ -159,7 +159,7 @@ public class BlockStoneMachine extends Block {
dropBlockAsItem(world, x, y, z, metadata, 0);
world.setBlockToAir(x, y, z);
}
} else if (metadata == 0) {
} else if (metadata == 0 || metadata == 3) {
if (world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator || world.getBlockMetadata(x, y - 1, z) != 5) {
dropBlockAsItem(world, x, y, z, metadata, 0);
world.setBlockToAir(x, y, z);
@@ -167,11 +167,21 @@ public class BlockStoneMachine extends Block {
}
}
@Override
public void onPostBlockPlaced(World world, int x, int y, int z, int metadata) {
if(metadata == 0 || metadata == 3) {
TileEntity te = world.getTileEntity(x, y, z);
if(te != null && te instanceof TileManipulationFocus) {
((TileManipulationFocus) te).setFociId(metadata == 0 ? 0 : 1);
}
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
int metadata = world.getBlockMetadata(x, y, z);
if(metadata == 0) {
if(metadata == 0 || metadata == 3) {
if (world.getBlock(x, y - 1, z).equals(RegisteredBlocks.blockNodeManipulator) && world.getBlockMetadata(x, y - 1, z) == 5) {
return world.getBlock(x, y - 1, z).onBlockActivated(world, x, y - 1, z, player, side, hitX, hitY, hitZ);
}
@@ -189,7 +199,7 @@ public class BlockStoneMachine extends Block {
setBlockBounds(0, 0, 0, 1, 0.5f, 1);
} else if (metadata == 11) {
setBlockBounds(0.0F, -1.0F, 0.0F, 1.0F, -0.5F, 1.0F);
} else if (metadata == 0) {
} else if (metadata == 0 || metadata == 3) {
setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 6 / 16f, 1 - (3 / 16f));
} else if(metadata == 1) {
setBlockBounds(0.25f, 0, 0.25f, 0.75f, 0.99f, 0.75f);
@@ -202,7 +212,7 @@ public class BlockStoneMachine extends Block {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 11 || metadata == 15 || metadata == 1) {
setBlockBounds(0, 0, 0, 1, 1, 1);
} else if (metadata == 0) {
} else if (metadata == 0 || metadata == 3) {
setBlockBoundsBasedOnState(world, x, y, z);
}
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
@@ -1,25 +1,43 @@
package makeo.gadomancy.common.blocks.tiles;
import net.minecraft.nbt.NBTTagCompound;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
* <p/>
*
* Created by makeo @ 28.10.2015 16:27
*/
public class TileManipulationFocus extends SynchronizedTileEntity {
private int fociId;
public TileManipulationFocus(int fociId) {
this.fociId = fociId;
}
private int fociId = -1;
public int getFociId() {
return fociId;
return fociId == -1 ? blockMetadata != -1 ? blockMetadata == 0 ? 0 : 1 : -1 : fociId;
}
public TileManipulationFocus setFociId(int fociId) {
this.fociId = fociId;
return this;
}
@Override
public boolean canUpdate() {
return false;
}
@Override
public void writeCustomNBT(NBTTagCompound compound) {
compound.setInteger("fociId", this.fociId);
super.writeCustomNBT(compound);
}
@Override
public void readCustomNBT(NBTTagCompound compound) {
this.fociId = compound.getInteger("fociId");
super.readCustomNBT(compound);
}
}
@@ -10,6 +10,7 @@ import makeo.gadomancy.common.node.NodeManipulatorResult;
import makeo.gadomancy.common.node.NodeManipulatorResultHandler;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.registration.RegisteredMultiblocks;
import makeo.gadomancy.common.registration.RegisteredRecipes;
import makeo.gadomancy.common.utils.MultiblockHelper;
import makeo.gadomancy.common.utils.world.TCMazeHandler;
import net.minecraft.entity.player.EntityPlayer;
@@ -127,18 +128,14 @@ public class TileNodeManipulator extends TileWandPedestal implements IAspectCont
TileEntity te = worldObj.getTileEntity(xCoord, yCoord + 2, zCoord);
if(te == null || !(te instanceof TileExtendedNode)) return;
TileExtendedNode node = (TileExtendedNode) te;
List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(15, 15, 15));
if(!players.isEmpty()) {
EntityPlayer player = (EntityPlayer) players.get(0);
//TCMazeHandler.createSessionWaitForTeleport(player, (int) player.posX, (int) player.posY, (int) player.posZ);
}
worldObj.removeTileEntity(xCoord, yCoord + 2, zCoord);
worldObj.setBlockToAir(xCoord, yCoord + 2, zCoord);
worldObj.setBlock(xCoord, yCoord + 2, zCoord, RegisteredBlocks.blockAdditionalEldrichPortal);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord + 2, zCoord);
markDirty();
node.markDirty();
}
private void manipulationTick() {
@@ -295,7 +292,8 @@ public class TileNodeManipulator extends TileWandPedestal implements IAspectCont
for(MultiblockHelper.IntVec3 v : compareableCompleteStructure.keySet()) {
MultiblockHelper.BlockInfo info = compareableCompleteStructure.get(v);
MultiblockHelper.BlockInfo restoreInfo = toRestore.get(v);
if(info.block == RegisteredBlocks.blockNode || info.block == Blocks.air || info.block == RegisteredBlocks.blockNodeManipulator || restoreInfo == null) continue;
if(info.block == RegisteredBlocks.blockNode || (info.block == RegisteredBlocks.blockStoneMachine && (info.meta == 0 || info.meta == 3))
|| info.block == Blocks.air || info.block == RegisteredBlocks.blockNodeManipulator) continue;
int absX = v.x + xCoord;
int absY = v.y + yCoord;
int absZ = v.z + zCoord;
@@ -326,7 +324,8 @@ public class TileNodeManipulator extends TileWandPedestal implements IAspectCont
}
for(MultiblockHelper.IntVec3 v : toBuild.keySet()) {
MultiblockHelper.BlockInfo info = toBuild.get(v);
if(info.block == RegisteredBlocks.blockNode || info.block == Blocks.air || info.block == RegisteredBlocks.blockNodeManipulator) continue;
if(info.block == RegisteredBlocks.blockNode || (info.block == RegisteredBlocks.blockStoneMachine && (info.meta == 0 || info.meta == 3))
|| info.block == Blocks.air || info.block == RegisteredBlocks.blockNodeManipulator) continue;
int absX = v.x + xCoord;
int absY = v.y + yCoord;
int absZ = v.z + zCoord;
@@ -519,18 +518,23 @@ public class TileNodeManipulator extends TileWandPedestal implements IAspectCont
public static enum MultiblockType {
NODE_MANIPULATOR(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR"),
E_PORTAL_CREATOR(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR"); //TODO Change sometime.
NODE_MANIPULATOR(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", RegisteredRecipes.costsNodeManipulatorMultiblock),
E_PORTAL_CREATOR(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", RegisteredRecipes.costsEldritchPortalCreatorMultiblock); //TODO Change sometime.
private String research;
private AspectList costs;
private MultiblockType(String research) {
private MultiblockType(String research, AspectList costs) {
this.research = research;
this.costs = costs;
}
public String getResearchNeeded() {
return research;
}
public AspectList getMultiblockCosts() {
return costs;
}
}
}
@@ -2,12 +2,18 @@ package makeo.gadomancy.common.events;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import makeo.gadomancy.common.data.ModConfig;
import makeo.gadomancy.common.familiar.FamiliarAIController;
import makeo.gadomancy.common.utils.world.TCMazeHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import thaumcraft.common.items.armor.Hover;
/**
* This class is part of the Gadomancy Mod
@@ -40,4 +46,19 @@ public class EventHandlerEntity {
}
}
@SubscribeEvent
public void on(LivingEvent.LivingUpdateEvent event) {
if(event.entityLiving == null || !(event.entityLiving instanceof EntityPlayer)) return;
EntityPlayer player = (EntityPlayer)event.entity;
if ((event.entity.worldObj.provider.dimensionId == ModConfig.dimOuterId) && ((player.ticksExisted & 7) == 0) && ((player.capabilities.isFlying) || (Hover.getHover(player.getEntityId())))){
player.capabilities.isFlying = false;
Hover.setHover(player.getEntityId(), false);
String msg = StatCollector.translateToLocal("tc.break.fly");
if(player.capabilities.isCreativeMode) {
msg += " " + StatCollector.translateToLocal("gadomancy.eldritch.noflyCreative");
}
player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + msg));
}
}
}
@@ -19,6 +19,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.Explosion;
import net.minecraft.world.GameRules;
@@ -31,6 +33,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.event.world.WorldEvent;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumcraft.common.tiles.TileJarFillable;
@@ -164,6 +167,12 @@ public class EventHandlerWorld {
((TileNodeManipulator) te).breakMultiblock();
}
}
if (event.world.provider.dimensionId == ModConfig.dimOuterId) {
if(event.block == ConfigBlocks.blockEldritchNothing) {
event.setCanceled(true);
event.getPlayer().addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + StatCollector.translateToLocal("gadomancy.eldritch.nobreakPortalNothing")));
}
}
}
}
@@ -36,6 +36,7 @@ public class RegisteredRecipes {
private RegisteredRecipes() {}
public static AspectList costsNodeManipulatorMultiblock = new AspectList().add(Aspect.FIRE, 100).add(Aspect.WATER, 100).add(Aspect.EARTH, 100).add(Aspect.AIR, 100).add(Aspect.ORDER, 100).add(Aspect.ENTROPY, 100);
public static AspectList costsEldritchPortalCreatorMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150);
public static List multiblockNodeManipulator;
@@ -72,6 +72,7 @@ public class TCMazeHandler {
if (!hasOpenSession(player)) {
WorldUtil.tryTeleportBack((EntityPlayerMP) player, 0);
ChunkCoordinates cc = out.getSpawnPoint();
//TODO return something valid
int y = w.getTopSolidOrLiquidBlock(cc.posX, cc.posZ);
player.setPositionAndUpdate(cc.posX + 0.5, y, cc.posZ + 0.5);
}
@@ -102,6 +102,9 @@ gadomancy.upgrades.runicshield=Runic Shield
gadomancy.lore.stickyjar=Sticky
gadomancy.lore.remotejar=§7Network: %s
gadomancy.eldritch.noflyCreative=(even in creative)
gadomancy.eldritch.nobreakPortalNothing=This portal cannot be broken
tile.BlockStickyJar.name=Sticky Jar
tile.BlockArcaneDropper.name=Arcane Dropper
tile.BlockInfusionClaw.name=Infusion Claw
Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 347 B