Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #104

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
*.launch
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod_version=2.4.4
mod_version=2.4.5
mod_name=rpsideas
mod_fancy_name=Random PSIdeas
mod_author=kamefrede
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/com/kamefrede/rpsideas/RPSIdeas.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
import com.teamwizardry.librarianlib.features.base.item.IShieldItem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderArmorStand;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerElytra;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ModFixs;
import net.minecraftforge.fml.common.FMLCommonHandler;
Expand Down Expand Up @@ -80,8 +83,13 @@ private static void injectLayers(RenderPlayer render) {
}
}



@SideOnly(Side.CLIENT)
private static void injectLayers(RenderArmorStand render) {
if (render != null) {
render.addLayer(new ExosuitGlowLayer(render));
render.addLayer(new LayerCustomElytra(render));
}
}


@Mod.EventHandler
Expand Down Expand Up @@ -153,6 +161,8 @@ public void clientInit(FMLInitializationEvent e) {
Map<String, RenderPlayer> skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap();
injectLayers(skinMap.get("default"));
injectLayers(skinMap.get("slim"));
Render<EntityArmorStand> entityRenderMap = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityArmorStand.class);
injectLayers((RenderArmorStand)entityRenderMap);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public RPSModifierAspect(IModifier parent) {

@Override
public boolean canApply(ItemStack itemStack, ItemStack itemStack1) throws TinkerGuiException {
if (!TinkerUtil.hasModifier(TagUtil.getTagSafe(itemStack), parent.getIdentifier())) {
if (!TinkerUtil.hasModifier(TagUtil.getTagSafe(itemStack), parent.getIdentifier()) && itemStack != itemStack1) {
String error = I18n.format("rpsideas.gui.error.no_socketable");
throw new TinkerGuiException(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public boolean canTakeStack(EntityPlayer playerIn) {
playerArmorBegin = inventorySlots.size();
for (EntityEquipmentSlot slot : EntityEquipmentSlot.values())
if (slot.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
addSlotToContainer(new Slot(playerInv, 39 - slot.getIndex(), xMin - 27, yMin + 18 * slot.getIndex()) {
addSlotToContainer(new Slot(playerInv, 36 + slot.getIndex(), xMin - 27, yMin + 18 * (3 - slot.getIndex())) {
@Override
public int getSlotStackLimit() {
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer play

boolean bandwidthMatch = magBandwidth < 0 || magBandwidth >= bandwidthRequired;

if (cadSockets >= socketsRequired && magSockets >= socketsRequired && bandwidthMatch) {
if ((cadSockets >= socketsRequired || cadSockets == -1) && (magSockets >= socketsRequired || magSockets == -1) && bandwidthMatch) {
NonNullList<ItemStack> tempInventory = NonNullList.create();
for (int i = 0; i < socketsRequired && isSocketSlotAvailable(mag, i); i++)
tempInventory.add(getBulletInSocket(mag, i));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/kamefrede/rpsideas/items/RPSItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class RPSItems {
public static final ItemMod psiCuffs = new ItemPsiCuffs();
public static final ItemMod psiCuffsKeys = new ItemPsiCuffKey();
public static final ItemMod psimetalShield = new ItemPsimetalShield(RPSItemNames.PSIMETAL_SHIELD);
// public static final ItemMod ivoryShield = new ItemFlowShield(RPSItemNames.IVORY_SHIELD);
public static final ItemMod ivoryShield = new ItemFlowShield(RPSItemNames.IVORY_SHIELD);
public static final ItemMod ebonyShield = new ItemFlowShield(RPSItemNames.EBONY_SHIELD);

public static final ItemMod psimetalHoe = new ItemPsimetalHoe(RPSItemNames.PSIMETAL_HOE);
Expand All @@ -78,7 +78,7 @@ public class RPSItems {
public static final ItemMod overvoltedCadAssembly = new ItemOvervoltedEbonyAssembly();
public static final ItemMod undervoltedCadAssembly = new ItemUndervoltedEbonyAssembly();

//public static final ItemMod elytra = new ItemPsiElytra("psimetal_elytra", 432);
//public static final ItemMod elytra = new ItemPsiElytra(RPSItemNames.PSIMETAL_ELYTRA, 432);
//public static final ItemMod braceletCad = new ItemBraceletCAD();

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public MessageChangeSocketSlot(int slot) {
public void handle(@Nonnull MessageContext context) {
EntityPlayerMP player = context.getServerHandler().player;
ItemStack mainhand = player.getHeldItemMainhand();
ItemStack offhand = player.getHeldItemMainhand();
ItemStack offhand = player.getHeldItemOffhand();
PlayerDataHandler.PlayerData data = PlayerDataHandler.get(player);
boolean isSneaking = player.isSneaking();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import net.minecraft.block.Block;
import net.minecraft.block.material.EnumPushReaction;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
import vazkii.psi.api.PsiAPI;
import vazkii.psi.api.internal.Vector3;
import vazkii.psi.api.spell.*;
import vazkii.psi.api.spell.param.ParamNumber;
Expand Down Expand Up @@ -53,7 +54,9 @@ public Object execute(SpellContext context) throws SpellRuntimeException {
Vector3 directionVal = SpellHelpers.getVector3(this, context, direction, false, true);
Vector3 positionVal = SpellHelpers.getVector3(this, context, position, true, false);
Vector3 targetVal = SpellHelpers.getVector3(this, context, target, false, false);
double maxBlocksVal = SpellHelpers.getNumber(this, context, maxBlocks, 0);
Double maxBlocksVal = SpellHelpers.getNumber(this, context, maxBlocks, 0);

boolean radius = false;


Map<BlockPos, IBlockState> toSet = Maps.newHashMap();
Expand All @@ -64,7 +67,7 @@ public Object execute(SpellContext context) throws SpellRuntimeException {
Vector3 targetNorm = targetVal.copy().normalize();


for (int i = 0; i < Math.min(len, maxBlocksVal); i++) {
for (int i = Math.min(len, maxBlocksVal.intValue()) -1; i >= 0; i--) {
Vector3 blockVec = positionVal.copy().add(targetNorm.copy().multiply(i));

World world = context.caster.world;
Expand All @@ -76,31 +79,36 @@ public Object execute(SpellContext context) throws SpellRuntimeException {

if (MinecraftForge.EVENT_BUS.post(event))
continue;

if(!context.isInRadius(blockVec)) {
radius = true;
continue;
}

ItemStack tool = context.tool;
if (tool.isEmpty())
tool = PsiAPI.getPlayerCAD(context.caster);

if (world.getTileEntity(pos) != null ||
state.getPushReaction() != EnumPushReaction.NORMAL ||
!block.canSilkHarvest(world, pos, state, context.caster) ||
state.getPlayerRelativeBlockHardness(context.caster, world, pos) <= 0 ||
!ForgeHooks.canHarvestBlock(block, context.caster, world, pos))
if(world.getTileEntity(pos) != null || state.getPushReaction() != EnumPushReaction.NORMAL ||
!block.canSilkHarvest(world, pos, state, context.caster) ||
state.getPlayerRelativeBlockHardness(context.caster, world, pos) <= 0 ||
!vazkii.psi.common.spell.trick.block.PieceTrickBreakBlock.canHarvestBlock(block, context.caster, world, pos, tool))
continue;



BlockPos pushToPos = pos.add(directNorm.x, directNorm.y, directNorm.z);
BlockPos nextPos = pos.add(targetNorm.x, targetNorm.y, targetNorm.z);
IBlockState pushToState = world.getBlockState(pushToPos);

if (!world.isBlockModifiable(context.caster, pos) ||
!world.isBlockModifiable(context.caster, pushToPos))
continue;


if (y > 256 || y < 1) continue;
if (pushToPos.getY() > 256 || pushToPos.getY() < 1) continue;


if (world.isAirBlock(pushToPos) ||
(nextPos.equals(pushToPos) && i + 1 < Math.min(len, maxBlocksVal)) ||
pushToState.getBlock().isReplaceable(world, pushToPos)) {
world.setBlockToAir(pos);
world.playEvent(2001, pos, Block.getStateId(state));
Expand All @@ -111,6 +119,8 @@ public Object execute(SpellContext context) throws SpellRuntimeException {
for (Map.Entry<BlockPos, IBlockState> pairToSet : toSet.entrySet())
context.caster.world.setBlockState(pairToSet.getKey(), pairToSet.getValue());

if(radius)
throw new SpellRuntimeException(SpellRuntimeException.OUTSIDE_RADIUS);
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class RPSItemNames {
public static final String KEYPAD = "keypad";
public static final String PSI_CUFFS = "psi_cuffs";
public static final String PSI_CUFF_KEY = "psi_cuff_key";
public static final String PSIMETAL_ELYTRA = "psimetal_elytra";
public static final String PSIMETAL_SHIELD = "psimetal_shield";
public static final String IVORY_SHIELD = "ivory_shield";
public static final String EBONY_SHIELD = "ebony_shield";
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/rpsideas/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ item.rpsideas:ivory_hoe_xmas.name=☃ Ivory Flow Ho Hoe ☃
item.rpsideas:ivory_shears.name=Ivory Flowshears
item.rpsideas:ivory_rod.name=Ivory Flowrod
item.rpsideas:ivory_rod_cast.name=Ivory Flowrod
item.rpsideas:psimetal_elytra.name=Psimetal Elytra
item.rpsideas:psimetal_shield.name=Psimetal Shield
item.rpsideas:ivory_shield.name=Ivory Shield
item.rpsideas:ebony_shield.name=Ebony Shield
Expand Down
19 changes: 19 additions & 0 deletions src/main/resources/assets/rpsideas/recipes/ivory_shield.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"result": {
"item": "rpsideas:ivory_shield"
},
"type": "rpsideas:socket_transfer",
"ingredients": [
{
"item": "rpsideas:psimetal_shield"
},
{
"type": "forge:ore_dict",
"ore": "dustGlowstone"
},
{
"type": "forge:ore_dict",
"ore": "ingotIvoryPsi"
}
]
}
24 changes: 24 additions & 0 deletions src/main/resources/assets/rpsideas/recipes/psimetal_elytra.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"result": {
"item": "rpsideas:psimetal_elytra"
},
"type": "forge:ore_shaped",
"pattern": [
"MMM",
"GEG",
"G G"
],
"key": {
"M": {
"type": "forge:ore_dict",
"ore": "ingotPsi"
},
"G": {
"type": "forge:ore_dict",
"ore": "gemPsi"
},
"E": {
"item": "minecraft:elytra"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.