Esempio n. 1
0
 @Override
 public ReplacementBlock getReplacementBlock(World world, int x, int y, int z) {
   IBlock iBlock = MineTweakerMC.getBlock(world, x, y, z);
   for (TweakerFruit fruit : fruits) {
     if (fruit.block.matches(iBlock))
       return new ReplacementBlock(MineTweakerMC.getBlock(fruit.replacement))
           .setMeta(iBlock.getMeta());
   }
   return null;
 }
Esempio n. 2
0
 @Override
 public void apply() {
   Map<Block, IFactoryFruit> fruits = MFRRegistry.getFruits();
   for (IBlock partial : fruit.block.getBlocks()) {
     Block block = ((MCBlockDefinition) partial.getDefinition()).getInternalBlock();
     if (fruits != null && fruits.containsKey(block)) {
       IFactoryFruit existingFruit = fruits.get(block);
       if (existingFruit instanceof TweakerFruitPartial) {
         TweakerFruitPartial existingFruitPartial = (TweakerFruitPartial) existingFruit;
         if (!existingFruitPartial.fruits.contains(fruit)) {
           existingFruitPartial.fruits.add(fruit);
         }
       } else {
         MineTweakerAPI.logError("A non-MineTweaker fruit already exists for this ID");
       }
     } else {
       TweakerFruitPartial factoryFruit = new TweakerFruitPartial(block);
       MFRRegistry.registerFruit(factoryFruit);
     }
   }
 }