Codota Logo
ObfuscationReflectionHelper.setPrivateValue
Code IndexAdd Codota to your IDE (free)

How to use
setPrivateValue
method
in
net.minecraftforge.fml.common.ObfuscationReflectionHelper

Best Java code snippets using net.minecraftforge.fml.common.ObfuscationReflectionHelper.setPrivateValue (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: PrinceOfAmber/Cyclic

public static void setVillagerCareer(EntityVillager merchant, int c) {
 ObfuscationReflectionHelper.setPrivateValue(EntityVillager.class, merchant, c, "careerId", "field_175563_bv");
}
origin: Zyin055/zyinhud

/**
 * Disables the potion effects from rendering by telling the Gui that the player has no potion effects applied.
 * Uses reflection to grab the class's private variable.
 * @param guiScreen the screen the player is looking at which extends InventoryEffectRenderer
 */
public static void DisableInventoryPotionEffects(InventoryEffectRenderer guiScreen)
{
  if(PotionTimers.Enabled && HidePotionEffectsInInventory)
  {
    //Note for future Forge versions: field "field_147045_u" will probably be renamed to something like "playerHasPotionEffects"
    boolean playerHasPotionEffects = ObfuscationReflectionHelper.getPrivateValue(InventoryEffectRenderer.class, (InventoryEffectRenderer)guiScreen, "field_147045_u");
    
    if(playerHasPotionEffects)
    {
      int guiLeftPx = (guiScreen.width - 176) / 2;
      
      ObfuscationReflectionHelper.setPrivateValue(GuiContainer.class, (GuiContainer)guiScreen, guiLeftPx, "field_147003_i","guiLeft");
      ObfuscationReflectionHelper.setPrivateValue(InventoryEffectRenderer.class, (InventoryEffectRenderer)guiScreen, false, "field_147045_u");
    }
  }
}

origin: GregTechCE/GregTech

protected void initBlockState() {
  BlockStateContainer stateContainer = createStateContainer();
  ObfuscationReflectionHelper.setPrivateValue(Block.class, this, stateContainer, 21); //this.stateContainer
  setDefaultState(stateContainer.getBaseState());
}
origin: GregTechCE/GregTech

protected void initBlockState() {
  BlockStateContainer stateContainer = createStateContainer();
  ObfuscationReflectionHelper.setPrivateValue(Block.class, this, stateContainer, 21); //this.stateContainer
  setDefaultState(stateContainer.getBaseState());
}
origin: PrinceOfAmber/Cyclic

 private void startConverting(EntityZombieVillager v, int t) {
  //      v.conversionTime = t;
  ObfuscationReflectionHelper.setPrivateValue(EntityZombieVillager.class, v, t, "conversionTime", "field_82234_d");
  v.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, t, Math.min(v.world.getDifficulty().getId() - 1, 0)));
  v.world.setEntityState(v, (byte) 16);
  try {
   //       v.getDataManager().set(CONVERTING, Boolean.valueOf(true));
   DataParameter<Boolean> CONVERTING = ObfuscationReflectionHelper.getPrivateValue(EntityZombieVillager.class, v, "CONVERTING", "field_184739_bx");
   v.getDataManager().set(CONVERTING, Boolean.valueOf(true));
  }
  catch (Exception e) {}
 }
}
origin: SleepyTrousers/EnderIO

@SideOnly(Side.CLIENT)
private void onInput(@Nonnull EntityPlayerSP player) {
 MovementInput input = player.movementInput;
 BlockPos target = TravelController.instance.selectedCoord;
 if (target == null) {
  return;
 }
 TileEntity te = player.world.getTileEntity(target);
 if (te instanceof ITravelAccessable) {
  ITravelAccessable ta = (ITravelAccessable) te;
  if (ta.getRequiresPassword(player)) {
   PacketOpenAuthGui p = new PacketOpenAuthGui(target);
   PacketHandler.INSTANCE.sendToServer(p);
   return;
  }
 }
 if (travelToSelectedTarget(player, Prep.getEmpty(), EnumHand.MAIN_HAND, TravelSource.BLOCK, false)) {
  input.jump = false;
  try {
   ObfuscationReflectionHelper.setPrivateValue(EntityPlayer.class, (EntityPlayer) player, 0, "flyToggleTimer", "field_71101_bC");
  } catch (Exception e) {
   // ignore
  }
 }
}
origin: SquidDev-CC/plethora

  ObfuscationReflectionHelper.setPrivateValue(NetHandlerPlayServer.class,
    ((EntityPlayerMP) entity).connection, 0, "field_147365_f");
} catch (RuntimeException ignored) {
origin: PrinceOfAmber/Cyclic

public void onSleepSuccess(World world, EnumHand hand, ItemStack stack, EntityPlayerMP player, final IPlayerExtendedProperties sleep) {
 sleep.setSleeping(true);
 if (doPotions) {
  player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, seconds * Const.TICKS_PER_SEC, Const.Potions.I));
  player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, seconds * Const.TICKS_PER_SEC, Const.Potions.I));
 }
 this.onUse(stack, player, world, hand);
 //hack because vanilla/forge has that java.lang.IllegalArgumentException: Cannot get property PropertyDirection error with assuming its a bed when its blocks.air
 ObfuscationReflectionHelper.setPrivateValue(EntityPlayer.class, player, true, "sleeping", "field_71083_bS");
 ObfuscationReflectionHelper.setPrivateValue(EntityPlayer.class, player, 0, "sleepTimer", "field_71076_b");
 UtilChat.sendStatusMessage(player, this.getTranslationKey() + ".trying");
 //first set bed location
 player.bedLocation = player.getPosition();
 ModCyclic.network.sendTo(new PacketSleepClient(player.bedLocation), player);
 //then stop player in place
 player.motionX = player.motionZ = player.motionY = 0;
 world.updateAllPlayersSleepingFlag();
 //then trigger vanilla sleep event(s)
 //                world.setBlockState(player.getPosition(), Blocks.BED.getDefaultState());
 SPacketUseBed sleepPacket = new SPacketUseBed(player, player.getPosition());
 player.getServerWorld().getEntityTracker().sendToTracking(player, sleepPacket);
 player.connection.sendPacket(sleepPacket);
 if (this.isOn(stack)) {
  player.setSpawnPoint(player.getPosition(), true);//true means it wont check for bed block
 }
}
origin: P3pp3rF1y/AncientWarfare2

@Override
public void setCollisionBoundingBox(EntityGate gate) {
  if (gate.pos1 == null || gate.pos2 == null) {
    return;
  }
  BlockPos min = BlockTools.getMin(gate.pos1, gate.pos2);
  BlockPos max = BlockTools.getMax(gate.pos1, gate.pos2);
  if (!(gate.getEntityBoundingBox() instanceof DualBoundingBox)) {
    try {
      ObfuscationReflectionHelper.setPrivateValue(Entity.class, gate, new DualBoundingBox(min, max), "boundingBox", "field_70121_D");
    }
    catch (Exception ignored) {
      //ignored
    }
  }
  if (gate.edgePosition > 0) {
    gate.setEntityBoundingBox(new AxisAlignedBB(min.getX(), max.getY() + 0.5d, min.getZ(), max.getX() + 1, max.getY() + 1, max.getZ() + 1));
  } else {
    gate.setEntityBoundingBox(new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX() + 1, max.getY() + 1, max.getZ() + 1));
  }
}
origin: P3pp3rF1y/AncientWarfare2

@Override
public void setCollisionBoundingBox(EntityGate gate) {
  if (gate.pos1 == null || gate.pos2 == null) {
    return;
  }
  BlockPos min = BlockTools.getMin(gate.pos1, gate.pos2);
  BlockPos max = BlockTools.getMax(gate.pos1, gate.pos2);
  updateRenderBoundingBox(gate);
  if (gate.edgePosition == 0) {
    gate.setEntityBoundingBox(new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX() + 1, max.getY() + 1, max.getZ() + 1));
  } else if (gate.edgePosition < gate.edgeMax) {
    if (!(gate.getEntityBoundingBox() instanceof RotateBoundingBox)) {
      try {
        ObfuscationReflectionHelper.setPrivateValue(Entity.class, gate, new RotateBoundingBox(gate.gateOrientation, min, max.add(1, 1, 1)), "boundingBox", "field_70121_D");
      }
      catch (Exception ignored) {
        //noop
      }
    }
    if (gate.getEntityBoundingBox() instanceof RotateBoundingBox) {
      ((RotateBoundingBox) gate.getEntityBoundingBox()).rotate(gate.getOpeningStatus() * getMoveSpeed());
    }
  } else {
    int heightAdj = max.getY() - min.getY();
    BlockPos pos3 = max.up(-heightAdj).offset(gate.gateOrientation, heightAdj);
    max = BlockTools.getMax(min, pos3).add(1, 1, 1);
    min = BlockTools.getMin(min, pos3);
    gate.setEntityBoundingBox(new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX(), max.getY(), max.getZ()));
  }
}
net.minecraftforge.fml.commonObfuscationReflectionHelpersetPrivateValue

Popular methods of ObfuscationReflectionHelper

  • getPrivateValue
  • remapFieldNames

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now