Skip to content

Commit

Permalink
Added Document annotation to some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kindlich committed May 6, 2020
1 parent 16ac796 commit d739374
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import com.blamejared.crafttweaker.impl.block.material.*;
import com.blamejared.crafttweaker.impl.blocks.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import net.minecraft.block.*;
import net.minecraft.item.*;
import org.openzen.zencode.java.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.block.BlockBuilder")
@Document("mods/contenttweaker/block/BlockBuilder")
public class BlockBuilder implements IIsBuilder {

private final Block.Properties blockProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import com.blamejared.contenttweaker.blocks.types.horizontal.*;
import com.blamejared.contenttweaker.blocks.types.stairs.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import org.openzen.zencode.java.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.blocks.BlockTypeSpecifiers")
@Document("mods/contenttweaker/blocks/BlockTypeSpecifiers")
public class BlockTypeSpecifiers {

@ZenCodeType.Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.blamejared.contenttweaker.wrappers.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import net.minecraft.block.*;
import net.minecraft.state.*;
import org.openzen.zencode.java.*;
Expand All @@ -15,6 +16,7 @@

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.block.custom.BuilderBlockCustom")
@Document("mods/contenttweaker/block/custom.BuilderBlockCustom")
public class BuilderBlockCustom implements IIsBuilder {

private final BlockBuilder builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.*;
import java.util.stream.*;

class WriteableResourceBlockStateCustom extends WriteableResource {
final class WriteableResourceBlockStateCustom extends WriteableResource {

private final Collection<WriteableResourceModelContentCustom> referencedModels;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import com.blamejared.contenttweaker.blocks.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import org.openzen.zencode.java.*;

import java.util.function.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.block.custom.BuilderPillarRotatable")
@Document("mods/contenttweaker/block/custom/BuilderPillarRotatable")
public class BuilderPillarRotatable implements IIsBuilder {

private final BlockBuilder builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import com.blamejared.contenttweaker.blocks.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import org.openzen.zencode.java.*;

import java.util.function.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.block.stairs.BuilderStairs")
@Document("mods/contenttweaker/block/stairs/BuilderStairs")
public class BuilderStairs implements IIsBuilder {

private final BlockBuilder builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import com.blamejared.contenttweaker.items.types.basic.*;
import com.blamejared.contenttweaker.items.types.tool.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import org.openzen.zencode.java.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.item.ItemTypeSpecifiers")
@Document("mods/contenttweaker/item/ItemTypeSpecifiers")
public class ItemTypeSpecifiers {
@ZenCodeType.Field
public static IItemTypeSpecifier<BuilderBasic> basic = BuilderBasic::new;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import com.blamejared.contenttweaker.items.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import org.openzen.zencode.java.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.item.basic.BuilderBasic")
@Document("mods/contenttweaker/item/basic/BuilderBasic")
public class BuilderBasic implements IIsBuilder {

private final ItemBuilder builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@
import com.blamejared.contenttweaker.wrappers.*;
import com.blamejared.crafttweaker.api.annotations.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import net.minecraftforge.common.*;
import org.openzen.zencode.java.*;

import java.util.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.item.tool.BuilderTool")
@Document("mods/contenttweaker/item/tool/BuilderTool")
public class BuilderTool implements IIsBuilder {

private final ItemBuilder builder;
private final Map<ToolType, Float> miningSpeeds;
private double attackSpeed;
private double attackDamage;
private int durabilityCostAttack;
private int durabilityCostMining;

public BuilderTool(ItemBuilder builder) {
this.builder = builder;
this.miningSpeeds = new HashMap<>();
this.durabilityCostAttack = 2;
this.durabilityCostMining = 1;
}

public Map<ToolType, Float> getMiningSpeeds() {
Expand Down Expand Up @@ -52,6 +58,18 @@ public BuilderTool withAttackSpeed(double attackSpeed) {
return this;
}

@ZenCodeType.Method
public BuilderTool withDurabilityCostAttack(int durabilityCostAttack) {
this.durabilityCostAttack = durabilityCostAttack;
return this;
}

@ZenCodeType.Method
public BuilderTool withDurabilityCostMining(int durabilityCostMining) {
this.durabilityCostMining = durabilityCostMining;
return this;
}

@Override
public void build(MCResourceLocation location) {
VanillaFactory.registerItem(new CoTItemTool(this, location.getInternal()));
Expand All @@ -64,4 +82,12 @@ public double getAttackSpeed() {
public double getAttackDamage() {
return attackDamage;
}

public int getDurabilityCostAttack() {
return durabilityCostAttack;
}

public int getDurabilityCostMining() {
return durabilityCostMining;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraft.util.math.*;
import net.minecraft.world.*;
import net.minecraftforge.common.*;

import javax.annotation.*;
Expand All @@ -20,12 +22,16 @@ final class CoTItemTool extends CoTItemBasic implements IIsCotItem {
private final Map<ToolType, Float> miningSpeeds;
private final double attackDamage;
private final double attackSpeed;
private final int durabilityCostAttack;
private final int durabilityCostMining;

public CoTItemTool(BuilderTool builder, ResourceLocation location) {
super(builder.getBuilder().getItemProperties(), location);
miningSpeeds = builder.getMiningSpeeds();
attackSpeed = builder.getAttackSpeed();
attackDamage = builder.getAttackDamage();
durabilityCostAttack = builder.getDurabilityCostAttack();
durabilityCostMining = builder.getDurabilityCostMining();
}

@Override
Expand All @@ -51,4 +57,18 @@ public Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotTy

return multimap;
}

@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) {
if (!worldIn.isRemote && state.getBlockHardness(worldIn, pos) != 0.0F) {
stack.damageItem(durabilityCostMining, entityLiving, holder -> holder.sendBreakAnimation(EquipmentSlotType.MAINHAND));
}
return true;
}

@Override
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) {
stack.damageItem(durabilityCostAttack, attacker, holder -> holder.sendBreakAnimation(EquipmentSlotType.MAINHAND));
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.blamejared.crafttweaker.impl.entity.player.*;
import com.blamejared.crafttweaker.impl.item.*;
import com.blamejared.crafttweaker.impl.util.*;
import com.blamejared.crafttweaker_annotations.annotations.*;
import net.minecraft.item.*;
import net.minecraft.util.math.*;
import org.openzen.zencode.java.*;
Expand All @@ -14,6 +15,7 @@

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.block.MCBlockItemUseContext")
@Document("mods/contenttweaker/block/MCBlockItemUseContext")
public class MCBlockItemUseContext {

private final BlockItemUseContext internal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import java.util.stream.*;

@ZenRegister
@ZenCodeType.Name("mods.contenttweaker.blocks.MCBlockStateProperty")
@Document("mods/contenttweaker/blocks/MCBlockStateProperty")
@ZenCodeType.Name("mods.contenttweaker.block.MCBlockStateProperty")
@Document("mods/contenttweaker/block/MCBlockStateProperty")
public class MCBlockStateProperty implements CommandStringDisplayable {

private final Property<?> internal;
Expand Down

0 comments on commit d739374

Please sign in to comment.