-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
261 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.../1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWBlockSound.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package nova.core.wrapper.mc.forge.v17.wrapper.block.forward; | ||
|
||
import net.minecraft.block.Block; | ||
import nova.core.block.component.BlockProperty; | ||
|
||
/** | ||
* @author winsock, soniex2, ExE Boss | ||
*/ | ||
public class FWBlockSound extends Block.SoundType { | ||
private final BlockProperty.BlockSound blockSound; | ||
|
||
/** | ||
* Construct a new FWBlockSound | ||
* @param blockSound The BlockSound to use. | ||
*/ | ||
public FWBlockSound(BlockProperty.BlockSound blockSound) { | ||
super("", 1f, 1f); | ||
this.blockSound = blockSound; | ||
} | ||
|
||
@Override | ||
public String getBreakSound() { | ||
return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.BREAK) | ||
.map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "dig." + sound.name : sound.getID()) | ||
.orElseGet(super::getBreakSound); | ||
} | ||
|
||
@Override | ||
public String getStepResourcePath() { | ||
return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.WALK) | ||
.map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "step." + sound.name : sound.getID()) | ||
.orElseGet(super::getStepResourcePath); | ||
} | ||
|
||
@Override | ||
public String func_150496_b() { | ||
return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE) | ||
.map(sound -> sound.domain.isEmpty() ? sound.name : sound.getID()) | ||
.orElseGet(this::getBreakSound); // By default MC uses the block break sound for block placement | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/ProxyMaterial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package nova.core.wrapper.mc.forge.v17.wrapper.block.forward; | ||
|
||
import net.minecraft.block.material.MapColor; | ||
import net.minecraft.block.material.Material; | ||
import nova.core.block.component.BlockProperty; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* @author soniex2, ExE Boss | ||
*/ | ||
public class ProxyMaterial extends Material { | ||
private final Optional<BlockProperty.Opacity> opacity; | ||
private final Optional<BlockProperty.Replaceable> replaceable; | ||
|
||
/** | ||
* Construct a new proxy material. | ||
* @param color The map color. | ||
* @param opacity The Opacity to use. | ||
*/ | ||
public ProxyMaterial(MapColor color, Optional<BlockProperty.Opacity> opacity, Optional<BlockProperty.Replaceable> replaceable) { | ||
super(color); | ||
this.opacity = opacity; | ||
this.replaceable = replaceable; | ||
} | ||
|
||
@Override | ||
public boolean isOpaque() { | ||
return opacity.isPresent() ? opacity.get().opacity == 1 : super.isOpaque(); | ||
} | ||
|
||
@Override | ||
public boolean isReplaceable() { | ||
return replaceable.isPresent() || super.isReplaceable(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 13 additions & 30 deletions
43
.../1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/forward/FWBlockSound.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,41 @@ | ||
package nova.core.wrapper.mc.forge.v18.wrapper.block.forward; | ||
|
||
import net.minecraft.block.Block; | ||
import nova.core.block.component.BlockProperty.BlockSound; | ||
import nova.core.sound.Sound; | ||
import nova.core.block.component.BlockProperty; | ||
|
||
/** | ||
* @author winsock, soniex2 | ||
* @author winsock, soniex2, ExE Boss | ||
*/ | ||
public class FWBlockSound extends Block.SoundType { | ||
private final BlockSound blockSound; | ||
private final BlockProperty.BlockSound blockSound; | ||
|
||
/** | ||
* Construct a new FWBlockSound | ||
* @param blockSound The BlockSound to use. | ||
*/ | ||
public FWBlockSound(BlockSound blockSound) { | ||
public FWBlockSound(BlockProperty.BlockSound blockSound) { | ||
super("", 1f, 1f); | ||
this.blockSound = blockSound; | ||
} | ||
|
||
@Override | ||
public String getBreakSound() { | ||
if (blockSound.blockSoundSoundMap.containsKey(BlockSound.BlockSoundTrigger.BREAK)) { | ||
Sound sound = blockSound.blockSoundSoundMap.get(BlockSound.BlockSoundTrigger.BREAK); | ||
if (sound.domain.isEmpty() && !sound.name.contains(".")) { | ||
return "dig." + sound.name; | ||
} | ||
return sound.getID(); | ||
} | ||
return super.getBreakSound(); | ||
return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.BREAK) | ||
.map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "dig." + sound.name : sound.getID()) | ||
.orElseGet(super::getBreakSound); | ||
} | ||
|
||
@Override | ||
public String getStepSound() { | ||
if (blockSound.blockSoundSoundMap.containsKey(BlockSound.BlockSoundTrigger.WALK)) { | ||
Sound sound = blockSound.blockSoundSoundMap.get(BlockSound.BlockSoundTrigger.WALK); | ||
if (sound.domain.isEmpty() && !sound.name.contains(".")) { | ||
return "step." + sound.name; | ||
} | ||
return sound.getID(); | ||
} | ||
return super.getStepSound(); | ||
return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.WALK) | ||
.map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "step." + sound.name : sound.getID()) | ||
.orElseGet(super::getStepSound); | ||
} | ||
|
||
@Override | ||
public String getPlaceSound() { | ||
if (blockSound.blockSoundSoundMap.containsKey(BlockSound.BlockSoundTrigger.WALK)) { | ||
Sound sound = blockSound.blockSoundSoundMap.get(BlockSound.BlockSoundTrigger.WALK); | ||
if (sound.domain.isEmpty()) { | ||
return sound.name; | ||
} | ||
return sound.getID(); | ||
} | ||
// By default MC uses the block break sound for block placement | ||
return this.getBreakSound(); | ||
return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE) | ||
.map(sound -> sound.domain.isEmpty() ? sound.name : sound.getID()) | ||
.orElseGet(this::getBreakSound); // By default MC uses the block break sound for block placement | ||
} | ||
} |
Oops, something went wrong.