Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zeng-github01 committed May 10, 2024
1 parent 741cbcc commit 7f011f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;

import appeng.tile.networking.TileCableBus;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
Expand Down Expand Up @@ -387,23 +388,12 @@ public TileEntity createNewTileEntity(World world, int metadata)
{
if (CompatibilityManager.isAppEngLoaded())
{
// Emulate Api.INSTANCE.partHelper().getCombinedInstance(
// TileCableBus.class )
try
{
IPartHelper apiPart = AEApi.instance().partHelper();
Class classTileCableBus = Class.forName("appeng.tile.networking.TileCableBus");
for (Method m : apiPart.getClass().getMethods())
{
if ("getCombinedInstance".equals(m.getName()))
{
return (TileEntity) ((Class) m.invoke(apiPart, classTileCableBus)).newInstance();
}
}
} catch (Exception e)
{
e.printStackTrace();
}
try {
Class<?> cableBusClass = Class.forName("appeng.tile.networking.TileCableBus");
return (TileEntity) cableBusClass.newInstance();
}catch (Exception e){
GalacticraftCore.logger.catching(e);
}
}
} else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos
ItemStack itemME = AEApi.instance().definitions().parts().cableGlass().stack(AEColor.TRANSPARENT, 1);
itemME.setCount(2); // Fool AppEng into not destroying
// anything in the player inventory
if (AEApi.instance().partHelper().placeBus(itemME, origPos, side, playerIn, hand, worldIn) != EnumActionResult.SUCCESS) {
SoundType soundType = this.getBlock().getSoundType(iblockstate, worldIn, pos, playerIn);
worldIn.playSound(playerIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F,
soundType.getPitch() * 0.8F);
}
AEApi.instance().partHelper().placeBus(itemME, origPos, side, playerIn, hand, worldIn);
}
return EnumActionResult.SUCCESS;
} else {
Expand All @@ -96,6 +92,10 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos
}
}





@Override
public int getMetadata(int damage) {
return damage;
Expand Down

0 comments on commit 7f011f7

Please sign in to comment.