Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonnenlicht-as committed Aug 15, 2021
1 parent 26e724a commit 7521926
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.16.5-36.2.2'
minecraft 'net.minecraftforge:forge:1.16.5-36.2.0'

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.IBooleanFunction;
import net.minecraft.util.math.shapes.ISelectionContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sonnenlicht.somethinggood.common.item;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -23,8 +22,6 @@ public FireCore() {
}
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Screen.hasShiftDown()) {
tooltip.add(new TranslationTextComponent("bizarre_fans.fire_core.desc_0"));
}
tooltip.add(new TranslationTextComponent("bizarre_fans.fire_core.desc_0"));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sonnenlicht.somethinggood.common.item;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -23,8 +22,6 @@ public FrozenCore() {
}
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Screen.hasShiftDown()) {
tooltip.add(new TranslationTextComponent("bizarre_fans.frozen_core.desc_0"));
}
tooltip.add(new TranslationTextComponent("bizarre_fans.frozen_core.desc_0"));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sonnenlicht.somethinggood.common.item;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -23,8 +22,6 @@ public FunctionCore() {
}
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Screen.hasShiftDown()) {
tooltip.add(new TranslationTextComponent("bizarre_fans.function_core.desc_0"));
}
tooltip.add(new TranslationTextComponent("bizarre_fans.function_core.desc_0"));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sonnenlicht.somethinggood.common.item;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -23,8 +22,6 @@ public ReversalCore() {
}
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Screen.hasShiftDown()) {
tooltip.add(new TranslationTextComponent("bizarre_fans.reversal_core.desc_0"));
}
tooltip.add(new TranslationTextComponent("bizarre_fans.reversal_core.desc_0"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public AxisAlignedBB getAABB() {
}

/** <H2>风扇基础功能</H2> */
private void setPushing() {
public void setPushing() {
if(getWorld() != null){
BlockState state = getWorld().getBlockState(getPos());
Direction facing = state.get(AbstractFanBlock.FACING).getOpposite();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package sonnenlicht.somethinggood.common.tile;

import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ public PullFanBlockTileEntity() {
/** <H2>保留父类方法内容,增加新功能</H2> */
@Override
public void tick() {
if (getWorld() !=null && getWorld().getBlockState(getPos()).getBlock() instanceof AbstractFanBlock && getWorld().getGameTime() % 2 == 0)
if (getWorld().getBlockState(getPos()).get(AbstractFanBlock.POWERED))
setPushing();
super.tick();
if (getWorld() !=null && getWorld().getBlockState(getPos()).getBlock() instanceof AbstractFanBlock && getWorld().getGameTime() % 100 == 0)
if (getWorld().getBlockState(getPos()).get(AbstractFanBlock.POWERED) && ConfigRegistry.PLAY_SOUND.get())
getWorld().playSound(null, pos, SoundEvents.ITEM_ELYTRA_FLYING, SoundCategory.BLOCKS,0.5F,1);
if (getWorld() !=null && getWorld().getBlockState(getPos()).getBlock() instanceof AbstractFanBlock && getWorld().getGameTime() % 2 == 0)
if (getWorld() !=null && getWorld().getBlockState(getPos()).getBlock() instanceof AbstractFanBlock && getWorld().getGameTime() % 2 == 0){
if (getWorld().getBlockState(getPos()).get(AbstractFanBlock.POWERED) && ConfigRegistry.SUMMON_PARTICLE.get()){
setPushing();
Random rand = new Random();
for(int i = 0; i < 4; ++i) {
double px = (float)pos.getZ() + rand.nextFloat();
Expand All @@ -47,13 +46,15 @@ public void tick() {
getWorld().addParticle(ParticleTypes.ENCHANTED_HIT, pz, py + 1, px, vz, vy, vx);
}
}
}
}

/**
* <H2>聚集风扇起作用时的逻辑</H2>
* 将范围内活实体聚集于风扇处
*/
private void setPushing() {
@Override
public void setPushing() {
if (getWorld() != null) {
for (LivingEntity living : getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(this.getPos()).grow(zone, zone, zone))) {
if (living.isAlive() && !(living instanceof PlayerEntity)) {
Expand Down

0 comments on commit 7521926

Please sign in to comment.